Skip to content

Commit 8bd9fa0

Browse files
authored
docs: clarify usage endpoint (#606)
1 parent 7890145 commit 8bd9fa0

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
@@ -1062,14 +1062,28 @@ await client.v2.createMediaMetadata(mediaId, { alt_text: { text: 'Hello, world!'
10621062

10631063
**Right level**: `Read-only`
10641064

1065+
**Scope**: App-only (no user OAuth scope required)
1066+
10651067
**Arguments**:
10661068
- `options: TweetUsageV2Params`
10671069

1070+
`usage.fields` values: `cap_reset_day`, `daily_client_app_usage`, `daily_project_usage`, `project_cap`, `project_id`, `project_usage`.
1071+
10681072
**Returns**: `TweetV2UsageResult`
10691073

10701074
**Example**
10711075
```ts
1072-
const usage = await client.v2.usage({ 'usage.fields': ['daily_project_usage'] });
1076+
const usage = await client.v2.usage({ 'usage.fields': ['project_usage', 'project_cap'] });
1077+
```
1078+
1079+
**Example result**
1080+
```json
1081+
{
1082+
"data": {
1083+
"project_usage": "123",
1084+
"project_cap": "1000"
1085+
}
1086+
}
10731087
```
10741088

10751089
## 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)