@schedulin/sdk 0.2.0 → 0.3.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.
Files changed (39) hide show
  1. package/cjs/api/resources/media/client/Client.d.ts +1 -1
  2. package/cjs/api/resources/media/client/Client.js +1 -1
  3. package/cjs/api/resources/posts/client/Client.d.ts +1 -1
  4. package/cjs/api/resources/posts/client/Client.js +1 -1
  5. package/cjs/api/resources/posts/client/requests/UpdatePostsRequest.d.ts +0 -2
  6. package/cjs/api/resources/posts/client/requests/UpdatePostsRequest.js +0 -2
  7. package/cjs/api/resources/socialAccounts/client/Client.d.ts +37 -1
  8. package/cjs/api/resources/socialAccounts/client/Client.js +119 -1
  9. package/cjs/api/resources/socialAccounts/client/requests/ListDiscordChannelsSocialAccountsRequest.d.ts +9 -0
  10. package/cjs/api/resources/socialAccounts/client/requests/ListDiscordChannelsSocialAccountsRequest.js +3 -0
  11. package/cjs/api/resources/socialAccounts/client/requests/ListSlackChannelsSocialAccountsRequest.d.ts +9 -0
  12. package/cjs/api/resources/socialAccounts/client/requests/ListSlackChannelsSocialAccountsRequest.js +3 -0
  13. package/cjs/api/resources/socialAccounts/client/requests/index.d.ts +2 -0
  14. package/cjs/api/resources/socialAccounts/types/ListDiscordChannelsSocialAccountsResponse.d.ts +12 -0
  15. package/cjs/api/resources/socialAccounts/types/ListDiscordChannelsSocialAccountsResponse.js +3 -0
  16. package/cjs/api/resources/socialAccounts/types/ListSlackChannelsSocialAccountsResponse.d.ts +12 -0
  17. package/cjs/api/resources/socialAccounts/types/ListSlackChannelsSocialAccountsResponse.js +3 -0
  18. package/cjs/api/resources/socialAccounts/types/index.d.ts +2 -0
  19. package/cjs/api/resources/socialAccounts/types/index.js +2 -0
  20. package/esm/api/resources/media/client/Client.d.mts +1 -1
  21. package/esm/api/resources/media/client/Client.mjs +1 -1
  22. package/esm/api/resources/posts/client/Client.d.mts +1 -1
  23. package/esm/api/resources/posts/client/Client.mjs +1 -1
  24. package/esm/api/resources/posts/client/requests/UpdatePostsRequest.d.mts +0 -2
  25. package/esm/api/resources/posts/client/requests/UpdatePostsRequest.mjs +0 -2
  26. package/esm/api/resources/socialAccounts/client/Client.d.mts +37 -1
  27. package/esm/api/resources/socialAccounts/client/Client.mjs +119 -1
  28. package/esm/api/resources/socialAccounts/client/requests/ListDiscordChannelsSocialAccountsRequest.d.mts +9 -0
  29. package/esm/api/resources/socialAccounts/client/requests/ListDiscordChannelsSocialAccountsRequest.mjs +2 -0
  30. package/esm/api/resources/socialAccounts/client/requests/ListSlackChannelsSocialAccountsRequest.d.mts +9 -0
  31. package/esm/api/resources/socialAccounts/client/requests/ListSlackChannelsSocialAccountsRequest.mjs +2 -0
  32. package/esm/api/resources/socialAccounts/client/requests/index.d.mts +2 -0
  33. package/esm/api/resources/socialAccounts/types/ListDiscordChannelsSocialAccountsResponse.d.mts +12 -0
  34. package/esm/api/resources/socialAccounts/types/ListDiscordChannelsSocialAccountsResponse.mjs +2 -0
  35. package/esm/api/resources/socialAccounts/types/ListSlackChannelsSocialAccountsResponse.d.mts +12 -0
  36. package/esm/api/resources/socialAccounts/types/ListSlackChannelsSocialAccountsResponse.mjs +2 -0
  37. package/esm/api/resources/socialAccounts/types/index.d.mts +2 -0
  38. package/esm/api/resources/socialAccounts/types/index.mjs +2 -0
  39. package/package.json +1 -1
