fxtwitter 1.0.0 → 2.1.0

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/dist/v1.d.cts CHANGED
@@ -1,2 +1,253 @@
1
- import { C as User, D as Video, E as VerificationType, O as VideoFormat, S as TwitterCard, T as Verification, _ as StatusMessage, a as AnyMedia, b as Translation, c as ExternalMedia, d as Photo, f as Poll, g as StatusMedia, h as RepostedBy, i as GetUserOptions, k as Website, l as Facet, m as RawText, n as FxTwitterV1Options, o as Author, p as PollChoice, r as GetStatusOptions, s as CommunityNote, t as FxTwitterV1, u as MosaicPhoto, v as StatusRawText, w as UserResponse, x as Tweet, y as StatusResponse } from "./v1-BKUGwGbc.cjs";
1
+ import { t as ClientOptions } from "./http-CidaL0TV.cjs";
2
+ //#region src/types/v1.d.ts
3
+ interface Facet {
4
+ /** e.g. `url`, `mention`, `hashtag`, `media`. */
5
+ type: string;
6
+ /** Start/end UTF-16 indices. */
7
+ indices: [number, number];
8
+ original?: string;
9
+ replacement?: string;
10
+ display?: string;
11
+ id?: string;
12
+ }
13
+ interface RawText {
14
+ text: string;
15
+ facets: Facet[];
16
+ }
17
+ interface StatusRawText extends RawText {
18
+ display_text_range: [number, number];
19
+ }
20
+ interface Website {
21
+ url: string;
22
+ display_url: string;
23
+ }
24
+ type VerificationType = "organization" | "government" | "individual" | null;
25
+ interface Verification {
26
+ verified: boolean;
27
+ type: VerificationType;
28
+ verified_at?: string | null;
29
+ identity_verified?: boolean;
30
+ verified_by?: string;
31
+ }
32
+ /** The author embedded in a status. Same shape as {@link User}, plus `avatar_color`. */
33
+ interface Author {
34
+ id: string;
35
+ name: string;
36
+ screen_name: string;
37
+ url: string;
38
+ description: string;
39
+ raw_description: RawText;
40
+ location: string;
41
+ avatar_url: string | null;
42
+ banner_url: string | null;
43
+ /** @deprecated Always `null` upstream. */
44
+ avatar_color?: string | null;
45
+ followers: number;
46
+ following: number;
47
+ likes: number;
48
+ media_count: number;
49
+ joined: string;
50
+ protected: boolean;
51
+ website: Website | null;
52
+ verification?: Verification;
53
+ }
54
+ /** The user returned by `GET /:screen_name`. Uses `tweets` where v2 uses `statuses`. */
55
+ interface User extends Author {
56
+ /** Status count. Named `statuses` in the v2 API. */
57
+ tweets: number;
58
+ }
59
+ interface Translation {
60
+ text: string;
61
+ source_lang: string;
62
+ source_lang_en: string;
63
+ target_lang: string;
64
+ provider: string;
65
+ }
66
+ interface PollChoice {
67
+ label: string;
68
+ count: number;
69
+ /** 0-100. */
70
+ percentage: number;
71
+ }
72
+ interface Poll {
73
+ choices: PollChoice[];
74
+ total_votes: number;
75
+ ends_at: string;
76
+ time_left_en: string;
77
+ }
78
+ interface VideoFormat {
79
+ container?: "mp4" | "webm" | "m3u8";
80
+ codec?: "h264" | "hevc" | "vp9" | "av1";
81
+ bitrate?: number;
82
+ url: string;
83
+ size?: number;
84
+ height?: number;
85
+ width?: number;
86
+ }
87
+ interface Photo {
88
+ id?: string;
89
+ /** MIME type, e.g. `image/jpeg`. */
90
+ format?: string;
91
+ type: "photo" | "gif";
92
+ url: string;
93
+ width: number;
94
+ height: number;
95
+ transcode_url?: string | null;
96
+ altText?: string;
97
+ }
98
+ interface Video {
99
+ id?: string;
100
+ /** MIME type, e.g. `video/mp4`. */
101
+ format?: string;
102
+ type: "video" | "gif";
103
+ url: string;
104
+ width: number;
105
+ height: number;
106
+ thumbnail_url?: string | null;
107
+ transcode_url?: string | null;
108
+ duration: number;
109
+ filesize?: number;
110
+ formats?: VideoFormat[];
111
+ }
112
+ interface MosaicPhoto {
113
+ id?: string;
114
+ type: "mosaic_photo";
115
+ url?: string;
116
+ width: number;
117
+ height: number;
118
+ formats: {
119
+ webp: string;
120
+ jpeg: string;
121
+ };
122
+ }
123
+ interface ExternalMedia {
124
+ /** Currently always `video`. */
125
+ type: string;
126
+ url: string;
127
+ thumbnail_url?: string;
128
+ height?: number;
129
+ width?: number;
130
+ duration?: number;
131
+ }
132
+ type AnyMedia = Photo | Video | MosaicPhoto;
133
+ interface StatusMedia {
134
+ /** Preserves the original ordering across photos and videos. */
135
+ all?: AnyMedia[];
136
+ external?: ExternalMedia;
137
+ photos?: Photo[];
138
+ videos?: Video[];
139
+ mosaic?: MosaicPhoto;
140
+ }
141
+ interface CommunityNote {
142
+ text: string;
143
+ facets: Facet[];
144
+ }
145
+ interface RepostedBy {
146
+ id: string;
147
+ name: string;
148
+ screen_name: string;
149
+ avatar_url?: string | null;
150
+ url?: string;
151
+ }
152
+ type TwitterCard = "tweet" | "summary" | "summary_large_image" | "player";
153
+ interface Tweet {
154
+ id: string;
155
+ url: string;
156
+ text: string;
157
+ raw_text: StatusRawText;
158
+ created_at: string;
159
+ created_timestamp: number;
160
+ author: Author;
161
+ likes: number;
162
+ /** Named `reposts` in the v2 API. */
163
+ retweets: number;
164
+ replies: number;
165
+ quotes: number;
166
+ views: number | null;
167
+ bookmarks?: number | null;
168
+ lang: string | null;
169
+ /** Screen name of the account being replied to. An object in the v2 API. */
170
+ replying_to: string | null;
171
+ /** Status ID being replied to. Folded into `replying_to` in the v2 API. */
172
+ replying_to_status: string | null;
173
+ source: string | null;
174
+ /** Named `embed_card` in the v2 API. */
175
+ twitter_card: TwitterCard;
176
+ provider?: string;
177
+ possibly_sensitive?: boolean;
178
+ is_note_tweet: boolean;
179
+ community_note: CommunityNote | null;
180
+ reposted_by: RepostedBy | null;
181
+ /** @deprecated Always `null` upstream. */
182
+ color?: string | null;
183
+ quote?: Tweet;
184
+ poll?: Poll;
185
+ /** Only present when a translation target was requested. */
186
+ translation?: Translation;
187
+ media?: StatusMedia;
188
+ }
189
+ /**
190
+ * `message` values the API maps onto its status codes: 200, 401, 404, 503
191
+ * and 500 respectively.
192
+ */
193
+ type StatusMessage = "OK" | "PRIVATE_TWEET" | "NOT_FOUND" | "UPSTREAM_UNAVAILABLE" | "API_FAIL";
194
+ interface StatusResponse {
195
+ /** Mirrors the HTTP status code. */
196
+ code: number;
197
+ message: StatusMessage | string;
198
+ /** `null` when the status could not be retrieved. */
199
+ tweet: Tweet | null;
200
+ }
201
+ interface UserResponse {
202
+ /** Mirrors the HTTP status code. */
203
+ code: number;
204
+ message: string;
205
+ /** Omitted entirely when the user could not be retrieved. */
206
+ user?: User;
207
+ /** Set to `suspended` when the account is suspended. */
208
+ reason?: "suspended";
209
+ }
210
+ //#endregion
211
+ //#region src/v1.d.ts
212
+ type FxTwitterV1Options = ClientOptions & {
213
+ /** Suppresses the one-time deprecation warning emitted on construction. */
214
+ silenceDeprecationWarning?: boolean;
215
+ };
216
+ interface GetStatusOptions {
217
+ /**
218
+ * Included in the URL for readability only. The API resolves the status from
219
+ * `id` alone and never validates this, so a wrong handle still succeeds.
220
+ */
221
+ screenName?: string;
222
+ /**
223
+ * Language to translate the status into, as an ISO 639-1 code (`es`) or a
224
+ * locale (`zh-cn`). Adds a `translation` object to the returned status.
225
+ */
226
+ translateTo?: string;
227
+ /** Per-call cancellation, composed with the client-level `timeout`. */
228
+ signal?: AbortSignal;
229
+ }
230
+ interface GetUserOptions {
231
+ signal?: AbortSignal;
232
+ }
233
+ /**
234
+ * Client for the legacy FxTwitter v1 API.
235
+ *
236
+ * @deprecated Use {@link import("./v2").FxTwitterV2} instead. v1 is kept only
237
+ * for backwards compatibility and does not receive new features.
238
+ */
239
+ declare class FxTwitterV1 {
240
+ private readonly http;
241
+ constructor(options?: FxTwitterV1Options);
242
+ /**
243
+ * Fetches a single status by its snowflake ID.
244
+ *
245
+ * `GET /status/:id`, `GET /status/:id/:language`,
246
+ * `GET /:handle/status/:id`, `GET /:handle/status/:id/:language`
247
+ */
248
+ getStatus(id: string, options?: GetStatusOptions): Promise<StatusResponse>;
249
+ /** Fetches a user profile by handle (`GET /:handle`). */
250
+ getUser(screenName: string, options?: GetUserOptions): Promise<UserResponse>;
251
+ }
252
+ //#endregion
2
253
  export { type AnyMedia, type Author, type CommunityNote, type ExternalMedia, type Facet, FxTwitterV1, FxTwitterV1Options, GetStatusOptions, GetUserOptions, type MosaicPhoto, type Photo, type Poll, type PollChoice, type RawText, type RepostedBy, type StatusMedia, type StatusMessage, type StatusRawText, type StatusResponse, type Translation, type Tweet, type TwitterCard, type User, type UserResponse, type Verification, type VerificationType, type Video, type VideoFormat, type Website };
