@runwayml/sdk 3.6.0 → 3.8.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/CHANGELOG.md +16 -0
- package/client.d.mts +5 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +5 -2
- package/client.d.ts.map +1 -1
- package/client.js +5 -2
- package/client.js.map +1 -1
- package/client.mjs +5 -2
- package/client.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/package.json +1 -1
- package/resources/image-to-video.d.mts +45 -37
- package/resources/image-to-video.d.mts.map +1 -1
- package/resources/image-to-video.d.ts +45 -37
- package/resources/image-to-video.d.ts.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/speech-to-speech.d.mts +1 -1
- package/resources/speech-to-speech.d.ts +1 -1
- package/resources/text-to-image.d.mts +111 -90
- package/resources/text-to-image.d.mts.map +1 -1
- package/resources/text-to-image.d.ts +111 -90
- package/resources/text-to-image.d.ts.map +1 -1
- package/resources/text-to-video.d.mts +8 -0
- package/resources/text-to-video.d.mts.map +1 -1
- package/resources/text-to-video.d.ts +8 -0
- package/resources/text-to-video.d.ts.map +1 -1
- package/resources/uploads.d.mts +33 -0
- package/resources/uploads.d.mts.map +1 -0
- package/resources/uploads.d.ts +33 -0
- package/resources/uploads.d.ts.map +1 -0
- package/resources/uploads.js +75 -0
- package/resources/uploads.js.map +1 -0
- package/resources/uploads.mjs +70 -0
- package/resources/uploads.mjs.map +1 -0
- package/src/client.ts +11 -2
- package/src/resources/image-to-video.ts +54 -44
- package/src/resources/index.ts +1 -0
- package/src/resources/speech-to-speech.ts +1 -1
- package/src/resources/text-to-image.ts +173 -116
- package/src/resources/text-to-video.ts +10 -0
- package/src/resources/uploads.ts +135 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -8,106 +8,127 @@ export declare class TextToImage extends APIResource {
|
|
|
8
8
|
create(body: TextToImageCreateParams, options?: RequestOptions): APIPromiseWithAwaitableTask<TextToImageCreateResponse>;
|
|
9
9
|
}
|
|
10
10
|
export interface TextToImageCreateResponse {
|
|
11
|
-
/**
|
|
12
|
-
* The ID of the newly created task.
|
|
13
|
-
*/
|
|
14
11
|
id: string;
|
|
15
12
|
}
|
|
16
|
-
export
|
|
17
|
-
/**
|
|
18
|
-
* The model variant to use.
|
|
19
|
-
*/
|
|
20
|
-
model: 'gen4_image_turbo' | 'gen4_image' | 'gemini_2.5_flash';
|
|
21
|
-
/**
|
|
22
|
-
* A non-empty string up to 1000 characters (measured in UTF-16 code units). This
|
|
23
|
-
* should describe in detail what should appear in the output.
|
|
24
|
-
*/
|
|
25
|
-
promptText: string;
|
|
26
|
-
/**
|
|
27
|
-
* The resolution of the output image.
|
|
28
|
-
*
|
|
29
|
-
* `gen4_image_turbo`, `gen4_image` support the following values:
|
|
30
|
-
*
|
|
31
|
-
* - `1920:1080`
|
|
32
|
-
* - `1080:1920`
|
|
33
|
-
* - `1024:1024`
|
|
34
|
-
* - `1360:768`
|
|
35
|
-
* - `1080:1080`
|
|
36
|
-
* - `1168:880`
|
|
37
|
-
* - `1440:1080`
|
|
38
|
-
* - `1080:1440`
|
|
39
|
-
* - `1808:768`
|
|
40
|
-
* - `2112:912`
|
|
41
|
-
* - `1280:720`
|
|
42
|
-
* - `720:1280`
|
|
43
|
-
* - `720:720`
|
|
44
|
-
* - `960:720`
|
|
45
|
-
* - `720:960`
|
|
46
|
-
* - `1680:720`
|
|
47
|
-
*
|
|
48
|
-
* `gemini_2.5_flash` supports the following values:
|
|
49
|
-
*
|
|
50
|
-
* - `1344:768`
|
|
51
|
-
* - `768:1344`
|
|
52
|
-
* - `1024:1024`
|
|
53
|
-
* - `1184:864`
|
|
54
|
-
* - `864:1184`
|
|
55
|
-
* - `1536:672`
|
|
56
|
-
* - `832x1248`
|
|
57
|
-
* - `1248x832`
|
|
58
|
-
* - `896x1152`
|
|
59
|
-
* - `1152x896`
|
|
60
|
-
*/
|
|
61
|
-
ratio: '1920:1080' | '1080:1920' | '1024:1024' | '1360:768' | '1080:1080' | '1168:880' | '1440:1080' | '1080:1440' | '1808:768' | '2112:912' | '1280:720' | '720:1280' | '720:720' | '960:720' | '720:960' | '1680:720' | '1344:768' | '768:1344' | '1184:864' | '864:1184' | '1536:672' | '832x1248' | '1248x832' | '896x1152' | '1152x896';
|
|
62
|
-
/**
|
|
63
|
-
* Settings that affect the behavior of the content moderation system.
|
|
64
|
-
*
|
|
65
|
-
* This field is allowed only for the following model variants: `gen4_image_turbo`,
|
|
66
|
-
* `gen4_image`
|
|
67
|
-
*/
|
|
68
|
-
contentModeration?: TextToImageCreateParams.ContentModeration;
|
|
69
|
-
/**
|
|
70
|
-
* An array of up to three images to be used as references for the generated image
|
|
71
|
-
* output.
|
|
72
|
-
*
|
|
73
|
-
* For `gen4_image_turbo`, _at least one_ reference image is required.
|
|
74
|
-
*/
|
|
75
|
-
referenceImages?: Array<TextToImageCreateParams.ReferenceImage>;
|
|
76
|
-
/**
|
|
77
|
-
* If unspecified, a random number is chosen. Varying the seed integer is a way to
|
|
78
|
-
* get different results for the same other request parameters. Using the same seed
|
|
79
|
-
* integer for an identical request will produce similar results.
|
|
80
|
-
*/
|
|
81
|
-
seed?: number;
|
|
82
|
-
}
|
|
13
|
+
export type TextToImageCreateParams = TextToImageCreateParams.Gen4ImageTurbo | TextToImageCreateParams.Gen4Image | TextToImageCreateParams.Gemini2_5Flash;
|
|
83
14
|
export declare namespace TextToImageCreateParams {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
15
|
+
interface Gen4ImageTurbo {
|
|
16
|
+
model: 'gen4_image_turbo';
|
|
17
|
+
/**
|
|
18
|
+
* A non-empty string up to 1000 characters (measured in UTF-16 code units). This
|
|
19
|
+
* should describe in detail what should appear in the output.
|
|
20
|
+
*/
|
|
21
|
+
promptText: string;
|
|
22
|
+
/**
|
|
23
|
+
* The resolution of the output image.
|
|
24
|
+
*/
|
|
25
|
+
ratio: '1024:1024' | '1080:1080' | '1168:880' | '1360:768' | '1440:1080' | '1080:1440' | '1808:768' | '1920:1080' | '1080:1920' | '2112:912' | '1280:720' | '720:1280' | '720:720' | '960:720' | '720:960' | '1680:720';
|
|
26
|
+
/**
|
|
27
|
+
* An array of one to three images to be used as references for the generated image
|
|
28
|
+
* output.
|
|
29
|
+
*/
|
|
30
|
+
referenceImages: Array<Gen4ImageTurbo.ReferenceImage>;
|
|
91
31
|
/**
|
|
92
|
-
*
|
|
93
|
-
* preventing generations that include recognizable public figures.
|
|
32
|
+
* Settings that affect the behavior of the content moderation system.
|
|
94
33
|
*/
|
|
95
|
-
|
|
34
|
+
contentModeration?: Gen4ImageTurbo.ContentModeration;
|
|
35
|
+
/**
|
|
36
|
+
* If unspecified, a random number is chosen. Varying the seed integer is a way to
|
|
37
|
+
* get different results for the same other request parameters. Using the same seed
|
|
38
|
+
* integer for an identical request will produce similar results.
|
|
39
|
+
*/
|
|
40
|
+
seed?: number;
|
|
41
|
+
}
|
|
42
|
+
namespace Gen4ImageTurbo {
|
|
43
|
+
interface ReferenceImage {
|
|
44
|
+
/**
|
|
45
|
+
* A HTTPS URL.
|
|
46
|
+
*/
|
|
47
|
+
uri: string;
|
|
48
|
+
tag?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Settings that affect the behavior of the content moderation system.
|
|
52
|
+
*/
|
|
53
|
+
interface ContentModeration {
|
|
54
|
+
/**
|
|
55
|
+
* When set to `low`, the content moderation system will be less strict about
|
|
56
|
+
* preventing generations that include recognizable public figures.
|
|
57
|
+
*/
|
|
58
|
+
publicFigureThreshold?: 'auto' | 'low';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
interface Gen4Image {
|
|
62
|
+
model: 'gen4_image';
|
|
63
|
+
/**
|
|
64
|
+
* A non-empty string up to 1000 characters (measured in UTF-16 code units). This
|
|
65
|
+
* should describe in detail what should appear in the output.
|
|
66
|
+
*/
|
|
67
|
+
promptText: string;
|
|
68
|
+
/**
|
|
69
|
+
* The resolution of the output image.
|
|
70
|
+
*/
|
|
71
|
+
ratio: '1024:1024' | '1080:1080' | '1168:880' | '1360:768' | '1440:1080' | '1080:1440' | '1808:768' | '1920:1080' | '1080:1920' | '2112:912' | '1280:720' | '720:1280' | '720:720' | '960:720' | '720:960' | '1680:720';
|
|
72
|
+
/**
|
|
73
|
+
* Settings that affect the behavior of the content moderation system.
|
|
74
|
+
*/
|
|
75
|
+
contentModeration?: Gen4Image.ContentModeration;
|
|
76
|
+
/**
|
|
77
|
+
* An array of up to three images to be used as references for the generated image
|
|
78
|
+
* output.
|
|
79
|
+
*/
|
|
80
|
+
referenceImages?: Array<Gen4Image.ReferenceImage>;
|
|
81
|
+
/**
|
|
82
|
+
* If unspecified, a random number is chosen. Varying the seed integer is a way to
|
|
83
|
+
* get different results for the same other request parameters. Using the same seed
|
|
84
|
+
* integer for an identical request will produce similar results.
|
|
85
|
+
*/
|
|
86
|
+
seed?: number;
|
|
96
87
|
}
|
|
97
|
-
|
|
88
|
+
namespace Gen4Image {
|
|
98
89
|
/**
|
|
99
|
-
*
|
|
100
|
-
* the generated output image. See [our docs](/assets/inputs#images) on image
|
|
101
|
-
* inputs for more information.
|
|
90
|
+
* Settings that affect the behavior of the content moderation system.
|
|
102
91
|
*/
|
|
103
|
-
|
|
92
|
+
interface ContentModeration {
|
|
93
|
+
/**
|
|
94
|
+
* When set to `low`, the content moderation system will be less strict about
|
|
95
|
+
* preventing generations that include recognizable public figures.
|
|
96
|
+
*/
|
|
97
|
+
publicFigureThreshold?: 'auto' | 'low';
|
|
98
|
+
}
|
|
99
|
+
interface ReferenceImage {
|
|
100
|
+
/**
|
|
101
|
+
* A HTTPS URL.
|
|
102
|
+
*/
|
|
103
|
+
uri: string;
|
|
104
|
+
tag?: string;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
interface Gemini2_5Flash {
|
|
108
|
+
model: 'gemini_2.5_flash';
|
|
104
109
|
/**
|
|
105
|
-
* A
|
|
106
|
-
*
|
|
107
|
-
* refer to the reference image's tag in the prompt text with at-mention syntax:
|
|
108
|
-
* `@tag`. Tags are case-sensitive.
|
|
110
|
+
* A non-empty string up to 1000 characters (measured in UTF-16 code units). This
|
|
111
|
+
* should describe in detail what should appear in the output.
|
|
109
112
|
*/
|
|
110
|
-
|
|
113
|
+
promptText: string;
|
|
114
|
+
/**
|
|
115
|
+
* The resolution of the output image.
|
|
116
|
+
*/
|
|
117
|
+
ratio: '1344:768' | '768:1344' | '1024:1024' | '1184:864' | '864:1184' | '1536:672' | '832:1248' | '1248:832' | '896:1152' | '1152:896';
|
|
118
|
+
/**
|
|
119
|
+
* An array of up to three images to be used as references for the generated image
|
|
120
|
+
* output.
|
|
121
|
+
*/
|
|
122
|
+
referenceImages?: Array<Gemini2_5Flash.ReferenceImage>;
|
|
123
|
+
}
|
|
124
|
+
namespace Gemini2_5Flash {
|
|
125
|
+
interface ReferenceImage {
|
|
126
|
+
/**
|
|
127
|
+
* A HTTPS URL.
|
|
128
|
+
*/
|
|
129
|
+
uri: string;
|
|
130
|
+
tag?: string;
|
|
131
|
+
}
|
|
111
132
|
}
|
|
112
133
|
}
|
|
113
134
|
export declare namespace TextToImage {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-to-image.d.ts","sourceRoot":"","sources":["../src/resources/text-to-image.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,cAAc,EAAE;OAClB,EAAE,2BAA2B,EAA0B;AAE9D,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,2BAA2B,CAAC,yBAAyB,CAAC;CAK1D;AAED,MAAM,WAAW,yBAAyB;IACxC
|
|
1
|
+
{"version":3,"file":"text-to-image.d.ts","sourceRoot":"","sources":["../src/resources/text-to-image.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,cAAc,EAAE;OAClB,EAAE,2BAA2B,EAA0B;AAE9D,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,2BAA2B,CAAC,yBAAyB,CAAC;CAK1D;AAED,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,uBAAuB,GAC/B,uBAAuB,CAAC,cAAc,GACtC,uBAAuB,CAAC,SAAS,GACjC,uBAAuB,CAAC,cAAc,CAAC;AAE3C,MAAM,CAAC,OAAO,WAAW,uBAAuB,CAAC;IAC/C,UAAiB,cAAc;QAC7B,KAAK,EAAE,kBAAkB,CAAC;QAE1B;;;WAGG;QACH,UAAU,EAAE,MAAM,CAAC;QAEnB;;WAEG;QACH,KAAK,EACD,WAAW,GACX,WAAW,GACX,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,UAAU,GACV,WAAW,GACX,WAAW,GACX,UAAU,GACV,UAAU,GACV,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,GACT,UAAU,CAAC;QAEf;;;WAGG;QACH,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAEtD;;WAEG;QACH,iBAAiB,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC;QAErD;;;;WAIG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,cAAc,CAAC;QAC9B,UAAiB,cAAc;YAC7B;;eAEG;YACH,GAAG,EAAE,MAA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AAC;QAC9B,UAAiB,cAAc;YAC7B;;eAEG;YACH,GAAG,EAAE,MAAM,CAAC;YAEZ,GAAG,CAAC,EAAE,MAAM,CAAC;SACd;KACF;CACF;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
|
|
@@ -23,6 +23,10 @@ export declare namespace TextToVideoCreateParams {
|
|
|
23
23
|
* The resolution of the output video.
|
|
24
24
|
*/
|
|
25
25
|
ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080';
|
|
26
|
+
/**
|
|
27
|
+
* Whether to generate audio for the video. Audio inclusion affects pricing.
|
|
28
|
+
*/
|
|
29
|
+
audio?: boolean;
|
|
26
30
|
/**
|
|
27
31
|
* The number of seconds of duration for the output video.
|
|
28
32
|
*/
|
|
@@ -39,6 +43,10 @@ export declare namespace TextToVideoCreateParams {
|
|
|
39
43
|
* The resolution of the output video.
|
|
40
44
|
*/
|
|
41
45
|
ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080';
|
|
46
|
+
/**
|
|
47
|
+
* Whether to generate audio for the video. Audio inclusion affects pricing.
|
|
48
|
+
*/
|
|
49
|
+
audio?: boolean;
|
|
42
50
|
/**
|
|
43
51
|
* The number of seconds of duration for the output video.
|
|
44
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-to-video.d.mts","sourceRoot":"","sources":["../src/resources/text-to-video.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,cAAc,EAAE;OAClB,EAAE,2BAA2B,EAA0B;AAE9D,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,2BAA2B,CAAC,yBAAyB,CAAC;CAK1D;AAED,MAAM,WAAW,yBA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C,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
|
|
@@ -23,6 +23,10 @@ export declare namespace TextToVideoCreateParams {
|
|
|
23
23
|
* The resolution of the output video.
|
|
24
24
|
*/
|
|
25
25
|
ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080';
|
|
26
|
+
/**
|
|
27
|
+
* Whether to generate audio for the video. Audio inclusion affects pricing.
|
|
28
|
+
*/
|
|
29
|
+
audio?: boolean;
|
|
26
30
|
/**
|
|
27
31
|
* The number of seconds of duration for the output video.
|
|
28
32
|
*/
|
|
@@ -39,6 +43,10 @@ export declare namespace TextToVideoCreateParams {
|
|
|
39
43
|
* The resolution of the output video.
|
|
40
44
|
*/
|
|
41
45
|
ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080';
|
|
46
|
+
/**
|
|
47
|
+
* Whether to generate audio for the video. Audio inclusion affects pricing.
|
|
48
|
+
*/
|
|
49
|
+
audio?: boolean;
|
|
42
50
|
/**
|
|
43
51
|
* The number of seconds of duration for the output video.
|
|
44
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-to-video.d.ts","sourceRoot":"","sources":["../src/resources/text-to-video.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,cAAc,EAAE;OAClB,EAAE,2BAA2B,EAA0B;AAE9D,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,2BAA2B,CAAC,yBAAyB,CAAC;CAK1D;AAED,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,uBAAuB,GAC/B,uBAAuB,CAAC,MAAM,GAC9B,uBAAuB,CAAC,UAAU,GAClC,uBAAuB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 -0,0 +1,33 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
3
|
+
import { Uploadable } from "../internal/uploads.mjs";
|
|
4
|
+
export declare class Uploads extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Uploads a temporary media file that can be used in other API generation
|
|
7
|
+
* requests.
|
|
8
|
+
*
|
|
9
|
+
* The uploaded files will be automatically expired and deleted after a
|
|
10
|
+
* period of time.
|
|
11
|
+
*/
|
|
12
|
+
createEphemeral(params: UploadsCreateEphemeralParams, options?: RequestOptions): Promise<UploadCreateEphemeralResponse>;
|
|
13
|
+
}
|
|
14
|
+
export interface UploadCreateEphemeralResponse {
|
|
15
|
+
/**
|
|
16
|
+
* The Runway upload URI to use in other API generation requests.
|
|
17
|
+
*/
|
|
18
|
+
uri: string;
|
|
19
|
+
}
|
|
20
|
+
export interface UploadsCreateEphemeralParams {
|
|
21
|
+
/**
|
|
22
|
+
* The file to upload. Must be a supported media type (image, video, or audio).
|
|
23
|
+
*/
|
|
24
|
+
file: Uploadable;
|
|
25
|
+
/**
|
|
26
|
+
* Optional metadata for the file, serialized as a field in multipart/form-data.
|
|
27
|
+
*/
|
|
28
|
+
fileMetadata?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare namespace Uploads {
|
|
31
|
+
export { type UploadCreateEphemeralResponse as UploadCreateEphemeralResponse, type UploadsCreateEphemeralParams as UploadsCreateEphemeralParams, };
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=uploads.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["../src/resources/uploads.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,cAAc,EAAE;OAClB,EAAE,UAAU,EAAE;AA+DrB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;OAMG;IACG,eAAe,CACnB,MAAM,EAAE,4BAA4B,EACpC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,6BAA6B,CAAC;CA8B1C;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,4BAA4B,IAAI,4BAA4B,GAClE,CAAC;CACH"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
3
|
+
import { Uploadable } from "../internal/uploads.js";
|
|
4
|
+
export declare class Uploads extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Uploads a temporary media file that can be used in other API generation
|
|
7
|
+
* requests.
|
|
8
|
+
*
|
|
9
|
+
* The uploaded files will be automatically expired and deleted after a
|
|
10
|
+
* period of time.
|
|
11
|
+
*/
|
|
12
|
+
createEphemeral(params: UploadsCreateEphemeralParams, options?: RequestOptions): Promise<UploadCreateEphemeralResponse>;
|
|
13
|
+
}
|
|
14
|
+
export interface UploadCreateEphemeralResponse {
|
|
15
|
+
/**
|
|
16
|
+
* The Runway upload URI to use in other API generation requests.
|
|
17
|
+
*/
|
|
18
|
+
uri: string;
|
|
19
|
+
}
|
|
20
|
+
export interface UploadsCreateEphemeralParams {
|
|
21
|
+
/**
|
|
22
|
+
* The file to upload. Must be a supported media type (image, video, or audio).
|
|
23
|
+
*/
|
|
24
|
+
file: Uploadable;
|
|
25
|
+
/**
|
|
26
|
+
* Optional metadata for the file, serialized as a field in multipart/form-data.
|
|
27
|
+
*/
|
|
28
|
+
fileMetadata?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare namespace Uploads {
|
|
31
|
+
export { type UploadCreateEphemeralResponse as UploadCreateEphemeralResponse, type UploadsCreateEphemeralParams as UploadsCreateEphemeralParams, };
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=uploads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../src/resources/uploads.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,cAAc,EAAE;OAClB,EAAE,UAAU,EAAE;AA+DrB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;OAMG;IACG,eAAe,CACnB,MAAM,EAAE,4BAA4B,EACpC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,6BAA6B,CAAC;CA8B1C;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,4BAA4B,IAAI,4BAA4B,GAClE,CAAC;CACH"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Uploads = void 0;
|
|
5
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
6
|
+
const resource_1 = require("../core/resource.js");
|
|
7
|
+
const to_file_1 = require("../internal/to-file.js");
|
|
8
|
+
const Errors = tslib_1.__importStar(require("../core/error.js"));
|
|
9
|
+
const errors_1 = require("../internal/errors.js");
|
|
10
|
+
async function uploadFileToStorage(uploadUrl, fields, file, fileMetadata, timeout, fetch) {
|
|
11
|
+
const formData = new FormData();
|
|
12
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
13
|
+
formData.append(key, value);
|
|
14
|
+
}
|
|
15
|
+
if (fileMetadata !== undefined) {
|
|
16
|
+
formData.append('metadata', fileMetadata);
|
|
17
|
+
}
|
|
18
|
+
formData.append('file', file);
|
|
19
|
+
const controller = new AbortController();
|
|
20
|
+
const timeoutId = timeout ? setTimeout(() => controller.abort(), timeout) : undefined;
|
|
21
|
+
try {
|
|
22
|
+
const response = await fetch(uploadUrl, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
body: formData,
|
|
25
|
+
signal: controller.signal,
|
|
26
|
+
});
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
const errorText = await response.text().catch(() => '');
|
|
29
|
+
throw new Errors.APIError(response.status, { error: errorText }, `Upload failed with status ${response.status}`, response.headers);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof Errors.APIError) {
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
const err = (0, errors_1.castToError)(error);
|
|
37
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
38
|
+
throw new Errors.APIConnectionTimeoutError();
|
|
39
|
+
}
|
|
40
|
+
throw new Errors.APIConnectionError({ cause: err });
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
if (timeoutId) {
|
|
44
|
+
clearTimeout(timeoutId);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
class Uploads extends resource_1.APIResource {
|
|
49
|
+
/**
|
|
50
|
+
* Uploads a temporary media file that can be used in other API generation
|
|
51
|
+
* requests.
|
|
52
|
+
*
|
|
53
|
+
* The uploaded files will be automatically expired and deleted after a
|
|
54
|
+
* period of time.
|
|
55
|
+
*/
|
|
56
|
+
async createEphemeral(params, options) {
|
|
57
|
+
const { file, fileMetadata } = params;
|
|
58
|
+
const fileObj = await (0, to_file_1.toFile)(file);
|
|
59
|
+
if (!fileObj.name || fileObj.name === 'unknown_file') {
|
|
60
|
+
throw new Error('Cannot infer filename from file. Please provide a File with a name property, ' +
|
|
61
|
+
'or use the toFile() utility with a name parameter to convert your data to a File.');
|
|
62
|
+
}
|
|
63
|
+
const placeholder = await this._client.post('/v1/uploads', {
|
|
64
|
+
body: { filename: fileObj.name, type: 'ephemeral' },
|
|
65
|
+
...options,
|
|
66
|
+
});
|
|
67
|
+
const timeout = options?.timeout ?? this._client.timeout;
|
|
68
|
+
// Access private fetch - using type assertion as it's needed for direct upload
|
|
69
|
+
const fetch = this._client.fetch;
|
|
70
|
+
await uploadFileToStorage(placeholder.uploadUrl, placeholder.fields, fileObj, fileMetadata, timeout, fetch);
|
|
71
|
+
return { uri: placeholder.runwayUri };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.Uploads = Uploads;
|
|
75
|
+
//# sourceMappingURL=uploads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["../src/resources/uploads.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,kDAA+C;AAG/C,oDAA6C;AAE7C,iEAAwC;AACxC,kDAAiD;AAQjD,KAAK,UAAU,mBAAmB,CAChC,SAAiB,EACjB,MAA8B,EAC9B,IAAU,EACV,YAAgC,EAChC,OAA2B,EAC3B,KAAY;IAEZ,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC5C,CAAC;IACD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AAS,EAAE,CAAC;YACd,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CACnB,MAAoC,EACpC,OAAwB;QAExB,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;QACtC,MAAM,OAAO,GAAG,MAAM,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC;QAEnC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CACb,+EAA+E;gBAC7E,mFAAmF,CACtF,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAA8B,aAAa,EAAE;YACtF,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,WAAoB,EAAE;YAC5D,GAAG,OAAO;SACX,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACzD,+EAA+E;QAC/E,MAAM,KAAK,GAAI,IAAI,CAAC,OAAuC,CAAC,KAAK,CAAC;QAClE,MAAM,mBAAmB,CACvB,WAAW,CAAC,SAAS,EACrB,WAAW,CAAC,MAAM,EAClB,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,CACN,CAAC;QAEF,OAAO,EAAE,GAAG,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC;IACxC,CAAC;CACF;AAzCD,0BAyCC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { toFile } from "../internal/to-file.mjs";
|
|
4
|
+
import * as Errors from "../core/error.mjs";
|
|
5
|
+
import { castToError } from "../internal/errors.mjs";
|
|
6
|
+
async function uploadFileToStorage(uploadUrl, fields, file, fileMetadata, timeout, fetch) {
|
|
7
|
+
const formData = new FormData();
|
|
8
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
9
|
+
formData.append(key, value);
|
|
10
|
+
}
|
|
11
|
+
if (fileMetadata !== undefined) {
|
|
12
|
+
formData.append('metadata', fileMetadata);
|
|
13
|
+
}
|
|
14
|
+
formData.append('file', file);
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = timeout ? setTimeout(() => controller.abort(), timeout) : undefined;
|
|
17
|
+
try {
|
|
18
|
+
const response = await fetch(uploadUrl, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
body: formData,
|
|
21
|
+
signal: controller.signal,
|
|
22
|
+
});
|
|
23
|
+
if (!response.ok) {
|
|
24
|
+
const errorText = await response.text().catch(() => '');
|
|
25
|
+
throw new Errors.APIError(response.status, { error: errorText }, `Upload failed with status ${response.status}`, response.headers);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (error instanceof Errors.APIError) {
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
const err = castToError(error);
|
|
33
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
34
|
+
throw new Errors.APIConnectionTimeoutError();
|
|
35
|
+
}
|
|
36
|
+
throw new Errors.APIConnectionError({ cause: err });
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
if (timeoutId) {
|
|
40
|
+
clearTimeout(timeoutId);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export class Uploads extends APIResource {
|
|
45
|
+
/**
|
|
46
|
+
* Uploads a temporary media file that can be used in other API generation
|
|
47
|
+
* requests.
|
|
48
|
+
*
|
|
49
|
+
* The uploaded files will be automatically expired and deleted after a
|
|
50
|
+
* period of time.
|
|
51
|
+
*/
|
|
52
|
+
async createEphemeral(params, options) {
|
|
53
|
+
const { file, fileMetadata } = params;
|
|
54
|
+
const fileObj = await toFile(file);
|
|
55
|
+
if (!fileObj.name || fileObj.name === 'unknown_file') {
|
|
56
|
+
throw new Error('Cannot infer filename from file. Please provide a File with a name property, ' +
|
|
57
|
+
'or use the toFile() utility with a name parameter to convert your data to a File.');
|
|
58
|
+
}
|
|
59
|
+
const placeholder = await this._client.post('/v1/uploads', {
|
|
60
|
+
body: { filename: fileObj.name, type: 'ephemeral' },
|
|
61
|
+
...options,
|
|
62
|
+
});
|
|
63
|
+
const timeout = options?.timeout ?? this._client.timeout;
|
|
64
|
+
// Access private fetch - using type assertion as it's needed for direct upload
|
|
65
|
+
const fetch = this._client.fetch;
|
|
66
|
+
await uploadFileToStorage(placeholder.uploadUrl, placeholder.fields, fileObj, fileMetadata, timeout, fetch);
|
|
67
|
+
return { uri: placeholder.runwayUri };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=uploads.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["../src/resources/uploads.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,MAAM,EAAE;OAEV,KAAK,MAAM;OACX,EAAE,WAAW,EAAE;AAQtB,KAAK,UAAU,mBAAmB,CAChC,SAAiB,EACjB,MAA8B,EAC9B,IAAU,EACV,YAAgC,EAChC,OAA2B,EAC3B,KAAY;IAEZ,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,QAA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,GAAG,EAAE,CAAC,CAAC;IACtD,CAAC;YAAS,CAAC;QACT,IAAI,SAAS,EAAE,CAAC;YACd,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CACnB,MAAoC,EACpC,OAAwB;QAExB,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;QACtC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QAEnC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CACb,+EAA+E;gBAC7E,mFAAmF,CACtF,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAA8B,aAAa,EAAE;YACtF,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,WAAoB,EAAE;YAC5D,GAAG,OAAO;SACX,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACzD,+EAA+E;QAC/E,MAAM,KAAK,GAAI,IAAI,CAAC,OAAuC,CAAC,KAAK,CAAC;QAClE,MAAM,mBAAmB,CACvB,WAAW,CAAC,SAAS,EACrB,WAAW,CAAC,MAAM,EAClB,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,CACN,CAAC;QAEF,OAAO,EAAE,GAAG,EAAE,WAAW,CAAC,SAAS,EAAE,CAAC;IACxC,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -13,7 +13,7 @@ import * as Shims from './internal/shims';
|
|
|
13
13
|
import * as Opts from './internal/request-options';
|
|
14
14
|
import { VERSION } from './version';
|
|
15
15
|
import * as Errors from './core/error';
|
|
16
|
-
import * as
|
|
16
|
+
import * as UploadsCore from './core/uploads';
|
|
17
17
|
import * as API from './resources/index';
|
|
18
18
|
import { APIPromise } from './core/api-promise';
|
|
19
19
|
import {
|
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
VoiceIsolationCreateParams,
|
|
67
67
|
VoiceIsolationCreateResponse,
|
|
68
68
|
} from './resources/voice-isolation';
|
|
69
|
+
import { Uploads, UploadsCreateEphemeralParams, UploadCreateEphemeralResponse } from './resources/uploads';
|
|
69
70
|
import { type Fetch } from './internal/builtin-types';
|
|
70
71
|
import { isRunningInBrowser } from './internal/detect-platform';
|
|
71
72
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
@@ -777,7 +778,7 @@ export class RunwayML {
|
|
|
777
778
|
static PermissionDeniedError = Errors.PermissionDeniedError;
|
|
778
779
|
static UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
779
780
|
|
|
780
|
-
static toFile =
|
|
781
|
+
static toFile = UploadsCore.toFile;
|
|
781
782
|
|
|
782
783
|
tasks: API.Tasks = new API.Tasks(this);
|
|
783
784
|
imageToVideo: API.ImageToVideo = new API.ImageToVideo(this);
|
|
@@ -792,6 +793,7 @@ export class RunwayML {
|
|
|
792
793
|
voiceDubbing: API.VoiceDubbing = new API.VoiceDubbing(this);
|
|
793
794
|
speechToSpeech: API.SpeechToSpeech = new API.SpeechToSpeech(this);
|
|
794
795
|
organization: API.Organization = new API.Organization(this);
|
|
796
|
+
uploads: API.Uploads = new API.Uploads(this);
|
|
795
797
|
}
|
|
796
798
|
|
|
797
799
|
RunwayML.Tasks = Tasks;
|
|
@@ -807,6 +809,7 @@ RunwayML.VoiceIsolation = VoiceIsolation;
|
|
|
807
809
|
RunwayML.VoiceDubbing = VoiceDubbing;
|
|
808
810
|
RunwayML.SpeechToSpeech = SpeechToSpeech;
|
|
809
811
|
RunwayML.Organization = Organization;
|
|
812
|
+
RunwayML.Uploads = Uploads;
|
|
810
813
|
|
|
811
814
|
export declare namespace RunwayML {
|
|
812
815
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -885,4 +888,10 @@ export declare namespace RunwayML {
|
|
|
885
888
|
type OrganizationRetrieveUsageResponse as OrganizationRetrieveUsageResponse,
|
|
886
889
|
type OrganizationRetrieveUsageParams as OrganizationRetrieveUsageParams,
|
|
887
890
|
};
|
|
891
|
+
|
|
892
|
+
export {
|
|
893
|
+
Uploads as Uploads,
|
|
894
|
+
type UploadCreateEphemeralResponse as UploadCreateEphemeralResponse,
|
|
895
|
+
type UploadsCreateEphemeralParams as UploadsCreateEphemeralParams,
|
|
896
|
+
};
|
|
888
897
|
}
|