@@ -45,7 +45,7 @@ export declare class MediaClient {
45
45
  createUploadLink(request?: Schedulin.CreateUploadLinkMediaRequest, requestOptions?: MediaClient.RequestOptions): core.HttpResponsePromise<unknown>;
46
46
  private __createUploadLink;
47
47
  /**
48
- * Upload raw image, video, or audio bytes directly as multipart/form-data. The file is stored in your media library and the record is returned; use its `url` in `media[].url` when creating a post. Max 250 MB; SVG and other active content is rejected. For a file already hosted at a public URL, prefer POST /v0/media/from-url.
48
+ * Upload raw image, video, or audio bytes directly as multipart/form-data. The file is stored in your media library and the record is returned; use its `url` in `media[].url` when creating a post. When the file part's type is missing or generic (`application/octet-stream`, `text/plain`), the type is detected from the file's bytes, then its filename extension. Max 250 MB; SVG and other active content is rejected. For a file already hosted at a public URL, prefer POST /v0/media/from-url.
49
49
  *
50
50
  * @param {Schedulin.UploadMediaRequest} request
51
51
  * @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -182,7 +182,7 @@ class MediaClient {
182
182
  });
183
183
  }
184
184
  /**
185
- * Upload raw image, video, or audio bytes directly as multipart/form-data. The file is stored in your media library and the record is returned; use its `url` in `media[].url` when creating a post. Max 250 MB; SVG and other active content is rejected. For a file already hosted at a public URL, prefer POST /v0/media/from-url.
185
+ * Upload raw image, video, or audio bytes directly as multipart/form-data. The file is stored in your media library and the record is returned; use its `url` in `media[].url` when creating a post. When the file part's type is missing or generic (`application/octet-stream`, `text/plain`), the type is detected from the file's bytes, then its filename extension. Max 250 MB; SVG and other active content is rejected. For a file already hosted at a public URL, prefer POST /v0/media/from-url.
186
186
  *
187
187
  * @param {Schedulin.UploadMediaRequest} request
188
188
  * @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -80,7 +80,7 @@ export declare class PostsClient {
80
80
  retrieve(request: Schedulin.RetrievePostsRequest, requestOptions?: PostsClient.RequestOptions): core.HttpResponsePromise<Schedulin.PostWithRelations>;
81
81
  private __retrieve;
82
82
  /**
83
- * Update an existing post by its ID
83
+ * Update an existing draft or scheduled post by its ID. `status` may be DRAFT, SCHEDULED (requires a future `scheduledAt`, either in this request or already on the post), or PROCESSING (publish now). COMPLETED and FAILED are set only by the publisher. Posts that are already publishing, published, or failed can't be edited (409).
84
84
  *
85
85
  * @param {Schedulin.UpdatePostsRequest} request
86
86
  * @param {PostsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -313,7 +313,7 @@ class PostsClient {
313
313
  });
314
314
  }
315
315
  /**
316
- * Update an existing post by its ID
316
+ * Update an existing draft or scheduled post by its ID. `status` may be DRAFT, SCHEDULED (requires a future `scheduledAt`, either in this request or already on the post), or PROCESSING (publish now). COMPLETED and FAILED are set only by the publisher. Posts that are already publishing, published, or failed can't be edited (409).
317
317
  *
318
318
  * @param {Schedulin.UpdatePostsRequest} request
319
319
  * @param {PostsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -29,8 +29,6 @@ export declare namespace UpdatePostsRequest {
29
29
  readonly Draft: "DRAFT";
30
30
  readonly Scheduled: "SCHEDULED";
31
31
  readonly Processing: "PROCESSING";
32
- readonly Completed: "COMPLETED";
33
- readonly Failed: "FAILED";
34
32
  };
35
33
  type Status = (typeof Status)[keyof typeof Status];
36
34
  }
@@ -8,7 +8,5 @@ var UpdatePostsRequest;
8
8
  Draft: "DRAFT",
9
9
  Scheduled: "SCHEDULED",
10
10
  Processing: "PROCESSING",
11
- Completed: "COMPLETED",
12
- Failed: "FAILED",
13
11
  };
14
12
  })(UpdatePostsRequest || (exports.UpdatePostsRequest = UpdatePostsRequest = {}));
@@ -62,6 +62,42 @@ export declare class SocialAccountsClient {
62
62
  */
63
63
  listWhopForums(request: Schedulin.ListWhopForumsSocialAccountsRequest, requestOptions?: SocialAccountsClient.RequestOptions): core.HttpResponsePromise<Schedulin.ListWhopForumsSocialAccountsResponse>;
64
64
  private __listWhopForums;
65
+ /**
66
+ * List the text and announcement channels the Schedulin bot can post into for a connected Discord server. Use an item id as `platformConfiguration.channel` when creating a Discord post.
67
+ *
68
+ * @param {Schedulin.ListDiscordChannelsSocialAccountsRequest} request
69
+ * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
70
+ *
71
+ * @throws {@link Schedulin.UnauthorizedError}
72
+ * @throws {@link Schedulin.InternalServerError}
73
+ * @throws {@link errors.SchedulinError}
74
+ * @throws {@link errors.SchedulinTimeoutError}
75
+ *
76
+ * @example
77
+ * await client.socialAccounts.listDiscordChannels({
78
+ * id: "id"
79
+ * })
80
+ */
81
+ listDiscordChannels(request: Schedulin.ListDiscordChannelsSocialAccountsRequest, requestOptions?: SocialAccountsClient.RequestOptions): core.HttpResponsePromise<Schedulin.ListDiscordChannelsSocialAccountsResponse>;
82
+ private __listDiscordChannels;
83
+ /**
84
+ * List the channels in a connected Slack workspace that the Schedulin bot can post into (public channels, plus private channels it was invited to). Use an item id as `platformConfiguration.channel` when creating a Slack post.
85
+ *
86
+ * @param {Schedulin.ListSlackChannelsSocialAccountsRequest} request
87
+ * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
88
+ *
89
+ * @throws {@link Schedulin.UnauthorizedError}
90
+ * @throws {@link Schedulin.InternalServerError}
91
+ * @throws {@link errors.SchedulinError}
92
+ * @throws {@link errors.SchedulinTimeoutError}
93
+ *
94
+ * @example
95
+ * await client.socialAccounts.listSlackChannels({
96
+ * id: "id"
97
+ * })
98
+ */
99
+ listSlackChannels(request: Schedulin.ListSlackChannelsSocialAccountsRequest, requestOptions?: SocialAccountsClient.RequestOptions): core.HttpResponsePromise<Schedulin.ListSlackChannelsSocialAccountsResponse>;
100
+ private __listSlackChannels;
65
101
  /**
66
102
  * Update social media account settings and information
67
103
  *
@@ -99,7 +135,7 @@ export declare class SocialAccountsClient {
99
135
  delete(request: Schedulin.DeleteSocialAccountsRequest, requestOptions?: SocialAccountsClient.RequestOptions): core.HttpResponsePromise<Schedulin.DeleteSocialAccountsResponse>;
100
136
  private __delete;
101
137
  /**
102
- * Set the IANA timezone (e.g. 'America/Los_Angeles') used to interpret queue times for this account.
138
+ * Set the IANA timezone (e.g. 'America/Los_Angeles') used to interpret queue times for this account. Unknown names and UTC-offset strings (e.g. '+05:00') are rejected with 422.
103
139
  *
104
140
  * @param {Schedulin.UpdateTimezoneSocialAccountsRequest} request
105
141
  * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -245,6 +245,124 @@ class SocialAccountsClient {
245
245
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/social-accounts/{id}/whop-forums");
246
246
  });
247
247
  }
248
+ /**
249
+ * List the text and announcement channels the Schedulin bot can post into for a connected Discord server. Use an item id as `platformConfiguration.channel` when creating a Discord post.
250
+ *
251
+ * @param {Schedulin.ListDiscordChannelsSocialAccountsRequest} request
252
+ * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
253
+ *
254
+ * @throws {@link Schedulin.UnauthorizedError}
255
+ * @throws {@link Schedulin.InternalServerError}
256
+ * @throws {@link errors.SchedulinError}
257
+ * @throws {@link errors.SchedulinTimeoutError}
258
+ *
259
+ * @example
260
+ * await client.socialAccounts.listDiscordChannels({
261
+ * id: "id"
262
+ * })
263
+ */
264
+ listDiscordChannels(request, requestOptions) {
265
+ return core.HttpResponsePromise.fromPromise(this.__listDiscordChannels(request, requestOptions));
266
+ }
267
+ __listDiscordChannels(request, requestOptions) {
268
+ return __awaiter(this, void 0, void 0, function* () {
269
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
270
+ const { id } = request;
271
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
272
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
273
+ const _response = yield core.fetcher({
274
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SchedulinEnvironment.Default, `v0/social-accounts/${core.url.encodePathParam(id)}/discord-channels`),
275
+ method: "GET",
276
+ headers: _headers,
277
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
278
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
279
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
280
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
281
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
282
+ logging: this._options.logging,
283
+ });
284
+ if (_response.ok) {
285
+ return {
286
+ data: _response.body,
287
+ rawResponse: _response.rawResponse,
288
+ };
289
+ }
290
+ if (_response.error.reason === "status-code") {
291
+ switch (_response.error.statusCode) {
292
+ case 401:
293
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
294
+ case 500:
295
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
296
+ default:
297
+ throw new errors.SchedulinError({
298
+ statusCode: _response.error.statusCode,
299
+ body: _response.error.body,
300
+ rawResponse: _response.rawResponse,
301
+ });
302
+ }
303
+ }
304
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/social-accounts/{id}/discord-channels");
305
+ });
306
+ }
307
+ /**
308
+ * List the channels in a connected Slack workspace that the Schedulin bot can post into (public channels, plus private channels it was invited to). Use an item id as `platformConfiguration.channel` when creating a Slack post.
309
+ *
310
+ * @param {Schedulin.ListSlackChannelsSocialAccountsRequest} request
311
+ * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
312
+ *
313
+ * @throws {@link Schedulin.UnauthorizedError}
314
+ * @throws {@link Schedulin.InternalServerError}
315
+ * @throws {@link errors.SchedulinError}
316
+ * @throws {@link errors.SchedulinTimeoutError}
317
+ *
318
+ * @example
319
+ * await client.socialAccounts.listSlackChannels({
320
+ * id: "id"
321
+ * })
322
+ */
323
+ listSlackChannels(request, requestOptions) {
324
+ return core.HttpResponsePromise.fromPromise(this.__listSlackChannels(request, requestOptions));
325
+ }
326
+ __listSlackChannels(request, requestOptions) {
327
+ return __awaiter(this, void 0, void 0, function* () {
328
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
329
+ const { id } = request;
330
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
331
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
332
+ const _response = yield core.fetcher({
333
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SchedulinEnvironment.Default, `v0/social-accounts/${core.url.encodePathParam(id)}/slack-channels`),
334
+ method: "GET",
335
+ headers: _headers,
336
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
337
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
338
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
339
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
340
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
341
+ logging: this._options.logging,
342
+ });
343
+ if (_response.ok) {
344
+ return {
345
+ data: _response.body,
346
+ rawResponse: _response.rawResponse,
347
+ };
348
+ }
349
+ if (_response.error.reason === "status-code") {
350
+ switch (_response.error.statusCode) {
351
+ case 401:
352
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
353
+ case 500:
354
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
355
+ default:
356
+ throw new errors.SchedulinError({
357
+ statusCode: _response.error.statusCode,
358
+ body: _response.error.body,
359
+ rawResponse: _response.rawResponse,
360
+ });
361
+ }
362
+ }
363
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v0/social-accounts/{id}/slack-channels");
364
+ });
365
+ }
248
366
  /**
249
367
  * Update social media account settings and information
250
368
  *
@@ -370,7 +488,7 @@ class SocialAccountsClient {
370
488
  });
371
489
  }
372
490
  /**
373
- * Set the IANA timezone (e.g. 'America/Los_Angeles') used to interpret queue times for this account.
491
+ * Set the IANA timezone (e.g. 'America/Los_Angeles') used to interpret queue times for this account. Unknown names and UTC-offset strings (e.g. '+05:00') are rejected with 422.
374
492
  *
375
493
  * @param {Schedulin.UpdateTimezoneSocialAccountsRequest} request
376
494
  * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface ListDiscordChannelsSocialAccountsRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface ListSlackChannelsSocialAccountsRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,6 @@
1
1
  export type { DeleteSocialAccountsRequest } from "./DeleteSocialAccountsRequest.js";
2
+ export type { ListDiscordChannelsSocialAccountsRequest } from "./ListDiscordChannelsSocialAccountsRequest.js";
3
+ export type { ListSlackChannelsSocialAccountsRequest } from "./ListSlackChannelsSocialAccountsRequest.js";
2
4
  export type { ListWhopCompaniesSocialAccountsRequest } from "./ListWhopCompaniesSocialAccountsRequest.js";
3
5
  export type { ListWhopForumsSocialAccountsRequest } from "./ListWhopForumsSocialAccountsRequest.js";
4
6
  export type { NextSlotsSocialAccountsRequest } from "./NextSlotsSocialAccountsRequest.js";
@@ -0,0 +1,12 @@
1
+ export interface ListDiscordChannelsSocialAccountsResponse {
2
+ items: ListDiscordChannelsSocialAccountsResponse.Items.Item[];
3
+ }
4
+ export declare namespace ListDiscordChannelsSocialAccountsResponse {
5
+ type Items = Items.Item[];
6
+ namespace Items {
7
+ interface Item {
8
+ id: string;
9
+ name: string;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ export interface ListSlackChannelsSocialAccountsResponse {
2
+ items: ListSlackChannelsSocialAccountsResponse.Items.Item[];
3
+ }
4
+ export declare namespace ListSlackChannelsSocialAccountsResponse {
5
+ type Items = Items.Item[];
6
+ namespace Items {
7
+ interface Item {
8
+ id: string;
9
+ name: string;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,6 @@
1
1
  export * from "./DeleteSocialAccountsResponse.js";
2
+ export * from "./ListDiscordChannelsSocialAccountsResponse.js";
3
+ export * from "./ListSlackChannelsSocialAccountsResponse.js";
2
4
  export * from "./ListSocialAccountsResponse.js";
3
5
  export * from "./ListWhopCompaniesSocialAccountsResponse.js";
4
6
  export * from "./ListWhopForumsSocialAccountsResponse.js";
@@ -15,6 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./DeleteSocialAccountsResponse.js"), exports);
18
+ __exportStar(require("./ListDiscordChannelsSocialAccountsResponse.js"), exports);
19
+ __exportStar(require("./ListSlackChannelsSocialAccountsResponse.js"), exports);
18
20
  __exportStar(require("./ListSocialAccountsResponse.js"), exports);
19
21
  __exportStar(require("./ListWhopCompaniesSocialAccountsResponse.js"), exports);
20
22
  __exportStar(require("./ListWhopForumsSocialAccountsResponse.js"), exports);
@@ -45,7 +45,7 @@ export declare class MediaClient {
45
45
  createUploadLink(request?: Schedulin.CreateUploadLinkMediaRequest, requestOptions?: MediaClient.RequestOptions): core.HttpResponsePromise<unknown>;
46
46
  private __createUploadLink;
47
47
  /**
48
- * Upload raw image, video, or audio bytes directly as multipart/form-data. The file is stored in your media library and the record is returned; use its `url` in `media[].url` when creating a post. Max 250 MB; SVG and other active content is rejected. For a file already hosted at a public URL, prefer POST /v0/media/from-url.
48
+ * Upload raw image, video, or audio bytes directly as multipart/form-data. The file is stored in your media library and the record is returned; use its `url` in `media[].url` when creating a post. When the file part's type is missing or generic (`application/octet-stream`, `text/plain`), the type is detected from the file's bytes, then its filename extension. Max 250 MB; SVG and other active content is rejected. For a file already hosted at a public URL, prefer POST /v0/media/from-url.
49
49
  *
50
50
  * @param {Schedulin.UploadMediaRequest} request
51
51
  * @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -146,7 +146,7 @@ export class MediaClient {
146
146
  });
147
147
  }
148
148
  /**
149
- * Upload raw image, video, or audio bytes directly as multipart/form-data. The file is stored in your media library and the record is returned; use its `url` in `media[].url` when creating a post. Max 250 MB; SVG and other active content is rejected. For a file already hosted at a public URL, prefer POST /v0/media/from-url.
149
+ * Upload raw image, video, or audio bytes directly as multipart/form-data. The file is stored in your media library and the record is returned; use its `url` in `media[].url` when creating a post. When the file part's type is missing or generic (`application/octet-stream`, `text/plain`), the type is detected from the file's bytes, then its filename extension. Max 250 MB; SVG and other active content is rejected. For a file already hosted at a public URL, prefer POST /v0/media/from-url.
150
150
  *
151
151
  * @param {Schedulin.UploadMediaRequest} request
152
152
  * @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -80,7 +80,7 @@ export declare class PostsClient {
80
80
  retrieve(request: Schedulin.RetrievePostsRequest, requestOptions?: PostsClient.RequestOptions): core.HttpResponsePromise<Schedulin.PostWithRelations>;
81
81
  private __retrieve;
82
82
  /**
83
- * Update an existing post by its ID
83
+ * Update an existing draft or scheduled post by its ID. `status` may be DRAFT, SCHEDULED (requires a future `scheduledAt`, either in this request or already on the post), or PROCESSING (publish now). COMPLETED and FAILED are set only by the publisher. Posts that are already publishing, published, or failed can't be edited (409).
84
84
  *
85
85
  * @param {Schedulin.UpdatePostsRequest} request
86
86
  * @param {PostsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -277,7 +277,7 @@ export class PostsClient {
277
277
  });
278
278
  }
279
279
  /**
280
- * Update an existing post by its ID
280
+ * Update an existing draft or scheduled post by its ID. `status` may be DRAFT, SCHEDULED (requires a future `scheduledAt`, either in this request or already on the post), or PROCESSING (publish now). COMPLETED and FAILED are set only by the publisher. Posts that are already publishing, published, or failed can't be edited (409).
281
281
  *
282
282
  * @param {Schedulin.UpdatePostsRequest} request
283
283
  * @param {PostsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -29,8 +29,6 @@ export declare namespace UpdatePostsRequest {
29
29
  readonly Draft: "DRAFT";
30
30
  readonly Scheduled: "SCHEDULED";
31
31
  readonly Processing: "PROCESSING";
32
- readonly Completed: "COMPLETED";
33
- readonly Failed: "FAILED";
34
32
  };
35
33
  type Status = (typeof Status)[keyof typeof Status];
36
34
  }
@@ -5,7 +5,5 @@ export var UpdatePostsRequest;
5
5
  Draft: "DRAFT",
6
6
  Scheduled: "SCHEDULED",
7
7
  Processing: "PROCESSING",
8
- Completed: "COMPLETED",
9
- Failed: "FAILED",
10
8
  };
11
9
  })(UpdatePostsRequest || (UpdatePostsRequest = {}));
@@ -62,6 +62,42 @@ export declare class SocialAccountsClient {
62
62
  */
