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