Skip to content

Commit df1f8a7

Browse files
committed
Update Typescript XDK docs
1 parent 5e74836 commit df1f8a7

60 files changed

Lines changed: 2192 additions & 1810 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,7 @@
11671167
"xdks/typescript/reference/interfaces/Schemas.FoundMediaOrigin",
11681168
"xdks/typescript/reference/interfaces/Schemas.FullTextEntities",
11691169
"xdks/typescript/reference/interfaces/Schemas.Geo",
1170+
"xdks/typescript/reference/interfaces/Schemas.Get2AiTrendsIdResponse",
11701171
"xdks/typescript/reference/interfaces/Schemas.Get2CommunitiesIdResponse",
11711172
"xdks/typescript/reference/interfaces/Schemas.Get2CommunitiesSearchResponse",
11721173
"xdks/typescript/reference/interfaces/Schemas.Get2ComplianceJobsIdResponse",
@@ -1191,6 +1192,8 @@
11911192
"xdks/typescript/reference/interfaces/Schemas.Get2MediaAnalyticsResponse",
11921193
"xdks/typescript/reference/interfaces/Schemas.Get2MediaMediaKeyResponse",
11931194
"xdks/typescript/reference/interfaces/Schemas.Get2MediaResponse",
1195+
"xdks/typescript/reference/interfaces/Schemas.Get2NewsIdResponse",
1196+
"xdks/typescript/reference/interfaces/Schemas.Get2NewsSearchResponse",
11941197
"xdks/typescript/reference/interfaces/Schemas.Get2NotesSearchNotesWrittenResponse",
11951198
"xdks/typescript/reference/interfaces/Schemas.Get2NotesSearchPostsEligibleForNotesResponse",
11961199
"xdks/typescript/reference/interfaces/Schemas.Get2SpacesByCreatorIdsResponse",
@@ -1275,6 +1278,7 @@
12751278
"xdks/typescript/reference/interfaces/Schemas.Metrics",
12761279
"xdks/typescript/reference/interfaces/Schemas.MuteUserMutationResponse",
12771280
"xdks/typescript/reference/interfaces/Schemas.MuteUserRequest",
1281+
"xdks/typescript/reference/interfaces/Schemas.News",
12781282
"xdks/typescript/reference/interfaces/Schemas.Note",
12791283
"xdks/typescript/reference/interfaces/Schemas.NoteInfo",
12801284
"xdks/typescript/reference/interfaces/Schemas.NoteTestResult",
@@ -1295,6 +1299,7 @@
12951299
"xdks/typescript/reference/interfaces/Schemas.PreviewImage",
12961300
"xdks/typescript/reference/interfaces/Schemas.Problem",
12971301
"xdks/typescript/reference/interfaces/Schemas.ProcessingInfo",
1302+
"xdks/typescript/reference/interfaces/Schemas.ProfileUpdateActivityResponsePayload",
12981303
"xdks/typescript/reference/interfaces/Schemas.ReplayJobCreateResponse",
12991304
"xdks/typescript/reference/interfaces/Schemas.Rule",
13001305
"xdks/typescript/reference/interfaces/Schemas.RuleNoId",
@@ -1322,6 +1327,7 @@
13221327
"xdks/typescript/reference/interfaces/Schemas.TimestampedMetrics",
13231328
"xdks/typescript/reference/interfaces/Schemas.Topic",
13241329
"xdks/typescript/reference/interfaces/Schemas.Trend",
1330+
"xdks/typescript/reference/interfaces/Schemas.TrendActivityResponsePayload",
13251331
"xdks/typescript/reference/interfaces/Schemas.Tweet",
13261332
"xdks/typescript/reference/interfaces/Schemas.TweetComplianceSchema",
13271333
"xdks/typescript/reference/interfaces/Schemas.TweetCreateRequest",
@@ -1407,6 +1413,12 @@
14071413
"xdks/typescript/reference/classes/Client"
14081414
]
14091415
},
1416+
{
1417+
"group": "Clients",
1418+
"pages": [
1419+
"xdks/typescript/reference/classes/NewsClient"
1420+
]
1421+
},
14101422
{
14111423
"group": "Communities",
14121424
"pages": [

‎xdks/typescript/authentication.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ main();
8888
import {
8989
Client,
9090
type ClientConfig,
91-
type UsersGetByUsernameResponse
91+
type Users
9292
} from '@xdevplatform/xdk';
9393

9494
const config: ClientConfig = { bearerToken: 'your-bearer-token' };
9595

9696
const client: Client = new Client(config);
9797

9898
async function main(): Promise<void> {
99-
const userResponse: UsersGetByUsernameResponse = await client.users.getByUsername('XDevelopers');
99+
const userResponse: Users.GetByUsernameResponse = await client.users.getByUsername('XDevelopers');
100100
const username: string = userResponse.data?.username!;
101101
console.log(username);
102102
}

‎xdks/typescript/overview.mdx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ A comprehensive TypeScript SDK for the X API (formerly Twitter API) with advance
1919

2020
```typescript quickstart.ts theme={null}
2121
import {
22-
Client,
23-
type ClientConfig,
24-
type UsersGetByUsernameResponse
22+
Client,
23+
type ClientConfig,
24+
type Users
2525
} from '@xdevplatform/xdk';
2626

2727
const config: ClientConfig = { bearerToken: 'your-bearer-token' };
2828

2929
const client: Client = new Client(config);
3030

3131
async function main(): Promise<void> {
32-
const userResponse: UsersGetByUsernameResponse = await client.users.getByUsername('XDevelopers');
32+
const userResponse: Users.GetByUsernameResponse = await client.users.getByUsername('XDevelopers');
3333
const username: string = userResponse.data?.username!;
3434
console.log(username);
3535
}

‎xdks/typescript/pagination.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const followers: UserPaginator = new UserPaginator(
2020
const res = await client.users.getFollowers('<userId>', {
2121
maxResults: 100,
2222
paginationToken: token,
23-
userfields: ['id','name','username'],
23+
userFields: ['id','name','username'],
2424
});
2525
return {
2626
data: res.data ?? [],
@@ -42,7 +42,7 @@ const followers = new UserPaginator(async (token) => {
4242
const res = await client.users.getFollowers('<userId>', {
4343
maxResults: 100,
4444
paginationToken: token,
45-
userfields: ['id','name','username'],
45+
userFields: ['id','name','username'],
4646
});
4747
return { data: res.data ?? [], meta: res.meta, includes: res.includes, errors: res.errors };
4848
});

‎xdks/typescript/reference/classes/AccountActivityClient.mdx‎

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Creates a new account activity client instance
2929

3030
#### Defined in
3131

32-
[account_activity/client.ts:54](https://github.com/xdevplatform/xdk/blob/a332a30384267be8a87066aae5bba329e7c24532/xdk/typescript/src/account_activity/client.ts#L54)
32+
[account_activity/client.ts:60](https://github.com/xdevplatform/xdk/blob/ccfc528c6a717b5c5744d47bf7452b4ad02fa1f3/xdk/typescript/src/account_activity/client.ts#L60)
3333

3434
## Methods
3535

@@ -54,85 +54,77 @@ Promise resolving to the API response
5454

5555
#### Defined in
5656

57-
[account_activity/client.ts:71](https://github.com/xdevplatform/xdk/blob/a332a30384267be8a87066aae5bba329e7c24532/xdk/typescript/src/account_activity/client.ts#L71)
57+
[account_activity/client.ts:106](https://github.com/xdevplatform/xdk/blob/ccfc528c6a717b5c5744d47bf7452b4ad02fa1f3/xdk/typescript/src/account_activity/client.ts#L106)
5858

5959
___
6060

61-
### createReplayJob
61+
### validateSubscription
6262

63-
▸ **createReplayJob**(`webhookId`, `fromDate`, `toDate`): `Promise`\<[`ReplayJobCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.ReplayJobCreateResponse)\>
63+
▸ **validateSubscription**(`webhookId`): `Promise`\<[`SubscriptionsGetResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsGetResponse)\>
6464

65-
Create replay job
66-
Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook.
65+
Validate subscription
66+
Checks a user’s Account Activity subscription for a given webhook.
6767

6868
#### Parameters
6969

7070
| Name | Type | Description |
7171
| :------ | :------ | :------ |
72-
| `webhookId` | `string` | The unique identifier for the webhook configuration. |
73-
| `fromDate` | `string` | The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. |
74-
| `toDate` | `string` | The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. |
72+
| `webhookId` | `string` | The webhook ID to check subscription against. |
7573

7674
#### Returns
7775

78-
`Promise`\<[`ReplayJobCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.ReplayJobCreateResponse)\>
76+
`Promise`\<[`SubscriptionsGetResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsGetResponse)\>
7977

8078
Promise resolving to the API response
8179

8280
#### Defined in
8381

84-
[account_activity/client.ts:118](https://github.com/xdevplatform/xdk/blob/a332a30384267be8a87066aae5bba329e7c24532/xdk/typescript/src/account_activity/client.ts#L118)
82+
[account_activity/client.ts:152](https://github.com/xdevplatform/xdk/blob/ccfc528c6a717b5c5744d47bf7452b4ad02fa1f3/xdk/typescript/src/account_activity/client.ts#L152)
8583

8684
___
8785

88-
### validateSubscription
86+
### createSubscription
8987

90-
▸ **validateSubscription**(`webhookId`): `Promise`\<[`SubscriptionsGetResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsGetResponse)\>
88+
▸ **createSubscription**(`webhookId`, `options?`): `Promise`\<[`SubscriptionsCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsCreateResponse)\>
9189

92-
Validate subscription
93-
Checks a user’s Account Activity subscription for a given webhook.
90+
Create subscription
91+
Creates an Account Activity subscription for the user and the given webhook.
9492

9593
#### Parameters
9694

9795
| Name | Type | Description |
9896
| :------ | :------ | :------ |
9997
| `webhookId` | `string` | The webhook ID to check subscription against. |
98+
| `options` | `CreateSubscriptionOptions` | - |
10099

101100
#### Returns
102101

103-
`Promise`\<[`SubscriptionsGetResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsGetResponse)\>
102+
`Promise`\<[`SubscriptionsCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsCreateResponse)\>
104103

105104
Promise resolving to the API response
106105

107106
#### Defined in
108107

109-
[account_activity/client.ts:169](https://github.com/xdevplatform/xdk/blob/a332a30384267be8a87066aae5bba329e7c24532/xdk/typescript/src/account_activity/client.ts#L169)
108+
[account_activity/client.ts:203](https://github.com/xdevplatform/xdk/blob/ccfc528c6a717b5c5744d47bf7452b4ad02fa1f3/xdk/typescript/src/account_activity/client.ts#L203)
110109

111110
___
112111

113-
### createSubscription
114-
115-
▸ **createSubscription**(`webhookId`, `options?`): `Promise`\<[`SubscriptionsCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsCreateResponse)\>
116-
117-
Create subscription
118-
Creates an Account Activity subscription for the user and the given webhook.
112+
### getSubscriptionCount
119113

120-
#### Parameters
114+
▸ **getSubscriptionCount**(): `Promise`\<[`SubscriptionsCountGetResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsCountGetResponse)\>
121115

122-
| Name | Type | Description |
123-
| :------ | :------ | :------ |
124-
| `webhookId` | `string` | The webhook ID to check subscription against. |
125-
| `options` | `CreateSubscriptionOptions` | - |
116+
Get subscription count
117+
Retrieves a count of currently active Account Activity subscriptions.
126118

127119
#### Returns
128120

129-
`Promise`\<[`SubscriptionsCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsCreateResponse)\>
121+
`Promise`\<[`SubscriptionsCountGetResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsCountGetResponse)\>
130122

131123
Promise resolving to the API response
132124

133125
#### Defined in
134126

135-
[account_activity/client.ts:209](https://github.com/xdevplatform/xdk/blob/a332a30384267be8a87066aae5bba329e7c24532/xdk/typescript/src/account_activity/client.ts#L209)
127+
[account_activity/client.ts:260](https://github.com/xdevplatform/xdk/blob/ccfc528c6a717b5c5744d47bf7452b4ad02fa1f3/xdk/typescript/src/account_activity/client.ts#L260)
136128

137129
___
138130

@@ -158,23 +150,31 @@ Promise resolving to the API response
158150

159151
#### Defined in
160152

161-
[account_activity/client.ts:261](https://github.com/xdevplatform/xdk/blob/a332a30384267be8a87066aae5bba329e7c24532/xdk/typescript/src/account_activity/client.ts#L261)
153+
[account_activity/client.ts:307](https://github.com/xdevplatform/xdk/blob/ccfc528c6a717b5c5744d47bf7452b4ad02fa1f3/xdk/typescript/src/account_activity/client.ts#L307)
162154

163155
___
164156

165-
### getSubscriptionCount
157+
### createReplayJob
166158

167-
▸ **getSubscriptionCount**(): `Promise`\<[`SubscriptionsCountGetResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsCountGetResponse)\>
159+
▸ **createReplayJob**(`webhookId`, `fromDate`, `toDate`): `Promise`\<[`ReplayJobCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.ReplayJobCreateResponse)\>
168160

169-
Get subscription count
170-
Retrieves a count of currently active Account Activity subscriptions.
161+
Create replay job
162+
Creates a replay job to retrieve activities from up to the past 5 days for all subscriptions associated with a given webhook.
163+
164+
#### Parameters
165+
166+
| Name | Type | Description |
167+
| :------ | :------ | :------ |
168+
| `webhookId` | `string` | The unique identifier for the webhook configuration. |
169+
| `fromDate` | `string` | The oldest (starting) UTC timestamp (inclusive) from which events will be provided, in `yyyymmddhhmm` format. |
170+
| `toDate` | `string` | The latest (ending) UTC timestamp (exclusive) up to which events will be provided, in `yyyymmddhhmm` format. |
171171

172172
#### Returns
173173

174-
`Promise`\<[`SubscriptionsCountGetResponse`](/xdks/typescript/reference/interfaces/Schemas.SubscriptionsCountGetResponse)\>
174+
`Promise`\<[`ReplayJobCreateResponse`](/xdks/typescript/reference/interfaces/Schemas.ReplayJobCreateResponse)\>
175175

176176
Promise resolving to the API response
177177

178178
#### Defined in
179179

180-
[account_activity/client.ts:301](https://github.com/xdevplatform/xdk/blob/a332a30384267be8a87066aae5bba329e7c24532/xdk/typescript/src/account_activity/client.ts#L301)
180+
[account_activity/client.ts:366](https://github.com/xdevplatform/xdk/blob/ccfc528c6a717b5c5744d47bf7452b4ad02fa1f3/xdk/typescript/src/account_activity/client.ts#L366)

0 commit comments

Comments
 (0)