63
63
  listWhopForums(request: Schedulin.ListWhopForumsSocialAccountsRequest, requestOptions?: SocialAccountsClient.RequestOptions): core.HttpResponsePromise<Schedulin.ListWhopForumsSocialAccountsResponse>;
64
64
  private __listWhopForums;
65
+ /**
66
+ * List the text and announcement channels the Schedulin bot can post into for a connected Discord server. Use an item id as `platformConfiguration.channel` when creating a Discord post.
67
+ *
68
+ * @param {Schedulin.ListDiscordChannelsSocialAccountsRequest} request
69
+ * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
70
+ *
71
+ * @throws {@link Schedulin.UnauthorizedError}
72
+ * @throws {@link Schedulin.InternalServerError}
73
+ * @throws {@link errors.SchedulinError}
74
+ * @throws {@link errors.SchedulinTimeoutError}
75
+ *
76
+ * @example
77
+ * await client.socialAccounts.listDiscordChannels({
78
+ * id: "id"
79
+ * })
80
+ */
81
+ listDiscordChannels(request: Schedulin.ListDiscordChannelsSocialAccountsRequest, requestOptions?: SocialAccountsClient.RequestOptions): core.HttpResponsePromise<Schedulin.ListDiscordChannelsSocialAccountsResponse>;
82
+ private __listDiscordChannels;
83
+ /**
84
+ * List the channels in a connected Slack workspace that the Schedulin bot can post into (public channels, plus private channels it was invited to). Use an item id as `platformConfiguration.channel` when creating a Slack post.
85
+ *
86
+ * @param {Schedulin.ListSlackChannelsSocialAccountsRequest} request
87
+ * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
88
+ *
89
+ * @throws {@link Schedulin.UnauthorizedError}
90
+ * @throws {@link Schedulin.InternalServerError}
91
+ * @throws {@link errors.SchedulinError}
92
+ * @throws {@link errors.SchedulinTimeoutError}
93
+ *
94
+ * @example
95
+ * await client.socialAccounts.listSlackChannels({
96
+ * id: "id"
97
+ * })
98
+ */
99
+ listSlackChannels(request: Schedulin.ListSlackChannelsSocialAccountsRequest, requestOptions?: SocialAccountsClient.RequestOptions): core.HttpResponsePromise<Schedulin.ListSlackChannelsSocialAccountsResponse>;
100
+ private __listSlackChannels;
65
101
  /**
66
102
  * Update social media account settings and information
67
103
  *
@@ -99,7 +135,7 @@ export declare class SocialAccountsClient {
99
135
  delete(request: Schedulin.DeleteSocialAccountsRequest, requestOptions?: SocialAccountsClient.RequestOptions): core.HttpResponsePromise<Schedulin.DeleteSocialAccountsResponse>;
100
136
  private __delete;
101
137
  /**
102
- * Set the IANA timezone (e.g. 'America/Los_Angeles') used to interpret queue times for this account.
138
+ * Set the IANA timezone (e.g. 'America/Los_Angeles') used to interpret queue times for this account. Unknown names and UTC-offset strings (e.g. '+05:00') are rejected with 422.
103
139
  *
104
140
  * @param {Schedulin.UpdateTimezoneSocialAccountsRequest} request
105
141
  * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -209,6 +209,124 @@ export class SocialAccountsClient {
209
209
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/social-accounts/{id}/whop-forums");
210
210
  });
211
211
  }
212
+ /**
213
+ * List the text and announcement channels the Schedulin bot can post into for a connected Discord server. Use an item id as `platformConfiguration.channel` when creating a Discord post.
214
+ *
215
+ * @param {Schedulin.ListDiscordChannelsSocialAccountsRequest} request
216
+ * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
217
+ *
218
+ * @throws {@link Schedulin.UnauthorizedError}
219
+ * @throws {@link Schedulin.InternalServerError}
220
+ * @throws {@link errors.SchedulinError}
221
+ * @throws {@link errors.SchedulinTimeoutError}
222
+ *
223
+ * @example
224
+ * await client.socialAccounts.listDiscordChannels({
225
+ * id: "id"
226
+ * })
227
+ */
228
+ listDiscordChannels(request, requestOptions) {
229
+ return core.HttpResponsePromise.fromPromise(this.__listDiscordChannels(request, requestOptions));
230
+ }
231
+ __listDiscordChannels(request, requestOptions) {
232
+ return __awaiter(this, void 0, void 0, function* () {
233
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
234
+ const { id } = request;
235
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
236
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
237
+ const _response = yield core.fetcher({
238
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SchedulinEnvironment.Default, `v0/social-accounts/${core.url.encodePathParam(id)}/discord-channels`),
239
+ method: "GET",
240
+ headers: _headers,
241
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
242
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
243
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
244
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
245
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
246
+ logging: this._options.logging,
247
+ });
248
+ if (_response.ok) {
249
+ return {
250
+ data: _response.body,
251
+ rawResponse: _response.rawResponse,
252
+ };
253
+ }
254
+ if (_response.error.reason === "status-code") {
255
+ switch (_response.error.statusCode) {
256
+ case 401:
257
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
258
+ case 500:
259
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
260
+ default:
261
+ throw new errors.SchedulinError({
262
+ statusCode: _response.error.statusCode,
263
+ body: _response.error.body,
264
+ rawResponse: _response.rawResponse,
265
+ });
266
+ }
267
+ }
268
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/social-accounts/{id}/discord-channels");
269
+ });
270
+ }
271
+ /**
272
+ * List the channels in a connected Slack workspace that the Schedulin bot can post into (public channels, plus private channels it was invited to). Use an item id as `platformConfiguration.channel` when creating a Slack post.
273
+ *
274
+ * @param {Schedulin.ListSlackChannelsSocialAccountsRequest} request
275
+ * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
276
+ *
277
+ * @throws {@link Schedulin.UnauthorizedError}
278
+ * @throws {@link Schedulin.InternalServerError}
279
+ * @throws {@link errors.SchedulinError}
280
+ * @throws {@link errors.SchedulinTimeoutError}
281
+ *
282
+ * @example
283
+ * await client.socialAccounts.listSlackChannels({
284
+ * id: "id"
285
+ * })
286
+ */
287
+ listSlackChannels(request, requestOptions) {
288
+ return core.HttpResponsePromise.fromPromise(this.__listSlackChannels(request, requestOptions));
289
+ }
290
+ __listSlackChannels(request, requestOptions) {
291
+ return __awaiter(this, void 0, void 0, function* () {
292
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
293
+ const { id } = request;
294
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
295
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
296
+ const _response = yield core.fetcher({
297
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SchedulinEnvironment.Default, `v0/social-accounts/${core.url.encodePathParam(id)}/slack-channels`),
298
+ method: "GET",
299
+ headers: _headers,
300
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
301
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
302
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
303
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
304
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
305
+ logging: this._options.logging,
306
+ });
307
+ if (_response.ok) {
308
+ return {
309
+ data: _response.body,
310
+ rawResponse: _response.rawResponse,
311
+ };
312
+ }
313
+ if (_response.error.reason === "status-code") {
314
+ switch (_response.error.statusCode) {
315
+ case 401:
316
+ throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
317
+ case 500:
318
+ throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
319
+ default:
320
+ throw new errors.SchedulinError({
321
+ statusCode: _response.error.statusCode,
322
+ body: _response.error.body,
323
+ rawResponse: _response.rawResponse,
324
+ });
325
+ }
326
+ }
327
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/social-accounts/{id}/slack-channels");
328
+ });
329
+ }
212
330
  /**
213
331
  * Update social media account settings and information
214
332
  *
@@ -334,7 +452,7 @@ export class SocialAccountsClient {
334
452
  });
335
453
  }
336
454
  /**
337
- * Set the IANA timezone (e.g. 'America/Los_Angeles') used to interpret queue times for this account.
455
+ * Set the IANA timezone (e.g. 'America/Los_Angeles') used to interpret queue times for this account. Unknown names and UTC-offset strings (e.g. '+05:00') are rejected with 422.
338
456
  *
339
457
  * @param {Schedulin.UpdateTimezoneSocialAccountsRequest} request
340
458
  * @param {SocialAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface ListDiscordChannelsSocialAccountsRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface ListSlackChannelsSocialAccountsRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,4 +1,6 @@
1
1
  export type { DeleteSocialAccountsRequest } from "./DeleteSocialAccountsRequest.mjs";
2
+ export type { ListDiscordChannelsSocialAccountsRequest } from "./ListDiscordChannelsSocialAccountsRequest.mjs";
3
+ export type { ListSlackChannelsSocialAccountsRequest } from "./ListSlackChannelsSocialAccountsRequest.mjs";
2
4
  export type { ListWhopCompaniesSocialAccountsRequest } from "./ListWhopCompaniesSocialAccountsRequest.mjs";
3
5
  export type { ListWhopForumsSocialAccountsRequest } from "./ListWhopForumsSocialAccountsRequest.mjs";
4
6
  export type { NextSlotsSocialAccountsRequest } from "./NextSlotsSocialAccountsRequest.mjs";
@@ -0,0 +1,12 @@
1
+ export interface ListDiscordChannelsSocialAccountsResponse {
2
+ items: ListDiscordChannelsSocialAccountsResponse.Items.Item[];
3
+ }
4
+ export declare namespace ListDiscordChannelsSocialAccountsResponse {
5
+ type Items = Items.Item[];
6
+ namespace Items {
7
+ interface Item {
8
+ id: string;
9
+ name: string;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,12 @@
1
+ export interface ListSlackChannelsSocialAccountsResponse {
2
+ items: ListSlackChannelsSocialAccountsResponse.Items.Item[];
3
+ }
4
+ export declare namespace ListSlackChannelsSocialAccountsResponse {
5
+ type Items = Items.Item[];
6
+ namespace Items {
7
+ interface Item {
8
+ id: string;
9
+ name: string;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,4 +1,6 @@
1
1
  export * from "./DeleteSocialAccountsResponse.mjs";
2
+ export * from "./ListDiscordChannelsSocialAccountsResponse.mjs";
3
+ export * from "./ListSlackChannelsSocialAccountsResponse.mjs";
2
4
  export * from "./ListSocialAccountsResponse.mjs";
3
5
  export * from "./ListWhopCompaniesSocialAccountsResponse.mjs";
4
6
  export * from "./ListWhopForumsSocialAccountsResponse.mjs";
@@ -1,4 +1,6 @@
1
1
  export * from "./DeleteSocialAccountsResponse.mjs";
2
+ export * from "./ListDiscordChannelsSocialAccountsResponse.mjs";
3
+ export * from "./ListSlackChannelsSocialAccountsResponse.mjs";
2
4
  export * from "./ListSocialAccountsResponse.mjs";
3
5
  export * from "./ListWhopCompaniesSocialAccountsResponse.mjs";
4
6
  export * from "./ListWhopForumsSocialAccountsResponse.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schedulin/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Official TypeScript SDK for the Schedulin API (schedulin.app)",
5
5
  "keywords": [
6
6
  "schedulin",