> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TrendsClient

> Methods for X API v2 Trends endpoints.

Access **Trends** endpoints via `client.trends` (`TrendsClient`).

## Methods

| Method | Endpoint | Behavior | Summary |
| :- | :- | :- | :- |
| [`get_by_woeid`](#get_by_woeid) | `GET /2/trends/by/woeid/{woeid}` | Standard | Get Trends by WOEID |
| [`get_locations`](#get_locations) | `GET /2/trends/locations` | Standard | Get Trend Locations |
| [`get_personalized`](#get_personalized) | `GET /2/users/personalized_trends` | Standard | Get Personalized Trends |

## `get_by_woeid`

GET `/2/trends/by/woeid/{woeid}`

**Get Trends by WOEID**

Retrieves trending topics for a specific location identified by its WOEID. `meta.location` describes that location: its `woeid` and `name`, and when they are known its `country`, `country_code`, `place_type` (`town`, `country` or `supername`) and `parent_id`, the WOEID of the place that contains it.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.trends.get_by_woeid(woeid: 1)
puts response
```

### Parameters

**woeid** `Integer` *required*

`woeid` (path parameter).

**Optional keyword arguments (2)**

**max\_trends** `Integer`

`max_trends` (query parameter).

**trend\_fields** `Array\<String\>`

A comma separated list of Trend fields to display.

**Returns:** `Hash`

***

## `get_locations`

GET `/2/trends/locations`

**Get Trend Locations**

Retrieves every location that has trends. Each location has a WOEID to pass to `GET /2/trends/by/woeid/{woeid}`. The list is short and is returned whole, so the route takes no paging parameters.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))

response = client.trends.get_locations
puts response
```

### Parameters

**Optional keyword arguments (1)**

**trend\_location\_fields** `Array\<String\>`

A comma separated list of TrendLocation fields to display.

**Returns:** `Hash`

***

## `get_personalized`

GET `/2/users/personalized_trends`

**Get Personalized Trends**

Retrieves personalized trending topics for the authenticated user.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.trends.get_personalized
puts response
```

### Parameters

**Optional keyword arguments (1)**

**personalized\_trend\_fields** `Array\<String\>`

A comma separated list of PersonalizedTrend fields to display.

**Returns:** `Hash`

***