package/dist/v1.d.mts CHANGED
@@ -1,2 +1,253 @@
1
- import { C as User, D as Video, E as VerificationType, O as VideoFormat, S as TwitterCard, T as Verification, _ as StatusMessage, a as AnyMedia, b as Translation, c as ExternalMedia, d as Photo, f as Poll, g as StatusMedia, h as RepostedBy, i as GetUserOptions, k as Website, l as Facet, m as RawText, n as FxTwitterV1Options, o as Author, p as PollChoice, r as GetStatusOptions, s as CommunityNote, t as FxTwitterV1, u as MosaicPhoto, v as StatusRawText, w as UserResponse, x as Tweet, y as StatusResponse } from "./v1-BKUGwGbc.mjs";
1
+ import { t as ClientOptions } from "./http-CidaL0TV.mjs";
2
+ //#region src/types/v1.d.ts
3
+ interface Facet {
4
+ /** e.g. `url`, `mention`, `hashtag`, `media`. */
5
+ type: string;
6
+ /** Start/end UTF-16 indices. */
7
+ indices: [number, number];
8
+ original?: string;
9
+ replacement?: string;
10
+ display?: string;
11
+ id?: string;
12
+ }
13
+ interface RawText {
14
+ text: string;
15
+ facets: Facet[];
16
+ }
17
+ interface StatusRawText extends RawText {
18
+ display_text_range: [number, number];
19
+ }
20
+ interface Website {
21
+ url: string;
22
+ display_url: string;
23
+ }
24
+ type VerificationType = "organization" | "government" | "individual" | null;
25
+ interface Verification {
26
+ verified: boolean;
27
+ type: VerificationType;
28
+ verified_at?: string | null;
29
+ identity_verified?: boolean;
30
+ verified_by?: string;
31
+ }
32
+ /** The author embedded in a status. Same shape as {@link User}, plus `avatar_color`. */
33
+ interface Author {
34
+ id: string;
35
+ name: string;
36
+ screen_name: string;
37
+ url: string;
38
+ description: string;
39
+ raw_description: RawText;
40
+ location: string;
41
+ avatar_url: string | null;
42
+ banner_url: string | null;
43
+ /** @deprecated Always `null` upstream. */
44
+ avatar_color?: string | null;
45
+ followers: number;
46
+ following: number;
47
+ likes: number;
48
+ media_count: number;
49
+ joined: string;
50
+ protected: boolean;
51
+ website: Website | null;
52
+ verification?: Verification;
53
+ }
54
+ /** The user returned by `GET /:screen_name`. Uses `tweets` where v2 uses `statuses`. */
55
+ interface User extends Author {
56
+ /** Status count. Named `statuses` in the v2 API. */
57
+ tweets: number;
58
+ }
59
+ interface Translation {
60
+ text: string;
61
+ source_lang: string;
62
+ source_lang_en: string;
63
+ target_lang: string;
64
+ provider: string;
65
+ }
66
+ interface PollChoice {
67
+ label: string;
68
+ count: number;
69
+ /** 0-100. */
70
+ percentage: number;
71
+ }
72
+ interface Poll {
73
+ choices: PollChoice[];
74
+ total_votes: number;
75
+ ends_at: string;
76
+ time_left_en: string;
77
+ }
78
+ interface VideoFormat {
79
+ container?: "mp4" | "webm" | "m3u8";
80
+ codec?: "h264" | "hevc" | "vp9" | "av1";
81
+ bitrate?: number;
82
+ url: string;
83
+ size?: number;
84
+ height?: number;
85
+ width?: number;
86
+ }
87
+ interface Photo {
88
+ id?: string;
89
+ /** MIME type, e.g. `image/jpeg`. */
90
+ format?: string;
91
+ type: "photo" | "gif";
92
+ url: string;
93
+ width: number;
94
+ height: number;
95
+ transcode_url?: string | null;
96
+ altText?: string;
97
+ }
98
+ interface Video {
99
+ id?: string;
100
+ /** MIME type, e.g. `video/mp4`. */
101
+ format?: string;
102
+ type: "video" | "gif";
103
+ url: string;
104
+ width: number;
105
+ height: number;
106
+ thumbnail_url?: string | null;
107
+ transcode_url?: string | null;
108
+ duration: number;
109
+ filesize?: number;
110
+ formats?: VideoFormat[];
111
+ }
112
+ interface MosaicPhoto {
113
+ id?: string;
114
+ type: "mosaic_photo";
115
+ url?: string;
116
+ width: number;
117
+ height: number;
118
+ formats: {
119
+ webp: string;
120
+ jpeg: string;
121
+ };
122
+ }
123
+ interface ExternalMedia {
124
+ /** Currently always `video`. */
125
+ type: string;
126
+ url: string;
127
+ thumbnail_url?: string;
128
+ height?: number;
129
+ width?: number;
130
+ duration?: number;
131
+ }
132
+ type AnyMedia = Photo | Video | MosaicPhoto;
133
+ interface StatusMedia {
134
+ /** Preserves the original ordering across photos and videos. */
135
+ all?: AnyMedia[];
136
+ external?: ExternalMedia;
137
+ photos?: Photo[];
138
+ videos?: Video[];
139
+ mosaic?: MosaicPhoto;
140
+ }
141
+ interface CommunityNote {
142
+ text: string;
143
+ facets: Facet[];
144
+ }
145
+ interface RepostedBy {
146
+ id: string;
147
+ name: string;
148
+ screen_name: string;
149
+ avatar_url?: string | null;
150
+ url?: string;
151
+ }
152
+ type TwitterCard = "tweet" | "summary" | "summary_large_image" | "player";
153
+ interface Tweet {
154
+ id: string;
155
+ url: string;
156
+ text: string;
157
+ raw_text: StatusRawText;
158
+ created_at: string;
159
+ created_timestamp: number;
160
+ author: Author;
161
+ likes: number;
162
+ /** Named `reposts` in the v2 API. */
163
+ retweets: number;
164
+ replies: number;
165
+ quotes: number;
166
+ views: number | null;
167
+ bookmarks?: number | null;
168
+ lang: string | null;
169
+ /** Screen name of the account being replied to. An object in the v2 API. */
170
+ replying_to: string | null;
171
+ /** Status ID being replied to. Folded into `replying_to` in the v2 API. */
172
+ replying_to_status: string | null;
173
+ source: string | null;
174
+ /** Named `embed_card` in the v2 API. */
175
+ twitter_card: TwitterCard;
176
+ provider?: string;
177
+ possibly_sensitive?: boolean;
178
+ is_note_tweet: boolean;
179
+ community_note: CommunityNote | null;
180
+ reposted_by: RepostedBy | null;
181
+ /** @deprecated Always `null` upstream. */
182
+ color?: string | null;
183
+ quote?: Tweet;
184
+ poll?: Poll;
185
+ /** Only present when a translation target was requested. */
186
+ translation?: Translation;
187
+ media?: StatusMedia;
188
+ }
189
+ /**
190
+ * `message` values the API maps onto its status codes: 200, 401, 404, 503
191
+ * and 500 respectively.
192
+ */
193
+ type StatusMessage = "OK" | "PRIVATE_TWEET" | "NOT_FOUND" | "UPSTREAM_UNAVAILABLE" | "API_FAIL";
194
+ interface StatusResponse {
195
+ /** Mirrors the HTTP status code. */
196
+ code: number;
197
+ message: StatusMessage | string;
198
+ /** `null` when the status could not be retrieved. */
199
+ tweet: Tweet | null;
200
+ }
201
+ interface UserResponse {
202
+ /** Mirrors the HTTP status code. */
203
+ code: number;
204
+ message: string;
205
+ /** Omitted entirely when the user could not be retrieved. */
206
+ user?: User;
207
+ /** Set to `suspended` when the account is suspended. */
208
+ reason?: "suspended";
209
+ }
210
+ //#endregion
211
+ //#region src/v1.d.ts
212
+ type FxTwitterV1Options = ClientOptions & {
213
+ /** Suppresses the one-time deprecation warning emitted on construction. */
214
+ silenceDeprecationWarning?: boolean;
215
+ };
216
+ interface GetStatusOptions {
217
+ /**
218
+ * Included in the URL for readability only. The API resolves the status from
219
+ * `id` alone and never validates this, so a wrong handle still succeeds.
220
+ */
221
+ screenName?: string;
222
+ /**
223
+ * Language to translate the status into, as an ISO 639-1 code (`es`) or a
224
+ * locale (`zh-cn`). Adds a `translation` object to the returned status.
225
+ */
226
+ translateTo?: string;
227
+ /** Per-call cancellation, composed with the client-level `timeout`. */
228
+ signal?: AbortSignal;
229
+ }
230
+ interface GetUserOptions {
231
+ signal?: AbortSignal;
232
+ }
233
+ /**
234
+ * Client for the legacy FxTwitter v1 API.
235
+ *
236
+ * @deprecated Use {@link import("./v2").FxTwitterV2} instead. v1 is kept only
237
+ * for backwards compatibility and does not receive new features.
238
+ */
239
+ declare class FxTwitterV1 {
240
+ private readonly http;
241
+ constructor(options?: FxTwitterV1Options);
242
+ /**
243
+ * Fetches a single status by its snowflake ID.
244
+ *
245
+ * `GET /status/:id`, `GET /status/:id/:language`,
246
+ * `GET /:handle/status/:id`, `GET /:handle/status/:id/:language`
247
+ */
248
+ getStatus(id: string, options?: GetStatusOptions): Promise<StatusResponse>;
249
+ /** Fetches a user profile by handle (`GET /:handle`). */
250
+ getUser(screenName: string, options?: GetUserOptions): Promise<UserResponse>;
251
+ }
252
+ //#endregion
2
253
  export { type AnyMedia, type Author, type CommunityNote, type ExternalMedia, type Facet, FxTwitterV1, FxTwitterV1Options, GetStatusOptions, GetUserOptions, type MosaicPhoto, type Photo, type Poll, type PollChoice, type RawText, type RepostedBy, type StatusMedia, type StatusMessage, type StatusRawText, type StatusResponse, type Translation, type Tweet, type TwitterCard, type User, type UserResponse, type Verification, type VerificationType, type Video, type VideoFormat, type Website };
