@breeze.blue/sdk 0.19.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +8 -0
- package/dist/_transform.js +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.js +6 -1
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +12 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/studio-types.d.ts +371 -0
- package/dist/studio-types.js +1 -0
- package/dist/studio.d.ts +182 -0
- package/dist/studio.js +275 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.20.1
|
|
4
|
+
|
|
5
|
+
- Studio list methods type their filters: `StudioProjectListParams`, `StudioChapterListParams`, `StudioClipListParams` and `StudioFileListParams`.
|
|
6
|
+
- `studio.files.upload` accepts `waitTimeout`.
|
|
7
|
+
- Studio file upload and processing failures reject with `BreezeBlueStudioFileError`, which carries the latest file record in `file`.
|
|
8
|
+
- Studio response types mark fields the API always returns as required.
|
|
9
|
+
- The default `fetch` is called unbound, so the client works in browsers without passing `fetch`; a custom `window.fetch` no longer throws "Illegal invocation".
|
|
10
|
+
- Studio methods without query parameters take request options as the last argument, e.g. `studio.projects.get(id, { timeout })`. The `(…, params, options)` form still works and is deprecated.
|
|
11
|
+
- Studio file responses type `status` as `StudioFileStatus`, and `uploadUrl` returns `expiresIn`.
|
|
12
|
+
|
|
13
|
+
## 0.20.0
|
|
14
|
+
|
|
15
|
+
- Manage Studio projects, chapters, clips, auxiliary tracks, audio instances and files through `client.studio`.
|
|
16
|
+
- Import multi-chapter scripts with existing voices, preserve edit tokens and error metadata, and upload materials without forwarding API credentials.
|
|
17
|
+
- Convert seconds and 48 kHz timeline frames with SDK helpers.
|
|
18
|
+
|
|
3
19
|
## 0.19.0
|
|
4
20
|
|
|
5
21
|
- Create Voice Remix candidates from custom descriptions or curated presets, with automatic input preparation and Expressive (4) as the default strength.
|
package/README.md
CHANGED
|
@@ -653,3 +653,11 @@ For a complete response, use `client.textToSpeech.convertWithTimestamps(...)`. I
|
|
|
653
653
|
For background generation with timing, use `client.textToSpeech.createJobWithTimestamps(...)`. Poll with `client.generationJobs.get(jobId)`; a ready job includes `wordTimestamps` and the audio download URL.
|
|
654
654
|
|
|
655
655
|
Clone preview creation accepts an omitted name. The server uses the filename stem or `Cloned Voice`; saving a Clone preview without a name keeps its preview name. Other preview types still require a save name. Explicit names longer than 80 Unicode characters are rejected.
|
|
656
|
+
|
|
657
|
+
## Studio management
|
|
658
|
+
|
|
659
|
+
`client.studio` exposes `projects`, `chapters`, `clips`, `tracks`, `instances`, and `files`. Import scripts with existing voice IDs, edit inherited instructions and silence, upload MP3/WAV materials, and arrange background audio. Project writes require the latest edit token and a UUID operation ID. Conflicts preserve error metadata and are not retried automatically.
|
|
660
|
+
|
|
661
|
+
See the [Studio initialization guide](https://docs.breezeblue.ai/guides/studio-projects) for a complete workflow. Signed uploads use a separate request without the API key. Management operations do not generate speech or export projects.
|
|
662
|
+
|
|
663
|
+
`client.studio.files.upload(blob, { operationId, name, projectId })` creates the file record, uploads to the signed URL, completes the upload and waits for `ready`; failures reject with `BreezeBlueStudioFileError`. Timeline positions, trims and lengths are 48 kHz frames; use `secondsToFrames` and `framesToSeconds` to convert.
|
package/dist/_transform.js
CHANGED
|
@@ -19,7 +19,7 @@ function transform(value, keyFn) {
|
|
|
19
19
|
if (isPlainObject(value)) {
|
|
20
20
|
const out = {};
|
|
21
21
|
for (const [k, v] of Object.entries(value)) {
|
|
22
|
-
out[keyFn(k)] = transform(v, keyFn);
|
|
22
|
+
out[keyFn(k)] = ["client_refs", "clientRefs", "headers"].includes(k) ? v : transform(v, keyFn);
|
|
23
23
|
}
|
|
24
24
|
return out;
|
|
25
25
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StudioResource } from "./studio.js";
|
|
1
2
|
import { SpeechTimingStream, type SpeechWithTimestamps } from "./timestamps.js";
|
|
2
3
|
import { AudioResponse } from "./audio.js";
|
|
3
4
|
import type { AudioRequestOptions, BreezeBlueWebSocket, AsyncTextToSpeechJob, Balance, BreezeBlueClientOptions, CurrentApiKeyResponse, GenericStatus, GenerationJob, HistoryItem, HistoryList, HistoryListParams, Model, RequestOptions, RealtimeTextToSpeechConnectOptions, RealtimeTextToSpeechEvent, RealtimeTextToSpeechManagedConnectOptions, RealtimeTextToSpeechMessage, RealtimeTextToSpeechSession, RealtimeTextToSpeechSessionRequest, SavedVoice, SaveVoiceRequest, StreamTextToSpeechOptions, TextToSpeechRequest, TtsEnhanceRequest, TtsEnhanceResponse, Usage, UsageParams, Voice, VoiceClonePreview, VoiceClonePreviewRequest, VoiceDesignRequest, VoiceDesignResponse, VoiceDesignStreamRequest, VoiceEditRequest, VoiceList, VoiceLocalizeJob, VoiceLocalizePreviewRequest, VoiceLocalizePreviewStatus, VoiceRemixPreviewRequest, VoiceRemixPrepareRequest, VoiceRemixPresets, VoiceRemixPreparation, VoiceRemixJob, VoiceRemixPreviewStatus, VoiceMetadataOptions, VoiceRandomParams, VoiceSearchParams, VoiceSettings } from "./types.js";
|
|
@@ -14,6 +15,7 @@ export declare class BreezeBlueClient {
|
|
|
14
15
|
readonly history: HistoryResource;
|
|
15
16
|
readonly models: ModelsResource;
|
|
16
17
|
readonly account: AccountResource;
|
|
18
|
+
readonly studio: StudioResource;
|
|
17
19
|
constructor(options?: BreezeBlueClientOptions);
|
|
18
20
|
requestJson<T>(method: string, path: string, params?: object, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
19
21
|
requestAudio(method: string, path: string, params?: object, body?: unknown, options?: RequestOptions): Promise<AudioResponse>;
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StudioResource } from "./studio.js";
|
|
1
2
|
import { SpeechTimingStream } from "./timestamps.js";
|
|
2
3
|
import { AudioResponse } from "./audio.js";
|
|
3
4
|
import { BreezeBlueAPIError, BreezeBlueConfigurationError, BreezeBlueRealtimeError, errorFromResponse, } from "./errors.js";
|
|
@@ -33,6 +34,7 @@ export class BreezeBlueClient {
|
|
|
33
34
|
history;
|
|
34
35
|
models;
|
|
35
36
|
account;
|
|
37
|
+
studio;
|
|
36
38
|
constructor(options = {}) {
|
|
37
39
|
const envApiKey = typeof process !== "undefined" ? process.env.BREEZE_API_KEY : undefined;
|
|
38
40
|
const envBaseUrl = typeof process !== "undefined" ? process.env.BREEZE_BASE_URL : undefined;
|
|
@@ -40,7 +42,9 @@ export class BreezeBlueClient {
|
|
|
40
42
|
// clientSecret works without one, so missing keys are reported lazily.
|
|
41
43
|
this.apiKey = options.apiKey ?? envApiKey;
|
|
42
44
|
this.baseUrl = normalizeBaseUrl(options.baseUrl ?? envBaseUrl ?? DEFAULT_BASE_URL);
|
|
43
|
-
|
|
45
|
+
const fetchImpl = options.fetch;
|
|
46
|
+
// Call fetch unbound: browsers reject window.fetch invoked with the client as `this`.
|
|
47
|
+
this.fetch = (input, init) => (fetchImpl ?? globalThis.fetch)(input, init);
|
|
44
48
|
this.webSocket = options.webSocket ?? readGlobalWebSocket();
|
|
45
49
|
this.headers = options.headers;
|
|
46
50
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
@@ -50,6 +54,7 @@ export class BreezeBlueClient {
|
|
|
50
54
|
this.history = new HistoryResource(this);
|
|
51
55
|
this.models = new ModelsResource(this);
|
|
52
56
|
this.account = new AccountResource(this);
|
|
57
|
+
this.studio = new StudioResource(this);
|
|
53
58
|
}
|
|
54
59
|
async requestJson(method, path, params, body, options) {
|
|
55
60
|
const response = await this.request(method, path, params, body, options);
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StudioFileView } from "./studio-types.js";
|
|
1
2
|
export interface BreezeBlueErrorPayload {
|
|
2
3
|
ok?: false;
|
|
3
4
|
code?: string;
|
|
@@ -37,6 +38,15 @@ export declare class BreezeBlueRealtimeError extends BreezeBlueError {
|
|
|
37
38
|
cause?: unknown;
|
|
38
39
|
});
|
|
39
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* A Studio file upload or processing step failed. `file` holds the latest
|
|
43
|
+
* file record; inspect `status`, `errorCode` and `errorMessage`, then retry
|
|
44
|
+
* processing or upload again.
|
|
45
|
+
*/
|
|
46
|
+
export declare class BreezeBlueStudioFileError extends BreezeBlueError {
|
|
47
|
+
readonly file: StudioFileView;
|
|
48
|
+
constructor(message: string, file: StudioFileView);
|
|
49
|
+
}
|
|
40
50
|
export declare class BreezeBlueAPIError extends BreezeBlueError {
|
|
41
51
|
readonly status: number;
|
|
42
52
|
readonly code: string;
|
package/dist/errors.js
CHANGED
|
@@ -33,6 +33,18 @@ export class BreezeBlueRealtimeError extends BreezeBlueError {
|
|
|
33
33
|
this.recoverable = params.recoverable ?? false;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* A Studio file upload or processing step failed. `file` holds the latest
|
|
38
|
+
* file record; inspect `status`, `errorCode` and `errorMessage`, then retry
|
|
39
|
+
* processing or upload again.
|
|
40
|
+
*/
|
|
41
|
+
export class BreezeBlueStudioFileError extends BreezeBlueError {
|
|
42
|
+
file;
|
|
43
|
+
constructor(message, file) {
|
|
44
|
+
super(message);
|
|
45
|
+
this.file = file;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
36
48
|
export class BreezeBlueAPIError extends BreezeBlueError {
|
|
37
49
|
status;
|
|
38
50
|
code;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { AudioResponse } from "./audio.js";
|
|
2
|
-
export { BreezeBlueAPIError, BreezeBlueAuthenticationError, BreezeBlueBadRequestError, BreezeBlueConfigurationError, BreezeBlueConflictError, BreezeBlueError, BreezeBlueForbiddenError, BreezeBlueGenerationNotReadyError, BreezeBlueInsufficientCreditsError, BreezeBlueNotFoundError, BreezeBlueRateLimitError, BreezeBlueRealtimeError, BreezeBlueServiceUnavailableError, BreezeBlueUpstreamError, BreezeBlueValidationError, } from "./errors.js";
|
|
2
|
+
export { BreezeBlueAPIError, BreezeBlueAuthenticationError, BreezeBlueBadRequestError, BreezeBlueConfigurationError, BreezeBlueConflictError, BreezeBlueError, BreezeBlueForbiddenError, BreezeBlueGenerationNotReadyError, BreezeBlueInsufficientCreditsError, BreezeBlueNotFoundError, BreezeBlueRateLimitError, BreezeBlueRealtimeError, BreezeBlueServiceUnavailableError, BreezeBlueStudioFileError, BreezeBlueUpstreamError, BreezeBlueValidationError, } from "./errors.js";
|
|
3
3
|
export { BreezeBlueClient, ManagedRealtimeTextToSpeechConnection, RealtimeTextToSpeechConnection, } from "./client.js";
|
|
4
4
|
export { SDK_NAME, SDK_VERSION } from "./version.js";
|
|
5
5
|
export type * from "./types.js";
|
|
6
6
|
export * from "./voice-metadata.js";
|
|
7
7
|
export { SpeechTimingStream } from "./timestamps.js";
|
|
8
8
|
export type { SpeechTimingChunk, SpeechWithTimestamps, WordTimestamp } from "./timestamps.js";
|
|
9
|
+
export * from "./studio.js";
|
|
10
|
+
export type * from "./studio-types.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { AudioResponse } from "./audio.js";
|
|
2
|
-
export { BreezeBlueAPIError, BreezeBlueAuthenticationError, BreezeBlueBadRequestError, BreezeBlueConfigurationError, BreezeBlueConflictError, BreezeBlueError, BreezeBlueForbiddenError, BreezeBlueGenerationNotReadyError, BreezeBlueInsufficientCreditsError, BreezeBlueNotFoundError, BreezeBlueRateLimitError, BreezeBlueRealtimeError, BreezeBlueServiceUnavailableError, BreezeBlueUpstreamError, BreezeBlueValidationError, } from "./errors.js";
|
|
2
|
+
export { BreezeBlueAPIError, BreezeBlueAuthenticationError, BreezeBlueBadRequestError, BreezeBlueConfigurationError, BreezeBlueConflictError, BreezeBlueError, BreezeBlueForbiddenError, BreezeBlueGenerationNotReadyError, BreezeBlueInsufficientCreditsError, BreezeBlueNotFoundError, BreezeBlueRateLimitError, BreezeBlueRealtimeError, BreezeBlueServiceUnavailableError, BreezeBlueStudioFileError, BreezeBlueUpstreamError, BreezeBlueValidationError, } from "./errors.js";
|
|
3
3
|
export { BreezeBlueClient, ManagedRealtimeTextToSpeechConnection, RealtimeTextToSpeechConnection, } from "./client.js";
|
|
4
4
|
export { SDK_NAME, SDK_VERSION } from "./version.js";
|
|
5
5
|
export * from "./voice-metadata.js";
|
|
6
6
|
export { SpeechTimingStream } from "./timestamps.js";
|
|
7
|
+
export * from "./studio.js";
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
export interface StudioChapterCreate {
|
|
2
|
+
expectedEditToken: string;
|
|
3
|
+
operationId: string;
|
|
4
|
+
title: string;
|
|
5
|
+
}
|
|
6
|
+
export interface StudioChapterDelete {
|
|
7
|
+
expectedEditToken: string;
|
|
8
|
+
operationId: string;
|
|
9
|
+
moveToChapterId?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface StudioChapterList {
|
|
12
|
+
items: Array<StudioChapterView>;
|
|
13
|
+
editToken: string;
|
|
14
|
+
}
|
|
15
|
+
export interface StudioChapterPatch {
|
|
16
|
+
expectedEditToken: string;
|
|
17
|
+
operationId: string;
|
|
18
|
+
title: string;
|
|
19
|
+
}
|
|
20
|
+
export interface StudioChapterResult {
|
|
21
|
+
chapter: StudioChapterView;
|
|
22
|
+
editToken: string;
|
|
23
|
+
}
|
|
24
|
+
export interface StudioChapterView {
|
|
25
|
+
id: string;
|
|
26
|
+
title: string;
|
|
27
|
+
deleted: boolean;
|
|
28
|
+
clipIds: Array<string>;
|
|
29
|
+
}
|
|
30
|
+
export interface StudioClipBatchCreate {
|
|
31
|
+
expectedEditToken: string;
|
|
32
|
+
operationId: string;
|
|
33
|
+
chapterId?: string | null;
|
|
34
|
+
afterClipId?: string | null;
|
|
35
|
+
clips: Array<StudioClipFields>;
|
|
36
|
+
}
|
|
37
|
+
export interface StudioClipBatchPatch {
|
|
38
|
+
expectedEditToken: string;
|
|
39
|
+
operationId: string;
|
|
40
|
+
updates: Array<StudioClipUpdateItem>;
|
|
41
|
+
}
|
|
42
|
+
export interface StudioClipBulkDelete {
|
|
43
|
+
expectedEditToken: string;
|
|
44
|
+
operationId: string;
|
|
45
|
+
clipIds: Array<string>;
|
|
46
|
+
}
|
|
47
|
+
export interface StudioClipCreate {
|
|
48
|
+
expectedEditToken: string;
|
|
49
|
+
operationId: string;
|
|
50
|
+
clientRef?: string | null;
|
|
51
|
+
name?: string;
|
|
52
|
+
script?: string;
|
|
53
|
+
instructions?: string;
|
|
54
|
+
voiceId?: string | null;
|
|
55
|
+
playback?: StudioPlayback;
|
|
56
|
+
trailingSilenceMs?: number | null;
|
|
57
|
+
chapterId?: string | null;
|
|
58
|
+
afterClipId?: string | null;
|
|
59
|
+
}
|
|
60
|
+
export interface StudioClipFields {
|
|
61
|
+
clientRef?: string | null;
|
|
62
|
+
name?: string;
|
|
63
|
+
script?: string;
|
|
64
|
+
instructions?: string;
|
|
65
|
+
voiceId?: string | null;
|
|
66
|
+
playback?: StudioPlayback;
|
|
67
|
+
trailingSilenceMs?: number | null;
|
|
68
|
+
}
|
|
69
|
+
export interface StudioClipList {
|
|
70
|
+
items: Array<StudioClipView>;
|
|
71
|
+
editToken: string;
|
|
72
|
+
total: number;
|
|
73
|
+
page: number;
|
|
74
|
+
pageSize: number;
|
|
75
|
+
}
|
|
76
|
+
export interface StudioClipMove {
|
|
77
|
+
expectedEditToken: string;
|
|
78
|
+
operationId: string;
|
|
79
|
+
clipIds: Array<string>;
|
|
80
|
+
chapterId: string;
|
|
81
|
+
afterClipId?: string | null;
|
|
82
|
+
}
|
|
83
|
+
export interface StudioClipPatch {
|
|
84
|
+
expectedEditToken: string;
|
|
85
|
+
operationId: string;
|
|
86
|
+
name?: string | null;
|
|
87
|
+
script?: string | null;
|
|
88
|
+
instructions?: string | null;
|
|
89
|
+
voiceId?: string | null;
|
|
90
|
+
playback?: StudioPlayback | null;
|
|
91
|
+
trailingSilenceMs?: number | null;
|
|
92
|
+
}
|
|
93
|
+
export interface StudioClipReorder {
|
|
94
|
+
expectedEditToken: string;
|
|
95
|
+
operationId: string;
|
|
96
|
+
ids: Array<string>;
|
|
97
|
+
chapterId: string;
|
|
98
|
+
}
|
|
99
|
+
export interface StudioClipResult {
|
|
100
|
+
clip: StudioClipView;
|
|
101
|
+
editToken: string;
|
|
102
|
+
}
|
|
103
|
+
export interface StudioClipUpdateItem {
|
|
104
|
+
name?: string | null;
|
|
105
|
+
script?: string | null;
|
|
106
|
+
instructions?: string | null;
|
|
107
|
+
voiceId?: string | null;
|
|
108
|
+
playback?: StudioPlayback | null;
|
|
109
|
+
trailingSilenceMs?: number | null;
|
|
110
|
+
clipId: string;
|
|
111
|
+
}
|
|
112
|
+
export interface StudioClipView {
|
|
113
|
+
id: string;
|
|
114
|
+
chapterId: string | null;
|
|
115
|
+
name: string;
|
|
116
|
+
script: string;
|
|
117
|
+
instructions: string;
|
|
118
|
+
voiceId: string | null;
|
|
119
|
+
voice: StudioVoiceSummary | null;
|
|
120
|
+
playback: StudioPlaybackView;
|
|
121
|
+
trailingSilenceMs: number | null;
|
|
122
|
+
effectiveInstructions: string;
|
|
123
|
+
effectiveTrailingSilenceMs: number;
|
|
124
|
+
version: number;
|
|
125
|
+
}
|
|
126
|
+
export interface StudioDeleted {
|
|
127
|
+
deleted: boolean;
|
|
128
|
+
editToken: string | null;
|
|
129
|
+
}
|
|
130
|
+
export interface StudioEdit {
|
|
131
|
+
expectedEditToken: string;
|
|
132
|
+
operationId: string;
|
|
133
|
+
}
|
|
134
|
+
export interface StudioEffects {
|
|
135
|
+
speed?: number;
|
|
136
|
+
volume?: number;
|
|
137
|
+
fadeInSeconds?: number;
|
|
138
|
+
fadeOutSeconds?: number;
|
|
139
|
+
}
|
|
140
|
+
export interface StudioFileCreate {
|
|
141
|
+
operationId: string;
|
|
142
|
+
projectId?: string | null;
|
|
143
|
+
name: string;
|
|
144
|
+
sizeBytes: number;
|
|
145
|
+
mimeType: "audio/mpeg" | "audio/wav";
|
|
146
|
+
}
|
|
147
|
+
export interface StudioFileDelete {
|
|
148
|
+
expectedRevision: number;
|
|
149
|
+
}
|
|
150
|
+
export interface StudioFileList {
|
|
151
|
+
items: Array<StudioFileView>;
|
|
152
|
+
nextOffset: number | null;
|
|
153
|
+
}
|
|
154
|
+
export interface StudioFilePatch {
|
|
155
|
+
expectedRevision: number;
|
|
156
|
+
name: string;
|
|
157
|
+
}
|
|
158
|
+
export interface StudioFileView {
|
|
159
|
+
id: string;
|
|
160
|
+
projectId: string | null;
|
|
161
|
+
name: string;
|
|
162
|
+
revision: number;
|
|
163
|
+
status: StudioFileStatus;
|
|
164
|
+
frames: number | null;
|
|
165
|
+
sampleRate: number;
|
|
166
|
+
sizeBytes: number | null;
|
|
167
|
+
errorCode: string | null;
|
|
168
|
+
errorReason: string | null;
|
|
169
|
+
errorMessage: string | null;
|
|
170
|
+
references: number;
|
|
171
|
+
}
|
|
172
|
+
export interface StudioImportChapter {
|
|
173
|
+
clientRef?: string | null;
|
|
174
|
+
title: string;
|
|
175
|
+
clips: Array<StudioClipFields>;
|
|
176
|
+
}
|
|
177
|
+
export interface StudioInstanceCreate {
|
|
178
|
+
expectedEditToken: string;
|
|
179
|
+
operationId: string;
|
|
180
|
+
fileId: string;
|
|
181
|
+
position?: StudioPosition;
|
|
182
|
+
trimStart?: number;
|
|
183
|
+
trimEnd: number;
|
|
184
|
+
effects?: StudioEffects;
|
|
185
|
+
length?: number | null;
|
|
186
|
+
}
|
|
187
|
+
export interface StudioInstanceList {
|
|
188
|
+
items: Array<StudioInstanceView>;
|
|
189
|
+
editToken: string;
|
|
190
|
+
}
|
|
191
|
+
export interface StudioInstancePatch {
|
|
192
|
+
expectedEditToken: string;
|
|
193
|
+
operationId: string;
|
|
194
|
+
fileId?: string | null;
|
|
195
|
+
position?: StudioPosition | null;
|
|
196
|
+
trimStart?: number | null;
|
|
197
|
+
trimEnd?: number | null;
|
|
198
|
+
effects?: StudioEffects | null;
|
|
199
|
+
length?: number | null;
|
|
200
|
+
trackId?: string | null;
|
|
201
|
+
}
|
|
202
|
+
export interface StudioInstanceResult {
|
|
203
|
+
instance: StudioInstanceView;
|
|
204
|
+
editToken: string;
|
|
205
|
+
}
|
|
206
|
+
export interface StudioInstanceView {
|
|
207
|
+
id: string;
|
|
208
|
+
fileId: string;
|
|
209
|
+
position: StudioPosition;
|
|
210
|
+
trimStart: number;
|
|
211
|
+
trimEnd: number;
|
|
212
|
+
effects: StudioEffects;
|
|
213
|
+
length: number | null;
|
|
214
|
+
phase: number;
|
|
215
|
+
envelopeOffset: number;
|
|
216
|
+
envelopeLength: number | null;
|
|
217
|
+
issues: Array<string>;
|
|
218
|
+
}
|
|
219
|
+
export type StudioFileStatus = "uploading" | "queued" | "running" | "ready" | "failed";
|
|
220
|
+
export interface StudioPlaybackView {
|
|
221
|
+
speed: number;
|
|
222
|
+
volume: number;
|
|
223
|
+
}
|
|
224
|
+
export interface StudioPlayback {
|
|
225
|
+
speed?: number;
|
|
226
|
+
volume?: number;
|
|
227
|
+
}
|
|
228
|
+
export interface StudioPosition {
|
|
229
|
+
mode?: "fixed" | "follow";
|
|
230
|
+
frame?: number;
|
|
231
|
+
clipId?: string | null;
|
|
232
|
+
edge?: "start" | "end";
|
|
233
|
+
offset?: number;
|
|
234
|
+
}
|
|
235
|
+
export interface StudioProjectCreate {
|
|
236
|
+
title?: string;
|
|
237
|
+
description?: string;
|
|
238
|
+
ttsSettings?: StudioTtsSettings | null;
|
|
239
|
+
defaultVoiceId?: string | null;
|
|
240
|
+
defaultInstructions?: string;
|
|
241
|
+
defaultSilenceMs?: number;
|
|
242
|
+
operationId: string;
|
|
243
|
+
}
|
|
244
|
+
export interface StudioProjectImport {
|
|
245
|
+
title?: string;
|
|
246
|
+
description?: string;
|
|
247
|
+
ttsSettings?: StudioTtsSettings | null;
|
|
248
|
+
defaultVoiceId?: string | null;
|
|
249
|
+
defaultInstructions?: string;
|
|
250
|
+
defaultSilenceMs?: number;
|
|
251
|
+
operationId: string;
|
|
252
|
+
chapters: Array<StudioImportChapter>;
|
|
253
|
+
}
|
|
254
|
+
export interface StudioProjectList {
|
|
255
|
+
items: Array<StudioProjectView>;
|
|
256
|
+
total: number;
|
|
257
|
+
page: number;
|
|
258
|
+
pageSize: number;
|
|
259
|
+
}
|
|
260
|
+
export interface StudioProjectPatch {
|
|
261
|
+
expectedEditToken: string;
|
|
262
|
+
operationId: string;
|
|
263
|
+
title?: string | null;
|
|
264
|
+
description?: string | null;
|
|
265
|
+
ttsSettings?: StudioTtsSettings | null;
|
|
266
|
+
defaultVoiceId?: string | null;
|
|
267
|
+
defaultInstructions?: string | null;
|
|
268
|
+
defaultSilenceMs?: number | null;
|
|
269
|
+
}
|
|
270
|
+
export interface StudioProjectResult {
|
|
271
|
+
project: StudioProjectView;
|
|
272
|
+
editToken: string;
|
|
273
|
+
clientRefs: Record<string, string>;
|
|
274
|
+
createdIds: Array<string>;
|
|
275
|
+
}
|
|
276
|
+
export interface StudioProjectView {
|
|
277
|
+
title: string;
|
|
278
|
+
description: string;
|
|
279
|
+
ttsSettings: StudioTtsSettings | null;
|
|
280
|
+
defaultVoiceId: string | null;
|
|
281
|
+
defaultInstructions: string;
|
|
282
|
+
defaultSilenceMs: number;
|
|
283
|
+
id: string;
|
|
284
|
+
editToken: string;
|
|
285
|
+
createdAt: string;
|
|
286
|
+
updatedAt: string;
|
|
287
|
+
chapterCount: number;
|
|
288
|
+
clipCount: number;
|
|
289
|
+
}
|
|
290
|
+
export interface StudioReorder {
|
|
291
|
+
expectedEditToken: string;
|
|
292
|
+
operationId: string;
|
|
293
|
+
ids: Array<string>;
|
|
294
|
+
}
|
|
295
|
+
export interface StudioTrackCreate {
|
|
296
|
+
expectedEditToken: string;
|
|
297
|
+
operationId: string;
|
|
298
|
+
name: string;
|
|
299
|
+
chapterId?: string | null;
|
|
300
|
+
volume?: number;
|
|
301
|
+
muted?: boolean;
|
|
302
|
+
}
|
|
303
|
+
export interface StudioTrackList {
|
|
304
|
+
items: Array<StudioTrackView>;
|
|
305
|
+
editToken: string;
|
|
306
|
+
}
|
|
307
|
+
export interface StudioTrackPatch {
|
|
308
|
+
expectedEditToken: string;
|
|
309
|
+
operationId: string;
|
|
310
|
+
name?: string | null;
|
|
311
|
+
chapterId?: string | null;
|
|
312
|
+
volume?: number | null;
|
|
313
|
+
muted?: boolean | null;
|
|
314
|
+
}
|
|
315
|
+
export interface StudioTrackResult {
|
|
316
|
+
track: StudioTrackView;
|
|
317
|
+
editToken: string;
|
|
318
|
+
}
|
|
319
|
+
export interface StudioTrackView {
|
|
320
|
+
id: string;
|
|
321
|
+
name: string;
|
|
322
|
+
chapterId: string | null;
|
|
323
|
+
volume: number;
|
|
324
|
+
muted: boolean;
|
|
325
|
+
readonly: boolean;
|
|
326
|
+
instances: Array<StudioInstanceView>;
|
|
327
|
+
}
|
|
328
|
+
export interface StudioTtsSettings {
|
|
329
|
+
model?: string | null;
|
|
330
|
+
language?: string | null;
|
|
331
|
+
generationLanguage?: string | null;
|
|
332
|
+
guidanceScale?: number | null;
|
|
333
|
+
}
|
|
334
|
+
export interface StudioUploadResult {
|
|
335
|
+
uploadUrl: string;
|
|
336
|
+
headers: Record<string, string>;
|
|
337
|
+
expiresIn: number;
|
|
338
|
+
}
|
|
339
|
+
export interface StudioVoiceSummary {
|
|
340
|
+
id: string;
|
|
341
|
+
name: string;
|
|
342
|
+
available: boolean;
|
|
343
|
+
}
|
|
344
|
+
/** Query parameters accepted by Studio endpoints; list methods document their named filters. */
|
|
345
|
+
export type StudioQueryParams = Record<string, string | number | boolean | undefined>;
|
|
346
|
+
export interface StudioProjectListParams extends StudioQueryParams {
|
|
347
|
+
/** Case-insensitive title filter. */
|
|
348
|
+
q?: string;
|
|
349
|
+
page?: number;
|
|
350
|
+
/** Defaults to 50; maximum 100. */
|
|
351
|
+
pageSize?: number;
|
|
352
|
+
}
|
|
353
|
+
export interface StudioChapterListParams extends StudioQueryParams {
|
|
354
|
+
includeDeleted?: boolean;
|
|
355
|
+
}
|
|
356
|
+
export interface StudioClipListParams extends StudioQueryParams {
|
|
357
|
+
chapterId?: string;
|
|
358
|
+
includeDeleted?: boolean;
|
|
359
|
+
page?: number;
|
|
360
|
+
/** Defaults to 100; maximum 400. */
|
|
361
|
+
pageSize?: number;
|
|
362
|
+
}
|
|
363
|
+
export interface StudioFileListParams extends StudioQueryParams {
|
|
364
|
+
/** Omit to list personal files. */
|
|
365
|
+
projectId?: string;
|
|
366
|
+
/** Case-insensitive name filter. */
|
|
367
|
+
q?: string;
|
|
368
|
+
offset?: number;
|
|
369
|
+
/** Defaults to 100; maximum 500. Continue with `nextOffset`. */
|
|
370
|
+
limit?: number;
|
|
371
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/studio.d.ts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { BreezeBlueClient } from "./client.js";
|
|
2
|
+
import type { RequestOptions } from "./types.js";
|
|
3
|
+
import type * as Types from "./studio-types.js";
|
|
4
|
+
/** Convert seconds to 48 kHz Studio timeline frames, rounding half away from zero. */
|
|
5
|
+
export declare function secondsToFrames(seconds: number): number;
|
|
6
|
+
/** Convert 48 kHz Studio timeline frames to seconds. */
|
|
7
|
+
export declare function framesToSeconds(frames: number): number;
|
|
8
|
+
export declare class StudioProjectsResource {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: BreezeBlueClient);
|
|
11
|
+
list(params?: Types.StudioProjectListParams, options?: RequestOptions): Promise<Types.StudioProjectList>;
|
|
12
|
+
create(body: Types.StudioProjectCreate, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
13
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
14
|
+
create(body: Types.StudioProjectCreate, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
15
|
+
importProject(body: Types.StudioProjectImport, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
16
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
17
|
+
importProject(body: Types.StudioProjectImport, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
18
|
+
get(projectId: string, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
19
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
20
|
+
get(projectId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
21
|
+
update(projectId: string, body: Types.StudioProjectPatch, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
22
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
23
|
+
update(projectId: string, body: Types.StudioProjectPatch, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
24
|
+
delete(projectId: string, body: Types.StudioEdit, options?: RequestOptions): Promise<Types.StudioDeleted>;
|
|
25
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
26
|
+
delete(projectId: string, body: Types.StudioEdit, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioDeleted>;
|
|
27
|
+
}
|
|
28
|
+
export declare class StudioChaptersResource {
|
|
29
|
+
private client;
|
|
30
|
+
constructor(client: BreezeBlueClient);
|
|
31
|
+
list(projectId: string, params?: Types.StudioChapterListParams, options?: RequestOptions): Promise<Types.StudioChapterList>;
|
|
32
|
+
create(projectId: string, body: Types.StudioChapterCreate, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
33
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
34
|
+
create(projectId: string, body: Types.StudioChapterCreate, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
35
|
+
reorder(projectId: string, body: Types.StudioReorder, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
36
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
37
|
+
reorder(projectId: string, body: Types.StudioReorder, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
38
|
+
get(projectId: string, chapterId: string, options?: RequestOptions): Promise<Types.StudioChapterResult>;
|
|
39
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
40
|
+
get(projectId: string, chapterId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioChapterResult>;
|
|
41
|
+
update(projectId: string, chapterId: string, body: Types.StudioChapterPatch, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
42
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
43
|
+
update(projectId: string, chapterId: string, body: Types.StudioChapterPatch, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
44
|
+
delete(projectId: string, chapterId: string, body: Types.StudioChapterDelete, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
45
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
46
|
+
delete(projectId: string, chapterId: string, body: Types.StudioChapterDelete, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
47
|
+
restore(projectId: string, chapterId: string, body: Types.StudioEdit, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
48
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
49
|
+
restore(projectId: string, chapterId: string, body: Types.StudioEdit, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
50
|
+
}
|
|
51
|
+
export declare class StudioClipsResource {
|
|
52
|
+
private client;
|
|
53
|
+
constructor(client: BreezeBlueClient);
|
|
54
|
+
list(projectId: string, params?: Types.StudioClipListParams, options?: RequestOptions): Promise<Types.StudioClipList>;
|
|
55
|
+
create(projectId: string, body: Types.StudioClipCreate, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
56
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
57
|
+
create(projectId: string, body: Types.StudioClipCreate, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
58
|
+
batchCreate(projectId: string, body: Types.StudioClipBatchCreate, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
59
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
60
|
+
batchCreate(projectId: string, body: Types.StudioClipBatchCreate, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
61
|
+
batchUpdate(projectId: string, body: Types.StudioClipBatchPatch, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
62
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
63
|
+
batchUpdate(projectId: string, body: Types.StudioClipBatchPatch, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
64
|
+
bulkDelete(projectId: string, body: Types.StudioClipBulkDelete, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
65
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
66
|
+
bulkDelete(projectId: string, body: Types.StudioClipBulkDelete, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
67
|
+
reorder(projectId: string, body: Types.StudioClipReorder, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
68
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
69
|
+
reorder(projectId: string, body: Types.StudioClipReorder, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
70
|
+
move(projectId: string, body: Types.StudioClipMove, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
71
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
72
|
+
move(projectId: string, body: Types.StudioClipMove, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
73
|
+
get(projectId: string, clipId: string, options?: RequestOptions): Promise<Types.StudioClipResult>;
|
|
74
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
75
|
+
get(projectId: string, clipId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioClipResult>;
|
|
76
|
+
update(projectId: string, clipId: string, body: Types.StudioClipPatch, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
77
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
78
|
+
update(projectId: string, clipId: string, body: Types.StudioClipPatch, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
79
|
+
delete(projectId: string, clipId: string, body: Types.StudioEdit, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
80
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
81
|
+
delete(projectId: string, clipId: string, body: Types.StudioEdit, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
82
|
+
}
|
|
83
|
+
export declare class StudioTracksResource {
|
|
84
|
+
private client;
|
|
85
|
+
constructor(client: BreezeBlueClient);
|
|
86
|
+
list(projectId: string, options?: RequestOptions): Promise<Types.StudioTrackList>;
|
|
87
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
88
|
+
list(projectId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioTrackList>;
|
|
89
|
+
create(projectId: string, body: Types.StudioTrackCreate, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
90
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
91
|
+
create(projectId: string, body: Types.StudioTrackCreate, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
92
|
+
reorder(projectId: string, body: Types.StudioReorder, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
93
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
94
|
+
reorder(projectId: string, body: Types.StudioReorder, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
95
|
+
get(projectId: string, trackId: string, options?: RequestOptions): Promise<Types.StudioTrackResult>;
|
|
96
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
97
|
+
get(projectId: string, trackId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioTrackResult>;
|
|
98
|
+
update(projectId: string, trackId: string, body: Types.StudioTrackPatch, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
99
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
100
|
+
update(projectId: string, trackId: string, body: Types.StudioTrackPatch, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
101
|
+
delete(projectId: string, trackId: string, body: Types.StudioEdit, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
102
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
103
|
+
delete(projectId: string, trackId: string, body: Types.StudioEdit, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
104
|
+
}
|
|
105
|
+
export declare class StudioInstancesResource {
|
|
106
|
+
private client;
|
|
107
|
+
constructor(client: BreezeBlueClient);
|
|
108
|
+
list(projectId: string, trackId: string, options?: RequestOptions): Promise<Types.StudioInstanceList>;
|
|
109
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
110
|
+
list(projectId: string, trackId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioInstanceList>;
|
|
111
|
+
create(projectId: string, trackId: string, body: Types.StudioInstanceCreate, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
112
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
113
|
+
create(projectId: string, trackId: string, body: Types.StudioInstanceCreate, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
114
|
+
get(projectId: string, trackId: string, instanceId: string, options?: RequestOptions): Promise<Types.StudioInstanceResult>;
|
|
115
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
116
|
+
get(projectId: string, trackId: string, instanceId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioInstanceResult>;
|
|
117
|
+
update(projectId: string, trackId: string, instanceId: string, body: Types.StudioInstancePatch, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
118
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
119
|
+
update(projectId: string, trackId: string, instanceId: string, body: Types.StudioInstancePatch, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
120
|
+
delete(projectId: string, trackId: string, instanceId: string, body: Types.StudioEdit, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
121
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
122
|
+
delete(projectId: string, trackId: string, instanceId: string, body: Types.StudioEdit, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioProjectResult>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Studio audio materials (MP3 or WAV). `upload` runs the whole flow:
|
|
126
|
+
* `create` → `uploadUrl` → signed PUT → `complete` → `waitReady`.
|
|
127
|
+
*/
|
|
128
|
+
export declare class StudioFilesResource {
|
|
129
|
+
private client;
|
|
130
|
+
constructor(client: BreezeBlueClient);
|
|
131
|
+
list(params?: Types.StudioFileListParams, options?: RequestOptions): Promise<Types.StudioFileList>;
|
|
132
|
+
create(body: Types.StudioFileCreate, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
133
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
134
|
+
create(body: Types.StudioFileCreate, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
135
|
+
get(fileId: string, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
136
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
137
|
+
get(fileId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
138
|
+
update(fileId: string, body: Types.StudioFilePatch, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
139
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
140
|
+
update(fileId: string, body: Types.StudioFilePatch, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
141
|
+
delete(fileId: string, body: Types.StudioFileDelete, options?: RequestOptions): Promise<Types.StudioDeleted>;
|
|
142
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
143
|
+
delete(fileId: string, body: Types.StudioFileDelete, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioDeleted>;
|
|
144
|
+
uploadUrl(fileId: string, options?: RequestOptions): Promise<Types.StudioUploadResult>;
|
|
145
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
146
|
+
uploadUrl(fileId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioUploadResult>;
|
|
147
|
+
complete(fileId: string, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
148
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
149
|
+
complete(fileId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
150
|
+
retry(fileId: string, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
151
|
+
/** @deprecated This endpoint takes no query parameters; pass request options as the last argument. */
|
|
152
|
+
retry(fileId: string, params: Types.StudioQueryParams | undefined, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
153
|
+
/**
|
|
154
|
+
* Poll until the file is `ready`. Rejects with `BreezeBlueStudioFileError`
|
|
155
|
+
* when processing fails or is still running after `timeout` milliseconds.
|
|
156
|
+
*/
|
|
157
|
+
waitReady(fileId: string, options?: {
|
|
158
|
+
timeout?: number;
|
|
159
|
+
pollInterval?: number;
|
|
160
|
+
signal?: AbortSignal;
|
|
161
|
+
}): Promise<Types.StudioFileView>;
|
|
162
|
+
/**
|
|
163
|
+
* Upload an MP3 or WAV blob and, unless `wait` is false, wait until it is ready.
|
|
164
|
+
* Reusing `operationId` with identical input resumes the same file.
|
|
165
|
+
*/
|
|
166
|
+
upload(file: Blob, input: {
|
|
167
|
+
operationId: string;
|
|
168
|
+
name: string;
|
|
169
|
+
projectId?: string;
|
|
170
|
+
wait?: boolean;
|
|
171
|
+
waitTimeout?: number;
|
|
172
|
+
}, options?: RequestOptions): Promise<Types.StudioFileView>;
|
|
173
|
+
}
|
|
174
|
+
export declare class StudioResource {
|
|
175
|
+
readonly projects: StudioProjectsResource;
|
|
176
|
+
readonly chapters: StudioChaptersResource;
|
|
177
|
+
readonly clips: StudioClipsResource;
|
|
178
|
+
readonly tracks: StudioTracksResource;
|
|
179
|
+
readonly instances: StudioInstancesResource;
|
|
180
|
+
readonly files: StudioFilesResource;
|
|
181
|
+
constructor(client: BreezeBlueClient);
|
|
182
|
+
}
|
package/dist/studio.js
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { BreezeBlueConfigurationError, BreezeBlueStudioFileError } from "./errors.js";
|
|
2
|
+
/** Convert seconds to 48 kHz Studio timeline frames, rounding half away from zero. */
|
|
3
|
+
export function secondsToFrames(seconds) {
|
|
4
|
+
if (!Number.isFinite(seconds))
|
|
5
|
+
throw new Error("seconds must be finite");
|
|
6
|
+
return Math.sign(seconds) * Math.round(Math.abs(seconds) * 48000);
|
|
7
|
+
}
|
|
8
|
+
/** Convert 48 kHz Studio timeline frames to seconds. */
|
|
9
|
+
export function framesToSeconds(frames) { return frames / 48000; }
|
|
10
|
+
/**
|
|
11
|
+
* Methods without query parameters take request options last. The 0.20.0
|
|
12
|
+
* `(…, params, options)` form keeps working when options are passed third.
|
|
13
|
+
*/
|
|
14
|
+
function requestArgs(paramsOrOptions, legacyOptions) {
|
|
15
|
+
return legacyOptions === undefined
|
|
16
|
+
? [undefined, paramsOrOptions]
|
|
17
|
+
: [paramsOrOptions, legacyOptions];
|
|
18
|
+
}
|
|
19
|
+
export class StudioProjectsResource {
|
|
20
|
+
client;
|
|
21
|
+
constructor(client) {
|
|
22
|
+
this.client = client;
|
|
23
|
+
}
|
|
24
|
+
list(params, options) {
|
|
25
|
+
return this.client.requestJson("GET", `/v1/studio/projects`, params, undefined, options);
|
|
26
|
+
}
|
|
27
|
+
create(body, paramsOrOptions, legacyOptions) {
|
|
28
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
29
|
+
return this.client.requestJson("POST", `/v1/studio/projects`, params, body, options);
|
|
30
|
+
}
|
|
31
|
+
importProject(body, paramsOrOptions, legacyOptions) {
|
|
32
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
33
|
+
return this.client.requestJson("POST", `/v1/studio/projects/import`, params, body, options);
|
|
34
|
+
}
|
|
35
|
+
get(projectId, paramsOrOptions, legacyOptions) {
|
|
36
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
37
|
+
return this.client.requestJson("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}`, params, undefined, options);
|
|
38
|
+
}
|
|
39
|
+
update(projectId, body, paramsOrOptions, legacyOptions) {
|
|
40
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
41
|
+
return this.client.requestJson("PATCH", `/v1/studio/projects/${encodeURIComponent(projectId)}`, params, body, options);
|
|
42
|
+
}
|
|
43
|
+
delete(projectId, body, paramsOrOptions, legacyOptions) {
|
|
44
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
45
|
+
return this.client.requestJson("DELETE", `/v1/studio/projects/${encodeURIComponent(projectId)}`, params, body, options);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export class StudioChaptersResource {
|
|
49
|
+
client;
|
|
50
|
+
constructor(client) {
|
|
51
|
+
this.client = client;
|
|
52
|
+
}
|
|
53
|
+
list(projectId, params, options) {
|
|
54
|
+
return this.client.requestJson("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters`, params, undefined, options);
|
|
55
|
+
}
|
|
56
|
+
create(projectId, body, paramsOrOptions, legacyOptions) {
|
|
57
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
58
|
+
return this.client.requestJson("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters`, params, body, options);
|
|
59
|
+
}
|
|
60
|
+
reorder(projectId, body, paramsOrOptions, legacyOptions) {
|
|
61
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
62
|
+
return this.client.requestJson("PATCH", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/reorder`, params, body, options);
|
|
63
|
+
}
|
|
64
|
+
get(projectId, chapterId, paramsOrOptions, legacyOptions) {
|
|
65
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
66
|
+
return this.client.requestJson("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}`, params, undefined, options);
|
|
67
|
+
}
|
|
68
|
+
update(projectId, chapterId, body, paramsOrOptions, legacyOptions) {
|
|
69
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
70
|
+
return this.client.requestJson("PATCH", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}`, params, body, options);
|
|
71
|
+
}
|
|
72
|
+
delete(projectId, chapterId, body, paramsOrOptions, legacyOptions) {
|
|
73
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
74
|
+
return this.client.requestJson("DELETE", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}`, params, body, options);
|
|
75
|
+
}
|
|
76
|
+
restore(projectId, chapterId, body, paramsOrOptions, legacyOptions) {
|
|
77
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
78
|
+
return this.client.requestJson("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}/restore`, params, body, options);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export class StudioClipsResource {
|
|
82
|
+
client;
|
|
83
|
+
constructor(client) {
|
|
84
|
+
this.client = client;
|
|
85
|
+
}
|
|
86
|
+
list(projectId, params, options) {
|
|
87
|
+
return this.client.requestJson("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips`, params, undefined, options);
|
|
88
|
+
}
|
|
89
|
+
create(projectId, body, paramsOrOptions, legacyOptions) {
|
|
90
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
91
|
+
return this.client.requestJson("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips`, params, body, options);
|
|
92
|
+
}
|
|
93
|
+
batchCreate(projectId, body, paramsOrOptions, legacyOptions) {
|
|
94
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
95
|
+
return this.client.requestJson("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips/batch`, params, body, options);
|
|
96
|
+
}
|
|
97
|
+
batchUpdate(projectId, body, paramsOrOptions, legacyOptions) {
|
|
98
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
99
|
+
return this.client.requestJson("PATCH", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips/batch`, params, body, options);
|
|
100
|
+
}
|
|
101
|
+
bulkDelete(projectId, body, paramsOrOptions, legacyOptions) {
|
|
102
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
103
|
+
return this.client.requestJson("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips/bulk-delete`, params, body, options);
|
|
104
|
+
}
|
|
105
|
+
reorder(projectId, body, paramsOrOptions, legacyOptions) {
|
|
106
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
107
|
+
return this.client.requestJson("PATCH", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips/reorder`, params, body, options);
|
|
108
|
+
}
|
|
109
|
+
move(projectId, body, paramsOrOptions, legacyOptions) {
|
|
110
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
111
|
+
return this.client.requestJson("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips/move`, params, body, options);
|
|
112
|
+
}
|
|
113
|
+
get(projectId, clipId, paramsOrOptions, legacyOptions) {
|
|
114
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
115
|
+
return this.client.requestJson("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips/${encodeURIComponent(clipId)}`, params, undefined, options);
|
|
116
|
+
}
|
|
117
|
+
update(projectId, clipId, body, paramsOrOptions, legacyOptions) {
|
|
118
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
119
|
+
return this.client.requestJson("PATCH", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips/${encodeURIComponent(clipId)}`, params, body, options);
|
|
120
|
+
}
|
|
121
|
+
delete(projectId, clipId, body, paramsOrOptions, legacyOptions) {
|
|
122
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
123
|
+
return this.client.requestJson("DELETE", `/v1/studio/projects/${encodeURIComponent(projectId)}/clips/${encodeURIComponent(clipId)}`, params, body, options);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export class StudioTracksResource {
|
|
127
|
+
client;
|
|
128
|
+
constructor(client) {
|
|
129
|
+
this.client = client;
|
|
130
|
+
}
|
|
131
|
+
list(projectId, paramsOrOptions, legacyOptions) {
|
|
132
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
133
|
+
return this.client.requestJson("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks`, params, undefined, options);
|
|
134
|
+
}
|
|
135
|
+
create(projectId, body, paramsOrOptions, legacyOptions) {
|
|
136
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
137
|
+
return this.client.requestJson("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks`, params, body, options);
|
|
138
|
+
}
|
|
139
|
+
reorder(projectId, body, paramsOrOptions, legacyOptions) {
|
|
140
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
141
|
+
return this.client.requestJson("PATCH", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks/reorder`, params, body, options);
|
|
142
|
+
}
|
|
143
|
+
get(projectId, trackId, paramsOrOptions, legacyOptions) {
|
|
144
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
145
|
+
return this.client.requestJson("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks/${encodeURIComponent(trackId)}`, params, undefined, options);
|
|
146
|
+
}
|
|
147
|
+
update(projectId, trackId, body, paramsOrOptions, legacyOptions) {
|
|
148
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
149
|
+
return this.client.requestJson("PATCH", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks/${encodeURIComponent(trackId)}`, params, body, options);
|
|
150
|
+
}
|
|
151
|
+
delete(projectId, trackId, body, paramsOrOptions, legacyOptions) {
|
|
152
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
153
|
+
return this.client.requestJson("DELETE", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks/${encodeURIComponent(trackId)}`, params, body, options);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export class StudioInstancesResource {
|
|
157
|
+
client;
|
|
158
|
+
constructor(client) {
|
|
159
|
+
this.client = client;
|
|
160
|
+
}
|
|
161
|
+
list(projectId, trackId, paramsOrOptions, legacyOptions) {
|
|
162
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
163
|
+
return this.client.requestJson("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks/${encodeURIComponent(trackId)}/instances`, params, undefined, options);
|
|
164
|
+
}
|
|
165
|
+
create(projectId, trackId, body, paramsOrOptions, legacyOptions) {
|
|
166
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
167
|
+
return this.client.requestJson("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks/${encodeURIComponent(trackId)}/instances`, params, body, options);
|
|
168
|
+
}
|
|
169
|
+
get(projectId, trackId, instanceId, paramsOrOptions, legacyOptions) {
|
|
170
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
171
|
+
return this.client.requestJson("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks/${encodeURIComponent(trackId)}/instances/${encodeURIComponent(instanceId)}`, params, undefined, options);
|
|
172
|
+
}
|
|
173
|
+
update(projectId, trackId, instanceId, body, paramsOrOptions, legacyOptions) {
|
|
174
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
175
|
+
return this.client.requestJson("PATCH", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks/${encodeURIComponent(trackId)}/instances/${encodeURIComponent(instanceId)}`, params, body, options);
|
|
176
|
+
}
|
|
177
|
+
delete(projectId, trackId, instanceId, body, paramsOrOptions, legacyOptions) {
|
|
178
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
179
|
+
return this.client.requestJson("DELETE", `/v1/studio/projects/${encodeURIComponent(projectId)}/tracks/${encodeURIComponent(trackId)}/instances/${encodeURIComponent(instanceId)}`, params, body, options);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Studio audio materials (MP3 or WAV). `upload` runs the whole flow:
|
|
184
|
+
* `create` → `uploadUrl` → signed PUT → `complete` → `waitReady`.
|
|
185
|
+
*/
|
|
186
|
+
export class StudioFilesResource {
|
|
187
|
+
client;
|
|
188
|
+
constructor(client) {
|
|
189
|
+
this.client = client;
|
|
190
|
+
}
|
|
191
|
+
list(params, options) {
|
|
192
|
+
return this.client.requestJson("GET", `/v1/studio/files`, params, undefined, options);
|
|
193
|
+
}
|
|
194
|
+
create(body, paramsOrOptions, legacyOptions) {
|
|
195
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
196
|
+
return this.client.requestJson("POST", `/v1/studio/files`, params, body, options);
|
|
197
|
+
}
|
|
198
|
+
get(fileId, paramsOrOptions, legacyOptions) {
|
|
199
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
200
|
+
return this.client.requestJson("GET", `/v1/studio/files/${encodeURIComponent(fileId)}`, params, undefined, options);
|
|
201
|
+
}
|
|
202
|
+
update(fileId, body, paramsOrOptions, legacyOptions) {
|
|
203
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
204
|
+
return this.client.requestJson("PATCH", `/v1/studio/files/${encodeURIComponent(fileId)}`, params, body, options);
|
|
205
|
+
}
|
|
206
|
+
delete(fileId, body, paramsOrOptions, legacyOptions) {
|
|
207
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
208
|
+
return this.client.requestJson("DELETE", `/v1/studio/files/${encodeURIComponent(fileId)}`, params, body, options);
|
|
209
|
+
}
|
|
210
|
+
uploadUrl(fileId, paramsOrOptions, legacyOptions) {
|
|
211
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
212
|
+
return this.client.requestJson("POST", `/v1/studio/files/${encodeURIComponent(fileId)}/upload`, params, undefined, options);
|
|
213
|
+
}
|
|
214
|
+
complete(fileId, paramsOrOptions, legacyOptions) {
|
|
215
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
216
|
+
return this.client.requestJson("POST", `/v1/studio/files/${encodeURIComponent(fileId)}/complete`, params, undefined, options);
|
|
217
|
+
}
|
|
218
|
+
retry(fileId, paramsOrOptions, legacyOptions) {
|
|
219
|
+
const [params, options] = requestArgs(paramsOrOptions, legacyOptions);
|
|
220
|
+
return this.client.requestJson("POST", `/v1/studio/files/${encodeURIComponent(fileId)}/retry`, params, undefined, options);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Poll until the file is `ready`. Rejects with `BreezeBlueStudioFileError`
|
|
224
|
+
* when processing fails or is still running after `timeout` milliseconds.
|
|
225
|
+
*/
|
|
226
|
+
async waitReady(fileId, options = {}) {
|
|
227
|
+
const deadline = Date.now() + (options.timeout ?? 300000);
|
|
228
|
+
while (true) {
|
|
229
|
+
options.signal?.throwIfAborted();
|
|
230
|
+
const value = await this.get(fileId, { signal: options.signal });
|
|
231
|
+
if (value.status === "ready")
|
|
232
|
+
return value;
|
|
233
|
+
if (value.status === "failed")
|
|
234
|
+
throw new BreezeBlueStudioFileError(value.errorMessage ?? "Studio file processing failed", value);
|
|
235
|
+
if (Date.now() >= deadline)
|
|
236
|
+
throw new BreezeBlueStudioFileError("Studio file is still processing; query the same file ID to resume", value);
|
|
237
|
+
await new Promise(resolve => setTimeout(resolve, Math.max(100, Math.min(options.pollInterval ?? 1000, deadline - Date.now()))));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Upload an MP3 or WAV blob and, unless `wait` is false, wait until it is ready.
|
|
242
|
+
* Reusing `operationId` with identical input resumes the same file.
|
|
243
|
+
*/
|
|
244
|
+
async upload(file, input, options = {}) {
|
|
245
|
+
const mimeType = input.name.toLowerCase().endsWith(".mp3") ? "audio/mpeg" : input.name.toLowerCase().endsWith(".wav") ? "audio/wav" : null;
|
|
246
|
+
if (!mimeType)
|
|
247
|
+
throw new BreezeBlueConfigurationError("Studio accepts MP3 or WAV files");
|
|
248
|
+
let value = await this.create({ operationId: input.operationId, name: input.name, projectId: input.projectId, sizeBytes: file.size, mimeType }, options);
|
|
249
|
+
if (value.status === "uploading") {
|
|
250
|
+
const signed = await this.uploadUrl(value.id, options);
|
|
251
|
+
// Never use the API request helper for a signed storage URL.
|
|
252
|
+
const response = await this.client.fetch(signed.uploadUrl, { method: "PUT", headers: signed.headers, body: file, credentials: "omit", redirect: "error", signal: options.signal });
|
|
253
|
+
if (!response.ok)
|
|
254
|
+
throw new BreezeBlueStudioFileError(`Studio upload failed with HTTP ${response.status}`, value);
|
|
255
|
+
value = await this.complete(value.id, options);
|
|
256
|
+
}
|
|
257
|
+
return input.wait === false ? value : this.waitReady(value.id, { timeout: input.waitTimeout, signal: options.signal });
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
export class StudioResource {
|
|
261
|
+
projects;
|
|
262
|
+
chapters;
|
|
263
|
+
clips;
|
|
264
|
+
tracks;
|
|
265
|
+
instances;
|
|
266
|
+
files;
|
|
267
|
+
constructor(client) {
|
|
268
|
+
this.projects = new StudioProjectsResource(client);
|
|
269
|
+
this.chapters = new StudioChaptersResource(client);
|
|
270
|
+
this.clips = new StudioClipsResource(client);
|
|
271
|
+
this.tracks = new StudioTracksResource(client);
|
|
272
|
+
this.instances = new StudioInstancesResource(client);
|
|
273
|
+
this.files = new StudioFilesResource(client);
|
|
274
|
+
}
|
|
275
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.20.1";
|
|
2
2
|
export declare const SDK_NAME = "@breeze.blue/sdk";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.
|
|
1
|
+
export const SDK_VERSION = "0.20.1";
|
|
2
2
|
export const SDK_NAME = "@breeze.blue/sdk";
|