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