samsar-js 0.48.34 → 0.48.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +213 -0
- package/dist/index.js +180 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,98 @@ export interface SamsarResult<T> {
|
|
|
30
30
|
creditsRemaining?: number;
|
|
31
31
|
raw: Response;
|
|
32
32
|
}
|
|
33
|
+
export interface SamsarApiKeyValidationResponse {
|
|
34
|
+
valid: boolean;
|
|
35
|
+
authType?: string;
|
|
36
|
+
email?: string | null;
|
|
37
|
+
username?: string | null;
|
|
38
|
+
displayName?: string | null;
|
|
39
|
+
remainingCredits?: number;
|
|
40
|
+
message?: string;
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
export interface DeploymentProviderCredentials {
|
|
44
|
+
samsarApiKey?: string;
|
|
45
|
+
samsar_api_key?: string;
|
|
46
|
+
openaiApiKey?: string;
|
|
47
|
+
openai_api_key?: string;
|
|
48
|
+
falApiKey?: string;
|
|
49
|
+
fal_api_key?: string;
|
|
50
|
+
runwayApiKey?: string;
|
|
51
|
+
runway_api_key?: string;
|
|
52
|
+
googleCredentialsJson?: string;
|
|
53
|
+
google_credentials_json?: string;
|
|
54
|
+
googleCredentialsJsonB64?: string;
|
|
55
|
+
google_credentials_json_b64?: string;
|
|
56
|
+
googleProjectId?: string;
|
|
57
|
+
google_project_id?: string;
|
|
58
|
+
validateFalRemotely?: boolean;
|
|
59
|
+
validate_fal_remotely?: boolean;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
export interface DeploymentProviderValidationResponse {
|
|
63
|
+
providers: Record<string, {
|
|
64
|
+
provider?: string;
|
|
65
|
+
status?: string;
|
|
66
|
+
ok?: boolean;
|
|
67
|
+
message?: string;
|
|
68
|
+
remainingCredits?: number;
|
|
69
|
+
email?: string | null;
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
}>;
|
|
72
|
+
available: {
|
|
73
|
+
providers: string[];
|
|
74
|
+
models: string[];
|
|
75
|
+
actions: string[];
|
|
76
|
+
};
|
|
77
|
+
[key: string]: unknown;
|
|
78
|
+
}
|
|
79
|
+
export interface DeploymentProviderCapabilitiesResponse {
|
|
80
|
+
providers: Record<string, {
|
|
81
|
+
label?: string;
|
|
82
|
+
models?: string[];
|
|
83
|
+
actions?: string[];
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
}>;
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
}
|
|
88
|
+
export interface ExternalChatCompletionRequest {
|
|
89
|
+
model?: InferenceModel;
|
|
90
|
+
messages: Array<Record<string, unknown>>;
|
|
91
|
+
stream?: false;
|
|
92
|
+
temperature?: number;
|
|
93
|
+
top_p?: number;
|
|
94
|
+
max_tokens?: number;
|
|
95
|
+
response_format?: Record<string, unknown>;
|
|
96
|
+
provider_options?: Record<string, unknown>;
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
}
|
|
99
|
+
export interface ExternalChatCompletionResponse {
|
|
100
|
+
id?: string;
|
|
101
|
+
object?: string;
|
|
102
|
+
created?: number;
|
|
103
|
+
model?: string;
|
|
104
|
+
choices?: Array<Record<string, unknown>>;
|
|
105
|
+
usage?: Record<string, unknown>;
|
|
106
|
+
[key: string]: unknown;
|
|
107
|
+
}
|
|
108
|
+
export interface ExternalMediaRequest {
|
|
109
|
+
input?: Record<string, unknown>;
|
|
110
|
+
webhookUrl?: string;
|
|
111
|
+
webhook_url?: string;
|
|
112
|
+
[key: string]: unknown;
|
|
113
|
+
}
|
|
114
|
+
export interface ExternalMediaResponse {
|
|
115
|
+
request_id?: string;
|
|
116
|
+
session_id?: string;
|
|
117
|
+
sessionID?: string;
|
|
118
|
+
status?: string;
|
|
119
|
+
message?: string;
|
|
120
|
+
status_endpoint?: string;
|
|
121
|
+
creditsCharged?: number;
|
|
122
|
+
remainingCredits?: number | null;
|
|
123
|
+
[key: string]: unknown;
|
|
124
|
+
}
|
|
33
125
|
export interface FontOptions {
|
|
34
126
|
key?: string;
|
|
35
127
|
font_key?: string;
|
|
@@ -2544,6 +2636,127 @@ export declare class SamsarClient {
|
|
|
2544
2636
|
getImageStatus(requestId: string, options?: SamsarRequestOptions & {
|
|
2545
2637
|
queryParams?: QueryParams;
|
|
2546
2638
|
}): Promise<SamsarResult<GlobalStatusResponse>>;
|
|
2639
|
+
/**
|
|
2640
|
+
* Validate the configured Samsar API key, or a supplied key, against /external/api_key/validate.
|
|
2641
|
+
*/
|
|
2642
|
+
validateSamsarApiKey(apiKey?: string, options?: SamsarRequestOptions): Promise<SamsarResult<SamsarApiKeyValidationResponse>>;
|
|
2643
|
+
/**
|
|
2644
|
+
* Validate the configured Samsar API key, or a supplied key, against /v2/external/api_key/validate.
|
|
2645
|
+
*/
|
|
2646
|
+
validateV2ExternalSamsarApiKey(apiKey?: string, options?: SamsarRequestOptions): Promise<SamsarResult<SamsarApiKeyValidationResponse>>;
|
|
2647
|
+
/**
|
|
2648
|
+
* Fetch provider/model/action capabilities used by the deployment onboarding flow.
|
|
2649
|
+
*/
|
|
2650
|
+
getExternalProviderCapabilities(options?: SamsarRequestOptions): Promise<SamsarResult<DeploymentProviderCapabilitiesResponse>>;
|
|
2651
|
+
/**
|
|
2652
|
+
* Fetch provider/model/action capabilities from /v2/external/providers/capabilities.
|
|
2653
|
+
*/
|
|
2654
|
+
getV2ExternalProviderCapabilities(options?: SamsarRequestOptions): Promise<SamsarResult<DeploymentProviderCapabilitiesResponse>>;
|
|
2655
|
+
/**
|
|
2656
|
+
* Validate onboarding provider credentials without storing secrets in the SDK.
|
|
2657
|
+
*/
|
|
2658
|
+
validateDeploymentProviders(payload: DeploymentProviderCredentials, options?: SamsarRequestOptions): Promise<SamsarResult<DeploymentProviderValidationResponse>>;
|
|
2659
|
+
/**
|
|
2660
|
+
* Validate onboarding provider credentials through /v2/external/providers/validate.
|
|
2661
|
+
*/
|
|
2662
|
+
validateV2ExternalDeploymentProviders(payload: DeploymentProviderCredentials, options?: SamsarRequestOptions): Promise<SamsarResult<DeploymentProviderValidationResponse>>;
|
|
2663
|
+
/**
|
|
2664
|
+
* OpenAI-compatible external chat request billed through Samsar credits.
|
|
2665
|
+
* This calls POST /external/chat.
|
|
2666
|
+
*/
|
|
2667
|
+
createExternalChat(payload: ExternalChatCompletionRequest, options?: SamsarRequestOptions): Promise<SamsarResult<ExternalChatCompletionResponse>>;
|
|
2668
|
+
/**
|
|
2669
|
+
* OpenAI-compatible external chat request billed through Samsar credits.
|
|
2670
|
+
* This calls POST /v2/external/chat.
|
|
2671
|
+
*/
|
|
2672
|
+
createV2ExternalChat(payload: ExternalChatCompletionRequest, options?: SamsarRequestOptions): Promise<SamsarResult<ExternalChatCompletionResponse>>;
|
|
2673
|
+
/**
|
|
2674
|
+
* OpenAI-compatible external chat completion billed through Samsar credits.
|
|
2675
|
+
*/
|
|
2676
|
+
createExternalChatCompletion(payload: ExternalChatCompletionRequest, options?: SamsarRequestOptions): Promise<SamsarResult<ExternalChatCompletionResponse>>;
|
|
2677
|
+
/**
|
|
2678
|
+
* OpenAI-compatible external chat completion billed through Samsar credits.
|
|
2679
|
+
* This calls POST /v2/external/chat/completions.
|
|
2680
|
+
*/
|
|
2681
|
+
createV2ExternalChatCompletion(payload: ExternalChatCompletionRequest, options?: SamsarRequestOptions): Promise<SamsarResult<ExternalChatCompletionResponse>>;
|
|
2682
|
+
/**
|
|
2683
|
+
* Low-level wrapper for POST /v2/external/image/{path}. The external image surface mirrors
|
|
2684
|
+
* the existing image API paths, for example assign_title, enhance, remove_branding,
|
|
2685
|
+
* add_image_set, create_rollup_banner, and receipt_templates/query.
|
|
2686
|
+
*/
|
|
2687
|
+
requestExternalImage<T = ExternalMediaResponse>(path: string, payload?: ExternalMediaRequest, options?: SamsarRequestOptions): Promise<SamsarResult<T>>;
|
|
2688
|
+
/**
|
|
2689
|
+
* Low-level wrapper for POST /v2/external/image/{path}.
|
|
2690
|
+
*/
|
|
2691
|
+
requestV2ExternalImage<T = ExternalMediaResponse>(path: string, payload?: ExternalMediaRequest, options?: SamsarRequestOptions): Promise<SamsarResult<T>>;
|
|
2692
|
+
/**
|
|
2693
|
+
* Retrieve status for an async /external/image request.
|
|
2694
|
+
*/
|
|
2695
|
+
getExternalImageStatus(requestId: string, options?: SamsarRequestOptions & {
|
|
2696
|
+
queryParams?: QueryParams;
|
|
2697
|
+
}): Promise<SamsarResult<GlobalStatusResponse>>;
|
|
2698
|
+
/**
|
|
2699
|
+
* Retrieve status for an async /v2/external/image request.
|
|
2700
|
+
*/
|
|
2701
|
+
getV2ExternalImageStatus(requestId: string, options?: SamsarRequestOptions & {
|
|
2702
|
+
queryParams?: QueryParams;
|
|
2703
|
+
}): Promise<SamsarResult<GlobalStatusResponse>>;
|
|
2704
|
+
/**
|
|
2705
|
+
* Low-level wrapper for POST /v2/external/video/{path}. The external video surface mirrors
|
|
2706
|
+
* the existing video API paths, including text_to_video, image_list_to_video,
|
|
2707
|
+
* upload_image_data, update_outro_image, translate_video, join_videos, and clone.
|
|
2708
|
+
*/
|
|
2709
|
+
requestExternalVideo<T = ExternalMediaResponse>(path: string, payload?: ExternalMediaRequest, options?: SamsarRequestOptions): Promise<SamsarResult<T>>;
|
|
2710
|
+
/**
|
|
2711
|
+
* Low-level wrapper for POST /v2/external/video/{path}.
|
|
2712
|
+
*/
|
|
2713
|
+
requestV2ExternalVideo<T = ExternalMediaResponse>(path: string, payload?: ExternalMediaRequest, options?: SamsarRequestOptions): Promise<SamsarResult<T>>;
|
|
2714
|
+
/**
|
|
2715
|
+
* Create a central /v2/external/video text-to-video request using the same input shape as createVideoFromText.
|
|
2716
|
+
*/
|
|
2717
|
+
createExternalVideoRequestFromText(input: CreateVideoFromTextInput, options?: {
|
|
2718
|
+
webhookUrl?: string;
|
|
2719
|
+
} & SamsarRequestOptions): Promise<SamsarResult<ExternalMediaResponse>>;
|
|
2720
|
+
/**
|
|
2721
|
+
* Create a central /v2/external/video text-to-video request using the same input shape as createVideoFromText.
|
|
2722
|
+
*/
|
|
2723
|
+
createV2ExternalVideoRequestFromText(input: CreateVideoFromTextInput, options?: {
|
|
2724
|
+
webhookUrl?: string;
|
|
2725
|
+
} & SamsarRequestOptions): Promise<SamsarResult<ExternalMediaResponse>>;
|
|
2726
|
+
/**
|
|
2727
|
+
* Create a central /v2/external/video image-list-to-video request using the same input shape as createVideoFromImageList.
|
|
2728
|
+
*/
|
|
2729
|
+
createExternalVideoRequestFromImageList(input: CreateVideoFromImageListInput, options?: {
|
|
2730
|
+
webhookUrl?: string;
|
|
2731
|
+
} & SamsarRequestOptions): Promise<SamsarResult<ExternalMediaResponse>>;
|
|
2732
|
+
/**
|
|
2733
|
+
* Create a central /v2/external/video image-list-to-video request using the same input shape as createVideoFromImageList.
|
|
2734
|
+
*/
|
|
2735
|
+
createV2ExternalVideoRequestFromImageList(input: CreateVideoFromImageListInput, options?: {
|
|
2736
|
+
webhookUrl?: string;
|
|
2737
|
+
} & SamsarRequestOptions): Promise<SamsarResult<ExternalMediaResponse>>;
|
|
2738
|
+
/**
|
|
2739
|
+
* Retrieve status for an async /external/video request.
|
|
2740
|
+
*/
|
|
2741
|
+
getExternalVideoStatus(requestId: string, options?: SamsarRequestOptions & {
|
|
2742
|
+
queryParams?: QueryParams;
|
|
2743
|
+
}): Promise<SamsarResult<GlobalStatusResponse>>;
|
|
2744
|
+
/**
|
|
2745
|
+
* Retrieve status for an async /v2/external/video request.
|
|
2746
|
+
*/
|
|
2747
|
+
getV2ExternalVideoStatus(requestId: string, options?: SamsarRequestOptions & {
|
|
2748
|
+
queryParams?: QueryParams;
|
|
2749
|
+
}): Promise<SamsarResult<GlobalStatusResponse>>;
|
|
2750
|
+
/**
|
|
2751
|
+
* Reserved wrapper for POST /v2/external/audio. The processor currently returns 501 until
|
|
2752
|
+
* the external audio request schema is enabled.
|
|
2753
|
+
*/
|
|
2754
|
+
requestExternalAudio<T = ExternalMediaResponse>(payload?: ExternalMediaRequest, options?: SamsarRequestOptions): Promise<SamsarResult<T>>;
|
|
2755
|
+
/**
|
|
2756
|
+
* Reserved wrapper for POST /v2/external/audio. The processor currently returns 501 until
|
|
2757
|
+
* the external audio request schema is enabled.
|
|
2758
|
+
*/
|
|
2759
|
+
requestV2ExternalAudio<T = ExternalMediaResponse>(payload?: ExternalMediaRequest, options?: SamsarRequestOptions): Promise<SamsarResult<T>>;
|
|
2547
2760
|
private get;
|
|
2548
2761
|
private post;
|
|
2549
2762
|
private postForm;
|
package/dist/index.js
CHANGED
|
@@ -2221,6 +2221,179 @@ export class SamsarClient {
|
|
|
2221
2221
|
async getImageStatus(requestId, options) {
|
|
2222
2222
|
return this.getStatus(requestId, { ...options, path: 'image/status' });
|
|
2223
2223
|
}
|
|
2224
|
+
/**
|
|
2225
|
+
* Validate the configured Samsar API key, or a supplied key, against /external/api_key/validate.
|
|
2226
|
+
*/
|
|
2227
|
+
async validateSamsarApiKey(apiKey, options) {
|
|
2228
|
+
return this.validateV2ExternalSamsarApiKey(apiKey, options);
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Validate the configured Samsar API key, or a supplied key, against /v2/external/api_key/validate.
|
|
2232
|
+
*/
|
|
2233
|
+
async validateV2ExternalSamsarApiKey(apiKey, options) {
|
|
2234
|
+
const headers = apiKey
|
|
2235
|
+
? { ...(options?.headers ?? {}), Authorization: `Bearer ${apiKey}` }
|
|
2236
|
+
: options?.headers;
|
|
2237
|
+
return this.get(this.buildV2Url('external/api_key/validate'), {
|
|
2238
|
+
...(options ?? {}),
|
|
2239
|
+
headers,
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
/**
|
|
2243
|
+
* Fetch provider/model/action capabilities used by the deployment onboarding flow.
|
|
2244
|
+
*/
|
|
2245
|
+
async getExternalProviderCapabilities(options) {
|
|
2246
|
+
return this.getV2ExternalProviderCapabilities(options);
|
|
2247
|
+
}
|
|
2248
|
+
/**
|
|
2249
|
+
* Fetch provider/model/action capabilities from /v2/external/providers/capabilities.
|
|
2250
|
+
*/
|
|
2251
|
+
async getV2ExternalProviderCapabilities(options) {
|
|
2252
|
+
return this.get(this.buildV2Url('external/providers/capabilities'), options);
|
|
2253
|
+
}
|
|
2254
|
+
/**
|
|
2255
|
+
* Validate onboarding provider credentials without storing secrets in the SDK.
|
|
2256
|
+
*/
|
|
2257
|
+
async validateDeploymentProviders(payload, options) {
|
|
2258
|
+
return this.validateV2ExternalDeploymentProviders(payload, options);
|
|
2259
|
+
}
|
|
2260
|
+
/**
|
|
2261
|
+
* Validate onboarding provider credentials through /v2/external/providers/validate.
|
|
2262
|
+
*/
|
|
2263
|
+
async validateV2ExternalDeploymentProviders(payload, options) {
|
|
2264
|
+
return this.post(this.buildV2Url('external/providers/validate'), payload, options);
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* OpenAI-compatible external chat request billed through Samsar credits.
|
|
2268
|
+
* This calls POST /external/chat.
|
|
2269
|
+
*/
|
|
2270
|
+
async createExternalChat(payload, options) {
|
|
2271
|
+
return this.createV2ExternalChat(payload, options);
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* OpenAI-compatible external chat request billed through Samsar credits.
|
|
2275
|
+
* This calls POST /v2/external/chat.
|
|
2276
|
+
*/
|
|
2277
|
+
async createV2ExternalChat(payload, options) {
|
|
2278
|
+
return this.post(this.buildV2Url('external/chat'), payload, options);
|
|
2279
|
+
}
|
|
2280
|
+
/**
|
|
2281
|
+
* OpenAI-compatible external chat completion billed through Samsar credits.
|
|
2282
|
+
*/
|
|
2283
|
+
async createExternalChatCompletion(payload, options) {
|
|
2284
|
+
return this.createV2ExternalChatCompletion(payload, options);
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* OpenAI-compatible external chat completion billed through Samsar credits.
|
|
2288
|
+
* This calls POST /v2/external/chat/completions.
|
|
2289
|
+
*/
|
|
2290
|
+
async createV2ExternalChatCompletion(payload, options) {
|
|
2291
|
+
return this.post(this.buildV2Url('external/chat/completions'), payload, options);
|
|
2292
|
+
}
|
|
2293
|
+
/**
|
|
2294
|
+
* Low-level wrapper for POST /v2/external/image/{path}. The external image surface mirrors
|
|
2295
|
+
* the existing image API paths, for example assign_title, enhance, remove_branding,
|
|
2296
|
+
* add_image_set, create_rollup_banner, and receipt_templates/query.
|
|
2297
|
+
*/
|
|
2298
|
+
async requestExternalImage(path, payload = {}, options) {
|
|
2299
|
+
return this.requestV2ExternalImage(path, payload, options);
|
|
2300
|
+
}
|
|
2301
|
+
/**
|
|
2302
|
+
* Low-level wrapper for POST /v2/external/image/{path}.
|
|
2303
|
+
*/
|
|
2304
|
+
async requestV2ExternalImage(path, payload = {}, options) {
|
|
2305
|
+
return this.post(this.buildV2Url(`external/image/${normalizeExternalRoutePath(path)}`), payload, options);
|
|
2306
|
+
}
|
|
2307
|
+
/**
|
|
2308
|
+
* Retrieve status for an async /external/image request.
|
|
2309
|
+
*/
|
|
2310
|
+
async getExternalImageStatus(requestId, options) {
|
|
2311
|
+
return this.getV2ExternalImageStatus(requestId, options);
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Retrieve status for an async /v2/external/image request.
|
|
2315
|
+
*/
|
|
2316
|
+
async getV2ExternalImageStatus(requestId, options) {
|
|
2317
|
+
return this.getStatus(requestId, {
|
|
2318
|
+
...options,
|
|
2319
|
+
path: this.buildV2Url('external/image/status'),
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
/**
|
|
2323
|
+
* Low-level wrapper for POST /v2/external/video/{path}. The external video surface mirrors
|
|
2324
|
+
* the existing video API paths, including text_to_video, image_list_to_video,
|
|
2325
|
+
* upload_image_data, update_outro_image, translate_video, join_videos, and clone.
|
|
2326
|
+
*/
|
|
2327
|
+
async requestExternalVideo(path, payload = {}, options) {
|
|
2328
|
+
return this.requestV2ExternalVideo(path, payload, options);
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
* Low-level wrapper for POST /v2/external/video/{path}.
|
|
2332
|
+
*/
|
|
2333
|
+
async requestV2ExternalVideo(path, payload = {}, options) {
|
|
2334
|
+
return this.post(this.buildV2Url(`external/video/${normalizeExternalRoutePath(path)}`), payload, options);
|
|
2335
|
+
}
|
|
2336
|
+
/**
|
|
2337
|
+
* Create a central /v2/external/video text-to-video request using the same input shape as createVideoFromText.
|
|
2338
|
+
*/
|
|
2339
|
+
async createExternalVideoRequestFromText(input, options) {
|
|
2340
|
+
return this.createV2ExternalVideoRequestFromText(input, options);
|
|
2341
|
+
}
|
|
2342
|
+
/**
|
|
2343
|
+
* Create a central /v2/external/video text-to-video request using the same input shape as createVideoFromText.
|
|
2344
|
+
*/
|
|
2345
|
+
async createV2ExternalVideoRequestFromText(input, options) {
|
|
2346
|
+
const normalizedInput = normalizeCreateVideoFromTextInput(input);
|
|
2347
|
+
return this.requestV2ExternalVideo('text_to_video', {
|
|
2348
|
+
input: normalizedInput,
|
|
2349
|
+
webhookUrl: options?.webhookUrl,
|
|
2350
|
+
}, options);
|
|
2351
|
+
}
|
|
2352
|
+
/**
|
|
2353
|
+
* Create a central /v2/external/video image-list-to-video request using the same input shape as createVideoFromImageList.
|
|
2354
|
+
*/
|
|
2355
|
+
async createExternalVideoRequestFromImageList(input, options) {
|
|
2356
|
+
return this.createV2ExternalVideoRequestFromImageList(input, options);
|
|
2357
|
+
}
|
|
2358
|
+
/**
|
|
2359
|
+
* Create a central /v2/external/video image-list-to-video request using the same input shape as createVideoFromImageList.
|
|
2360
|
+
*/
|
|
2361
|
+
async createV2ExternalVideoRequestFromImageList(input, options) {
|
|
2362
|
+
const normalizedInput = normalizeCreateVideoFromImageListInput(input);
|
|
2363
|
+
return this.requestV2ExternalVideo('image_list_to_video', {
|
|
2364
|
+
input: normalizedInput,
|
|
2365
|
+
webhookUrl: options?.webhookUrl,
|
|
2366
|
+
}, options);
|
|
2367
|
+
}
|
|
2368
|
+
/**
|
|
2369
|
+
* Retrieve status for an async /external/video request.
|
|
2370
|
+
*/
|
|
2371
|
+
async getExternalVideoStatus(requestId, options) {
|
|
2372
|
+
return this.getV2ExternalVideoStatus(requestId, options);
|
|
2373
|
+
}
|
|
2374
|
+
/**
|
|
2375
|
+
* Retrieve status for an async /v2/external/video request.
|
|
2376
|
+
*/
|
|
2377
|
+
async getV2ExternalVideoStatus(requestId, options) {
|
|
2378
|
+
return this.getStatus(requestId, {
|
|
2379
|
+
...options,
|
|
2380
|
+
path: this.buildV2Url('external/video/status'),
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
/**
|
|
2384
|
+
* Reserved wrapper for POST /v2/external/audio. The processor currently returns 501 until
|
|
2385
|
+
* the external audio request schema is enabled.
|
|
2386
|
+
*/
|
|
2387
|
+
async requestExternalAudio(payload = {}, options) {
|
|
2388
|
+
return this.requestV2ExternalAudio(payload, options);
|
|
2389
|
+
}
|
|
2390
|
+
/**
|
|
2391
|
+
* Reserved wrapper for POST /v2/external/audio. The processor currently returns 501 until
|
|
2392
|
+
* the external audio request schema is enabled.
|
|
2393
|
+
*/
|
|
2394
|
+
async requestV2ExternalAudio(payload = {}, options) {
|
|
2395
|
+
return this.post(this.buildV2Url('external/audio'), payload, options);
|
|
2396
|
+
}
|
|
2224
2397
|
async get(path, options) {
|
|
2225
2398
|
return this.request(path, { ...(options ?? {}), method: 'GET' });
|
|
2226
2399
|
}
|
|
@@ -2394,6 +2567,13 @@ export class SamsarClient {
|
|
|
2394
2567
|
function trimTrailingSlash(url) {
|
|
2395
2568
|
return url.replace(/\/+$/, '');
|
|
2396
2569
|
}
|
|
2570
|
+
function normalizeExternalRoutePath(path) {
|
|
2571
|
+
const cleanedPath = String(path || '').trim().replace(/^\/+|\/+$/g, '');
|
|
2572
|
+
if (!cleanedPath) {
|
|
2573
|
+
throw new Error('external route path is required');
|
|
2574
|
+
}
|
|
2575
|
+
return cleanedPath;
|
|
2576
|
+
}
|
|
2397
2577
|
function buildAssignImageTitleBody(payload) {
|
|
2398
2578
|
if (isFormDataBody(payload)) {
|
|
2399
2579
|
return payload;
|