package/dist/v1.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as FxTwitterV1 } from "./v1-KUPCoHD9.mjs";
1
+ import { t as FxTwitterV1 } from "./v1-ByqsBlpO.mjs";
2
2
  export { FxTwitterV1 };
package/dist/v2.cjs ADDED
@@ -0,0 +1,183 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_http = require("./http-Cs4GJeg-.cjs");
3
+ //#region src/v2.ts
4
+ /** Builds the `id:<rest_id>` handle form accepted by the profile endpoints. */
5
+ function byUserId(id) {
6
+ return `id:${id}`;
7
+ }
8
+ /**
9
+ * Recovers the body of a 404 that carries a well-formed, empty result page,
10
+ * which is how the list endpoints report "no results or timeline unavailable".
11
+ */
12
+ function emptyPage(error) {
13
+ if (!(error instanceof require_http.FxTwitterError) || error.status !== 404) return null;
14
+ const body = error.body;
15
+ if (typeof body !== "object" || body === null) return null;
16
+ const results = body.results;
17
+ return Array.isArray(results) ? body : null;
18
+ }
19
+ /** Client for the FxTwitter/FxEmbed v2 API (https://docs.fxembed.com/api/twitter/). */
20
+ var FxTwitterV2 = class {
21
+ http;
22
+ constructor(options = {}) {
23
+ this.http = new require_http.HttpClient(options);
24
+ }
25
+ /** Only `/2/profile/{handle}/statuses` can answer 204, so everything else demands a body. */
26
+ async get(path, query, signal) {
27
+ const body = await this.http.get({
28
+ path,
29
+ query,
30
+ signal
31
+ });
32
+ if (body === null) throw new require_http.FxTwitterError("The API returned an empty response");
33
+ return body;
34
+ }
35
+ /**
36
+ * Same as {@link get}, for the endpoints that report "no results" as a 404
37
+ * carrying an otherwise normal body. An empty page is a result, not an
38
+ * error, so it is returned rather than thrown.
39
+ *
40
+ * The API uses that same 404 for an unknown handle, which it does not
41
+ * distinguish from an empty timeline.
42
+ */
43
+ async getPage(path, query, signal) {
44
+ try {
45
+ return await this.get(path, query, signal);
46
+ } catch (error) {
47
+ const page = emptyPage(error);
48
+ if (page) return page;
49
+ throw error;
50
+ }
51
+ }
52
+ /** `GET /2/status/{id}` — a single post by snowflake ID. */
53
+ getStatus(id, options = {}) {
54
+ return this.get(`/2/status/${encodeURIComponent(id)}`, {
55
+ about_account: options.aboutAccount ? "1" : void 0,
56
+ lang: options.lang
57
+ }, options.signal);
58
+ }
59
+ /** `GET /2/status/{id}/reposts` — users who reposted a post. */
60
+ getStatusReposts(id, options = {}) {
61
+ return this.getPage(`/2/status/${encodeURIComponent(id)}/reposts`, {
62
+ count: options.count,
63
+ cursor: options.cursor
64
+ }, options.signal);
65
+ }
66
+ /** `GET /2/status/{id}/quotes` — posts quoting a post. */
67
+ getStatusQuotes(id, options = {}) {
68
+ return this.getPage(`/2/status/${encodeURIComponent(id)}/quotes`, {
69
+ count: options.count,
70
+ cursor: options.cursor,
71
+ lang: options.lang
72
+ }, options.signal);
73
+ }
74
+ /** `GET /2/thread/{id}` — a post with its unrolled thread. */
75
+ getThread(id, options = {}) {
76
+ return this.get(`/2/thread/${encodeURIComponent(id)}`, {
77
+ about_account: options.aboutAccount ? "1" : void 0,
78
+ lang: options.lang
79
+ }, options.signal);
80
+ }
81
+ /** `GET /2/conversation/{id}` — a post, its thread, and ranked replies. */
82
+ getConversation(id, options = {}) {
83
+ return this.get(`/2/conversation/${encodeURIComponent(id)}`, {
84
+ ranking_mode: options.rankingMode,
85
+ cursor: options.cursor,
86
+ about_account: options.aboutAccount ? "1" : void 0,
87
+ lang: options.lang
88
+ }, options.signal);
89
+ }
90
+ /**
91
+ * `GET /2/profile/{handle}` — a user's profile. `handle` is a username
92
+ * without `@`, or `byUserId(id)` for a numeric user ID.
93
+ */
94
+ getProfile(handle, options = {}) {
95
+ return this.get(`/2/profile/${encodeURIComponent(handle)}`, { about_account: options.aboutAccount ? "1" : void 0 }, options.signal);
96
+ }
97
+ /**
98
+ * `GET /2/profile/{handle}/statuses` — a user's posts. Resolves to `null`
99
+ * when `since` is set (without `cursor`) and nothing is newer than it.
100
+ */
101
+ async getProfileStatuses(handle, options = {}) {
102
+ try {
103
+ return await this.http.get({
104
+ path: `/2/profile/${encodeURIComponent(handle)}/statuses`,
105
+ query: {
106
+ count: options.count,
107
+ cursor: options.cursor,
108
+ since: options.since,
109
+ with_replies: options.withReplies ? "1" : void 0,
110
+ groupthreads: options.groupThreads ? "1" : void 0,
111
+ lang: options.lang
112
+ },
113
+ signal: options.signal
114
+ });
115
+ } catch (error) {
116
+ const page = emptyPage(error);
117
+ if (page) return page;
118
+ throw error;
119
+ }
120
+ }
121
+ /** `GET /2/profile/{handle}/articles` — a user's long-form articles. */
122
+ getProfileArticles(handle, options = {}) {
123
+ return this.getPage(`/2/profile/${encodeURIComponent(handle)}/articles`, {
124
+ count: options.count,
125
+ cursor: options.cursor,
126
+ lang: options.lang
127
+ }, options.signal);
128
+ }
129
+ /** `GET /2/profile/{handle}/about` — account metadata (based-in country, name changes). */
130
+ getProfileAbout(handle, options = {}) {
131
+ return this.get(`/2/profile/${encodeURIComponent(handle)}/about`, void 0, options.signal);
132
+ }
133
+ /** `GET /2/profile/{handle}/media` — a user's posts that contain media. */
134
+ getProfileMedia(handle, options = {}) {
135
+ return this.getPage(`/2/profile/${encodeURIComponent(handle)}/media`, {
136
+ count: options.count,
137
+ cursor: options.cursor,
138
+ lang: options.lang
139
+ }, options.signal);
140
+ }
141
+ /** `GET /2/profile/{handle}/followers` — a user's followers. */
142
+ getProfileFollowers(handle, options = {}) {
143
+ return this.getPage(`/2/profile/${encodeURIComponent(handle)}/followers`, {
144
+ count: options.count,
145
+ cursor: options.cursor
146
+ }, options.signal);
147
+ }
148
+ /** `GET /2/profile/{handle}/following` — accounts a user follows. */
149
+ getProfileFollowing(handle, options = {}) {
150
+ return this.getPage(`/2/profile/${encodeURIComponent(handle)}/following`, {
151
+ count: options.count,
152
+ cursor: options.cursor
153
+ }, options.signal);
154
+ }
155
+ /** `GET /2/search` — search posts. */
156
+ search(query, options = {}) {
157
+ return this.getPage("/2/search", {
158
+ q: query,
159
+ feed: options.feed,
160
+ count: options.count,
161
+ cursor: options.cursor,
162
+ lang: options.lang
163
+ }, options.signal);
164
+ }
165
+ /** `GET /2/typeahead` — search-box autocomplete suggestions. */
166
+ typeahead(query, options = {}) {
167
+ return this.get("/2/typeahead", {
168
+ q: query,
169
+ result_type: options.resultType?.join(","),
170
+ src: options.src
171
+ }, options.signal);
172
+ }
173
+ /** `GET /2/trends` — trending topics. */
174
+ trends(options = {}) {
175
+ return this.get("/2/trends", {
176
+ type: "trending",
177
+ count: options.count
178
+ }, options.signal);
179
+ }
180
+ };
181
+ //#endregion
182
+ exports.FxTwitterV2 = FxTwitterV2;
183
+ exports.byUserId = byUserId;