Skip to content

Commit 8dd7565

Browse files
feat(api): api update
1 parent 83ff69f commit 8dd7565

10 files changed

Lines changed: 281 additions & 39 deletions

File tree

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 122
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik/x-twitter-scraper-26de9a1d18b92c9472fcc289877ba281ae305db846b7b14065142e26c7637d72.yml
3-
openapi_spec_hash: f90f7016413291fdcbedb986385dc3ae
4-
config_hash: 17c84052d27489691ee6dd861cc56e24
1+
configured_endpoints: 123
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik/x-twitter-scraper-11bfd40a2b747d214a152accd804517c20b0393d5a79fc65552f1aa07d04fa74.yml
3+
openapi_spec_hash: 23b07f11e26be0f87bb49146f1269c26
4+
config_hash: dab26921eb273c16e5570c0485c9ac2c

api.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ Types:
408408

409409
Methods:
410410

411-
- <code title="post /x/accounts">client.x.accounts.<a href="./src/resources/x/accounts.ts">create</a>({ ...params }) -> AccountCreateResponse</code>
411+
- <code title="post /x/accounts">client.x.accounts.<a href="./src/resources/x/accounts.ts">create</a>({ ...params }) -> unknown</code>
412412
- <code title="get /x/accounts/{id}">client.x.accounts.<a href="./src/resources/x/accounts.ts">retrieve</a>(id) -> XAccountDetail</code>
413413
- <code title="get /x/accounts">client.x.accounts.<a href="./src/resources/x/accounts.ts">list</a>() -> AccountListResponse</code>
414414
- <code title="delete /x/accounts/{id}">client.x.accounts.<a href="./src/resources/x/accounts.ts">delete</a>(id) -> AccountDeleteResponse</code>
@@ -425,6 +425,16 @@ Methods:
425425

426426
- <code title="post /x/account-connection-challenges/{id}/submit">client.x.accountConnectionChallenges.<a href="./src/resources/x/account-connection-challenges.ts">submit</a>(id, { ...params }) -> AccountConnectionChallengeSubmitResponse</code>
427427

428+
## AccountConnectionAttempts
429+
430+
Types:
431+
432+
- <code><a href="./src/resources/x/account-connection-attempts.ts">AccountConnectionAttemptRetrieveResponse</a></code>
433+
434+
Methods:
435+
436+
- <code title="get /x/account-connection-attempts/{id}">client.x.accountConnectionAttempts.<a href="./src/resources/x/account-connection-attempts.ts">retrieve</a>(id) -> AccountConnectionAttemptRetrieveResponse</code>
437+
428438
## Bookmarks
429439

430440
Types:

src/resources/compose.ts

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import { RequestOptions } from '../internal/request-options';
1313
*/
1414
export class Compose extends APIResource {
1515
/**
16-
* Run one step of Xquik's three-step writing workflow. Compose returns questions
17-
* and editorial rules. Refine returns goal-specific guidance. Score applies
18-
* deterministic text checks. It does not predict reach or expose X ranking
19-
* weights.
16+
* Run one step of Xquik's three-step writing workflow. Compose returns questions,
17+
* editorial rules, and source-specific Radar recommendations. Refine returns
18+
* goal-specific guidance. Score applies deterministic text checks. It does not
19+
* predict reach or expose X ranking weights.
2020
*
2121
* @example
2222
* ```ts
@@ -63,6 +63,11 @@ export namespace ComposeCreateResponse {
6363

6464
nextStep: string;
6565

66+
/**
67+
* Sources and guidance for researching a fresh post angle.
68+
*/
69+
radarRecommendations: Array<ComposePrepareResult.RadarRecommendation>;
70+
6671
/**
6772
* Published signal names with unpublished weights as null.
6873
*/
@@ -108,6 +113,25 @@ export namespace ComposeCreateResponse {
108113
multiplier: 'Production weight not published by X';
109114
}
110115

116+
export interface RadarRecommendation {
117+
/**
118+
* Radar endpoint for this source.
119+
*/
120+
endpoint: string;
121+
122+
/**
123+
* Source-specific drafting guidance.
124+
*/
125+
guidance: string;
126+
127+
source: 'reddit' | 'github' | 'trustmrr' | 'hacker_news' | 'google_trends' | 'wikipedia' | 'polymarket';
128+
129+
/**
130+
* Current-topic research this source supports.
131+
*/
132+
useFor: string;
133+
}
134+
111135
export interface ScorerWeight {
112136
/**
113137
* Signal direction and publication limit.

src/resources/radar.ts

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,41 @@ export interface RadarItem {
3737

3838
createdAt: string;
3939

40+
/**
41+
* BCP-47 language code. und means the source did not identify a language.
42+
*/
4043
language: string;
4144

4245
/**
4346
* Source-specific fields. Shape varies per source:
4447
*
45-
* - reddit: { subreddit: string, author: string }
48+
* - reddit: { author, authorId?, subreddit, subredditId?, subredditSubscribers?,
49+
* sourceFormat, score?, upvoteRatio?, estimatedUpvotes?, estimatedDownvotes?,
50+
* numberComments?, numberCrossposts?, selftext?, contentUrl?, domain?,
51+
* postHint?, linkFlairText?, distinguished?, totalAwardsReceived?, viewCount?,
52+
* editedAt?, galleryImageUrls?, redditVideo?, archived?, contestMode?,
53+
* isCrosspostable?, isMeta?, isNsfw?, isOriginalContent?, isRobotIndexable?,
54+
* isSelf?, isSpoiler?, isVideo?, locked?, stickied? }. `score` is Reddit's
55+
* public net score. Exact public upvote and downvote counts are not available.
56+
* Estimated counts derive from the public score and upvote ratio, which Reddit
57+
* may fuzz. Comment bodies are not included. Current items combine public
58+
* listing discovery with server-rendered post data and use `sourceFormat: html`;
59+
* `json` and `rss` remain for legacy rows.
4660
* - github: { starsToday: number }
4761
* - hacker_news: { points: number, numberComments: number }
4862
* - google_trends: { approxTraffic: number }
4963
* - polymarket: { volume24hr: number }
5064
* - wikipedia: { views: number }
5165
* - trustmrr: { mrr, growthPercent, last30Days, total, customers,
5266
* activeSubscriptions, onSale, xHandle?, category?, askingPrice?, country?,
53-
* growthMrrPercent?, multiple?, paymentProvider?, rank? }
67+
* foundedDate?, googleSearchImpressionsLast30Days?, growthMrrPercent?,
68+
* multiple?, paymentProvider?, profitMarginLast30Days?, rank?,
69+
* revenuePerVisitor?, targetAudience?, visitorsLast30Days? } For the startup
70+
* growth source, xHandle is the founder's X username without @. The rank field
71+
* is the source's revenue rank. Result order represents reported 30-day
72+
* revenue-growth rank.
5473
*/
55-
metadata: { [key: string]: unknown };
74+
metadata: RadarItem.Metadata;
5675

5776
publishedAt: string;
5877

@@ -71,11 +90,72 @@ export interface RadarItem {
7190

7291
description?: string;
7392

93+
/**
94+
* Source image. Startup growth items return the logo here.
95+
*/
7496
imageUrl?: string;
7597

7698
url?: string;
7799
}
78100

101+
export namespace RadarItem {
102+
/**
103+
* Source-specific fields. Shape varies per source:
104+
*
105+
* - reddit: { author, authorId?, subreddit, subredditId?, subredditSubscribers?,
106+
* sourceFormat, score?, upvoteRatio?, estimatedUpvotes?, estimatedDownvotes?,
107+
* numberComments?, numberCrossposts?, selftext?, contentUrl?, domain?,
108+
* postHint?, linkFlairText?, distinguished?, totalAwardsReceived?, viewCount?,
109+
* editedAt?, galleryImageUrls?, redditVideo?, archived?, contestMode?,
110+
* isCrosspostable?, isMeta?, isNsfw?, isOriginalContent?, isRobotIndexable?,
111+
* isSelf?, isSpoiler?, isVideo?, locked?, stickied? }. `score` is Reddit's
112+
* public net score. Exact public upvote and downvote counts are not available.
113+
* Estimated counts derive from the public score and upvote ratio, which Reddit
114+
* may fuzz. Comment bodies are not included. Current items combine public
115+
* listing discovery with server-rendered post data and use `sourceFormat: html`;
116+
* `json` and `rss` remain for legacy rows.
117+
* - github: { starsToday: number }
118+
* - hacker_news: { points: number, numberComments: number }
119+
* - google_trends: { approxTraffic: number }
120+
* - polymarket: { volume24hr: number }
121+
* - wikipedia: { views: number }
122+
* - trustmrr: { mrr, growthPercent, last30Days, total, customers,
123+
* activeSubscriptions, onSale, xHandle?, category?, askingPrice?, country?,
124+
* foundedDate?, googleSearchImpressionsLast30Days?, growthMrrPercent?,
125+
* multiple?, paymentProvider?, profitMarginLast30Days?, rank?,
126+
* revenuePerVisitor?, targetAudience?, visitorsLast30Days? } For the startup
127+
* growth source, xHandle is the founder's X username without @. The rank field
128+
* is the source's revenue rank. Result order represents reported 30-day
129+
* revenue-growth rank.
130+
*/
131+
export interface Metadata {
132+
author?: string;
133+
134+
contentUrl?: string;
135+
136+
estimatedDownvotes?: number;
137+
138+
estimatedUpvotes?: number;
139+
140+
numberComments?: number;
141+
142+
score?: number;
143+
144+
selftext?: string;
145+
146+
/**
147+
* Current items use html. json and rss are retained for legacy rows.
148+
*/
149+
sourceFormat?: 'html' | 'json' | 'rss';
150+
151+
subreddit?: string;
152+
153+
upvoteRatio?: number;
154+
155+
[k: string]: unknown;
156+
}
157+
}
158+
79159
export interface RadarRetrieveTrendingTopicsResponse {
80160
hasMore: boolean;
81161

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../../core/resource';
4+
import { APIPromise } from '../../core/api-promise';
5+
import { RequestOptions } from '../../internal/request-options';
6+
import { path } from '../../internal/utils/path';
7+
8+
/**
9+
* Connected X account management
10+
*/
11+
export class AccountConnectionAttempts extends APIResource {
12+
/**
13+
* Get X account connection status
14+
*
15+
* @example
16+
* ```ts
17+
* const accountConnectionAttempt =
18+
* await client.x.accountConnectionAttempts.retrieve(
19+
* 'xatt_0123456789abcdef0123456789abcdef',
20+
* );
21+
* ```
22+
*/
23+
retrieve(id: string, options?: RequestOptions): APIPromise<AccountConnectionAttemptRetrieveResponse> {
24+
return this._client.get(path`/x/account-connection-attempts/${id}`, options);
25+
}
26+
}
27+
28+
/**
29+
* The connection is still in progress.
30+
*/
31+
export type AccountConnectionAttemptRetrieveResponse =
32+
| AccountConnectionAttemptRetrieveResponse.XAccountConnectionAttemptPending
33+
| AccountConnectionAttemptRetrieveResponse.XAccountConnectionAttemptSuccess
34+
| AccountConnectionAttemptRetrieveResponse.XAccountConnectionAttemptFailed
35+
| AccountConnectionAttemptRetrieveResponse.XAccountConnectionChallenge;
36+
37+
export namespace AccountConnectionAttemptRetrieveResponse {
38+
/**
39+
* The connection is still in progress.
40+
*/
41+
export interface XAccountConnectionAttemptPending {
42+
id: string;
43+
44+
object: 'x_account_connection_attempt';
45+
46+
pollAfterMs: number;
47+
48+
status: 'pending';
49+
}
50+
51+
/**
52+
* The account connected successfully.
53+
*/
54+
export interface XAccountConnectionAttemptSuccess {
55+
id: string;
56+
57+
object: 'x_account_connection_attempt';
58+
59+
status: 'success';
60+
}
61+
62+
/**
63+
* The connection reached a final failure.
64+
*/
65+
export interface XAccountConnectionAttemptFailed {
66+
id: string;
67+
68+
error: string;
69+
70+
object: 'x_account_connection_attempt';
71+
72+
retryable: boolean;
73+
74+
status: 'failed';
75+
76+
reason?: string;
77+
}
78+
79+
/**
80+
* Resumable account connection challenge. Submit the email code to finish the same
81+
* connection attempt.
82+
*/
83+
export interface XAccountConnectionChallenge {
84+
id: string;
85+
86+
expiresAt: string;
87+
88+
message: string;
89+
90+
object: 'x_account_connection_challenge';
91+
92+
status: 'requires_email_code';
93+
94+
username: string;
95+
}
96+
}
97+
98+
export declare namespace AccountConnectionAttempts {
99+
export { type AccountConnectionAttemptRetrieveResponse as AccountConnectionAttemptRetrieveResponse };
100+
}

src/resources/x/accounts.ts

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ export class Accounts extends APIResource {
2121
* const account = await client.x.accounts.create({
2222
* email: 'account@example.invalid',
2323
* password: '<ACCOUNT_PASSWORD>',
24-
* username: 'your_x_username',
2524
* totp_secret: '<TOTP_SECRET>',
25+
* username: 'your_x_username',
2626
* });
2727
* ```
2828
*/
29-
create(body: AccountCreateParams, options?: RequestOptions): APIPromise<AccountCreateResponse> {
29+
create(body: AccountCreateParams, options?: RequestOptions): APIPromise<unknown> {
3030
return this._client.post('/x/accounts', { body, ...options });
3131
}
3232

@@ -109,9 +109,9 @@ export interface XAccount {
109109
/**
110110
* Derived connection health. `healthy` = session active. `needsReauth` = user must
111111
* submit fresh credentials. `locked` = X locked the account; unlock on x.com
112-
* first. `suspended` = X banned the account. `recovering` = past cooldown, will
113-
* auto-retry on next use. `temporaryIssue` = temporary connection problem; retry
114-
* shortly.
112+
* first. `suspended` = X banned the account. `recovering` = cooldown ended; the
113+
* account can reconnect on its next use. `temporaryIssue` = temporary connection
114+
* problem; wait before the next use.
115115
*/
116116
health: 'healthy' | 'locked' | 'needsReauth' | 'recovering' | 'suspended' | 'temporaryIssue';
117117

@@ -147,22 +147,7 @@ export interface XAccountDetail {
147147
updatedAt?: string;
148148
}
149149

150-
/**
151-
* Sanitized X account summary returned by connect and reauth.
152-
*/
153-
export interface AccountCreateResponse {
154-
id: string;
155-
156-
createdAt: string;
157-
158-
health: 'healthy' | 'locked' | 'needsReauth' | 'recovering' | 'suspended' | 'temporaryIssue';
159-
160-
status: string;
161-
162-
xUserId: string;
163-
164-
xUsername: string;
165-
}
150+
export type AccountCreateResponse = unknown;
166151

167152
export interface AccountListResponse {
168153
accounts: Array<XAccount>;
@@ -208,14 +193,14 @@ export interface AccountCreateParams {
208193
password: string;
209194

210195
/**
211-
* X username
196+
* Authenticator App TOTP secret required for durable login
212197
*/
213-
username: string;
198+
totp_secret: string;
214199

215200
/**
216-
* TOTP secret for 2FA
201+
* X username
217202
*/
218-
totp_secret?: string;
203+
username: string;
219204
}
220205

221206
export interface AccountReauthParams {
@@ -230,7 +215,7 @@ export interface AccountReauthParams {
230215
email?: string;
231216

232217
/**
233-
* TOTP secret for 2FA re-authentication
218+
* Replacement Authenticator App TOTP secret. Omit it to reuse the saved secret.
234219
*/
235220
totp_secret?: string;
236221
}

src/resources/x/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
66

7+
export {
8+
AccountConnectionAttempts,
9+
type AccountConnectionAttemptRetrieveResponse,
10+
} from './account-connection-attempts';
711
export {
812
AccountConnectionChallenges,
913
type AccountConnectionChallengeSubmitResponse,

0 commit comments

Comments
 (0)