@elizaos/plugin-xai 2.0.0-alpha.6 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +20 -19
- package/auto-enable.ts +17 -0
- package/dist/browser/index.browser.js +3 -3
- package/dist/browser/index.browser.js.map +5 -5
- package/dist/cjs/index.node.cjs +362 -11075
- package/dist/cjs/index.node.js.map +5 -110
- package/dist/index.browser.d.ts +2 -5
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/models/grok.d.ts.map +1 -1
- package/dist/node/index.node.js +339 -11125
- package/dist/node/index.node.js.map +5 -110
- package/package.json +34 -100
- package/dist/actions/post.d.ts +0 -3
- package/dist/actions/post.d.ts.map +0 -1
- package/dist/base.d.ts +0 -55
- package/dist/base.d.ts.map +0 -1
- package/dist/client/api-types.d.ts +0 -28
- package/dist/client/api-types.d.ts.map +0 -1
- package/dist/client/auth-providers/broker.d.ts +0 -19
- package/dist/client/auth-providers/broker.d.ts.map +0 -1
- package/dist/client/auth-providers/env.d.ts +0 -20
- package/dist/client/auth-providers/env.d.ts.map +0 -1
- package/dist/client/auth-providers/factory.d.ts +0 -5
- package/dist/client/auth-providers/factory.d.ts.map +0 -1
- package/dist/client/auth-providers/interactive.d.ts +0 -7
- package/dist/client/auth-providers/interactive.d.ts.map +0 -1
- package/dist/client/auth-providers/oauth2-pkce.d.ts +0 -24
- package/dist/client/auth-providers/oauth2-pkce.d.ts.map +0 -1
- package/dist/client/auth-providers/pkce.d.ts +0 -5
- package/dist/client/auth-providers/pkce.d.ts.map +0 -1
- package/dist/client/auth-providers/token-store.d.ts +0 -31
- package/dist/client/auth-providers/token-store.d.ts.map +0 -1
- package/dist/client/auth-providers/types.d.ts +0 -35
- package/dist/client/auth-providers/types.d.ts.map +0 -1
- package/dist/client/auth.d.ts +0 -38
- package/dist/client/auth.d.ts.map +0 -1
- package/dist/client/client.d.ts +0 -462
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/errors.d.ts +0 -72
- package/dist/client/errors.d.ts.map +0 -1
- package/dist/client/index.d.ts +0 -21
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/posts.d.ts +0 -325
- package/dist/client/posts.d.ts.map +0 -1
- package/dist/client/profile.d.ts +0 -140
- package/dist/client/profile.d.ts.map +0 -1
- package/dist/client/relationships.d.ts +0 -47
- package/dist/client/relationships.d.ts.map +0 -1
- package/dist/client/search.d.ts +0 -48
- package/dist/client/search.d.ts.map +0 -1
- package/dist/client/types.d.ts +0 -24
- package/dist/client/types.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -5
- package/dist/constants.d.ts.map +0 -1
- package/dist/discovery.d.ts +0 -37
- package/dist/discovery.d.ts.map +0 -1
- package/dist/environment.d.ts +0 -40
- package/dist/environment.d.ts.map +0 -1
- package/dist/generated/prompts/typescript/prompts.d.ts +0 -22
- package/dist/generated/prompts/typescript/prompts.d.ts.map +0 -1
- package/dist/generated/specs/spec-helpers.d.ts +0 -49
- package/dist/generated/specs/spec-helpers.d.ts.map +0 -1
- package/dist/generated/specs/specs.d.ts +0 -65
- package/dist/generated/specs/specs.d.ts.map +0 -1
- package/dist/interactions.d.ts +0 -129
- package/dist/interactions.d.ts.map +0 -1
- package/dist/post.d.ts +0 -43
- package/dist/post.d.ts.map +0 -1
- package/dist/services/x.service.d.ts +0 -23
- package/dist/services/x.service.d.ts.map +0 -1
- package/dist/templates.d.ts +0 -6
- package/dist/templates.d.ts.map +0 -1
- package/dist/timeline.d.ts +0 -46
- package/dist/timeline.d.ts.map +0 -1
- package/dist/types.d.ts +0 -150
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/error-handler.d.ts +0 -20
- package/dist/utils/error-handler.d.ts.map +0 -1
- package/dist/utils/memory.d.ts +0 -21
- package/dist/utils/memory.d.ts.map +0 -1
- package/dist/utils/settings.d.ts +0 -3
- package/dist/utils/settings.d.ts.map +0 -1
- package/dist/utils/time.d.ts +0 -2
- package/dist/utils/time.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -36
- package/dist/utils.d.ts.map +0 -1
package/dist/client/client.d.ts
DELETED
|
@@ -1,462 +0,0 @@
|
|
|
1
|
-
import type { TTweetv2Expansion, TTweetv2MediaField, TTweetv2PlaceField, TTweetv2PollField, TTweetv2TweetField, TTweetv2UserField } from "twitter-api-v2";
|
|
2
|
-
type TPostv2Expansion = TTweetv2Expansion;
|
|
3
|
-
type TPostv2MediaField = TTweetv2MediaField;
|
|
4
|
-
type TPostv2PlaceField = TTweetv2PlaceField;
|
|
5
|
-
type TPostv2PollField = TTweetv2PollField;
|
|
6
|
-
type TPostv2PostField = TTweetv2TweetField;
|
|
7
|
-
type TPostv2UserField = TTweetv2UserField;
|
|
8
|
-
import type { FetchTransformOptions } from "./api-types";
|
|
9
|
-
import { XAuth } from "./auth";
|
|
10
|
-
import type { XAuthProvider } from "./auth-providers/types";
|
|
11
|
-
import { type PollData, type Post, type PostQuery, type Reposter } from "./posts";
|
|
12
|
-
import { type Profile } from "./profile";
|
|
13
|
-
import { SearchMode } from "./search";
|
|
14
|
-
import type { QueryPostsResponse, QueryProfilesResponse } from "./types";
|
|
15
|
-
/**
|
|
16
|
-
* An alternative fetch function to use instead of the default fetch function. This may be useful
|
|
17
|
-
* in nonstandard runtime environments, such as edge workers.
|
|
18
|
-
*
|
|
19
|
-
* @param {typeof fetch} fetch - The fetch function to use.
|
|
20
|
-
*
|
|
21
|
-
* @param {Partial<FetchTransformOptions>} transform - Additional options that control how requests
|
|
22
|
-
* and responses are processed. This can be used to proxy requests through other hosts, for example.
|
|
23
|
-
*/
|
|
24
|
-
export interface ClientOptions {
|
|
25
|
-
/**
|
|
26
|
-
* An alternative fetch function to use instead of the default fetch function. This may be useful
|
|
27
|
-
* in nonstandard runtime environments, such as edge workers.
|
|
28
|
-
*/
|
|
29
|
-
fetch: typeof fetch;
|
|
30
|
-
/**
|
|
31
|
-
* Additional options that control how requests and responses are processed. This can be used to
|
|
32
|
-
* proxy requests through other hosts, for example.
|
|
33
|
-
*/
|
|
34
|
-
transform: Partial<FetchTransformOptions>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* An interface to X's API v2.
|
|
38
|
-
* - Reusing Client objects is recommended to minimize the time spent authenticating unnecessarily.
|
|
39
|
-
*/
|
|
40
|
-
export declare class Client {
|
|
41
|
-
readonly _options?: Partial<ClientOptions> | undefined;
|
|
42
|
-
private auth?;
|
|
43
|
-
/**
|
|
44
|
-
* Creates a new Client object.
|
|
45
|
-
* - Reusing Client objects is recommended to minimize the time spent authenticating unnecessarily.
|
|
46
|
-
*/
|
|
47
|
-
constructor(_options?: Partial<ClientOptions> | undefined);
|
|
48
|
-
/**
|
|
49
|
-
* Fetches an X profile.
|
|
50
|
-
* @param username The X username of the profile to fetch, without an `@` at the beginning.
|
|
51
|
-
* @returns The requested {@link Profile}.
|
|
52
|
-
*/
|
|
53
|
-
getProfile(username: string): Promise<Profile>;
|
|
54
|
-
/**
|
|
55
|
-
* Fetches the user ID corresponding to the provided screen name.
|
|
56
|
-
* @param screenName The X screen name of the profile to fetch.
|
|
57
|
-
* @returns The ID of the corresponding account.
|
|
58
|
-
*/
|
|
59
|
-
getEntityIdByScreenName(screenName: string): Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
* @param userId The user ID of the profile to fetch.
|
|
63
|
-
* @returns The screen name of the corresponding account.
|
|
64
|
-
*/
|
|
65
|
-
getScreenNameByUserId(userId: string): Promise<string>;
|
|
66
|
-
/**
|
|
67
|
-
* Fetches posts from X.
|
|
68
|
-
* @param query The search query. Any X-compatible query format can be used.
|
|
69
|
-
* @param maxPosts The maximum number of posts to return.
|
|
70
|
-
* @param includeReplies Whether or not replies should be included in the response.
|
|
71
|
-
* @param searchMode The category filter to apply to the search. Defaults to `Top`.
|
|
72
|
-
* @returns An {@link AsyncGenerator} of posts matching the provided filters.
|
|
73
|
-
*/
|
|
74
|
-
searchPosts(query: string, maxPosts: number, searchMode?: SearchMode): AsyncGenerator<Post, void>;
|
|
75
|
-
/**
|
|
76
|
-
* Fetches profiles from X.
|
|
77
|
-
* @param query The search query. Any X-compatible query format can be used.
|
|
78
|
-
* @param maxProfiles The maximum number of profiles to return.
|
|
79
|
-
* @returns An {@link AsyncGenerator} of profiles matching the provided filter(s).
|
|
80
|
-
*/
|
|
81
|
-
searchProfiles(query: string, maxProfiles: number): AsyncGenerator<Profile, void>;
|
|
82
|
-
/**
|
|
83
|
-
* Fetches posts from X.
|
|
84
|
-
* @param query The search query. Any X-compatible query format can be used.
|
|
85
|
-
* @param maxPosts The maximum number of posts to return.
|
|
86
|
-
* @param includeReplies Whether or not replies should be included in the response.
|
|
87
|
-
* @param searchMode The category filter to apply to the search. Defaults to `Top`.
|
|
88
|
-
* @param cursor The search cursor, which can be passed into further requests for more results.
|
|
89
|
-
* @returns A page of results, containing a cursor that can be used in further requests.
|
|
90
|
-
*/
|
|
91
|
-
fetchSearchPosts(query: string, maxPosts: number, searchMode: SearchMode, _cursor?: string): Promise<QueryPostsResponse>;
|
|
92
|
-
/**
|
|
93
|
-
* Fetches profiles from X.
|
|
94
|
-
* @param query The search query. Any X-compatible query format can be used.
|
|
95
|
-
* @param maxProfiles The maximum number of profiles to return.
|
|
96
|
-
* @param cursor The search cursor, which can be passed into further requests for more results.
|
|
97
|
-
* @returns A page of results, containing a cursor that can be used in further requests.
|
|
98
|
-
*/
|
|
99
|
-
fetchSearchProfiles(query: string, maxProfiles: number, _cursor?: string): Promise<QueryProfilesResponse>;
|
|
100
|
-
/**
|
|
101
|
-
* Fetches list posts from X.
|
|
102
|
-
* @param listId The list id
|
|
103
|
-
* @param maxPosts The maximum number of posts to return.
|
|
104
|
-
* @param cursor The search cursor, which can be passed into further requests for more results.
|
|
105
|
-
* @returns A page of results, containing a cursor that can be used in further requests.
|
|
106
|
-
*/
|
|
107
|
-
fetchListPosts(listId: string, maxPosts: number, cursor?: string): Promise<QueryPostsResponse>;
|
|
108
|
-
/**
|
|
109
|
-
* Fetch the profiles a user is following
|
|
110
|
-
* @param userId The user whose following should be returned
|
|
111
|
-
* @param maxProfiles The maximum number of profiles to return.
|
|
112
|
-
* @returns An {@link AsyncGenerator} of following profiles for the provided user.
|
|
113
|
-
*/
|
|
114
|
-
getFollowing(userId: string, maxProfiles: number): AsyncGenerator<Profile, void>;
|
|
115
|
-
/**
|
|
116
|
-
* Fetch the profiles that follow a user
|
|
117
|
-
* @param userId The user whose followers should be returned
|
|
118
|
-
* @param maxProfiles The maximum number of profiles to return.
|
|
119
|
-
* @returns An {@link AsyncGenerator} of profiles following the provided user.
|
|
120
|
-
*/
|
|
121
|
-
getFollowers(userId: string, maxProfiles: number): AsyncGenerator<Profile, void>;
|
|
122
|
-
/**
|
|
123
|
-
* Fetches following profiles from X.
|
|
124
|
-
* @param userId The user whose following should be returned
|
|
125
|
-
* @param maxProfiles The maximum number of profiles to return.
|
|
126
|
-
* @param cursor The search cursor, which can be passed into further requests for more results.
|
|
127
|
-
* @returns A page of results, containing a cursor that can be used in further requests.
|
|
128
|
-
*/
|
|
129
|
-
fetchProfileFollowing(userId: string, maxProfiles: number, cursor?: string): Promise<QueryProfilesResponse>;
|
|
130
|
-
/**
|
|
131
|
-
* Fetches profile followers from X.
|
|
132
|
-
* @param userId The user whose following should be returned
|
|
133
|
-
* @param maxProfiles The maximum number of profiles to return.
|
|
134
|
-
* @param cursor The search cursor, which can be passed into further requests for more results.
|
|
135
|
-
* @returns A page of results, containing a cursor that can be used in further requests.
|
|
136
|
-
*/
|
|
137
|
-
fetchProfileFollowers(userId: string, maxProfiles: number, cursor?: string): Promise<QueryProfilesResponse>;
|
|
138
|
-
/**
|
|
139
|
-
* Fetches the home timeline for the current user using X API v2.
|
|
140
|
-
* X API v2 returns a combined feed (no separate "For You" vs "Following").
|
|
141
|
-
* @param count The number of posts to fetch.
|
|
142
|
-
* @param seenPostIds An array of post IDs that have already been seen (not used in v2).
|
|
143
|
-
* @returns A promise that resolves to an array of posts.
|
|
144
|
-
*/
|
|
145
|
-
fetchHomeTimeline(count: number, _seenPostIds: string[]): Promise<Post[]>;
|
|
146
|
-
/**
|
|
147
|
-
* Fetches the home timeline for the current user (same as fetchHomeTimeline in v2).
|
|
148
|
-
* X API v2 doesn't provide separate "Following" timeline endpoint.
|
|
149
|
-
* @param count The number of posts to fetch.
|
|
150
|
-
* @param seenPostIds An array of post IDs that have already been seen (not used in v2).
|
|
151
|
-
* @returns A promise that resolves to an array of posts.
|
|
152
|
-
*/
|
|
153
|
-
fetchFollowingTimeline(count: number, seenPostIds: string[]): Promise<Post[]>;
|
|
154
|
-
getUserPosts(userId: string, maxPosts?: number, cursor?: string): Promise<{
|
|
155
|
-
posts: Post[];
|
|
156
|
-
next?: string;
|
|
157
|
-
}>;
|
|
158
|
-
getUserPostsIterator(userId: string, maxPosts?: number): AsyncGenerator<Post, void>;
|
|
159
|
-
/**
|
|
160
|
-
* Fetches the current trends from X.
|
|
161
|
-
* @returns The current list of trends.
|
|
162
|
-
*/
|
|
163
|
-
getTrends(): Promise<string[]>;
|
|
164
|
-
/**
|
|
165
|
-
* Fetches posts from an X user.
|
|
166
|
-
* @param user The user whose posts should be returned.
|
|
167
|
-
* @param maxPosts The maximum number of posts to return. Defaults to `200`.
|
|
168
|
-
* @returns An {@link AsyncGenerator} of posts from the provided user.
|
|
169
|
-
*/
|
|
170
|
-
getPosts(user: string, maxPosts?: number): AsyncGenerator<Post>;
|
|
171
|
-
/**
|
|
172
|
-
* Fetches posts from an X user using their ID.
|
|
173
|
-
* @param userId The user whose posts should be returned.
|
|
174
|
-
* @param maxPosts The maximum number of posts to return. Defaults to `200`.
|
|
175
|
-
* @returns An {@link AsyncGenerator} of posts from the provided user.
|
|
176
|
-
*/
|
|
177
|
-
getPostsByUserId(userId: string, maxPosts?: number): AsyncGenerator<Post, void>;
|
|
178
|
-
/**
|
|
179
|
-
* Send a post
|
|
180
|
-
* @param text The text of the post
|
|
181
|
-
* @param postId The id of the post to reply to
|
|
182
|
-
* @param mediaData Optional media data
|
|
183
|
-
* @returns
|
|
184
|
-
*/
|
|
185
|
-
sendPost(text: string, replyToPostId?: string, mediaData?: {
|
|
186
|
-
data: Buffer;
|
|
187
|
-
mediaType: string;
|
|
188
|
-
}[], hideLinkPreview?: boolean): Promise<{
|
|
189
|
-
ok: boolean;
|
|
190
|
-
json: () => Promise<import("twitter-api-v2").TweetV2PostTweetResult>;
|
|
191
|
-
data: import("twitter-api-v2").TweetV2PostTweetResult;
|
|
192
|
-
}>;
|
|
193
|
-
sendNotePost(text: string, replyToPostId?: string, mediaData?: {
|
|
194
|
-
data: Buffer;
|
|
195
|
-
mediaType: string;
|
|
196
|
-
}[]): Promise<{
|
|
197
|
-
ok: boolean;
|
|
198
|
-
json: () => Promise<import("twitter-api-v2").TweetV2PostTweetResult>;
|
|
199
|
-
data: import("twitter-api-v2").TweetV2PostTweetResult;
|
|
200
|
-
}>;
|
|
201
|
-
/**
|
|
202
|
-
* Send a long post (Note Post)
|
|
203
|
-
* @param text The text of the post
|
|
204
|
-
* @param postId The id of the post to reply to
|
|
205
|
-
* @param mediaData Optional media data
|
|
206
|
-
* @returns
|
|
207
|
-
*/
|
|
208
|
-
sendLongPost(text: string, replyToPostId?: string, mediaData?: {
|
|
209
|
-
data: Buffer;
|
|
210
|
-
mediaType: string;
|
|
211
|
-
}[]): Promise<{
|
|
212
|
-
ok: boolean;
|
|
213
|
-
json: () => Promise<import("twitter-api-v2").TweetV2PostTweetResult>;
|
|
214
|
-
data: import("twitter-api-v2").TweetV2PostTweetResult;
|
|
215
|
-
}>;
|
|
216
|
-
/**
|
|
217
|
-
* Send a post
|
|
218
|
-
* @param text The text of the post
|
|
219
|
-
* @param postId The id of the post to reply to
|
|
220
|
-
* @param options The options for the post
|
|
221
|
-
* @returns
|
|
222
|
-
*/
|
|
223
|
-
sendPostV2(text: string, replyToPostId?: string, options?: {
|
|
224
|
-
poll?: PollData;
|
|
225
|
-
}): Promise<Post | null>;
|
|
226
|
-
/**
|
|
227
|
-
* Fetches posts and replies from an X user.
|
|
228
|
-
* @param user The user whose posts should be returned.
|
|
229
|
-
* @param maxPosts The maximum number of posts to return. Defaults to `200`.
|
|
230
|
-
* @returns An {@link AsyncGenerator} of posts from the provided user.
|
|
231
|
-
*/
|
|
232
|
-
getPostsAndReplies(user: string, maxPosts?: number): AsyncGenerator<Post>;
|
|
233
|
-
/**
|
|
234
|
-
* Fetches posts and replies from an X user using their ID.
|
|
235
|
-
* @param userId The user whose posts should be returned.
|
|
236
|
-
* @param maxPosts The maximum number of posts to return. Defaults to `200`.
|
|
237
|
-
* @returns An {@link AsyncGenerator} of posts from the provided user.
|
|
238
|
-
*/
|
|
239
|
-
getPostsAndRepliesByUserId(userId: string, maxPosts?: number): AsyncGenerator<Post, void>;
|
|
240
|
-
/**
|
|
241
|
-
* Fetches the first post matching the given query.
|
|
242
|
-
*
|
|
243
|
-
* Example:
|
|
244
|
-
* ```js
|
|
245
|
-
* const timeline = client.getPosts('user', 200);
|
|
246
|
-
* const repost = await client.getPostWhere(timeline, { isRepost: true });
|
|
247
|
-
* ```
|
|
248
|
-
* @param posts The {@link AsyncIterable} of posts to search through.
|
|
249
|
-
* @param query A query to test **all** posts against. This may be either an
|
|
250
|
-
* object of key/value pairs or a predicate. If this query is an object, all
|
|
251
|
-
* key/value pairs must match a {@link Post} for it to be returned. If this query
|
|
252
|
-
* is a predicate, it must resolve to `true` for a {@link Post} to be returned.
|
|
253
|
-
* - All keys are optional.
|
|
254
|
-
* - If specified, the key must be implemented by that of {@link Post}.
|
|
255
|
-
*/
|
|
256
|
-
getPostWhere(posts: AsyncIterable<Post>, query: PostQuery): Promise<Post | null>;
|
|
257
|
-
/**
|
|
258
|
-
* Fetches all posts matching the given query.
|
|
259
|
-
*
|
|
260
|
-
* Example:
|
|
261
|
-
* ```js
|
|
262
|
-
* const timeline = client.getPosts('user', 200);
|
|
263
|
-
* const reposts = await client.getPostsWhere(timeline, { isRepost: true });
|
|
264
|
-
* ```
|
|
265
|
-
* @param posts The {@link AsyncIterable} of posts to search through.
|
|
266
|
-
* @param query A query to test **all** posts against. This may be either an
|
|
267
|
-
* object of key/value pairs or a predicate. If this query is an object, all
|
|
268
|
-
* key/value pairs must match a {@link Post} for it to be returned. If this query
|
|
269
|
-
* is a predicate, it must resolve to `true` for a {@link Post} to be returned.
|
|
270
|
-
* - All keys are optional.
|
|
271
|
-
* - If specified, the key must be implemented by that of {@link Post}.
|
|
272
|
-
*/
|
|
273
|
-
getPostsWhere(posts: AsyncIterable<Post>, query: PostQuery): Promise<Post[]>;
|
|
274
|
-
/**
|
|
275
|
-
* Fetches the most recent post from an X user.
|
|
276
|
-
* @param user The user whose latest post should be returned.
|
|
277
|
-
* @param includeReposts Whether or not to include reposts. Defaults to `false`.
|
|
278
|
-
* @returns The {@link Post} object or `null`/`undefined` if it couldn't be fetched.
|
|
279
|
-
*/
|
|
280
|
-
getLatestPost(user: string, includeReposts?: boolean, max?: number): Promise<Post | null | undefined>;
|
|
281
|
-
/**
|
|
282
|
-
* Fetches a single post.
|
|
283
|
-
* @param id The ID of the post to fetch.
|
|
284
|
-
* @returns The {@link Post} object, or `null` if it couldn't be fetched.
|
|
285
|
-
*/
|
|
286
|
-
getPost(id: string): Promise<Post | null>;
|
|
287
|
-
/**
|
|
288
|
-
* Fetches a single post by ID using the X API v2.
|
|
289
|
-
* Allows specifying optional expansions and fields for more detailed data.
|
|
290
|
-
*
|
|
291
|
-
* @param {string} id - The ID of the post to fetch.
|
|
292
|
-
* @param {Object} [options] - Optional parameters to customize the post data.
|
|
293
|
-
* @param {string[]} [options.expansions] - Array of expansions to include, e.g., 'attachments.poll_ids'.
|
|
294
|
-
* @param {string[]} [options.postFields] - Array of post fields to include, e.g., 'created_at', 'public_metrics'.
|
|
295
|
-
* @param {string[]} [options.pollFields] - Array of poll fields to include, if the post has a poll, e.g., 'options', 'end_datetime'.
|
|
296
|
-
* @param {string[]} [options.mediaFields] - Array of media fields to include, if the post includes media, e.g., 'url', 'preview_image_url'.
|
|
297
|
-
* @param {string[]} [options.userFields] - Array of user fields to include, if user information is requested, e.g., 'username', 'verified'.
|
|
298
|
-
* @param {string[]} [options.placeFields] - Array of place fields to include, if the post includes location data, e.g., 'full_name', 'country'.
|
|
299
|
-
* @returns {Promise<PostV2 | null>} - The post data, including requested expansions and fields.
|
|
300
|
-
*/
|
|
301
|
-
getPostV2(id: string, options?: {
|
|
302
|
-
expansions?: TPostv2Expansion[];
|
|
303
|
-
postFields?: TPostv2PostField[];
|
|
304
|
-
pollFields?: TPostv2PollField[];
|
|
305
|
-
mediaFields?: TPostv2MediaField[];
|
|
306
|
-
userFields?: TPostv2UserField[];
|
|
307
|
-
placeFields?: TPostv2PlaceField[];
|
|
308
|
-
}): Promise<Post | null>;
|
|
309
|
-
/**
|
|
310
|
-
* Fetches multiple posts by IDs using the X API v2.
|
|
311
|
-
* Allows specifying optional expansions and fields for more detailed data.
|
|
312
|
-
*
|
|
313
|
-
* @param {string[]} ids - Array of post IDs to fetch.
|
|
314
|
-
* @param {Object} [options] - Optional parameters to customize the post data.
|
|
315
|
-
* @param {string[]} [options.expansions] - Array of expansions to include, e.g., 'attachments.poll_ids'.
|
|
316
|
-
* @param {string[]} [options.postFields] - Array of post fields to include, e.g., 'created_at', 'public_metrics'.
|
|
317
|
-
* @param {string[]} [options.pollFields] - Array of poll fields to include, if posts contain polls, e.g., 'options', 'end_datetime'.
|
|
318
|
-
* @param {string[]} [options.mediaFields] - Array of media fields to include, if posts contain media, e.g., 'url', 'preview_image_url'.
|
|
319
|
-
* @param {string[]} [options.userFields] - Array of user fields to include, if user information is requested, e.g., 'username', 'verified'.
|
|
320
|
-
* @param {string[]} [options.placeFields] - Array of place fields to include, if posts contain location data, e.g., 'full_name', 'country'.
|
|
321
|
-
* @returns {Promise<PostV2[]> } - Array of post data, including requested expansions and fields.
|
|
322
|
-
*/
|
|
323
|
-
getPostsV2(ids: string[], options?: {
|
|
324
|
-
expansions?: TPostv2Expansion[];
|
|
325
|
-
postFields?: TPostv2PostField[];
|
|
326
|
-
pollFields?: TPostv2PollField[];
|
|
327
|
-
mediaFields?: TPostv2MediaField[];
|
|
328
|
-
userFields?: TPostv2UserField[];
|
|
329
|
-
placeFields?: TPostv2PlaceField[];
|
|
330
|
-
}): Promise<Post[]>;
|
|
331
|
-
/**
|
|
332
|
-
* Updates the authentication state for the client.
|
|
333
|
-
* @param auth The new authentication.
|
|
334
|
-
*/
|
|
335
|
-
updateAuth(auth: XAuth): void;
|
|
336
|
-
authenticate(provider: XAuthProvider): Promise<void>;
|
|
337
|
-
/**
|
|
338
|
-
* Get current authentication credentials
|
|
339
|
-
* @returns {XAuth | null} Current authentication or null if not authenticated
|
|
340
|
-
*/
|
|
341
|
-
getAuth(): XAuth | null;
|
|
342
|
-
/**
|
|
343
|
-
* Check if client is properly authenticated with X API v2 credentials
|
|
344
|
-
* @returns {boolean} True if authenticated
|
|
345
|
-
*/
|
|
346
|
-
isAuthenticated(): boolean;
|
|
347
|
-
/**
|
|
348
|
-
* Returns if the client is logged in as a real user.
|
|
349
|
-
* @returns `true` if the client is logged in with a real user account; otherwise `false`.
|
|
350
|
-
*/
|
|
351
|
-
isLoggedIn(): Promise<boolean>;
|
|
352
|
-
/**
|
|
353
|
-
* Returns the currently logged in user
|
|
354
|
-
* @returns The currently logged in user
|
|
355
|
-
*/
|
|
356
|
-
me(): Promise<Profile | undefined>;
|
|
357
|
-
/**
|
|
358
|
-
* Login to X using API v2 credentials only.
|
|
359
|
-
* @param appKey The API key
|
|
360
|
-
* @param appSecret The API secret key
|
|
361
|
-
* @param accessToken The access token
|
|
362
|
-
* @param accessSecret The access token secret
|
|
363
|
-
*/
|
|
364
|
-
login(_username: string, _password: string, _email?: string, _twoFactorSecret?: string, appKey?: string, appSecret?: string, accessToken?: string, accessSecret?: string): Promise<void>;
|
|
365
|
-
/**
|
|
366
|
-
* Log out of X.
|
|
367
|
-
* With API v2 credentials, logout is a no-op.
|
|
368
|
-
*/
|
|
369
|
-
logout(): Promise<void>;
|
|
370
|
-
/**
|
|
371
|
-
* Sends a quote post.
|
|
372
|
-
* @param text The text of the post.
|
|
373
|
-
* @param quotedPostId The ID of the post to quote.
|
|
374
|
-
* @param options Optional parameters, such as media data.
|
|
375
|
-
* @returns The response from the X API.
|
|
376
|
-
*/
|
|
377
|
-
sendQuotePost(text: string, quotedPostId: string, options?: {
|
|
378
|
-
mediaData: {
|
|
379
|
-
data: Buffer;
|
|
380
|
-
mediaType: string;
|
|
381
|
-
}[];
|
|
382
|
-
}): Promise<{
|
|
383
|
-
ok: boolean;
|
|
384
|
-
json: () => Promise<import("twitter-api-v2").TweetV2PostTweetResult>;
|
|
385
|
-
data: import("twitter-api-v2").TweetV2PostTweetResult;
|
|
386
|
-
}>;
|
|
387
|
-
/**
|
|
388
|
-
* Delete a post with the given ID.
|
|
389
|
-
* @param postId The ID of the post to delete.
|
|
390
|
-
* @returns A promise that resolves when the post is deleted.
|
|
391
|
-
*/
|
|
392
|
-
deletePost(postId: string): Promise<{
|
|
393
|
-
success: boolean;
|
|
394
|
-
}>;
|
|
395
|
-
/**
|
|
396
|
-
* Likes a post with the given post ID.
|
|
397
|
-
* @param postId The ID of the post to like.
|
|
398
|
-
* @returns A promise that resolves when the post is liked.
|
|
399
|
-
*/
|
|
400
|
-
likePost(postId: string): Promise<void>;
|
|
401
|
-
/**
|
|
402
|
-
* Reposts a post with the given post ID.
|
|
403
|
-
* @param postId The ID of the post to repost.
|
|
404
|
-
* @returns A promise that resolves when the post is reposted.
|
|
405
|
-
*/
|
|
406
|
-
repost(postId: string): Promise<void>;
|
|
407
|
-
/**
|
|
408
|
-
* Unlikes a post with the given post ID.
|
|
409
|
-
* @param postId The ID of the post to unlike.
|
|
410
|
-
* @returns A promise that resolves when the post is unliked.
|
|
411
|
-
*/
|
|
412
|
-
unlikePost(postId: string): Promise<void>;
|
|
413
|
-
/**
|
|
414
|
-
* Removes a repost of a post with the given post ID.
|
|
415
|
-
* @param postId The ID of the post to unrepost.
|
|
416
|
-
* @returns A promise that resolves when the repost is removed.
|
|
417
|
-
*/
|
|
418
|
-
unrepost(postId: string): Promise<void>;
|
|
419
|
-
/**
|
|
420
|
-
* Follows a user with the given user ID.
|
|
421
|
-
* @param userId The user ID of the user to follow.
|
|
422
|
-
* @returns A promise that resolves when the user is followed.
|
|
423
|
-
*/
|
|
424
|
-
followUser(userName: string): Promise<void>;
|
|
425
|
-
/**
|
|
426
|
-
* Fetches direct message conversations.
|
|
427
|
-
* Requires additional API permissions not included in basic access.
|
|
428
|
-
*/
|
|
429
|
-
getDirectMessageConversations(_userId: string, _cursor?: string): Promise<{
|
|
430
|
-
conversations: unknown[];
|
|
431
|
-
}>;
|
|
432
|
-
/**
|
|
433
|
-
* Sends a direct message to a user.
|
|
434
|
-
* Requires additional API permissions not included in basic access.
|
|
435
|
-
*/
|
|
436
|
-
sendDirectMessage(_conversationId: string, _text: string): Promise<never>;
|
|
437
|
-
private handleResponse;
|
|
438
|
-
/**
|
|
439
|
-
* Retrieves all users who reposted the given post.
|
|
440
|
-
* @param postId The ID of the post.
|
|
441
|
-
* @returns An array of users (reposters).
|
|
442
|
-
*/
|
|
443
|
-
getRepostersOfPost(postId: string): Promise<Reposter[]>;
|
|
444
|
-
/**
|
|
445
|
-
* Fetches all quote posts for a given post ID, handling pagination automatically.
|
|
446
|
-
* @param postId The ID of the post to fetch quotes for.
|
|
447
|
-
* @param maxQuotes Maximum number of quotes to return (default: 100).
|
|
448
|
-
* @returns An array of all quote posts.
|
|
449
|
-
*/
|
|
450
|
-
fetchAllQuotedPosts(postId: string, maxQuotes?: number): Promise<Post[]>;
|
|
451
|
-
/**
|
|
452
|
-
* Fetches quote posts for a given post ID.
|
|
453
|
-
* This method now uses a generator function internally.
|
|
454
|
-
* @param postId The ID of the post to fetch quotes for.
|
|
455
|
-
* @param maxQuotes Maximum number of quotes to return.
|
|
456
|
-
* @param cursor Optional cursor for pagination.
|
|
457
|
-
* @returns A promise that resolves to a QueryPostsResponse containing posts and the next cursor.
|
|
458
|
-
*/
|
|
459
|
-
fetchQuotedPostsPage(postId: string, maxQuotes?: number, _cursor?: string): Promise<QueryPostsResponse>;
|
|
460
|
-
}
|
|
461
|
-
export {};
|
|
462
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../client/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,gBAAgB,GAAG,iBAAiB,CAAC;AAC1C,KAAK,iBAAiB,GAAG,kBAAkB,CAAC;AAC5C,KAAK,iBAAiB,GAAG,kBAAkB,CAAC;AAC5C,KAAK,gBAAgB,GAAG,iBAAiB,CAAC;AAC1C,KAAK,gBAAgB,GAAG,kBAAkB,CAAC;AAC3C,KAAK,gBAAgB,GAAG,iBAAiB,CAAC;AAE1C,OAAO,KAAK,EAAE,qBAAqB,EAAoB,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAqBL,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,SAAS,EAEd,KAAK,QAAQ,EAId,MAAM,SAAS,CAAC;AAEjB,OAAO,EAIL,KAAK,OAAO,EACb,MAAM,WAAW,CAAC;AAQnB,OAAO,EAAE,UAAU,EAAkD,MAAM,UAAU,CAAC;AACtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIzE;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,KAAK,EAAE,O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G,OAAO,CAAC,IAAI,CAAC;IAOpD;;;;OAIG;IACU,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxD;;;OAGG;IACU,6BAA6B,CACxC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,aAAa,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;IAIxC;;;OAGG;IACU,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAItF,OAAO,CAAC,cAAc;IAQtB;;;;OAIG;IACU,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAOpE;;;;;OAKG;IACU,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAiC1F;;;;;;;OAOG;IACU,oBAAoB,CAC/B,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,MAAW,EACtB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC;CAoB/B"}
|
package/dist/client/errors.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Class representing an API error.
|
|
3
|
-
*/
|
|
4
|
-
export declare class ApiError extends Error {
|
|
5
|
-
readonly response: Response;
|
|
6
|
-
readonly data: unknown;
|
|
7
|
-
/**
|
|
8
|
-
* Constructor for creating a new instance of the class.
|
|
9
|
-
*
|
|
10
|
-
* @param response The response object.
|
|
11
|
-
* @param data The data object.
|
|
12
|
-
* @param message The message string.
|
|
13
|
-
*/
|
|
14
|
-
private constructor();
|
|
15
|
-
/**
|
|
16
|
-
* Creates an instance of ApiError based on a Response object.
|
|
17
|
-
*
|
|
18
|
-
* @param {Response} response The Response object to parse.
|
|
19
|
-
* @returns {Promise<ApiError>} A new instance of ApiError with the parsed data and status.
|
|
20
|
-
*/
|
|
21
|
-
static fromResponse(response: Response): Promise<ApiError>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Represents a position in a file with line and column information.
|
|
25
|
-
* @interface Position
|
|
26
|
-
* @property {number} line - The line number of the position.
|
|
27
|
-
* @property {number} column - The column number of the position.
|
|
28
|
-
*/
|
|
29
|
-
interface Position {
|
|
30
|
-
line: number;
|
|
31
|
-
column: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Interface representing trace information.
|
|
35
|
-
* @property { string } trace_id - The ID of the trace.
|
|
36
|
-
*/
|
|
37
|
-
interface TraceInfo {
|
|
38
|
-
trace_id: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Interface representing additional information that can be included in X API error objects.
|
|
42
|
-
* @typedef { Object } XApiErrorExtensions
|
|
43
|
-
* @property { number } [code] - The error code associated with the error.
|
|
44
|
-
* @property { string } [kind] - The kind of error that occurred.
|
|
45
|
-
* @property { string } [name] - The name of the error.
|
|
46
|
-
* @property { string } [source] - The source of the error.
|
|
47
|
-
* @property { TraceInfo } [tracing] - Information about the tracing of the error.
|
|
48
|
-
*/
|
|
49
|
-
interface XApiErrorExtensions {
|
|
50
|
-
code?: number;
|
|
51
|
-
kind?: string;
|
|
52
|
-
name?: string;
|
|
53
|
-
source?: string;
|
|
54
|
-
tracing?: TraceInfo;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Interface representing a raw X API error object.
|
|
58
|
-
* @interface
|
|
59
|
-
* @extends {XApiErrorExtensions}
|
|
60
|
-
* @property {string} [message] The error message.
|
|
61
|
-
* @property {Position[]} [locations] An array of positions.
|
|
62
|
-
* @property {string[]} [path] An array representing the path of the error.
|
|
63
|
-
* @property {XApiErrorExtensions} [extensions] Additional error extensions.
|
|
64
|
-
*/
|
|
65
|
-
export interface XApiErrorRaw extends XApiErrorExtensions {
|
|
66
|
-
message?: string;
|
|
67
|
-
locations?: Position[];
|
|
68
|
-
path?: string[];
|
|
69
|
-
extensions?: XApiErrorExtensions;
|
|
70
|
-
}
|
|
71
|
-
export {};
|
|
72
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../client/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,QAAS,SAAQ,KAAK;IAS/B,QAAQ,CAAC,QAAQ,EAAE,QAAQ;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO;IATxB;;;;;;OAMG;IACH,OAAO;IAQP;;;;;OAKG;WACU,YAAY,CAAC,QAAQ,EAAE,QAAQ;CAa7C;AAED;;;;;GAKG;AACH,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,UAAU,mBAAmB;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAClC"}
|
package/dist/client/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* X API v2 Client
|
|
3
|
-
*
|
|
4
|
-
* Provides a clean interface to X's API v2 for:
|
|
5
|
-
* - Posts (create, read, delete, like, repost)
|
|
6
|
-
* - Users (profiles, followers, following)
|
|
7
|
-
* - Timelines (home, user, list)
|
|
8
|
-
* - Search (posts, users)
|
|
9
|
-
* - Direct Messages (limited in v2)
|
|
10
|
-
*/
|
|
11
|
-
export * from "./api-types";
|
|
12
|
-
export { XAuth } from "./auth";
|
|
13
|
-
export type { ClientOptions } from "./client";
|
|
14
|
-
export { Client } from "./client";
|
|
15
|
-
export * from "./errors";
|
|
16
|
-
export * from "./posts";
|
|
17
|
-
export * from "./profile";
|
|
18
|
-
export * from "./relationships";
|
|
19
|
-
export * from "./search";
|
|
20
|
-
export type { QueryPostsResponse, QueryProfilesResponse } from "./types";
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|