@vocalstack/js-sdk 1.0.13 → 2.0.0-alpha.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/LICENSE +21 -21
- package/README.md +112 -69
- package/SKILL.md +252 -0
- package/dist/errors.d.ts +40 -0
- package/dist/errors.js +74 -0
- package/dist/file.d.ts +2 -0
- package/dist/file.js +38 -0
- package/dist/http.d.ts +75 -0
- package/dist/http.js +122 -0
- package/dist/index.d.ts +56 -2
- package/dist/index.js +65 -17
- package/dist/mic.d.ts +75 -0
- package/dist/mic.js +258 -0
- package/dist/realtime.d.ts +132 -0
- package/dist/realtime.js +450 -0
- package/dist/resources.d.ts +521 -0
- package/dist/resources.js +787 -0
- package/dist/subscription.d.ts +55 -0
- package/dist/subscription.js +164 -0
- package/dist/ws.d.ts +12 -0
- package/dist/ws.js +15 -0
- package/package.json +32 -36
- package/skills/vocalstack/SKILL.md +252 -0
- package/dist/RestApi.d.ts +0 -21
- package/dist/RestApi.js +0 -94
- package/dist/VocalStackApi.d.ts +0 -20
- package/dist/VocalStackApi.js +0 -51
- package/dist/WebsocketApi.d.ts +0 -38
- package/dist/WebsocketApi.js +0 -150
- package/dist/apis/Billing.d.ts +0 -59
- package/dist/apis/Billing.js +0 -21
- package/dist/apis/LiveTranscription.d.ts +0 -58
- package/dist/apis/LiveTranscription.js +0 -55
- package/dist/apis/Polyglot.d.ts +0 -113
- package/dist/apis/Polyglot.js +0 -68
- package/dist/apis/Security.d.ts +0 -25
- package/dist/apis/Security.js +0 -35
- package/dist/apis/Transcriptions.d.ts +0 -61
- package/dist/apis/Transcriptions.js +0 -43
- package/dist/apis/UrlTranscription.d.ts +0 -59
- package/dist/apis/UrlTranscription.js +0 -53
- package/dist/apis/index.d.ts +0 -6
- package/dist/apis/index.js +0 -22
- package/dist/esm/ApiVersion.d.ts +0 -2
- package/dist/esm/ApiVersion.js +0 -28
- package/dist/esm/RestApi.d.ts +0 -21
- package/dist/esm/RestApi.js +0 -91
- package/dist/esm/VocalStackApi.d.ts +0 -19
- package/dist/esm/VocalStackApi.js +0 -46
- package/dist/esm/WebsocketApi.d.ts +0 -38
- package/dist/esm/WebsocketApi.js +0 -146
- package/dist/esm/apis/Billing.d.ts +0 -59
- package/dist/esm/apis/Billing.js +0 -17
- package/dist/esm/apis/LiveTranscription.d.ts +0 -58
- package/dist/esm/apis/LiveTranscription.js +0 -51
- package/dist/esm/apis/Polyglot.d.ts +0 -113
- package/dist/esm/apis/Polyglot.js +0 -64
- package/dist/esm/apis/Security.d.ts +0 -25
- package/dist/esm/apis/Security.js +0 -31
- package/dist/esm/apis/Transcriptions.d.ts +0 -61
- package/dist/esm/apis/Transcriptions.js +0 -39
- package/dist/esm/apis/UrlTranscription.d.ts +0 -59
- package/dist/esm/apis/UrlTranscription.js +0 -49
- package/dist/esm/apis/index.d.ts +0 -6
- package/dist/esm/apis/index.js +0 -6
- package/dist/esm/generics.zod.d.ts +0 -77
- package/dist/esm/generics.zod.js +0 -45
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/index.js +0 -2
- package/dist/esm/version.d.ts +0 -1
- package/dist/esm/version.js +0 -1
- package/dist/generics.zod.d.ts +0 -77
- package/dist/generics.zod.js +0 -48
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
import type { AppStreamKey, AudioSourceCheck, Batch, BatchPage, AutoTopUpSettings, AutoTopUpView, BillingDetails, BillingView, CheckPromoCode, CheckoutView, CreateCheckout, LowBalanceAlertSettings, LowBalanceAlertView, PaymentDocument, PaymentMethodList, PaymentPage, PortalLink, PromoCodeView, SetInterval, SubscriptionView, YearlyOptIn, UsageChargePage, UsageReport, Broadcast, Correction, CorrectionBatch, CorrectionPage, CreateAppStreamKey, CreateAudioSource, CreateBatch, CreateLiveTranscription, CreateBroadcast, CreateShareLink, CreateTranscription, CreateVoiceFromSpeaker, CreatedAppStreamKey, ChargePage, ExportFormat, Health, LanguageLists, LedgerPage, LinkProbe, PatchVoice, PlanList, PublishGrant, Recording, RecordingEvent, RecordingEvents, RecordingPage, RetranscribeLine, RtmpStatus, SearchResults, SettingsPatch, ShareLink, StartRecording, StartJob, SummaryStatus, Transcription, TranscriptionJob, TranscriptionPage, TranscriptSnapshot, UpdateBroadcast, UpdateTranscription, UpdateShareLink, UploadRecording, Voice, VoiceCatalogue, VoiceTrack } from '@vocalstack/contract';
|
|
2
|
+
import { Transport, type CallOptions, type ReadAs } from './http.js';
|
|
3
|
+
import { RealtimeSession, type ConnectOptions } from './realtime.js';
|
|
4
|
+
import { Subscription, type SubscribeOptions } from './subscription.js';
|
|
5
|
+
import { type WsLike } from './ws.js';
|
|
6
|
+
/** A file to upload: a `Blob`/`File`, bytes, or (Node) a path. */
|
|
7
|
+
export type Upload = Blob | Uint8Array | ArrayBuffer | string;
|
|
8
|
+
/** Which of a principal's broadcasts or transcriptions a list returns
|
|
9
|
+
* (`?lifecycle=`): `all` is the active and the archived in one answer. */
|
|
10
|
+
export type LifecycleFilter = 'active' | 'archived' | 'all';
|
|
11
|
+
/** One page of a broadcast's or a transcription's recordings. */
|
|
12
|
+
export interface RecordingPageOptions extends PageOptions {
|
|
13
|
+
lifecycle?: 'active' | 'archived';
|
|
14
|
+
}
|
|
15
|
+
/** What broadcasts and transcriptions have in common: both hold
|
|
16
|
+
* recordings and share links. */
|
|
17
|
+
declare abstract class ParentResource<T, U> {
|
|
18
|
+
protected readonly t: Transport;
|
|
19
|
+
protected abstract readonly base: '/v1/broadcasts' | '/v1/transcriptions';
|
|
20
|
+
/** The list's key: what it holds. */
|
|
21
|
+
protected abstract readonly key: 'broadcasts' | 'transcriptions';
|
|
22
|
+
constructor(t: Transport);
|
|
23
|
+
protected p(id: string, rest?: string): string;
|
|
24
|
+
/** Every one, newest first: a paged list is read to its last page
|
|
25
|
+
* (`transcriptions.listPage` reads one). */
|
|
26
|
+
list(lifecycle?: LifecycleFilter): Promise<T[]>;
|
|
27
|
+
get(id: string): Promise<T>;
|
|
28
|
+
/** Rename, change the default capture settings (a broadcast: also its access, password or link). */
|
|
29
|
+
update(id: string, req: U): Promise<T>;
|
|
30
|
+
/** Hidden, its links dead, its data kept until `restore` or `purge`. */
|
|
31
|
+
archive(id: string): Promise<T>;
|
|
32
|
+
restore(id: string): Promise<T>;
|
|
33
|
+
/** Delete an archived one and everything in it, for good. */
|
|
34
|
+
purge(id: string): Promise<void>;
|
|
35
|
+
/** Every recording, newest first (every page of `listRecordingsPage`). */
|
|
36
|
+
listRecordings(id: string, lifecycle?: 'active' | 'archived'): Promise<Recording[]>;
|
|
37
|
+
/** One page of recordings, newest first: pass its `nextCursor` as `cursor` for the next. */
|
|
38
|
+
listRecordingsPage(id: string, opts?: RecordingPageOptions): Promise<RecordingPage>;
|
|
39
|
+
/** Start a live recording. The grant's `streamUrl` is the publisher
|
|
40
|
+
* socket (`vs.recordings.publish(grant)`). A 409 `conflict` with
|
|
41
|
+
* `details.takeover` means another device is recording: retry with
|
|
42
|
+
* `{ takeover: true }` to record here instead. */
|
|
43
|
+
startRecording(id: string, req?: StartRecording, call?: CallOptions): Promise<PublishGrant>;
|
|
44
|
+
listShareLinks(id: string): Promise<ShareLink[]>;
|
|
45
|
+
createShareLink(id: string, req: CreateShareLink): Promise<ShareLink>;
|
|
46
|
+
/** The events socket a waiting screen needs: `recording.started` (it is
|
|
47
|
+
* live), `recording.ended`, `job.progress`, `stream.ingest`.
|
|
48
|
+
* Each names the transcription the recording is made in (`transcriptionId`). */
|
|
49
|
+
events(id: string, as?: ReadAs & {
|
|
50
|
+
asOwner?: boolean;
|
|
51
|
+
}): Promise<WsLike>;
|
|
52
|
+
}
|
|
53
|
+
/** `vs.broadcasts`: the links listeners open (design 77). */
|
|
54
|
+
export declare class Broadcasts extends ParentResource<Broadcast, UpdateBroadcast> {
|
|
55
|
+
protected readonly base: "/v1/broadcasts";
|
|
56
|
+
protected readonly key: "broadcasts";
|
|
57
|
+
create(req: CreateBroadcast, call?: CallOptions): Promise<Broadcast>;
|
|
58
|
+
/** Give a broadcast a stream it can record from (a YouTube live, an
|
|
59
|
+
* internet radio address). Returns the broadcast. */
|
|
60
|
+
addAudioSource(id: string, req: CreateAudioSource): Promise<Broadcast>;
|
|
61
|
+
removeAudioSource(id: string, sourceId: string): Promise<Broadcast>;
|
|
62
|
+
/** Whether that source can be recorded right now; `fresh` skips the short cache. */
|
|
63
|
+
checkAudioSource(id: string, sourceId: string, opts?: {
|
|
64
|
+
fresh?: boolean;
|
|
65
|
+
}): Promise<AudioSourceCheck>;
|
|
66
|
+
}
|
|
67
|
+
export type CreateTranscriptionInput = CreateTranscription & {
|
|
68
|
+
/** The file to transcribe; omit it and set `url` to have the server fetch a link. */
|
|
69
|
+
file?: Upload;
|
|
70
|
+
/** The upload's file name, when `file` does not carry one. */
|
|
71
|
+
fileName?: string;
|
|
72
|
+
};
|
|
73
|
+
/** `vs.transcriptions`: a file, a link, a microphone or a stream, transcribed and stored. */
|
|
74
|
+
export declare class Transcriptions extends ParentResource<Transcription, UpdateTranscription> {
|
|
75
|
+
protected readonly base: "/v1/transcriptions";
|
|
76
|
+
protected readonly key: "transcriptions";
|
|
77
|
+
/** One page of transcriptions, newest first: pass its `nextCursor` as
|
|
78
|
+
* `cursor` for the next; the last page has none. */
|
|
79
|
+
listPage(opts?: PageOptions & {
|
|
80
|
+
lifecycle?: LifecycleFilter;
|
|
81
|
+
}): Promise<TranscriptionPage>;
|
|
82
|
+
/** A file or link recording in this transcription: no live phase, transcribed at full speed.
|
|
83
|
+
* It has no job: open the grant's socket with `vs.recordings.publish(grant)` (with `url`
|
|
84
|
+
* the server fetches the link) and read it until the session is done. */
|
|
85
|
+
uploadRecording(id: string, req?: UploadRecording, call?: CallOptions): Promise<PublishGrant>;
|
|
86
|
+
/** From a file (`file`) or a public link (`url`). The answer's
|
|
87
|
+
* `job.recordingId` is the job: `vs.jobs.wait(recordingId)`,
|
|
88
|
+
* then `vs.recordings.transcript(recordingId)`. */
|
|
89
|
+
create(req: CreateTranscriptionInput, call?: CallOptions): Promise<Transcription>;
|
|
90
|
+
/** `create({ url, ...opts })`. */
|
|
91
|
+
createFromUrl(url: string, opts?: Omit<CreateTranscription, 'url'>, call?: CallOptions): Promise<Transcription>;
|
|
92
|
+
/** A transcription captured as it is spoken: a microphone, or a stream
|
|
93
|
+
* the server pulls. Created idle: `startRecording(id)` starts it. */
|
|
94
|
+
createLive(req: CreateLiveTranscription, call?: CallOptions): Promise<Transcription>;
|
|
95
|
+
/** Whether a link is live (a live transcription) or a file. */
|
|
96
|
+
probe(url: string): Promise<LinkProbe>;
|
|
97
|
+
/** Feed a broadcast from a live transcription. Returns the transcription. */
|
|
98
|
+
attachBroadcast(id: string, broadcastId: string): Promise<Transcription>;
|
|
99
|
+
detachBroadcast(id: string, broadcastId: string): Promise<Transcription>;
|
|
100
|
+
}
|
|
101
|
+
/** What `batches.addFile` takes: a file (`file`) or a public link (`url`),
|
|
102
|
+
* and of the transcription options only these (the settings are the batch's). */
|
|
103
|
+
export type AddBatchFileInput = Pick<CreateTranscription, 'url' | 'name' | 'startS' | 'endS' | 'durationS'> & {
|
|
104
|
+
/** The file to add; omit it and set `url` to have the server fetch a link. */
|
|
105
|
+
file?: Upload;
|
|
106
|
+
/** The upload's file name, when `file` does not carry one. */
|
|
107
|
+
fileName?: string;
|
|
108
|
+
};
|
|
109
|
+
/** `vs.batches`: several files transcribed together, for less than a
|
|
110
|
+
* transcription each (one create, one minimum charge). Create a batch, add
|
|
111
|
+
* each file or link with `addFile`, then `start` it; `get` shows its files
|
|
112
|
+
* (each a transcription with its job) and their counts. A batch's files get
|
|
113
|
+
* no summary, title, share link or spoken translations. */
|
|
114
|
+
export declare class Batches {
|
|
115
|
+
#private;
|
|
116
|
+
constructor(t: Transport);
|
|
117
|
+
/** An open batch, ready for files (`name` defaults to "Batch of <date>"). */
|
|
118
|
+
create(req?: CreateBatch, call?: CallOptions): Promise<Batch>;
|
|
119
|
+
/** Every batch, newest first (every page of `listPage`); each with its counts, not its files. */
|
|
120
|
+
list(): Promise<Batch[]>;
|
|
121
|
+
/** One page of batches, newest first: pass its `nextCursor` as `cursor` for the next. */
|
|
122
|
+
listPage(opts?: PageOptions): Promise<BatchPage>;
|
|
123
|
+
/** A batch with its files (`files`, each a transcription with its job), in the order they were added. */
|
|
124
|
+
get(id: string): Promise<Batch>;
|
|
125
|
+
/** Discard a batch that was never started, with its files (nothing was charged). */
|
|
126
|
+
delete(id: string): Promise<void>;
|
|
127
|
+
/** Add one file (`file`) or link (`url`) to an open batch: a transcription
|
|
128
|
+
* of its own (`batchId`), waiting for the batch's `start`. */
|
|
129
|
+
addFile(id: string, req: AddBatchFileInput, call?: CallOptions): Promise<Transcription>;
|
|
130
|
+
/** `addFile(id, { url, ...opts })`. */
|
|
131
|
+
addUrl(id: string, url: string, opts?: Omit<AddBatchFileInput, 'url' | 'file' | 'fileName'>, call?: CallOptions): Promise<Transcription>;
|
|
132
|
+
/** Seal the batch and queue its files, longest first; `wait` follows it to the end. */
|
|
133
|
+
start(id: string, call?: CallOptions): Promise<Batch>;
|
|
134
|
+
/** Every finished file's transcript in one `format` (as `recordings.export`
|
|
135
|
+
* makes one), in one zip, as a `Response`: `.arrayBuffer()` it. Files
|
|
136
|
+
* still running or failed are left out. */
|
|
137
|
+
export(id: string, format: ExportFormat): Promise<Response>;
|
|
138
|
+
/** Stop every file not finished yet: queued files never start, a running
|
|
139
|
+
* one is cancelled and billed for what it transcribed. */
|
|
140
|
+
stop(id: string): Promise<Batch>;
|
|
141
|
+
/** Poll a started batch until it is `done` (every file finished or
|
|
142
|
+
* failed) or `stopped`, and return it with its files. It does not throw
|
|
143
|
+
* on a failed file: check `counts.failed` and each file's `job.state`.
|
|
144
|
+
* `onProgress` sees every read, the last one included. */
|
|
145
|
+
wait(id: string, opts?: {
|
|
146
|
+
intervalMs?: number;
|
|
147
|
+
timeoutMs?: number;
|
|
148
|
+
signal?: AbortSignal;
|
|
149
|
+
onProgress?(batch: Batch): void;
|
|
150
|
+
}): Promise<Batch>;
|
|
151
|
+
}
|
|
152
|
+
/** `vs.recordings`: one take, live or uploaded. */
|
|
153
|
+
export declare class Recordings {
|
|
154
|
+
#private;
|
|
155
|
+
constructor(t: Transport);
|
|
156
|
+
get(id: string, as?: ReadAs): Promise<Recording>;
|
|
157
|
+
pause(id: string): Promise<Recording>;
|
|
158
|
+
resume(id: string): Promise<Recording>;
|
|
159
|
+
/** Only from paused. */
|
|
160
|
+
stop(id: string, reason?: string): Promise<Recording>;
|
|
161
|
+
settings(id: string, patch: SettingsPatch): Promise<Recording>;
|
|
162
|
+
/** A new publisher grant for a recording that is already live. */
|
|
163
|
+
publishToken(id: string, opts?: {
|
|
164
|
+
takeover?: boolean;
|
|
165
|
+
}): Promise<PublishGrant>;
|
|
166
|
+
/** Open the publisher socket a grant names and wait until it is ready:
|
|
167
|
+
* send raw PCM (f32le, 16 kHz, mono) with `sendAudio`, end with `eof()`. */
|
|
168
|
+
publish(grant: PublishGrant, opts?: ConnectOptions): Promise<RealtimeSession>;
|
|
169
|
+
archive(id: string): Promise<Recording>;
|
|
170
|
+
restore(id: string): Promise<Recording>;
|
|
171
|
+
purge(id: string): Promise<void>;
|
|
172
|
+
/** The transcript: segments (with word timings), sentences and speakers,
|
|
173
|
+
* up to `lastSeq`; `after` continues from a cursor, `lang` reads it translated. */
|
|
174
|
+
transcript(id: string, opts?: {
|
|
175
|
+
after?: number;
|
|
176
|
+
lang?: string;
|
|
177
|
+
asListener?: boolean;
|
|
178
|
+
} & ReadAs): Promise<TranscriptSnapshot>;
|
|
179
|
+
/** Translate the given sentences (at most 40 ids per call); the answer
|
|
180
|
+
* carries only what this call translated. */
|
|
181
|
+
translation(id: string, lang: string, sentences?: number[], as?: ReadAs): Promise<{
|
|
182
|
+
lang: string;
|
|
183
|
+
translations: Record<string, string>;
|
|
184
|
+
}>;
|
|
185
|
+
/** Queue the AI title and summary of a finished recording. */
|
|
186
|
+
summarize(id: string, call?: CallOptions): Promise<SummaryStatus>;
|
|
187
|
+
/** The title and summary as they stand, in `lang` when given. */
|
|
188
|
+
summary(id: string, opts?: {
|
|
189
|
+
lang?: string;
|
|
190
|
+
} & ReadAs): Promise<SummaryStatus>;
|
|
191
|
+
/** An export file (JSON, SRT, XLSX, PDF) as a `Response`: `.text()` or
|
|
192
|
+
* `.arrayBuffer()` it. `lang` makes it read in that language. */
|
|
193
|
+
export(id: string, format: ExportFormat, opts?: {
|
|
194
|
+
lang?: string;
|
|
195
|
+
} & ReadAs): Promise<Response>;
|
|
196
|
+
/** The export as a plain link, for a browser download with a browser
|
|
197
|
+
* access token (it rides in the query). Never use it with an API key:
|
|
198
|
+
* the API refuses a key in a URL. */
|
|
199
|
+
exportUrl(id: string, format: ExportFormat, opts?: {
|
|
200
|
+
lang?: string;
|
|
201
|
+
shareCode?: string; /** A broadcast listener's, once the recording has ended. */
|
|
202
|
+
listenerToken?: string;
|
|
203
|
+
}): Promise<string>;
|
|
204
|
+
/** The signed media URL the server redirects to. `kind`: `delivery`
|
|
205
|
+
* (default), `master`, or `source` (a transcription's original upload). */
|
|
206
|
+
audioUrl(id: string, opts?: {
|
|
207
|
+
kind?: 'delivery' | 'master' | 'source' | 'video';
|
|
208
|
+
lang?: string;
|
|
209
|
+
format?: string;
|
|
210
|
+
} & ReadAs): Promise<string>;
|
|
211
|
+
/** A stretch of the recording's audio, `startS` to `endS` seconds (at most 120 s). */
|
|
212
|
+
clip(id: string, startS: number, endS: number, as?: ReadAs): Promise<Response>;
|
|
213
|
+
/** The synthesized voice tracks of a recording (per language). */
|
|
214
|
+
voice(id: string, lang?: string, as?: ReadAs): Promise<VoiceTrack[]>;
|
|
215
|
+
/** Synthesize the voice track in these languages. */
|
|
216
|
+
renderVoice(id: string, langs: string[], call?: CallOptions): Promise<VoiceTrack[]>;
|
|
217
|
+
/** One sentence spoken in `lang`. */
|
|
218
|
+
voiceClip(id: string, sentence: number, lang: string, opts?: {
|
|
219
|
+
format?: 'ogg' | 'caf';
|
|
220
|
+
} & ReadAs): Promise<Response>;
|
|
221
|
+
/** A short-lived token for the recording's media URLs. */
|
|
222
|
+
mediaToken(id: string): Promise<{
|
|
223
|
+
token: string;
|
|
224
|
+
expiresAt: string;
|
|
225
|
+
}>;
|
|
226
|
+
/** Name a speaker (the diarizer's index); `null` clears the name. */
|
|
227
|
+
nameSpeaker(id: string, speaker: number, name: string | null): Promise<void>;
|
|
228
|
+
/** The durable event log with wall times (owner only): every event
|
|
229
|
+
* after `after` (a `seq`; the whole log without it), read `limit` a page. */
|
|
230
|
+
events(id: string, opts?: {
|
|
231
|
+
after?: number;
|
|
232
|
+
limit?: number;
|
|
233
|
+
}): Promise<RecordingEvent[]>;
|
|
234
|
+
/** One page of the event log (500 by default, 1000 at most): from `after`
|
|
235
|
+
* a `seq`, or the previous page's `nextCursor` as `cursor`. */
|
|
236
|
+
eventsPage(id: string, opts?: {
|
|
237
|
+
cursor?: string;
|
|
238
|
+
after?: number;
|
|
239
|
+
limit?: number;
|
|
240
|
+
}): Promise<RecordingEvents>;
|
|
241
|
+
/** Attach to the live fan-out; resolves once the backfill snapshot is in place. */
|
|
242
|
+
subscribe(id: string, opts?: SubscribeOptions): Promise<Subscription>;
|
|
243
|
+
}
|
|
244
|
+
/** `vs.jobs`: the transcription job of a file or link recording
|
|
245
|
+
* (`/v1/recordings/{id}/job`). States: queued, fetching, transcribing,
|
|
246
|
+
* done, failed, and cropping (waiting for `start`). */
|
|
247
|
+
export declare class Jobs {
|
|
248
|
+
#private;
|
|
249
|
+
constructor(t: Transport);
|
|
250
|
+
get(recordingId: string): Promise<TranscriptionJob>;
|
|
251
|
+
/** Release a job waiting in `cropping`: the window to transcribe, in seconds. */
|
|
252
|
+
start(recordingId: string, window?: StartJob): Promise<TranscriptionJob>;
|
|
253
|
+
/** Re-queue a failed job from its stored source. */
|
|
254
|
+
retry(recordingId: string): Promise<TranscriptionJob>;
|
|
255
|
+
/** The file the server fetched for a link job waiting in `cropping`. */
|
|
256
|
+
preview(recordingId: string): Promise<Response>;
|
|
257
|
+
/** Poll until the job is `done`, `failed` or `cropping`, and return it.
|
|
258
|
+
* It does not throw on `failed`: check `job.state` (and `job.error`).
|
|
259
|
+
* `onProgress` sees every job read, the last one included: its `state`
|
|
260
|
+
* and `progress` (`pct`, `processedS`, the fetch phase). */
|
|
261
|
+
wait(recordingId: string, opts?: {
|
|
262
|
+
intervalMs?: number;
|
|
263
|
+
timeoutMs?: number;
|
|
264
|
+
signal?: AbortSignal;
|
|
265
|
+
onProgress?(job: TranscriptionJob): void;
|
|
266
|
+
}): Promise<TranscriptionJob>;
|
|
267
|
+
}
|
|
268
|
+
/** `vs.corrections`: edits to a finished transcript, each revertible. */
|
|
269
|
+
export declare class Corrections {
|
|
270
|
+
#private;
|
|
271
|
+
constructor(t: Transport);
|
|
272
|
+
/** Every correction, newest first (every page of `listPage`). */
|
|
273
|
+
list(recordingId: string): Promise<Correction[]>;
|
|
274
|
+
/** One page of corrections, newest first: pass its `nextCursor` as `cursor` for the next. */
|
|
275
|
+
listPage(recordingId: string, opts?: PageOptions): Promise<CorrectionPage>;
|
|
276
|
+
/** Apply a staged batch atomically; every target must be settled. */
|
|
277
|
+
apply(recordingId: string, batch: CorrectionBatch): Promise<Correction[]>;
|
|
278
|
+
/** Read lines again with the language forced; lands as `line` corrections. */
|
|
279
|
+
retranscribe(recordingId: string, req: RetranscribeLine): Promise<Correction[]>;
|
|
280
|
+
revert(correctionId: string): Promise<Correction>;
|
|
281
|
+
}
|
|
282
|
+
/** `vs.shareLinks`: named public links to a transcription or broadcast
|
|
283
|
+
* (create and list them on their owner). */
|
|
284
|
+
export declare class ShareLinks {
|
|
285
|
+
#private;
|
|
286
|
+
constructor(t: Transport);
|
|
287
|
+
update(id: string, req: UpdateShareLink): Promise<ShareLink>;
|
|
288
|
+
revoke(id: string): Promise<ShareLink>;
|
|
289
|
+
}
|
|
290
|
+
/** `vs.voices`: the account's cloned voices, and the catalogue a language offers. */
|
|
291
|
+
export declare class Voices {
|
|
292
|
+
#private;
|
|
293
|
+
constructor(t: Transport);
|
|
294
|
+
list(): Promise<Voice[]>;
|
|
295
|
+
get(id: string): Promise<Voice>;
|
|
296
|
+
/** Build a voice from a sample (`sample`) or audio the server fetches
|
|
297
|
+
* (`sampleUrl`). Calling it asserts you have the speaker's permission,
|
|
298
|
+
* unless `draft` (a draft is named and consented to later with `update`). */
|
|
299
|
+
create(req: {
|
|
300
|
+
name: string;
|
|
301
|
+
sample?: Upload;
|
|
302
|
+
sampleUrl?: string;
|
|
303
|
+
fileName?: string;
|
|
304
|
+
gender?: 'male' | 'female';
|
|
305
|
+
color?: string;
|
|
306
|
+
draft?: boolean;
|
|
307
|
+
}, call?: CallOptions): Promise<Voice>;
|
|
308
|
+
/** Build a voice from one speaker of a recording (asserts permission). */
|
|
309
|
+
createFromSpeaker(req: Omit<CreateVoiceFromSpeaker, 'consent'>, call?: CallOptions): Promise<Voice>;
|
|
310
|
+
/** Rename, recolour, switch off; `{ name, consent: true, draft: false }` finishes a draft. */
|
|
311
|
+
update(id: string, patch: PatchVoice): Promise<Voice>;
|
|
312
|
+
delete(id: string): Promise<void>;
|
|
313
|
+
/** The voices that can speak `lang`, best first (with a token, also the
|
|
314
|
+
* account's ready clones). `recording` also offers the cloned voices that
|
|
315
|
+
* recording uses, to whoever may read it: its owner, or a listener with
|
|
316
|
+
* `listenerToken` or `shareCode`. */
|
|
317
|
+
available(lang: string, opts?: {
|
|
318
|
+
recording?: string;
|
|
319
|
+
asOwner?: boolean;
|
|
320
|
+
} & ReadAs): Promise<VoiceCatalogue>;
|
|
321
|
+
/** A catalogue voice speaking `lang` (Ogg/Opus; `caf` for Apple). 202 while it is prepared. */
|
|
322
|
+
preview(voice: string, lang: string, opts?: {
|
|
323
|
+
format?: 'ogg' | 'caf';
|
|
324
|
+
}): Promise<Response>;
|
|
325
|
+
/** A cloned voice speaking `lang`; 409 while it is not ready. With
|
|
326
|
+
* `recording`, as it speaks in that recording, for whoever may read it
|
|
327
|
+
* (its owner, or a listener with `listenerToken` or `shareCode`). */
|
|
328
|
+
clonePreview(id: string, opts?: {
|
|
329
|
+
lang?: string;
|
|
330
|
+
format?: 'ogg' | 'caf';
|
|
331
|
+
recording?: string;
|
|
332
|
+
asOwner?: boolean;
|
|
333
|
+
} & ReadAs): Promise<Response>;
|
|
334
|
+
/** The audio a voice was made from. */
|
|
335
|
+
sample(id: string): Promise<Response>;
|
|
336
|
+
}
|
|
337
|
+
export interface SearchOptions {
|
|
338
|
+
/** Only these broadcasts, by link (`code`): what a listener joined. */
|
|
339
|
+
broadcasts?: string[];
|
|
340
|
+
/** Listener tokens for the private ones among `broadcasts`. */
|
|
341
|
+
listenerTokens?: string[];
|
|
342
|
+
/** Only this recording. */
|
|
343
|
+
recording?: string;
|
|
344
|
+
lang?: string;
|
|
345
|
+
limit?: number;
|
|
346
|
+
}
|
|
347
|
+
/** `vs.search`: full-text search over the caller's transcripts. */
|
|
348
|
+
export declare class Search {
|
|
349
|
+
#private;
|
|
350
|
+
constructor(t: Transport);
|
|
351
|
+
/** `q` is 2 or more characters. */
|
|
352
|
+
query(q: string, opts?: SearchOptions): Promise<SearchResults>;
|
|
353
|
+
}
|
|
354
|
+
export interface Me {
|
|
355
|
+
userId?: string | null;
|
|
356
|
+
apiKeyId?: string | null;
|
|
357
|
+
displayName: string;
|
|
358
|
+
principalId: string;
|
|
359
|
+
principals: unknown[];
|
|
360
|
+
scopes: string[];
|
|
361
|
+
}
|
|
362
|
+
/** `vs.me`: who the credential is. */
|
|
363
|
+
export declare class MeApi {
|
|
364
|
+
#private;
|
|
365
|
+
constructor(t: Transport);
|
|
366
|
+
get(): Promise<Me>;
|
|
367
|
+
}
|
|
368
|
+
/** `vs.connect.token()`'s parameters: what the callback received and the
|
|
369
|
+
* verifier the app made for the connect link. */
|
|
370
|
+
export interface ConnectTokenInput {
|
|
371
|
+
/** The `code` the dashboard added to `redirect_uri` (single use, two minutes). */
|
|
372
|
+
code: string;
|
|
373
|
+
/** The PKCE verifier whose `BASE64URL(SHA256(verifier))` was the link's `code_challenge`. */
|
|
374
|
+
codeVerifier: string;
|
|
375
|
+
/** Exactly the `redirect_uri` of the connect link. */
|
|
376
|
+
redirectUri: string;
|
|
377
|
+
}
|
|
378
|
+
/** The key a connect code was redeemed for (the wire's own field names). */
|
|
379
|
+
export interface ConnectToken {
|
|
380
|
+
/** The new API key (`vs_key_…`): shown once, here; keep it on the server. */
|
|
381
|
+
access_token: string;
|
|
382
|
+
token_type: 'api_key';
|
|
383
|
+
/** The key's id, as the API keys list and `GET /v1/me` (`apiKeyId`) show it. */
|
|
384
|
+
key_id: string;
|
|
385
|
+
/** The granted scopes, space-separated (`read write`). */
|
|
386
|
+
scope: string;
|
|
387
|
+
/** The account the key acts for. */
|
|
388
|
+
account: {
|
|
389
|
+
name: string;
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/** `vs.connect`: one-click Connect, on the app's server. */
|
|
393
|
+
export declare class Connect {
|
|
394
|
+
#private;
|
|
395
|
+
constructor(t: Transport);
|
|
396
|
+
/** Redeem the `code` the dashboard sent to the app's `redirect_uri` for
|
|
397
|
+
* an API key (OAuth 2.0 authorization code + PKCE). No credential is
|
|
398
|
+
* sent, even when the client has one, and the call is never retried:
|
|
399
|
+
* the code works once. A refusal is a `VocalStackError` whose `code` is
|
|
400
|
+
* OAuth's `error` (`invalid_grant`: unknown, spent or expired code, or a
|
|
401
|
+
* verifier or `redirect_uri` that does not match). */
|
|
402
|
+
token(input: ConnectTokenInput, opts?: CallOptions): Promise<ConnectToken>;
|
|
403
|
+
}
|
|
404
|
+
/** A page of a list. */
|
|
405
|
+
export interface PageOptions {
|
|
406
|
+
/** The `nextCursor` of the previous page. */
|
|
407
|
+
cursor?: string;
|
|
408
|
+
/** 1 to 200: 50 by default for the billing lists, 100 for the others. */
|
|
409
|
+
limit?: number;
|
|
410
|
+
}
|
|
411
|
+
/** `vs.billing.usage()`'s range: inclusive days (`YYYY-MM-DD`) in `tz`. */
|
|
412
|
+
export interface UsageOptions {
|
|
413
|
+
/** The first day (default: the first of this month); an earlier one than the account's is moved to it. */
|
|
414
|
+
startDate?: string;
|
|
415
|
+
/** The last day (default: today, the latest it may be). */
|
|
416
|
+
endDate?: string;
|
|
417
|
+
/** An IANA time zone (default `UTC`). */
|
|
418
|
+
tz?: string;
|
|
419
|
+
}
|
|
420
|
+
/** `vs.billing.usageCharges()`: the usage report's range, its filters and a page. */
|
|
421
|
+
export interface UsageChargesOptions extends UsageOptions, PageOptions {
|
|
422
|
+
/** Only `file` or only `live` charges (realtime sessions are live). */
|
|
423
|
+
kind?: 'file' | 'live';
|
|
424
|
+
/** Only `dashboard`'s charges or one API key's (its id). */
|
|
425
|
+
source?: string;
|
|
426
|
+
}
|
|
427
|
+
/** `vs.billing`: the account's plan, credit balance and limits, the price
|
|
428
|
+
* list, the ledger, the per-recording charges, the usage report, the
|
|
429
|
+
* payments history, payment methods, invoice details and promo codes. */
|
|
430
|
+
export declare class Billing {
|
|
431
|
+
#private;
|
|
432
|
+
constructor(t: Transport);
|
|
433
|
+
/** The account: plan, rates, balance, limits, subscription, top-up URL. */
|
|
434
|
+
get(): Promise<BillingView>;
|
|
435
|
+
/** The visible plans with their current rates and limits (no credential needed). */
|
|
436
|
+
plans(): Promise<PlanList>;
|
|
437
|
+
/** The ledger, newest first. */
|
|
438
|
+
ledger(opts?: PageOptions): Promise<LedgerPage>;
|
|
439
|
+
/** The per-recording charges, newest first. */
|
|
440
|
+
charges(opts?: PageOptions): Promise<ChargePage>;
|
|
441
|
+
/** Open a checkout at the payment provider (a top-up or a subscription); send the customer to `url`.
|
|
442
|
+
* A signed-in person only, never an API key. */
|
|
443
|
+
createCheckout(req: CreateCheckout, opts?: CallOptions): Promise<CheckoutView>;
|
|
444
|
+
/** A checkout's status (by its id or the provider's). */
|
|
445
|
+
getCheckout(id: string): Promise<CheckoutView>;
|
|
446
|
+
/** Cancel the subscription at the end of its period. */
|
|
447
|
+
cancelSubscription(): Promise<SubscriptionView>;
|
|
448
|
+
/** Take back a scheduled cancellation. */
|
|
449
|
+
uncancelSubscription(): Promise<SubscriptionView>;
|
|
450
|
+
/** Turn auto top-up on (threshold and amount from `plans().autoTopUp`) or off. */
|
|
451
|
+
setAutoTopUp(req: AutoTopUpSettings): Promise<AutoTopUpView>;
|
|
452
|
+
/** A link to the provider's customer portal (payment methods, invoices, receipts). */
|
|
453
|
+
portal(): Promise<PortalLink>;
|
|
454
|
+
/** Charge the configured auto top-up amount now (under the day's cap). */
|
|
455
|
+
retryAutoTopUp(): Promise<AutoTopUpView>;
|
|
456
|
+
/** Turn the low-balance email on or off and set its line. */
|
|
457
|
+
setLowBalanceAlert(req: LowBalanceAlertSettings): Promise<LowBalanceAlertView>;
|
|
458
|
+
/** Renew `month`ly or `year`ly from the next period, at `subscription.switchPrices` (needs `acceptTerms` and `noNewWithdrawalPeriodShown`). */
|
|
459
|
+
setInterval(req: SetInterval): Promise<SubscriptionView>;
|
|
460
|
+
/** Keep the subscription by switching to yearly when monthly billing is withdrawn (`subscription.yearlyOptIn`). */
|
|
461
|
+
optInYearly(req: YearlyOptIn): Promise<SubscriptionView>;
|
|
462
|
+
/** Take back a scheduled interval switch. */
|
|
463
|
+
unsetInterval(): Promise<SubscriptionView>;
|
|
464
|
+
/** What the account spent per day, source (API key or Dashboard) and kind. */
|
|
465
|
+
usage(opts?: UsageOptions): Promise<UsageReport>;
|
|
466
|
+
/** The usage report's charges one by one, newest first, with how many match and their total. */
|
|
467
|
+
usageCharges(opts?: UsageChargesOptions): Promise<UsageChargePage>;
|
|
468
|
+
/** The payments history, newest first. */
|
|
469
|
+
payments(opts?: PageOptions): Promise<PaymentPage>;
|
|
470
|
+
/** A payment's invoice or receipt: `{url}`, or `{pending: true}` while the provider makes it. */
|
|
471
|
+
paymentDocument(id: string): Promise<PaymentDocument>;
|
|
472
|
+
/** The saved payment methods. */
|
|
473
|
+
paymentMethods(): Promise<PaymentMethodList>;
|
|
474
|
+
/** Remove a saved payment method. */
|
|
475
|
+
deletePaymentMethod(id: string): Promise<void>;
|
|
476
|
+
/** A link to the provider's portal to add a card or choose the default. */
|
|
477
|
+
managePaymentMethods(): Promise<PortalLink>;
|
|
478
|
+
/** The invoice details. */
|
|
479
|
+
details(): Promise<BillingDetails>;
|
|
480
|
+
/** Save the invoice details. */
|
|
481
|
+
setDetails(req: BillingDetails): Promise<BillingDetails>;
|
|
482
|
+
/** What a promo code gives for a top-up or a subscription. */
|
|
483
|
+
checkPromoCode(req: CheckPromoCode): Promise<PromoCodeView>;
|
|
484
|
+
}
|
|
485
|
+
/** `vs.languages`. */
|
|
486
|
+
export declare class Languages {
|
|
487
|
+
#private;
|
|
488
|
+
constructor(t: Transport);
|
|
489
|
+
/** Spoken and translation languages. */
|
|
490
|
+
list(): Promise<LanguageLists>;
|
|
491
|
+
}
|
|
492
|
+
/** `vs.rtmp`. */
|
|
493
|
+
export declare class Rtmp {
|
|
494
|
+
#private;
|
|
495
|
+
constructor(t: Transport);
|
|
496
|
+
/** The account's RTMP ingest: server URL (RTMPS where available), the stream key (in full only in the answer that made it, `maskedStreamKey` after), and whether an encoder is sending. */
|
|
497
|
+
status(): Promise<RtmpStatus>;
|
|
498
|
+
/** A stream key of the app's own, beside the account's: `streamKey` is in full in this answer only. It works while the API key that made it does. */
|
|
499
|
+
createKey(req: CreateAppStreamKey): Promise<CreatedAppStreamKey>;
|
|
500
|
+
/** The account's app stream keys, oldest first: masked, each with whether an encoder is sending on it (`live`, `audio`). */
|
|
501
|
+
listKeys(): Promise<AppStreamKey[]>;
|
|
502
|
+
/** Delete an app stream key: an encoder publishing on it is dropped within seconds. */
|
|
503
|
+
deleteKey(id: string): Promise<void>;
|
|
504
|
+
}
|
|
505
|
+
/** `vs.events`: the account socket. */
|
|
506
|
+
export declare class Events {
|
|
507
|
+
#private;
|
|
508
|
+
constructor(t: Transport);
|
|
509
|
+
/** `events.ready`, then `lists.changed` whenever one of the owner's
|
|
510
|
+
* lists of broadcasts or transcriptions is out of date: re-read them. */
|
|
511
|
+
account(): Promise<WsLike>;
|
|
512
|
+
}
|
|
513
|
+
/** `vs.meta`. */
|
|
514
|
+
export declare class Meta {
|
|
515
|
+
#private;
|
|
516
|
+
constructor(t: Transport);
|
|
517
|
+
health(): Promise<Health>;
|
|
518
|
+
/** The OpenAPI document this SDK is generated from. */
|
|
519
|
+
openapi(): Promise<Record<string, unknown>>;
|
|
520
|
+
}
|
|
521
|
+
export {};
|