@chirpie/sdk 1.0.11 → 1.0.13
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/index.d.mts +58 -1
- package/dist/index.d.ts +58 -1
- package/dist/index.js +31 -0
- package/dist/index.mjs +31 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -31,9 +31,42 @@ interface ApiAccount {
|
|
|
31
31
|
display_name: string | null;
|
|
32
32
|
avatar_url: string | null;
|
|
33
33
|
max_post_length: number;
|
|
34
|
+
/**
|
|
35
|
+
* X accounts only. True when the account was connected through your own X
|
|
36
|
+
* developer app, so its posts use your X API credits.
|
|
37
|
+
*/
|
|
38
|
+
byo_keys?: boolean;
|
|
34
39
|
is_active: boolean;
|
|
35
40
|
created_at: string;
|
|
36
41
|
}
|
|
42
|
+
/** Status of your own X developer app. Never includes the client secret. */
|
|
43
|
+
interface XKeysStatus {
|
|
44
|
+
configured: boolean;
|
|
45
|
+
label: string | null;
|
|
46
|
+
/** Last 4 characters of the stored client ID, to confirm which app is saved. */
|
|
47
|
+
client_id_last4: string | null;
|
|
48
|
+
/** The exact callback URI to register on your X app. */
|
|
49
|
+
redirect_uri: string;
|
|
50
|
+
created_at: string | null;
|
|
51
|
+
updated_at: string | null;
|
|
52
|
+
}
|
|
53
|
+
interface SetXKeysInput {
|
|
54
|
+
/** OAuth 2.0 Client ID from developer.x.com. */
|
|
55
|
+
client_id: string;
|
|
56
|
+
/** OAuth 2.0 Client Secret from developer.x.com. Stored encrypted. */
|
|
57
|
+
client_secret: string;
|
|
58
|
+
/** Optional human-readable name for the app. */
|
|
59
|
+
label?: string;
|
|
60
|
+
}
|
|
61
|
+
interface SetXKeysResult extends XKeysStatus {
|
|
62
|
+
required_scopes: string[];
|
|
63
|
+
message: string;
|
|
64
|
+
}
|
|
65
|
+
interface RemoveXKeysResult {
|
|
66
|
+
configured: false;
|
|
67
|
+
removed: true;
|
|
68
|
+
message: string;
|
|
69
|
+
}
|
|
37
70
|
interface ApiAnalytics {
|
|
38
71
|
post_id: string;
|
|
39
72
|
platform: Platform;
|
|
@@ -145,6 +178,8 @@ declare class ChirpieClient {
|
|
|
145
178
|
* @returns The created post.
|
|
146
179
|
* @throws {ChirpieError} On network/transport failure.
|
|
147
180
|
* @throws {ChirpieApiError} On non-2xx responses (auth, validation, plan limit, platform error) or invalid JSON.
|
|
181
|
+
* X posts whose text contains a link are billed at $0.25 each on paid plans, and are
|
|
182
|
+
* rejected on the Free plan with code `x_link_posts_require_paid_plan` (HTTP 402).
|
|
148
183
|
*/
|
|
149
184
|
createPost(input: CreatePostInput): Promise<ApiPost>;
|
|
150
185
|
listPosts(options?: ListPostsOptions): Promise<ApiPost[]>;
|
|
@@ -163,6 +198,8 @@ declare class ChirpieClient {
|
|
|
163
198
|
* @returns The created thread, including each post's id and status.
|
|
164
199
|
* @throws {ChirpieError} On network/transport failure.
|
|
165
200
|
* @throws {ChirpieApiError} On non-2xx responses (auth, validation, plan limit, platform error) or invalid JSON.
|
|
201
|
+
* X posts whose text contains a link are billed at $0.25 each on paid plans, and are
|
|
202
|
+
* rejected on the Free plan with code `x_link_posts_require_paid_plan` (HTTP 402).
|
|
166
203
|
*/
|
|
167
204
|
createThread(input: CreateThreadInput): Promise<ApiThread>;
|
|
168
205
|
listAccounts(): Promise<ApiAccount[]>;
|
|
@@ -214,6 +251,26 @@ declare class ChirpieClient {
|
|
|
214
251
|
connectAccount(): Promise<{
|
|
215
252
|
authorization_url: string;
|
|
216
253
|
}>;
|
|
254
|
+
/**
|
|
255
|
+
* Register your own X developer app so X accounts connect through it and
|
|
256
|
+
* post against your X API credits instead of Chirpie's. Link posts from
|
|
257
|
+
* accounts connected this way are not surcharged.
|
|
258
|
+
*
|
|
259
|
+
* Add the returned `redirect_uri` as a callback URI on your X app, then
|
|
260
|
+
* reconnect each X account you want to move onto your app — accounts that
|
|
261
|
+
* are already connected keep using whichever app connected them.
|
|
262
|
+
*/
|
|
263
|
+
setXKeys(input: SetXKeysInput): Promise<SetXKeysResult>;
|
|
264
|
+
/**
|
|
265
|
+
* Remove your own X developer app. X accounts connected through it stop
|
|
266
|
+
* refreshing until you re-add the keys or reconnect them through Chirpie.
|
|
267
|
+
*/
|
|
268
|
+
removeXKeys(): Promise<RemoveXKeysResult>;
|
|
269
|
+
/**
|
|
270
|
+
* Check whether your own X developer app is configured. Never returns the
|
|
271
|
+
* client secret.
|
|
272
|
+
*/
|
|
273
|
+
getXKeysStatus(): Promise<XKeysStatus>;
|
|
217
274
|
createKey(name?: string): Promise<{
|
|
218
275
|
key: string;
|
|
219
276
|
prefix: string;
|
|
@@ -259,4 +316,4 @@ declare function deleteConfig(): boolean;
|
|
|
259
316
|
*/
|
|
260
317
|
declare function requireConfig(): ChirpieConfig;
|
|
261
318
|
|
|
262
|
-
export { type ApiAccount, type ApiAnalytics, type ApiKeyInfo, type ApiPost, type ApiThread, ChirpieApiError, ChirpieClient, type ChirpieClientOptions, type ChirpieConfig, ChirpieError, type ConnectBlueskyInput, type ConnectFacebookInput, type ConnectGBPInput, type ConnectInstagramInput, type ConnectLinkedInInput, type ConnectMastodonInput, type ConnectPinterestInput, type ConnectRedditInput, type ConnectSnapchatInput, type ConnectTelegramInput, type ConnectThreadsInput, type ConnectTikTokInput, type ConnectYouTubeInput, type CreatePostInput, type CreateThreadInput, type ListPostsOptions, deleteConfig, getConfig, requireConfig, saveConfig };
|
|
319
|
+
export { type ApiAccount, type ApiAnalytics, type ApiKeyInfo, type ApiPost, type ApiThread, ChirpieApiError, ChirpieClient, type ChirpieClientOptions, type ChirpieConfig, ChirpieError, type ConnectBlueskyInput, type ConnectFacebookInput, type ConnectGBPInput, type ConnectInstagramInput, type ConnectLinkedInInput, type ConnectMastodonInput, type ConnectPinterestInput, type ConnectRedditInput, type ConnectSnapchatInput, type ConnectTelegramInput, type ConnectThreadsInput, type ConnectTikTokInput, type ConnectYouTubeInput, type CreatePostInput, type CreateThreadInput, type ListPostsOptions, type RemoveXKeysResult, type SetXKeysInput, type SetXKeysResult, type XKeysStatus, deleteConfig, getConfig, requireConfig, saveConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,9 +31,42 @@ interface ApiAccount {
|
|
|
31
31
|
display_name: string | null;
|
|
32
32
|
avatar_url: string | null;
|
|
33
33
|
max_post_length: number;
|
|
34
|
+
/**
|
|
35
|
+
* X accounts only. True when the account was connected through your own X
|
|
36
|
+
* developer app, so its posts use your X API credits.
|
|
37
|
+
*/
|
|
38
|
+
byo_keys?: boolean;
|
|
34
39
|
is_active: boolean;
|
|
35
40
|
created_at: string;
|
|
36
41
|
}
|
|
42
|
+
/** Status of your own X developer app. Never includes the client secret. */
|
|
43
|
+
interface XKeysStatus {
|
|
44
|
+
configured: boolean;
|
|
45
|
+
label: string | null;
|
|
46
|
+
/** Last 4 characters of the stored client ID, to confirm which app is saved. */
|
|
47
|
+
client_id_last4: string | null;
|
|
48
|
+
/** The exact callback URI to register on your X app. */
|
|
49
|
+
redirect_uri: string;
|
|
50
|
+
created_at: string | null;
|
|
51
|
+
updated_at: string | null;
|
|
52
|
+
}
|
|
53
|
+
interface SetXKeysInput {
|
|
54
|
+
/** OAuth 2.0 Client ID from developer.x.com. */
|
|
55
|
+
client_id: string;
|
|
56
|
+
/** OAuth 2.0 Client Secret from developer.x.com. Stored encrypted. */
|
|
57
|
+
client_secret: string;
|
|
58
|
+
/** Optional human-readable name for the app. */
|
|
59
|
+
label?: string;
|
|
60
|
+
}
|
|
61
|
+
interface SetXKeysResult extends XKeysStatus {
|
|
62
|
+
required_scopes: string[];
|
|
63
|
+
message: string;
|
|
64
|
+
}
|
|
65
|
+
interface RemoveXKeysResult {
|
|
66
|
+
configured: false;
|
|
67
|
+
removed: true;
|
|
68
|
+
message: string;
|
|
69
|
+
}
|
|
37
70
|
interface ApiAnalytics {
|
|
38
71
|
post_id: string;
|
|
39
72
|
platform: Platform;
|
|
@@ -145,6 +178,8 @@ declare class ChirpieClient {
|
|
|
145
178
|
* @returns The created post.
|
|
146
179
|
* @throws {ChirpieError} On network/transport failure.
|
|
147
180
|
* @throws {ChirpieApiError} On non-2xx responses (auth, validation, plan limit, platform error) or invalid JSON.
|
|
181
|
+
* X posts whose text contains a link are billed at $0.25 each on paid plans, and are
|
|
182
|
+
* rejected on the Free plan with code `x_link_posts_require_paid_plan` (HTTP 402).
|
|
148
183
|
*/
|
|
149
184
|
createPost(input: CreatePostInput): Promise<ApiPost>;
|
|
150
185
|
listPosts(options?: ListPostsOptions): Promise<ApiPost[]>;
|
|
@@ -163,6 +198,8 @@ declare class ChirpieClient {
|
|
|
163
198
|
* @returns The created thread, including each post's id and status.
|
|
164
199
|
* @throws {ChirpieError} On network/transport failure.
|
|
165
200
|
* @throws {ChirpieApiError} On non-2xx responses (auth, validation, plan limit, platform error) or invalid JSON.
|
|
201
|
+
* X posts whose text contains a link are billed at $0.25 each on paid plans, and are
|
|
202
|
+
* rejected on the Free plan with code `x_link_posts_require_paid_plan` (HTTP 402).
|
|
166
203
|
*/
|
|
167
204
|
createThread(input: CreateThreadInput): Promise<ApiThread>;
|
|
168
205
|
listAccounts(): Promise<ApiAccount[]>;
|
|
@@ -214,6 +251,26 @@ declare class ChirpieClient {
|
|
|
214
251
|
connectAccount(): Promise<{
|
|
215
252
|
authorization_url: string;
|
|
216
253
|
}>;
|
|
254
|
+
/**
|
|
255
|
+
* Register your own X developer app so X accounts connect through it and
|
|
256
|
+
* post against your X API credits instead of Chirpie's. Link posts from
|
|
257
|
+
* accounts connected this way are not surcharged.
|
|
258
|
+
*
|
|
259
|
+
* Add the returned `redirect_uri` as a callback URI on your X app, then
|
|
260
|
+
* reconnect each X account you want to move onto your app — accounts that
|
|
261
|
+
* are already connected keep using whichever app connected them.
|
|
262
|
+
*/
|
|
263
|
+
setXKeys(input: SetXKeysInput): Promise<SetXKeysResult>;
|
|
264
|
+
/**
|
|
265
|
+
* Remove your own X developer app. X accounts connected through it stop
|
|
266
|
+
* refreshing until you re-add the keys or reconnect them through Chirpie.
|
|
267
|
+
*/
|
|
268
|
+
removeXKeys(): Promise<RemoveXKeysResult>;
|
|
269
|
+
/**
|
|
270
|
+
* Check whether your own X developer app is configured. Never returns the
|
|
271
|
+
* client secret.
|
|
272
|
+
*/
|
|
273
|
+
getXKeysStatus(): Promise<XKeysStatus>;
|
|
217
274
|
createKey(name?: string): Promise<{
|
|
218
275
|
key: string;
|
|
219
276
|
prefix: string;
|
|
@@ -259,4 +316,4 @@ declare function deleteConfig(): boolean;
|
|
|
259
316
|
*/
|
|
260
317
|
declare function requireConfig(): ChirpieConfig;
|
|
261
318
|
|
|
262
|
-
export { type ApiAccount, type ApiAnalytics, type ApiKeyInfo, type ApiPost, type ApiThread, ChirpieApiError, ChirpieClient, type ChirpieClientOptions, type ChirpieConfig, ChirpieError, type ConnectBlueskyInput, type ConnectFacebookInput, type ConnectGBPInput, type ConnectInstagramInput, type ConnectLinkedInInput, type ConnectMastodonInput, type ConnectPinterestInput, type ConnectRedditInput, type ConnectSnapchatInput, type ConnectTelegramInput, type ConnectThreadsInput, type ConnectTikTokInput, type ConnectYouTubeInput, type CreatePostInput, type CreateThreadInput, type ListPostsOptions, deleteConfig, getConfig, requireConfig, saveConfig };
|
|
319
|
+
export { type ApiAccount, type ApiAnalytics, type ApiKeyInfo, type ApiPost, type ApiThread, ChirpieApiError, ChirpieClient, type ChirpieClientOptions, type ChirpieConfig, ChirpieError, type ConnectBlueskyInput, type ConnectFacebookInput, type ConnectGBPInput, type ConnectInstagramInput, type ConnectLinkedInInput, type ConnectMastodonInput, type ConnectPinterestInput, type ConnectRedditInput, type ConnectSnapchatInput, type ConnectTelegramInput, type ConnectThreadsInput, type ConnectTikTokInput, type ConnectYouTubeInput, type CreatePostInput, type CreateThreadInput, type ListPostsOptions, type RemoveXKeysResult, type SetXKeysInput, type SetXKeysResult, type XKeysStatus, deleteConfig, getConfig, requireConfig, saveConfig };
|
package/dist/index.js
CHANGED
|
@@ -99,6 +99,8 @@ var ChirpieClient = class {
|
|
|
99
99
|
* @returns The created post.
|
|
100
100
|
* @throws {ChirpieError} On network/transport failure.
|
|
101
101
|
* @throws {ChirpieApiError} On non-2xx responses (auth, validation, plan limit, platform error) or invalid JSON.
|
|
102
|
+
* X posts whose text contains a link are billed at $0.25 each on paid plans, and are
|
|
103
|
+
* rejected on the Free plan with code `x_link_posts_require_paid_plan` (HTTP 402).
|
|
102
104
|
*/
|
|
103
105
|
async createPost(input) {
|
|
104
106
|
return this.request("POST", "/posts", input);
|
|
@@ -129,6 +131,8 @@ var ChirpieClient = class {
|
|
|
129
131
|
* @returns The created thread, including each post's id and status.
|
|
130
132
|
* @throws {ChirpieError} On network/transport failure.
|
|
131
133
|
* @throws {ChirpieApiError} On non-2xx responses (auth, validation, plan limit, platform error) or invalid JSON.
|
|
134
|
+
* X posts whose text contains a link are billed at $0.25 each on paid plans, and are
|
|
135
|
+
* rejected on the Free plan with code `x_link_posts_require_paid_plan` (HTTP 402).
|
|
132
136
|
*/
|
|
133
137
|
async createThread(input) {
|
|
134
138
|
return this.request("POST", "/threads", input);
|
|
@@ -209,6 +213,33 @@ var ChirpieClient = class {
|
|
|
209
213
|
async connectAccount() {
|
|
210
214
|
return this.connectXAccount();
|
|
211
215
|
}
|
|
216
|
+
// Your own X developer app ("bring your own keys")
|
|
217
|
+
/**
|
|
218
|
+
* Register your own X developer app so X accounts connect through it and
|
|
219
|
+
* post against your X API credits instead of Chirpie's. Link posts from
|
|
220
|
+
* accounts connected this way are not surcharged.
|
|
221
|
+
*
|
|
222
|
+
* Add the returned `redirect_uri` as a callback URI on your X app, then
|
|
223
|
+
* reconnect each X account you want to move onto your app — accounts that
|
|
224
|
+
* are already connected keep using whichever app connected them.
|
|
225
|
+
*/
|
|
226
|
+
async setXKeys(input) {
|
|
227
|
+
return this.request("PUT", "/accounts/x/keys", input);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Remove your own X developer app. X accounts connected through it stop
|
|
231
|
+
* refreshing until you re-add the keys or reconnect them through Chirpie.
|
|
232
|
+
*/
|
|
233
|
+
async removeXKeys() {
|
|
234
|
+
return this.request("DELETE", "/accounts/x/keys");
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Check whether your own X developer app is configured. Never returns the
|
|
238
|
+
* client secret.
|
|
239
|
+
*/
|
|
240
|
+
async getXKeysStatus() {
|
|
241
|
+
return this.request("GET", "/accounts/x/keys");
|
|
242
|
+
}
|
|
212
243
|
// Keys
|
|
213
244
|
async createKey(name) {
|
|
214
245
|
return this.request(
|
package/dist/index.mjs
CHANGED
|
@@ -67,6 +67,8 @@ var ChirpieClient = class {
|
|
|
67
67
|
* @returns The created post.
|
|
68
68
|
* @throws {ChirpieError} On network/transport failure.
|
|
69
69
|
* @throws {ChirpieApiError} On non-2xx responses (auth, validation, plan limit, platform error) or invalid JSON.
|
|
70
|
+
* X posts whose text contains a link are billed at $0.25 each on paid plans, and are
|
|
71
|
+
* rejected on the Free plan with code `x_link_posts_require_paid_plan` (HTTP 402).
|
|
70
72
|
*/
|
|
71
73
|
async createPost(input) {
|
|
72
74
|
return this.request("POST", "/posts", input);
|
|
@@ -97,6 +99,8 @@ var ChirpieClient = class {
|
|
|
97
99
|
* @returns The created thread, including each post's id and status.
|
|
98
100
|
* @throws {ChirpieError} On network/transport failure.
|
|
99
101
|
* @throws {ChirpieApiError} On non-2xx responses (auth, validation, plan limit, platform error) or invalid JSON.
|
|
102
|
+
* X posts whose text contains a link are billed at $0.25 each on paid plans, and are
|
|
103
|
+
* rejected on the Free plan with code `x_link_posts_require_paid_plan` (HTTP 402).
|
|
100
104
|
*/
|
|
101
105
|
async createThread(input) {
|
|
102
106
|
return this.request("POST", "/threads", input);
|
|
@@ -177,6 +181,33 @@ var ChirpieClient = class {
|
|
|
177
181
|
async connectAccount() {
|
|
178
182
|
return this.connectXAccount();
|
|
179
183
|
}
|
|
184
|
+
// Your own X developer app ("bring your own keys")
|
|
185
|
+
/**
|
|
186
|
+
* Register your own X developer app so X accounts connect through it and
|
|
187
|
+
* post against your X API credits instead of Chirpie's. Link posts from
|
|
188
|
+
* accounts connected this way are not surcharged.
|
|
189
|
+
*
|
|
190
|
+
* Add the returned `redirect_uri` as a callback URI on your X app, then
|
|
191
|
+
* reconnect each X account you want to move onto your app — accounts that
|
|
192
|
+
* are already connected keep using whichever app connected them.
|
|
193
|
+
*/
|
|
194
|
+
async setXKeys(input) {
|
|
195
|
+
return this.request("PUT", "/accounts/x/keys", input);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Remove your own X developer app. X accounts connected through it stop
|
|
199
|
+
* refreshing until you re-add the keys or reconnect them through Chirpie.
|
|
200
|
+
*/
|
|
201
|
+
async removeXKeys() {
|
|
202
|
+
return this.request("DELETE", "/accounts/x/keys");
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Check whether your own X developer app is configured. Never returns the
|
|
206
|
+
* client secret.
|
|
207
|
+
*/
|
|
208
|
+
async getXKeysStatus() {
|
|
209
|
+
return this.request("GET", "/accounts/x/keys");
|
|
210
|
+
}
|
|
180
211
|
// Keys
|
|
181
212
|
async createKey(name) {
|
|
182
213
|
return this.request(
|