Skip to content

Commit 201286d

Browse files
committed
docs: clarify usage endpoint
1 parent 0335ed6 commit 201286d

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

doc/v2.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,14 +1059,28 @@ await client.v2.createMediaMetadata(mediaId, { alt_text: { text: 'Hello, world!'
10591059

10601060
**Right level**: `Read-only`
10611061

1062+
**Scope**: App-only (no user OAuth scope required)
1063+
10621064
**Arguments**:
10631065
- `options: TweetUsageV2Params`
10641066

1067+
`usage.fields` values: `cap_reset_day`, `daily_client_app_usage`, `daily_project_usage`, `project_cap`, `project_id`, `project_usage`.
1068+
10651069
**Returns**: `TweetV2UsageResult`
10661070

10671071
**Example**
10681072
```ts
1069-
const usage = await client.v2.usage({ 'usage.fields': ['daily_project_usage'] });
1073+
const usage = await client.v2.usage({ 'usage.fields': ['project_usage', 'project_cap'] });
1074+
```
1075+
1076+
**Example result**
1077+
```json
1078+
{
1079+
"data": {
1080+
"project_usage": "123",
1081+
"project_cap": "1000"
1082+
}
1083+
}
10701084
```
10711085

10721086
## Lists

src/types/v2/community.v2.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ export interface CommunitySearchV2Params {
3131
max_results?: number;
3232
next_token?: string;
3333
pagination_token?: string;
34-
}
34+
}

src/v2/client.v2.read.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ export default class TwitterApiv2ReadOnly extends TwitterApiSubClient {
873873

874874
/**
875875
* Allows you to retrieve your project usage.
876-
*
876+
*
877877
* https://developer.x.com/en/docs/x-api/usage/tweets/introduction
878878
*/
879879
public async usage(options: Partial<TweetUsageV2Params> = {}) {

0 commit comments

Comments
 (0)