@schedulin/sdk 0.1.2 → 0.3.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/README.md +45 -0
- package/cjs/BaseClient.d.ts +12 -0
- package/cjs/Client.d.ts +9 -0
- package/cjs/Client.js +23 -8
- package/cjs/api/errors/InternalServerError.d.ts +1 -0
- package/cjs/api/errors/UnauthorizedError.d.ts +1 -0
- package/cjs/api/resources/ai/client/Client.d.ts +49 -0
- package/cjs/api/resources/ai/client/Client.js +181 -0
- package/cjs/api/resources/ai/client/index.d.ts +1 -0
- package/cjs/api/resources/ai/client/index.js +17 -0
- package/cjs/api/resources/ai/client/requests/GenerateImageAiRequest.d.ts +20 -0
- package/cjs/api/resources/ai/client/requests/GenerateImageAiRequest.js +12 -0
- package/cjs/api/resources/{posts/client/requests/GetJobStatusPostsRequest.d.ts → ai/client/requests/GetGenerationAiRequest.d.ts} +1 -1
- package/cjs/api/resources/ai/client/requests/index.d.ts +2 -0
- package/cjs/api/resources/ai/client/requests/index.js +5 -0
- package/cjs/api/resources/ai/exports.d.ts +2 -0
- package/cjs/api/resources/ai/exports.js +21 -0
- package/cjs/api/resources/ai/index.d.ts +1 -0
- package/cjs/api/resources/ai/index.js +17 -0
- package/cjs/api/resources/index.d.ts +6 -0
- package/cjs/api/resources/index.js +7 -1
- package/cjs/api/resources/media/client/Client.d.ts +83 -0
- package/cjs/api/resources/media/client/Client.js +260 -3
- package/cjs/api/resources/media/client/requests/CreateFromUrlMediaRequest.d.ts +12 -0
- package/cjs/api/resources/media/client/requests/CreateFromUrlMediaRequest.js +3 -0
- package/cjs/api/resources/media/client/requests/CreateUploadLinkMediaRequest.d.ts +7 -0
- package/cjs/api/resources/media/client/requests/CreateUploadLinkMediaRequest.js +3 -0
- package/{esm/api/resources/posts/client/requests/GetJobStatusPostsRequest.d.mts → cjs/api/resources/media/client/requests/DeleteMediaRequest.d.ts} +1 -1
- package/cjs/api/resources/media/client/requests/DeleteMediaRequest.js +3 -0
- package/cjs/api/resources/media/client/requests/UploadMediaRequest.d.ts +13 -0
- package/cjs/api/resources/media/client/requests/UploadMediaRequest.js +3 -0
- package/cjs/api/resources/media/client/requests/index.d.ts +4 -0
- package/cjs/api/resources/platforms/client/Client.d.ts +28 -0
- package/cjs/api/resources/platforms/client/Client.js +111 -0
- package/cjs/api/resources/platforms/client/index.d.ts +1 -0
- package/cjs/api/resources/platforms/client/index.js +2 -0
- package/cjs/api/resources/platforms/exports.d.ts +2 -0
- package/cjs/api/resources/platforms/exports.js +21 -0
- package/cjs/api/resources/platforms/index.d.ts +2 -0
- package/cjs/api/resources/platforms/index.js +18 -0
- package/cjs/api/resources/platforms/types/ListPlatformsResponse.d.ts +56 -0
- package/cjs/api/resources/platforms/types/ListPlatformsResponse.js +24 -0
- package/cjs/api/resources/platforms/types/index.d.ts +1 -0
- package/cjs/api/resources/platforms/types/index.js +17 -0
- package/cjs/api/resources/posts/client/Client.d.ts +22 -18
- package/cjs/api/resources/posts/client/Client.js +30 -62
- package/cjs/api/resources/posts/client/requests/ListPostsRequest.d.ts +1 -0
- package/cjs/api/resources/posts/client/requests/PostCreate.d.ts +64 -0
- package/cjs/api/resources/posts/client/requests/PostCreate.js +63 -0
- package/cjs/api/resources/posts/client/requests/UpdatePostsRequest.d.ts +0 -2
- package/cjs/api/resources/posts/client/requests/UpdatePostsRequest.js +0 -2
- package/cjs/api/resources/posts/client/requests/index.d.ts +0 -1
- package/cjs/api/resources/posts/types/CreatePostsResponse.d.ts +21 -0
- package/cjs/api/resources/posts/types/CreatePostsResponse.js +21 -0
- package/cjs/api/resources/posts/types/ListPostsRequestStatusesItem.d.ts +8 -0
- package/cjs/api/resources/posts/types/ListPostsRequestStatusesItem.js +11 -0
- package/cjs/api/resources/posts/types/index.d.ts +1 -0
- package/cjs/api/resources/posts/types/index.js +1 -0
- package/cjs/api/resources/socialAccounts/client/Client.d.ts +68 -1
- package/cjs/api/resources/socialAccounts/client/Client.js +210 -4
- package/cjs/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.d.ts +9 -0
- package/cjs/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.js +3 -0
- package/cjs/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.d.ts +11 -0
- package/cjs/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.js +3 -0
- package/cjs/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.d.ts +11 -0
- package/cjs/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.js +3 -0
- package/cjs/api/resources/socialAccounts/client/requests/index.d.ts +3 -0
- package/cjs/api/resources/socialAccounts/types/ListSocialAccountsResponse.d.ts +22 -0
- package/cjs/api/resources/socialAccounts/types/ListSocialAccountsResponse.js +21 -0
- package/cjs/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.d.ts +12 -0
- package/cjs/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.js +3 -0
- package/cjs/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.d.ts +12 -0
- package/cjs/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.js +3 -0
- package/cjs/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.d.ts +3 -0
- package/cjs/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.js +3 -0
- package/cjs/api/resources/socialAccounts/types/index.d.ts +3 -0
- package/cjs/api/resources/socialAccounts/types/index.js +3 -0
- package/cjs/api/resources/tags/client/Client.d.ts +8 -0
- package/cjs/api/resources/tags/client/Client.js +12 -3
- package/cjs/api/resources/webhooks/client/Client.d.ts +155 -0
- package/cjs/api/resources/webhooks/client/Client.js +538 -0
- package/cjs/api/resources/webhooks/client/index.d.ts +1 -0
- package/cjs/api/resources/webhooks/client/index.js +17 -0
- package/cjs/api/resources/webhooks/client/requests/CreateWebhooksRequest.d.ts +24 -0
- package/cjs/api/resources/webhooks/client/requests/CreateWebhooksRequest.js +16 -0
- package/cjs/api/resources/webhooks/client/requests/DeleteWebhooksRequest.d.ts +9 -0
- package/cjs/api/resources/webhooks/client/requests/DeleteWebhooksRequest.js +3 -0
- package/cjs/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.d.ts +11 -0
- package/cjs/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.js +3 -0
- package/cjs/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.d.ts +9 -0
- package/cjs/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.js +3 -0
- package/cjs/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.d.ts +9 -0
- package/cjs/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.js +3 -0
- package/cjs/api/resources/webhooks/client/requests/TestWebhooksRequest.d.ts +9 -0
- package/cjs/api/resources/webhooks/client/requests/TestWebhooksRequest.js +3 -0
- package/cjs/api/resources/webhooks/client/requests/UpdateWebhooksRequest.d.ts +25 -0
- package/cjs/api/resources/webhooks/client/requests/UpdateWebhooksRequest.js +16 -0
- package/cjs/api/resources/webhooks/client/requests/index.d.ts +7 -0
- package/cjs/api/resources/webhooks/client/requests/index.js +7 -0
- package/cjs/api/resources/webhooks/exports.d.ts +2 -0
- package/cjs/api/resources/webhooks/exports.js +21 -0
- package/cjs/api/resources/webhooks/index.d.ts +1 -0
- package/cjs/api/resources/webhooks/index.js +17 -0
- package/cjs/api/types/OauthScope.d.ts +12 -0
- package/cjs/api/types/OauthScope.js +12 -0
- package/cjs/api/types/PostSearch.d.ts +12 -0
- package/cjs/api/types/PostSearch.js +10 -0
- package/cjs/api/types/PostWithRelations.d.ts +21 -0
- package/cjs/api/types/PostWithRelations.js +21 -0
- package/cjs/api/types/SocialAccountDisconnectedReason.d.ts +1 -0
- package/cjs/api/types/SocialAccountDisconnectedReason.js +1 -0
- package/cjs/api/types/SocialPlatform.d.ts +21 -0
- package/cjs/api/types/SocialPlatform.js +21 -0
- package/cjs/core/exports.d.ts +1 -0
- package/cjs/core/exports.js +1 -0
- package/cjs/core/fetcher/Fetcher.js +9 -92
- package/cjs/core/fetcher/makePassthroughRequest.js +26 -4
- package/cjs/core/fetcher/redactUrl.d.ts +2 -0
- package/cjs/core/fetcher/redactUrl.js +88 -0
- package/cjs/core/file/exports.d.ts +1 -0
- package/cjs/core/file/exports.js +2 -0
- package/cjs/core/file/file.d.ts +10 -0
- package/cjs/core/file/file.js +225 -0
- package/cjs/core/file/index.d.ts +2 -0
- package/cjs/core/file/index.js +18 -0
- package/cjs/core/file/types.d.ts +66 -0
- package/cjs/core/file/types.js +2 -0
- package/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
- package/cjs/core/form-data-utils/FormDataWrapper.js +188 -0
- package/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
- package/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
- package/cjs/core/form-data-utils/index.d.ts +2 -0
- package/cjs/core/form-data-utils/index.js +20 -0
- package/cjs/core/index.d.ts +2 -0
- package/cjs/core/index.js +3 -1
- package/cjs/core/requestBody.d.ts +12 -0
- package/cjs/core/requestBody.js +26 -0
- package/cjs/core/runtime/index.d.ts +1 -1
- package/cjs/core/runtime/index.js +2 -1
- package/cjs/core/runtime/runtime.d.ts +19 -0
- package/cjs/core/runtime/runtime.js +74 -2
- package/cjs/core/url/qs.js +2 -2
- package/cjs/errors/SchedulinError.d.ts +1 -0
- package/cjs/errors/SchedulinError.js +4 -0
- package/cjs/errors/SchedulinTimeoutError.d.ts +2 -2
- package/cjs/errors/SchedulinTimeoutError.js +39 -5
- package/esm/BaseClient.d.mts +12 -0
- package/esm/Client.d.mts +9 -0
- package/esm/Client.mjs +15 -0
- package/esm/api/errors/InternalServerError.d.mts +1 -0
- package/esm/api/errors/UnauthorizedError.d.mts +1 -0
- package/esm/api/resources/ai/client/Client.d.mts +49 -0
- package/esm/api/resources/ai/client/Client.mjs +144 -0
- package/esm/api/resources/ai/client/index.d.mts +1 -0
- package/esm/api/resources/ai/client/index.mjs +1 -0
- package/esm/api/resources/ai/client/requests/GenerateImageAiRequest.d.mts +20 -0
- package/esm/api/resources/ai/client/requests/GenerateImageAiRequest.mjs +9 -0
- package/esm/api/resources/ai/client/requests/GetGenerationAiRequest.d.mts +9 -0
- package/esm/api/resources/ai/client/requests/index.d.mts +2 -0
- package/esm/api/resources/ai/client/requests/index.mjs +1 -0
- package/esm/api/resources/ai/exports.d.mts +2 -0
- package/esm/api/resources/ai/exports.mjs +3 -0
- package/esm/api/resources/ai/index.d.mts +1 -0
- package/esm/api/resources/ai/index.mjs +1 -0
- package/esm/api/resources/index.d.mts +6 -0
- package/esm/api/resources/index.mjs +6 -0
- package/esm/api/resources/media/client/Client.d.mts +83 -0
- package/esm/api/resources/media/client/Client.mjs +261 -4
- package/esm/api/resources/media/client/requests/CreateFromUrlMediaRequest.d.mts +12 -0
- package/esm/api/resources/media/client/requests/CreateFromUrlMediaRequest.mjs +2 -0
- package/esm/api/resources/media/client/requests/CreateUploadLinkMediaRequest.d.mts +7 -0
- package/esm/api/resources/media/client/requests/CreateUploadLinkMediaRequest.mjs +2 -0
- package/esm/api/resources/media/client/requests/DeleteMediaRequest.d.mts +9 -0
- package/esm/api/resources/media/client/requests/DeleteMediaRequest.mjs +2 -0
- package/esm/api/resources/media/client/requests/UploadMediaRequest.d.mts +13 -0
- package/esm/api/resources/media/client/requests/UploadMediaRequest.mjs +2 -0
- package/esm/api/resources/media/client/requests/index.d.mts +4 -0
- package/esm/api/resources/platforms/client/Client.d.mts +28 -0
- package/esm/api/resources/platforms/client/Client.mjs +74 -0
- package/esm/api/resources/platforms/client/index.d.mts +1 -0
- package/esm/api/resources/platforms/client/index.mjs +1 -0
- package/esm/api/resources/platforms/exports.d.mts +2 -0
- package/esm/api/resources/platforms/exports.mjs +3 -0
- package/esm/api/resources/platforms/index.d.mts +2 -0
- package/esm/api/resources/platforms/index.mjs +2 -0
- package/esm/api/resources/platforms/types/ListPlatformsResponse.d.mts +56 -0
- package/esm/api/resources/platforms/types/ListPlatformsResponse.mjs +21 -0
- package/esm/api/resources/platforms/types/index.d.mts +1 -0
- package/esm/api/resources/platforms/types/index.mjs +1 -0
- package/esm/api/resources/posts/client/Client.d.mts +22 -18
- package/esm/api/resources/posts/client/Client.mjs +30 -62
- package/esm/api/resources/posts/client/requests/ListPostsRequest.d.mts +1 -0
- package/esm/api/resources/posts/client/requests/PostCreate.d.mts +64 -0
- package/esm/api/resources/posts/client/requests/PostCreate.mjs +63 -0
- package/esm/api/resources/posts/client/requests/UpdatePostsRequest.d.mts +0 -2
- package/esm/api/resources/posts/client/requests/UpdatePostsRequest.mjs +0 -2
- package/esm/api/resources/posts/client/requests/index.d.mts +0 -1
- package/esm/api/resources/posts/types/CreatePostsResponse.d.mts +21 -0
- package/esm/api/resources/posts/types/CreatePostsResponse.mjs +21 -0
- package/esm/api/resources/posts/types/ListPostsRequestStatusesItem.d.mts +8 -0
- package/esm/api/resources/posts/types/ListPostsRequestStatusesItem.mjs +8 -0
- package/esm/api/resources/posts/types/index.d.mts +1 -0
- package/esm/api/resources/posts/types/index.mjs +1 -0
- package/esm/api/resources/socialAccounts/client/Client.d.mts +68 -1
- package/esm/api/resources/socialAccounts/client/Client.mjs +210 -4
- package/esm/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.d.mts +9 -0
- package/esm/api/resources/socialAccounts/client/requests/ListWhopCompaniesSocialAccountsRequest.mjs +2 -0
- package/esm/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.d.mts +11 -0
- package/esm/api/resources/socialAccounts/client/requests/ListWhopForumsSocialAccountsRequest.mjs +2 -0
- package/esm/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.d.mts +11 -0
- package/esm/api/resources/socialAccounts/client/requests/NextSlotsSocialAccountsRequest.mjs +2 -0
- package/esm/api/resources/socialAccounts/client/requests/index.d.mts +3 -0
- package/esm/api/resources/socialAccounts/types/ListSocialAccountsResponse.d.mts +22 -0
- package/esm/api/resources/socialAccounts/types/ListSocialAccountsResponse.mjs +21 -0
- package/esm/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.d.mts +12 -0
- package/esm/api/resources/socialAccounts/types/ListWhopCompaniesSocialAccountsResponse.mjs +2 -0
- package/esm/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.d.mts +12 -0
- package/esm/api/resources/socialAccounts/types/ListWhopForumsSocialAccountsResponse.mjs +2 -0
- package/esm/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.d.mts +3 -0
- package/esm/api/resources/socialAccounts/types/NextSlotsSocialAccountsResponse.mjs +2 -0
- package/esm/api/resources/socialAccounts/types/index.d.mts +3 -0
- package/esm/api/resources/socialAccounts/types/index.mjs +3 -0
- package/esm/api/resources/tags/client/Client.d.mts +8 -0
- package/esm/api/resources/tags/client/Client.mjs +12 -3
- package/esm/api/resources/webhooks/client/Client.d.mts +155 -0
- package/esm/api/resources/webhooks/client/Client.mjs +501 -0
- package/esm/api/resources/webhooks/client/index.d.mts +1 -0
- package/esm/api/resources/webhooks/client/index.mjs +1 -0
- package/esm/api/resources/webhooks/client/requests/CreateWebhooksRequest.d.mts +24 -0
- package/esm/api/resources/webhooks/client/requests/CreateWebhooksRequest.mjs +13 -0
- package/esm/api/resources/webhooks/client/requests/DeleteWebhooksRequest.d.mts +9 -0
- package/esm/api/resources/webhooks/client/requests/DeleteWebhooksRequest.mjs +2 -0
- package/esm/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.d.mts +11 -0
- package/esm/api/resources/webhooks/client/requests/ListDeliveriesWebhooksRequest.mjs +2 -0
- package/esm/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.d.mts +9 -0
- package/esm/api/resources/webhooks/client/requests/RetrieveWebhooksRequest.mjs +2 -0
- package/esm/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.d.mts +9 -0
- package/esm/api/resources/webhooks/client/requests/RotateSecretWebhooksRequest.mjs +2 -0
- package/esm/api/resources/webhooks/client/requests/TestWebhooksRequest.d.mts +9 -0
- package/esm/api/resources/webhooks/client/requests/TestWebhooksRequest.mjs +2 -0
- package/esm/api/resources/webhooks/client/requests/UpdateWebhooksRequest.d.mts +25 -0
- package/esm/api/resources/webhooks/client/requests/UpdateWebhooksRequest.mjs +13 -0
- package/esm/api/resources/webhooks/client/requests/index.d.mts +7 -0
- package/esm/api/resources/webhooks/client/requests/index.mjs +2 -0
- package/esm/api/resources/webhooks/exports.d.mts +2 -0
- package/esm/api/resources/webhooks/exports.mjs +3 -0
- package/esm/api/resources/webhooks/index.d.mts +1 -0
- package/esm/api/resources/webhooks/index.mjs +1 -0
- package/esm/api/types/OauthScope.d.mts +12 -0
- package/esm/api/types/OauthScope.mjs +12 -0
- package/esm/api/types/PostSearch.d.mts +12 -0
- package/esm/api/types/PostSearch.mjs +10 -0
- package/esm/api/types/PostWithRelations.d.mts +21 -0
- package/esm/api/types/PostWithRelations.mjs +21 -0
- package/esm/api/types/SocialAccountDisconnectedReason.d.mts +1 -0
- package/esm/api/types/SocialAccountDisconnectedReason.mjs +1 -0
- package/esm/api/types/SocialPlatform.d.mts +21 -0
- package/esm/api/types/SocialPlatform.mjs +21 -0
- package/esm/core/exports.d.mts +1 -0
- package/esm/core/exports.mjs +1 -0
- package/esm/core/fetcher/Fetcher.mjs +1 -84
- package/esm/core/fetcher/makePassthroughRequest.mjs +26 -4
- package/esm/core/fetcher/redactUrl.d.mts +2 -0
- package/esm/core/fetcher/redactUrl.mjs +84 -0
- package/esm/core/file/exports.d.mts +1 -0
- package/esm/core/file/exports.mjs +1 -0
- package/esm/core/file/file.d.mts +10 -0
- package/esm/core/file/file.mjs +188 -0
- package/esm/core/file/index.d.mts +2 -0
- package/esm/core/file/index.mjs +2 -0
- package/esm/core/file/types.d.mts +66 -0
- package/esm/core/file/types.mjs +1 -0
- package/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
- package/esm/core/form-data-utils/FormDataWrapper.mjs +150 -0
- package/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
- package/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
- package/esm/core/form-data-utils/index.d.mts +2 -0
- package/esm/core/form-data-utils/index.mjs +2 -0
- package/esm/core/index.d.mts +2 -0
- package/esm/core/index.mjs +2 -0
- package/esm/core/requestBody.d.mts +12 -0
- package/esm/core/requestBody.mjs +23 -0
- package/esm/core/runtime/index.d.mts +1 -1
- package/esm/core/runtime/index.mjs +1 -1
- package/esm/core/runtime/runtime.d.mts +19 -0
- package/esm/core/runtime/runtime.mjs +73 -2
- package/esm/core/url/qs.mjs +2 -2
- package/esm/errors/SchedulinError.d.mts +1 -0
- package/esm/errors/SchedulinError.mjs +4 -0
- package/esm/errors/SchedulinTimeoutError.d.mts +2 -2
- package/esm/errors/SchedulinTimeoutError.mjs +6 -5
- package/package.json +1 -1
- /package/cjs/api/resources/{posts/client/requests/GetJobStatusPostsRequest.js → ai/client/requests/GetGenerationAiRequest.js} +0 -0
- /package/esm/api/resources/{posts/client/requests/GetJobStatusPostsRequest.mjs → ai/client/requests/GetGenerationAiRequest.mjs} +0 -0
|
@@ -10,6 +10,59 @@ export declare namespace MediaClient {
|
|
|
10
10
|
export declare class MediaClient {
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<MediaClient.Options>;
|
|
12
12
|
constructor(options: MediaClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Downloads a publicly reachable image or video into the media library and returns the media record. Use the returned `url` in `media[].url` when creating a post. Prefer this over the presign flow whenever your client cannot issue a raw HTTP PUT (e.g. an AI agent). The source URL must be public (no auth), http(s), and at most the post upload limit (250 MB); SVG and other active content is rejected.
|
|
15
|
+
*
|
|
16
|
+
* @param {Schedulin.CreateFromUrlMediaRequest} request
|
|
17
|
+
* @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link Schedulin.UnauthorizedError}
|
|
20
|
+
* @throws {@link Schedulin.InternalServerError}
|
|
21
|
+
* @throws {@link errors.SchedulinError}
|
|
22
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* await client.media.createFromUrl({
|
|
26
|
+
* url: "url"
|
|
27
|
+
* })
|
|
28
|
+
*/
|
|
29
|
+
createFromUrl(request: Schedulin.CreateFromUrlMediaRequest, requestOptions?: MediaClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
30
|
+
private __createFromUrl;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a short-lived URL to a page where the user uploads files from their device (or a pasted attachment) straight into the media library. Hand the URL to the user; once they've uploaded, call GET /v0/media (list media, newest first) and reference the returned `url` when creating a post. Use this whenever the file isn't already at a public URL.
|
|
33
|
+
*
|
|
34
|
+
* @param {Schedulin.CreateUploadLinkMediaRequest} request
|
|
35
|
+
* @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
36
|
+
*
|
|
37
|
+
* @throws {@link Schedulin.UnauthorizedError}
|
|
38
|
+
* @throws {@link Schedulin.InternalServerError}
|
|
39
|
+
* @throws {@link errors.SchedulinError}
|
|
40
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* await client.media.createUploadLink()
|
|
44
|
+
*/
|
|
45
|
+
createUploadLink(request?: Schedulin.CreateUploadLinkMediaRequest, requestOptions?: MediaClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
46
|
+
private __createUploadLink;
|
|
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.
|
|
49
|
+
*
|
|
50
|
+
* @param {Schedulin.UploadMediaRequest} request
|
|
51
|
+
* @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
52
|
+
*
|
|
53
|
+
* @throws {@link Schedulin.UnauthorizedError}
|
|
54
|
+
* @throws {@link Schedulin.InternalServerError}
|
|
55
|
+
* @throws {@link errors.SchedulinError}
|
|
56
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* import { createReadStream } from "fs";
|
|
60
|
+
* await client.media.upload({
|
|
61
|
+
* file: fs.createReadStream("/path/to/your/file")
|
|
62
|
+
* })
|
|
63
|
+
*/
|
|
64
|
+
upload(request: Schedulin.UploadMediaRequest, requestOptions?: MediaClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
65
|
+
private __upload;
|
|
13
66
|
/**
|
|
14
67
|
* Retrieve media information by its ID
|
|
15
68
|
*
|
|
@@ -18,6 +71,8 @@ export declare class MediaClient {
|
|
|
18
71
|
*
|
|
19
72
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
20
73
|
* @throws {@link Schedulin.InternalServerError}
|
|
74
|
+
* @throws {@link errors.SchedulinError}
|
|
75
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
21
76
|
*
|
|
22
77
|
* @example
|
|
23
78
|
* await client.media.retrieve({
|
|
@@ -34,6 +89,8 @@ export declare class MediaClient {
|
|
|
34
89
|
*
|
|
35
90
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
36
91
|
* @throws {@link Schedulin.InternalServerError}
|
|
92
|
+
* @throws {@link errors.SchedulinError}
|
|
93
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
37
94
|
*
|
|
38
95
|
* @example
|
|
39
96
|
* await client.media.update({
|
|
@@ -43,6 +100,24 @@ export declare class MediaClient {
|
|
|
43
100
|
*/
|
|
44
101
|
update(request: Schedulin.UpdateMediaRequest, requestOptions?: MediaClient.RequestOptions): core.HttpResponsePromise<Schedulin.Media>;
|
|
45
102
|
private __update;
|
|
103
|
+
/**
|
|
104
|
+
* Delete a media object and remove its files from storage. Fails with a conflict when the media is attached to any post — remove it from those posts (or delete them) first.
|
|
105
|
+
*
|
|
106
|
+
* @param {Schedulin.DeleteMediaRequest} request
|
|
107
|
+
* @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
108
|
+
*
|
|
109
|
+
* @throws {@link Schedulin.UnauthorizedError}
|
|
110
|
+
* @throws {@link Schedulin.InternalServerError}
|
|
111
|
+
* @throws {@link errors.SchedulinError}
|
|
112
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* await client.media.delete({
|
|
116
|
+
* id: "id"
|
|
117
|
+
* })
|
|
118
|
+
*/
|
|
119
|
+
delete(request: Schedulin.DeleteMediaRequest, requestOptions?: MediaClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
120
|
+
private __delete;
|
|
46
121
|
/**
|
|
47
122
|
* List media for the organization with page pagination, search, type and tag filters
|
|
48
123
|
*
|
|
@@ -51,6 +126,8 @@ export declare class MediaClient {
|
|
|
51
126
|
*
|
|
52
127
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
53
128
|
* @throws {@link Schedulin.InternalServerError}
|
|
129
|
+
* @throws {@link errors.SchedulinError}
|
|
130
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
54
131
|
*
|
|
55
132
|
* @example
|
|
56
133
|
* await client.media.list()
|
|
@@ -65,6 +142,8 @@ export declare class MediaClient {
|
|
|
65
142
|
*
|
|
66
143
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
67
144
|
* @throws {@link Schedulin.InternalServerError}
|
|
145
|
+
* @throws {@link errors.SchedulinError}
|
|
146
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
68
147
|
*
|
|
69
148
|
* @example
|
|
70
149
|
* await client.media.setTags({
|
|
@@ -81,6 +160,8 @@ export declare class MediaClient {
|
|
|
81
160
|
*
|
|
82
161
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
83
162
|
* @throws {@link Schedulin.InternalServerError}
|
|
163
|
+
* @throws {@link errors.SchedulinError}
|
|
164
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
84
165
|
*
|
|
85
166
|
* @example
|
|
86
167
|
* await client.media.countByTag()
|
|
@@ -95,6 +176,8 @@ export declare class MediaClient {
|
|
|
95
176
|
*
|
|
96
177
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
97
178
|
* @throws {@link Schedulin.InternalServerError}
|
|
179
|
+
* @throws {@link errors.SchedulinError}
|
|
180
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
98
181
|
*
|
|
99
182
|
* @example
|
|
100
183
|
* await client.media.createPresignedPost({
|
|
@@ -58,6 +58,7 @@ exports.MediaClient = void 0;
|
|
|
58
58
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
59
59
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
60
60
|
const core = __importStar(require("../../../../core/index.js"));
|
|
61
|
+
const requestBody_js_1 = require("../../../../core/requestBody.js");
|
|
61
62
|
const environments = __importStar(require("../../../../environments.js"));
|
|
62
63
|
const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
|
|
63
64
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
@@ -66,6 +67,191 @@ class MediaClient {
|
|
|
66
67
|
constructor(options) {
|
|
67
68
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
68
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Downloads a publicly reachable image or video into the media library and returns the media record. Use the returned `url` in `media[].url` when creating a post. Prefer this over the presign flow whenever your client cannot issue a raw HTTP PUT (e.g. an AI agent). The source URL must be public (no auth), http(s), and at most the post upload limit (250 MB); SVG and other active content is rejected.
|
|
72
|
+
*
|
|
73
|
+
* @param {Schedulin.CreateFromUrlMediaRequest} request
|
|
74
|
+
* @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
75
|
+
*
|
|
76
|
+
* @throws {@link Schedulin.UnauthorizedError}
|
|
77
|
+
* @throws {@link Schedulin.InternalServerError}
|
|
78
|
+
* @throws {@link errors.SchedulinError}
|
|
79
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* await client.media.createFromUrl({
|
|
83
|
+
* url: "url"
|
|
84
|
+
* })
|
|
85
|
+
*/
|
|
86
|
+
createFromUrl(request, requestOptions) {
|
|
87
|
+
return core.HttpResponsePromise.fromPromise(this.__createFromUrl(request, requestOptions));
|
|
88
|
+
}
|
|
89
|
+
__createFromUrl(request, requestOptions) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
92
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
93
|
+
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);
|
|
94
|
+
const _response = yield core.fetcher({
|
|
95
|
+
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/media/from-url"),
|
|
96
|
+
method: "POST",
|
|
97
|
+
headers: _headers,
|
|
98
|
+
contentType: "application/json",
|
|
99
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
100
|
+
requestType: "json",
|
|
101
|
+
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
102
|
+
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,
|
|
103
|
+
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,
|
|
104
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
105
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
106
|
+
logging: this._options.logging,
|
|
107
|
+
});
|
|
108
|
+
if (_response.ok) {
|
|
109
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
110
|
+
}
|
|
111
|
+
if (_response.error.reason === "status-code") {
|
|
112
|
+
switch (_response.error.statusCode) {
|
|
113
|
+
case 401:
|
|
114
|
+
throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
115
|
+
case 500:
|
|
116
|
+
throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
|
|
117
|
+
default:
|
|
118
|
+
throw new errors.SchedulinError({
|
|
119
|
+
statusCode: _response.error.statusCode,
|
|
120
|
+
body: _response.error.body,
|
|
121
|
+
rawResponse: _response.rawResponse,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/media/from-url");
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Returns a short-lived URL to a page where the user uploads files from their device (or a pasted attachment) straight into the media library. Hand the URL to the user; once they've uploaded, call GET /v0/media (list media, newest first) and reference the returned `url` when creating a post. Use this whenever the file isn't already at a public URL.
|
|
130
|
+
*
|
|
131
|
+
* @param {Schedulin.CreateUploadLinkMediaRequest} request
|
|
132
|
+
* @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
133
|
+
*
|
|
134
|
+
* @throws {@link Schedulin.UnauthorizedError}
|
|
135
|
+
* @throws {@link Schedulin.InternalServerError}
|
|
136
|
+
* @throws {@link errors.SchedulinError}
|
|
137
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* await client.media.createUploadLink()
|
|
141
|
+
*/
|
|
142
|
+
createUploadLink(request = {}, requestOptions) {
|
|
143
|
+
return core.HttpResponsePromise.fromPromise(this.__createUploadLink(request, requestOptions));
|
|
144
|
+
}
|
|
145
|
+
__createUploadLink() {
|
|
146
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
147
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
148
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
149
|
+
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);
|
|
150
|
+
const _response = yield core.fetcher({
|
|
151
|
+
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/media/upload-link"),
|
|
152
|
+
method: "POST",
|
|
153
|
+
headers: _headers,
|
|
154
|
+
contentType: "application/json",
|
|
155
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
156
|
+
requestType: "json",
|
|
157
|
+
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
158
|
+
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,
|
|
159
|
+
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,
|
|
160
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
161
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
162
|
+
logging: this._options.logging,
|
|
163
|
+
});
|
|
164
|
+
if (_response.ok) {
|
|
165
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
166
|
+
}
|
|
167
|
+
if (_response.error.reason === "status-code") {
|
|
168
|
+
switch (_response.error.statusCode) {
|
|
169
|
+
case 401:
|
|
170
|
+
throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
171
|
+
case 500:
|
|
172
|
+
throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
|
|
173
|
+
default:
|
|
174
|
+
throw new errors.SchedulinError({
|
|
175
|
+
statusCode: _response.error.statusCode,
|
|
176
|
+
body: _response.error.body,
|
|
177
|
+
rawResponse: _response.rawResponse,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/media/upload-link");
|
|
182
|
+
});
|
|
183
|
+
}
|
|
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.
|
|
186
|
+
*
|
|
187
|
+
* @param {Schedulin.UploadMediaRequest} request
|
|
188
|
+
* @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
189
|
+
*
|
|
190
|
+
* @throws {@link Schedulin.UnauthorizedError}
|
|
191
|
+
* @throws {@link Schedulin.InternalServerError}
|
|
192
|
+
* @throws {@link errors.SchedulinError}
|
|
193
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* import { createReadStream } from "fs";
|
|
197
|
+
* await client.media.upload({
|
|
198
|
+
* file: fs.createReadStream("/path/to/your/file")
|
|
199
|
+
* })
|
|
200
|
+
*/
|
|
201
|
+
upload(request, requestOptions) {
|
|
202
|
+
return core.HttpResponsePromise.fromPromise(this.__upload(request, requestOptions));
|
|
203
|
+
}
|
|
204
|
+
__upload(request, requestOptions) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
207
|
+
const _body = yield core.newFormData();
|
|
208
|
+
yield _body.appendFile("file", request.file);
|
|
209
|
+
if (request.name != null) {
|
|
210
|
+
_body.append("name", request.name);
|
|
211
|
+
}
|
|
212
|
+
if (request.alt != null) {
|
|
213
|
+
_body.append("alt", request.alt);
|
|
214
|
+
}
|
|
215
|
+
if (request.contentType != null) {
|
|
216
|
+
_body.append("contentType", request.contentType);
|
|
217
|
+
}
|
|
218
|
+
const _maybeEncodedRequest = yield _body.getRequest();
|
|
219
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
220
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
221
|
+
const _response = yield core.fetcher({
|
|
222
|
+
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/media/upload"),
|
|
223
|
+
method: "POST",
|
|
224
|
+
headers: _headers,
|
|
225
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
226
|
+
requestType: "file",
|
|
227
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
228
|
+
body: _maybeEncodedRequest.body,
|
|
229
|
+
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,
|
|
230
|
+
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,
|
|
231
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
232
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
233
|
+
logging: this._options.logging,
|
|
234
|
+
});
|
|
235
|
+
if (_response.ok) {
|
|
236
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
237
|
+
}
|
|
238
|
+
if (_response.error.reason === "status-code") {
|
|
239
|
+
switch (_response.error.statusCode) {
|
|
240
|
+
case 401:
|
|
241
|
+
throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
242
|
+
case 500:
|
|
243
|
+
throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
|
|
244
|
+
default:
|
|
245
|
+
throw new errors.SchedulinError({
|
|
246
|
+
statusCode: _response.error.statusCode,
|
|
247
|
+
body: _response.error.body,
|
|
248
|
+
rawResponse: _response.rawResponse,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/media/upload");
|
|
253
|
+
});
|
|
254
|
+
}
|
|
69
255
|
/**
|
|
70
256
|
* Retrieve media information by its ID
|
|
71
257
|
*
|
|
@@ -74,6 +260,8 @@ class MediaClient {
|
|
|
74
260
|
*
|
|
75
261
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
76
262
|
* @throws {@link Schedulin.InternalServerError}
|
|
263
|
+
* @throws {@link errors.SchedulinError}
|
|
264
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
77
265
|
*
|
|
78
266
|
* @example
|
|
79
267
|
* await client.media.retrieve({
|
|
@@ -128,6 +316,8 @@ class MediaClient {
|
|
|
128
316
|
*
|
|
129
317
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
130
318
|
* @throws {@link Schedulin.InternalServerError}
|
|
319
|
+
* @throws {@link errors.SchedulinError}
|
|
320
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
131
321
|
*
|
|
132
322
|
* @example
|
|
133
323
|
* await client.media.update({
|
|
@@ -151,7 +341,7 @@ class MediaClient {
|
|
|
151
341
|
contentType: "application/json",
|
|
152
342
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
153
343
|
requestType: "json",
|
|
154
|
-
body: _body,
|
|
344
|
+
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
155
345
|
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,
|
|
156
346
|
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,
|
|
157
347
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -178,6 +368,65 @@ class MediaClient {
|
|
|
178
368
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/v0/media/{id}");
|
|
179
369
|
});
|
|
180
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* Delete a media object and remove its files from storage. Fails with a conflict when the media is attached to any post — remove it from those posts (or delete them) first.
|
|
373
|
+
*
|
|
374
|
+
* @param {Schedulin.DeleteMediaRequest} request
|
|
375
|
+
* @param {MediaClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
376
|
+
*
|
|
377
|
+
* @throws {@link Schedulin.UnauthorizedError}
|
|
378
|
+
* @throws {@link Schedulin.InternalServerError}
|
|
379
|
+
* @throws {@link errors.SchedulinError}
|
|
380
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* await client.media.delete({
|
|
384
|
+
* id: "id"
|
|
385
|
+
* })
|
|
386
|
+
*/
|
|
387
|
+
delete(request, requestOptions) {
|
|
388
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions));
|
|
389
|
+
}
|
|
390
|
+
__delete(request, requestOptions) {
|
|
391
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
392
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
393
|
+
const { id } = request, _body = __rest(request, ["id"]);
|
|
394
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
395
|
+
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);
|
|
396
|
+
const _response = yield core.fetcher({
|
|
397
|
+
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/media/${core.url.encodePathParam(id)}`),
|
|
398
|
+
method: "DELETE",
|
|
399
|
+
headers: _headers,
|
|
400
|
+
contentType: "application/json",
|
|
401
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
402
|
+
requestType: "json",
|
|
403
|
+
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
404
|
+
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,
|
|
405
|
+
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,
|
|
406
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
407
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
408
|
+
logging: this._options.logging,
|
|
409
|
+
});
|
|
410
|
+
if (_response.ok) {
|
|
411
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
412
|
+
}
|
|
413
|
+
if (_response.error.reason === "status-code") {
|
|
414
|
+
switch (_response.error.statusCode) {
|
|
415
|
+
case 401:
|
|
416
|
+
throw new Schedulin.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
417
|
+
case 500:
|
|
418
|
+
throw new Schedulin.InternalServerError(_response.error.body, _response.rawResponse);
|
|
419
|
+
default:
|
|
420
|
+
throw new errors.SchedulinError({
|
|
421
|
+
statusCode: _response.error.statusCode,
|
|
422
|
+
body: _response.error.body,
|
|
423
|
+
rawResponse: _response.rawResponse,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v0/media/{id}");
|
|
428
|
+
});
|
|
429
|
+
}
|
|
181
430
|
/**
|
|
182
431
|
* List media for the organization with page pagination, search, type and tag filters
|
|
183
432
|
*
|
|
@@ -186,6 +435,8 @@ class MediaClient {
|
|
|
186
435
|
*
|
|
187
436
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
188
437
|
* @throws {@link Schedulin.InternalServerError}
|
|
438
|
+
* @throws {@link errors.SchedulinError}
|
|
439
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
189
440
|
*
|
|
190
441
|
* @example
|
|
191
442
|
* await client.media.list()
|
|
@@ -250,6 +501,8 @@ class MediaClient {
|
|
|
250
501
|
*
|
|
251
502
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
252
503
|
* @throws {@link Schedulin.InternalServerError}
|
|
504
|
+
* @throws {@link errors.SchedulinError}
|
|
505
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
253
506
|
*
|
|
254
507
|
* @example
|
|
255
508
|
* await client.media.setTags({
|
|
@@ -273,7 +526,7 @@ class MediaClient {
|
|
|
273
526
|
contentType: "application/json",
|
|
274
527
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
275
528
|
requestType: "json",
|
|
276
|
-
body: _body,
|
|
529
|
+
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
277
530
|
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,
|
|
278
531
|
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,
|
|
279
532
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -307,6 +560,8 @@ class MediaClient {
|
|
|
307
560
|
*
|
|
308
561
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
309
562
|
* @throws {@link Schedulin.InternalServerError}
|
|
563
|
+
* @throws {@link errors.SchedulinError}
|
|
564
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
310
565
|
*
|
|
311
566
|
* @example
|
|
312
567
|
* await client.media.countByTag()
|
|
@@ -358,6 +613,8 @@ class MediaClient {
|
|
|
358
613
|
*
|
|
359
614
|
* @throws {@link Schedulin.UnauthorizedError}
|
|
360
615
|
* @throws {@link Schedulin.InternalServerError}
|
|
616
|
+
* @throws {@link errors.SchedulinError}
|
|
617
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
361
618
|
*
|
|
362
619
|
* @example
|
|
363
620
|
* await client.media.createPresignedPost({
|
|
@@ -380,7 +637,7 @@ class MediaClient {
|
|
|
380
637
|
contentType: "application/json",
|
|
381
638
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
382
639
|
requestType: "json",
|
|
383
|
-
body: request,
|
|
640
|
+
body: (0, requestBody_js_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
384
641
|
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,
|
|
385
642
|
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,
|
|
386
643
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as core from "../../../../../core/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* file: fs.createReadStream("/path/to/your/file")
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface UploadMediaRequest {
|
|
9
|
+
file: core.file.Uploadable;
|
|
10
|
+
name?: string;
|
|
11
|
+
alt?: string;
|
|
12
|
+
contentType?: string;
|
|
13
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export type { CreateFromUrlMediaRequest } from "./CreateFromUrlMediaRequest.js";
|
|
1
2
|
export { CreatePresignedPost } from "./CreatePresignedPost.js";
|
|
3
|
+
export type { CreateUploadLinkMediaRequest } from "./CreateUploadLinkMediaRequest.js";
|
|
4
|
+
export type { DeleteMediaRequest } from "./DeleteMediaRequest.js";
|
|
2
5
|
export type { ListMediaRequest } from "./ListMediaRequest.js";
|
|
3
6
|
export type { RetrieveMediaRequest } from "./RetrieveMediaRequest.js";
|
|
4
7
|
export type { SetTagsMediaRequest } from "./SetTagsMediaRequest.js";
|
|
5
8
|
export type { UpdateMediaRequest } from "./UpdateMediaRequest.js";
|
|
9
|
+
export type { UploadMediaRequest } from "./UploadMediaRequest.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../core/index.js";
|
|
4
|
+
import * as Schedulin from "../../../index.js";
|
|
5
|
+
export declare namespace PlatformsClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class PlatformsClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<PlatformsClient.Options>;
|
|
12
|
+
constructor(options: PlatformsClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Per-platform posting requirements: caption length limits, media count/type rules, whether `platformConfiguration` is required, its JSON Schema when server-validated, and helper endpoints for fetching dynamic values (e.g. Pinterest boards). Platforms marked `comingSoon` cannot be posted to yet.
|
|
15
|
+
*
|
|
16
|
+
* @param {PlatformsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
17
|
+
*
|
|
18
|
+
* @throws {@link Schedulin.UnauthorizedError}
|
|
19
|
+
* @throws {@link Schedulin.InternalServerError}
|
|
20
|
+
* @throws {@link errors.SchedulinError}
|
|
21
|
+
* @throws {@link errors.SchedulinTimeoutError}
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* await client.platforms.list()
|
|
25
|
+
*/
|
|
26
|
+
list(requestOptions?: PlatformsClient.RequestOptions): core.HttpResponsePromise<Schedulin.ListPlatformsResponse>;
|
|
27
|
+
private __list;
|
|
28
|
+
}
|