@deepgram/sdk 5.0.0-alpha.2 → 5.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/browser/index.global.js +674 -1135
- package/dist/cjs/BaseClient.d.ts +7 -7
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +1 -2
- package/dist/cjs/CustomClient.d.ts +9 -1
- package/dist/cjs/CustomClient.js +346 -232
- package/dist/cjs/api/resources/agent/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/agent/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/agent/resources/v1/client/Socket.d.ts +8 -8
- package/dist/cjs/api/resources/agent/resources/v1/client/Socket.js +9 -9
- package/dist/cjs/api/resources/agent/resources/v1/resources/settings/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1Settings.d.ts +3 -43
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.ts +26 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.js +3 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.ts +28 -13
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.js +19 -17
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.ts +28 -13
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.js +19 -17
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.ts +115 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.js +57 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.ts +18 -3
- package/dist/cjs/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.js +2 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/agent/resources/v1/types/index.js +2 -0
- package/dist/cjs/api/resources/auth/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/auth/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/auth/resources/v1/resources/tokens/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/resources/v1/client/Client.js +29 -80
- package/dist/cjs/api/resources/listen/resources/v1/client/Socket.d.ts +4 -4
- package/dist/cjs/api/resources/listen/resources/v1/client/Socket.js +5 -5
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.js +76 -298
- package/dist/cjs/api/resources/listen/resources/v1/types/ListenV1Results.d.ts +3 -3
- package/dist/cjs/api/resources/listen/resources/v2/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/resources/v2/client/Client.js +11 -26
- package/dist/cjs/api/resources/listen/resources/v2/client/Socket.d.ts +2 -2
- package/dist/cjs/api/resources/listen/resources/v2/client/Socket.js +3 -3
- package/dist/cjs/api/resources/manage/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/models/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/models/client/Client.js +3 -4
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/client/Client.js +4 -7
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.js +9 -27
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.js +4 -7
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.js +3 -4
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.js +3 -4
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.js +3 -4
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.js +12 -31
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.js +46 -133
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.js +47 -136
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.js +4 -7
- package/dist/cjs/api/resources/read/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/read/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/read/resources/v1/resources/text/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/read/resources/v1/resources/text/client/Client.js +14 -52
- package/dist/cjs/api/resources/selfHosted/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/selfHosted/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.js +4 -12
- package/dist/cjs/api/resources/speak/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/speak/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/speak/resources/v1/client/Client.js +6 -13
- package/dist/cjs/api/resources/speak/resources/v1/client/Socket.d.ts +4 -4
- package/dist/cjs/api/resources/speak/resources/v1/client/Socket.js +4 -4
- package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/Client.js +11 -33
- package/dist/cjs/api/types/SpeakV1SampleRate.d.ts +1 -1
- package/dist/cjs/api/types/SpeakV1SampleRate.js +1 -1
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +14 -8
- package/dist/cjs/auth/HeaderAuthProvider.js +19 -9
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
- package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -2
- package/dist/cjs/core/headers.d.ts +2 -2
- package/dist/cjs/core/websocket/ws.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +7 -7
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +1 -2
- package/dist/esm/CustomClient.d.mts +9 -1
- package/dist/esm/CustomClient.mjs +347 -233
- package/dist/esm/api/resources/agent/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/agent/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/agent/resources/v1/client/Socket.d.mts +8 -8
- package/dist/esm/api/resources/agent/resources/v1/client/Socket.mjs +9 -9
- package/dist/esm/api/resources/agent/resources/v1/resources/settings/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1Settings.d.mts +3 -43
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.d.mts +26 -0
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentListenProvider.mjs +2 -0
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.d.mts +28 -13
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.mjs +19 -17
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.d.mts +28 -13
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.mjs +19 -17
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.d.mts +115 -0
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1SettingsAgentThinkProvider.mjs +54 -0
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.d.mts +18 -3
- package/dist/esm/api/resources/agent/resources/v1/types/AgentV1UpdateSpeakSpeakProvider.mjs +2 -0
- package/dist/esm/api/resources/agent/resources/v1/types/index.d.mts +2 -0
- package/dist/esm/api/resources/agent/resources/v1/types/index.mjs +2 -0
- package/dist/esm/api/resources/auth/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/auth/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/auth/resources/v1/resources/tokens/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/resources/v1/client/Client.mjs +29 -80
- package/dist/esm/api/resources/listen/resources/v1/client/Socket.d.mts +4 -4
- package/dist/esm/api/resources/listen/resources/v1/client/Socket.mjs +5 -5
- package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.mjs +76 -298
- package/dist/esm/api/resources/listen/resources/v1/types/ListenV1Results.d.mts +3 -3
- package/dist/esm/api/resources/listen/resources/v2/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/resources/v2/client/Client.mjs +11 -26
- package/dist/esm/api/resources/listen/resources/v2/client/Socket.d.mts +2 -2
- package/dist/esm/api/resources/listen/resources/v2/client/Socket.mjs +3 -3
- package/dist/esm/api/resources/manage/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/models/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/models/client/Client.mjs +3 -4
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/client/Client.mjs +4 -7
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.mjs +9 -27
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.mjs +4 -7
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.mjs +3 -4
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.mjs +3 -4
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.mjs +3 -4
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.mjs +12 -31
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.mjs +46 -133
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.mjs +47 -136
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.mjs +4 -7
- package/dist/esm/api/resources/read/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/read/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/read/resources/v1/resources/text/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/read/resources/v1/resources/text/client/Client.mjs +14 -52
- package/dist/esm/api/resources/selfHosted/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/selfHosted/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.mjs +4 -12
- package/dist/esm/api/resources/speak/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/speak/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/speak/resources/v1/client/Client.mjs +6 -13
- package/dist/esm/api/resources/speak/resources/v1/client/Socket.d.mts +4 -4
- package/dist/esm/api/resources/speak/resources/v1/client/Socket.mjs +4 -4
- package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/Client.mjs +11 -33
- package/dist/esm/api/types/SpeakV1SampleRate.d.mts +1 -1
- package/dist/esm/api/types/SpeakV1SampleRate.mjs +1 -1
- package/dist/esm/auth/HeaderAuthProvider.d.mts +14 -8
- package/dist/esm/auth/HeaderAuthProvider.mjs +19 -9
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
- package/dist/esm/core/fetcher/Fetcher.d.mts +1 -2
- package/dist/esm/core/headers.d.mts +2 -2
- package/dist/esm/core/websocket/ws.d.mts +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +11 -10
|
@@ -120,142 +120,53 @@ class BreakdownClient {
|
|
|
120
120
|
return __awaiter(this, arguments, void 0, function* (project_id, request = {}, requestOptions) {
|
|
121
121
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
122
122
|
const { start, end, grouping, accessor, alternatives, callback_method: callbackMethod, callback, channels, custom_intent_mode: customIntentMode, custom_intent: customIntent, custom_topic_mode: customTopicMode, custom_topic: customTopic, deployment, detect_entities: detectEntities, detect_language: detectLanguage, diarize, dictation, encoding, endpoint, extra, filler_words: fillerWords, intents, keyterm, keywords, language, measurements, method, model, multichannel, numerals, paragraphs, profanity_filter: profanityFilter, punctuate, redact, replace, sample_rate: sampleRate, search, sentiment, smart_format: smartFormat, summarize, tag, topics, utt_split: uttSplit, utterances, version, } = request;
|
|
123
|
-
const _queryParams = {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
_queryParams.diarize = diarize.toString();
|
|
171
|
-
}
|
|
172
|
-
if (dictation != null) {
|
|
173
|
-
_queryParams.dictation = dictation.toString();
|
|
174
|
-
}
|
|
175
|
-
if (encoding != null) {
|
|
176
|
-
_queryParams.encoding = encoding.toString();
|
|
177
|
-
}
|
|
178
|
-
if (endpoint != null) {
|
|
179
|
-
_queryParams.endpoint = endpoint;
|
|
180
|
-
}
|
|
181
|
-
if (extra != null) {
|
|
182
|
-
_queryParams.extra = extra.toString();
|
|
183
|
-
}
|
|
184
|
-
if (fillerWords != null) {
|
|
185
|
-
_queryParams.filler_words = fillerWords.toString();
|
|
186
|
-
}
|
|
187
|
-
if (intents != null) {
|
|
188
|
-
_queryParams.intents = intents.toString();
|
|
189
|
-
}
|
|
190
|
-
if (keyterm != null) {
|
|
191
|
-
_queryParams.keyterm = keyterm.toString();
|
|
192
|
-
}
|
|
193
|
-
if (keywords != null) {
|
|
194
|
-
_queryParams.keywords = keywords.toString();
|
|
195
|
-
}
|
|
196
|
-
if (language != null) {
|
|
197
|
-
_queryParams.language = language.toString();
|
|
198
|
-
}
|
|
199
|
-
if (measurements != null) {
|
|
200
|
-
_queryParams.measurements = measurements.toString();
|
|
201
|
-
}
|
|
202
|
-
if (method != null) {
|
|
203
|
-
_queryParams.method = method;
|
|
204
|
-
}
|
|
205
|
-
if (model != null) {
|
|
206
|
-
_queryParams.model = model;
|
|
207
|
-
}
|
|
208
|
-
if (multichannel != null) {
|
|
209
|
-
_queryParams.multichannel = multichannel.toString();
|
|
210
|
-
}
|
|
211
|
-
if (numerals != null) {
|
|
212
|
-
_queryParams.numerals = numerals.toString();
|
|
213
|
-
}
|
|
214
|
-
if (paragraphs != null) {
|
|
215
|
-
_queryParams.paragraphs = paragraphs.toString();
|
|
216
|
-
}
|
|
217
|
-
if (profanityFilter != null) {
|
|
218
|
-
_queryParams.profanity_filter = profanityFilter.toString();
|
|
219
|
-
}
|
|
220
|
-
if (punctuate != null) {
|
|
221
|
-
_queryParams.punctuate = punctuate.toString();
|
|
222
|
-
}
|
|
223
|
-
if (redact != null) {
|
|
224
|
-
_queryParams.redact = redact.toString();
|
|
225
|
-
}
|
|
226
|
-
if (replace != null) {
|
|
227
|
-
_queryParams.replace = replace.toString();
|
|
228
|
-
}
|
|
229
|
-
if (sampleRate != null) {
|
|
230
|
-
_queryParams.sample_rate = sampleRate.toString();
|
|
231
|
-
}
|
|
232
|
-
if (search != null) {
|
|
233
|
-
_queryParams.search = search.toString();
|
|
234
|
-
}
|
|
235
|
-
if (sentiment != null) {
|
|
236
|
-
_queryParams.sentiment = sentiment.toString();
|
|
237
|
-
}
|
|
238
|
-
if (smartFormat != null) {
|
|
239
|
-
_queryParams.smart_format = smartFormat.toString();
|
|
240
|
-
}
|
|
241
|
-
if (summarize != null) {
|
|
242
|
-
_queryParams.summarize = summarize.toString();
|
|
243
|
-
}
|
|
244
|
-
if (tag != null) {
|
|
245
|
-
_queryParams.tag = tag;
|
|
246
|
-
}
|
|
247
|
-
if (topics != null) {
|
|
248
|
-
_queryParams.topics = topics.toString();
|
|
249
|
-
}
|
|
250
|
-
if (uttSplit != null) {
|
|
251
|
-
_queryParams.utt_split = uttSplit.toString();
|
|
252
|
-
}
|
|
253
|
-
if (utterances != null) {
|
|
254
|
-
_queryParams.utterances = utterances.toString();
|
|
255
|
-
}
|
|
256
|
-
if (version != null) {
|
|
257
|
-
_queryParams.version = version.toString();
|
|
258
|
-
}
|
|
123
|
+
const _queryParams = {
|
|
124
|
+
start,
|
|
125
|
+
end,
|
|
126
|
+
grouping: grouping != null ? grouping : undefined,
|
|
127
|
+
accessor,
|
|
128
|
+
alternatives,
|
|
129
|
+
callback_method: callbackMethod,
|
|
130
|
+
callback,
|
|
131
|
+
channels,
|
|
132
|
+
custom_intent_mode: customIntentMode,
|
|
133
|
+
custom_intent: customIntent,
|
|
134
|
+
custom_topic_mode: customTopicMode,
|
|
135
|
+
custom_topic: customTopic,
|
|
136
|
+
deployment: deployment != null ? deployment : undefined,
|
|
137
|
+
detect_entities: detectEntities,
|
|
138
|
+
detect_language: detectLanguage,
|
|
139
|
+
diarize,
|
|
140
|
+
dictation,
|
|
141
|
+
encoding,
|
|
142
|
+
endpoint: endpoint != null ? endpoint : undefined,
|
|
143
|
+
extra,
|
|
144
|
+
filler_words: fillerWords,
|
|
145
|
+
intents,
|
|
146
|
+
keyterm,
|
|
147
|
+
keywords,
|
|
148
|
+
language,
|
|
149
|
+
measurements,
|
|
150
|
+
method: method != null ? method : undefined,
|
|
151
|
+
model,
|
|
152
|
+
multichannel,
|
|
153
|
+
numerals,
|
|
154
|
+
paragraphs,
|
|
155
|
+
profanity_filter: profanityFilter,
|
|
156
|
+
punctuate,
|
|
157
|
+
redact,
|
|
158
|
+
replace,
|
|
159
|
+
sample_rate: sampleRate,
|
|
160
|
+
search,
|
|
161
|
+
sentiment,
|
|
162
|
+
smart_format: smartFormat,
|
|
163
|
+
summarize,
|
|
164
|
+
tag,
|
|
165
|
+
topics,
|
|
166
|
+
utt_split: uttSplit,
|
|
167
|
+
utterances,
|
|
168
|
+
version,
|
|
169
|
+
};
|
|
259
170
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
260
171
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
261
172
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -3,8 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../..
|
|
|
3
3
|
import * as core from "../../../../../../../../../../../../core/index.js";
|
|
4
4
|
import * as Deepgram from "../../../../../../../../../../../index.js";
|
|
5
5
|
export declare namespace FieldsClient {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
8
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -77,13 +77,10 @@ class FieldsClient {
|
|
|
77
77
|
return __awaiter(this, arguments, void 0, function* (project_id, request = {}, requestOptions) {
|
|
78
78
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
79
79
|
const { start, end } = request;
|
|
80
|
-
const _queryParams = {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
if (end != null) {
|
|
85
|
-
_queryParams.end = end;
|
|
86
|
-
}
|
|
80
|
+
const _queryParams = {
|
|
81
|
+
start,
|
|
82
|
+
end,
|
|
83
|
+
};
|
|
87
84
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
88
85
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
89
86
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -2,8 +2,7 @@ import type { BaseClientOptions } from "../../../../BaseClient.js";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
3
|
import { V1Client } from "../resources/v1/client/Client.js";
|
|
4
4
|
export declare namespace ReadClient {
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
type Options = BaseClientOptions;
|
|
7
6
|
}
|
|
8
7
|
export declare class ReadClient {
|
|
9
8
|
protected readonly _options: NormalizedClientOptionsWithAuth<ReadClient.Options>;
|
|
@@ -2,8 +2,7 @@ import type { BaseClientOptions } from "../../../../../../BaseClient.js";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
|
|
3
3
|
import { TextClient } from "../resources/text/client/Client.js";
|
|
4
4
|
export declare namespace V1Client {
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
type Options = BaseClientOptions;
|
|
7
6
|
}
|
|
8
7
|
export declare class V1Client {
|
|
9
8
|
protected readonly _options: NormalizedClientOptionsWithAuth<V1Client.Options>;
|
|
@@ -3,8 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../Ba
|
|
|
3
3
|
import * as core from "../../../../../../../../core/index.js";
|
|
4
4
|
import * as Deepgram from "../../../../../../../index.js";
|
|
5
5
|
export declare namespace TextClient {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
8
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -89,58 +89,20 @@ class TextClient {
|
|
|
89
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
90
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
91
91
|
const { callback, callback_method: callbackMethod, sentiment, summarize, tag, topics, custom_topic: customTopic, custom_topic_mode: customTopicMode, intents, custom_intent: customIntent, custom_intent_mode: customIntentMode, language, body: _body, } = request;
|
|
92
|
-
const _queryParams = {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (Array.isArray(tag)) {
|
|
107
|
-
_queryParams.tag = tag.map((item) => item);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
_queryParams.tag = tag;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (topics != null) {
|
|
114
|
-
_queryParams.topics = topics.toString();
|
|
115
|
-
}
|
|
116
|
-
if (customTopic != null) {
|
|
117
|
-
if (Array.isArray(customTopic)) {
|
|
118
|
-
_queryParams.custom_topic = customTopic.map((item) => item);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
_queryParams.custom_topic = customTopic;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (customTopicMode != null) {
|
|
125
|
-
_queryParams.custom_topic_mode = customTopicMode;
|
|
126
|
-
}
|
|
127
|
-
if (intents != null) {
|
|
128
|
-
_queryParams.intents = intents.toString();
|
|
129
|
-
}
|
|
130
|
-
if (customIntent != null) {
|
|
131
|
-
if (Array.isArray(customIntent)) {
|
|
132
|
-
_queryParams.custom_intent = customIntent.map((item) => item);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
_queryParams.custom_intent = customIntent;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (customIntentMode != null) {
|
|
139
|
-
_queryParams.custom_intent_mode = customIntentMode;
|
|
140
|
-
}
|
|
141
|
-
if (language != null) {
|
|
142
|
-
_queryParams.language = language;
|
|
143
|
-
}
|
|
92
|
+
const _queryParams = {
|
|
93
|
+
callback,
|
|
94
|
+
callback_method: callbackMethod != null ? callbackMethod : undefined,
|
|
95
|
+
sentiment,
|
|
96
|
+
summarize: summarize != null ? summarize : undefined,
|
|
97
|
+
tag,
|
|
98
|
+
topics,
|
|
99
|
+
custom_topic: customTopic,
|
|
100
|
+
custom_topic_mode: customTopicMode != null ? customTopicMode : undefined,
|
|
101
|
+
intents,
|
|
102
|
+
custom_intent: customIntent,
|
|
103
|
+
custom_intent_mode: customIntentMode != null ? customIntentMode : undefined,
|
|
104
|
+
language,
|
|
105
|
+
};
|
|
144
106
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
145
107
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
146
108
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -2,8 +2,7 @@ import type { BaseClientOptions } from "../../../../BaseClient.js";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
3
|
import { V1Client } from "../resources/v1/client/Client.js";
|
|
4
4
|
export declare namespace SelfHostedClient {
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
type Options = BaseClientOptions;
|
|
7
6
|
}
|
|
8
7
|
export declare class SelfHostedClient {
|
|
9
8
|
protected readonly _options: NormalizedClientOptionsWithAuth<SelfHostedClient.Options>;
|
|
@@ -2,8 +2,7 @@ import type { BaseClientOptions } from "../../../../../../BaseClient.js";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
|
|
3
3
|
import { DistributionCredentialsClient } from "../resources/distributionCredentials/client/Client.js";
|
|
4
4
|
export declare namespace V1Client {
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
type Options = BaseClientOptions;
|
|
7
6
|
}
|
|
8
7
|
export declare class V1Client {
|
|
9
8
|
protected readonly _options: NormalizedClientOptionsWithAuth<V1Client.Options>;
|
|
@@ -3,8 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../Ba
|
|
|
3
3
|
import * as core from "../../../../../../../../core/index.js";
|
|
4
4
|
import * as Deepgram from "../../../../../../../index.js";
|
|
5
5
|
export declare namespace DistributionCredentialsClient {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
8
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -138,18 +138,10 @@ class DistributionCredentialsClient {
|
|
|
138
138
|
return __awaiter(this, arguments, void 0, function* (project_id, request = {}, requestOptions) {
|
|
139
139
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
140
140
|
const { scopes, provider } = request, _body = __rest(request, ["scopes", "provider"]);
|
|
141
|
-
const _queryParams = {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
_queryParams.scopes = scopes;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (provider != null) {
|
|
151
|
-
_queryParams.provider = provider;
|
|
152
|
-
}
|
|
141
|
+
const _queryParams = {
|
|
142
|
+
scopes: Array.isArray(scopes) ? scopes.map((item) => item) : scopes != null ? scopes : undefined,
|
|
143
|
+
provider: provider != null ? provider : undefined,
|
|
144
|
+
};
|
|
153
145
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
154
146
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
155
147
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -2,8 +2,7 @@ import type { BaseClientOptions } from "../../../../BaseClient.js";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
3
|
import { V1Client } from "../resources/v1/client/Client.js";
|
|
4
4
|
export declare namespace SpeakClient {
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
type Options = BaseClientOptions;
|
|
7
6
|
}
|
|
8
7
|
export declare class SpeakClient {
|
|
9
8
|
protected readonly _options: NormalizedClientOptionsWithAuth<SpeakClient.Options>;
|
|
@@ -3,8 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClie
|
|
|
3
3
|
import { AudioClient } from "../resources/audio/client/Client.js";
|
|
4
4
|
import { V1Socket } from "./Socket.js";
|
|
5
5
|
export declare namespace V1Client {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
8
7
|
interface ConnectArgs {
|
|
9
8
|
encoding?: string;
|
|
10
9
|
mip_opt_out?: string;
|
|
@@ -62,19 +62,12 @@ class V1Client {
|
|
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
63
|
var _a, _b;
|
|
64
64
|
const { encoding, mip_opt_out: mipOptOut, model, sample_rate: sampleRate, headers, debug, reconnectAttempts, } = args;
|
|
65
|
-
const _queryParams = {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
if (model != null) {
|
|
73
|
-
_queryParams.model = model;
|
|
74
|
-
}
|
|
75
|
-
if (sampleRate != null) {
|
|
76
|
-
_queryParams.sample_rate = sampleRate;
|
|
77
|
-
}
|
|
65
|
+
const _queryParams = {
|
|
66
|
+
encoding,
|
|
67
|
+
mip_opt_out: mipOptOut,
|
|
68
|
+
model,
|
|
69
|
+
sample_rate: sampleRate,
|
|
70
|
+
};
|
|
78
71
|
const _headers = (0, headers_js_1.mergeHeaders)((0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: args.Authorization }), headers);
|
|
79
72
|
const socket = new core.ReconnectingWebSocket({
|
|
80
73
|
url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.DeepgramEnvironment.Production).production, "/v1/speak"),
|
|
@@ -33,10 +33,10 @@ export declare class V1Socket {
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
on<T extends keyof V1Socket.EventHandlers>(event: T, callback: V1Socket.EventHandlers[T]): void;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
sendText(message: Deepgram.speak.SpeakV1Text): void;
|
|
37
|
+
sendFlush(message: Deepgram.speak.SpeakV1Flush): void;
|
|
38
|
+
sendClear(message: Deepgram.speak.SpeakV1Clear): void;
|
|
39
|
+
sendClose(message: Deepgram.speak.SpeakV1Close): void;
|
|
40
40
|
/** Connect to the websocket and register event handlers. */
|
|
41
41
|
connect(): V1Socket;
|
|
42
42
|
/** Close the websocket and unregister event handlers. */
|
|
@@ -90,19 +90,19 @@ class V1Socket {
|
|
|
90
90
|
on(event, callback) {
|
|
91
91
|
this.eventHandlers[event] = callback;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
sendText(message) {
|
|
94
94
|
this.assertSocketIsOpen();
|
|
95
95
|
this.sendJson(message);
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
sendFlush(message) {
|
|
98
98
|
this.assertSocketIsOpen();
|
|
99
99
|
this.sendJson(message);
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
sendClear(message) {
|
|
102
102
|
this.assertSocketIsOpen();
|
|
103
103
|
this.sendJson(message);
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
sendClose(message) {
|
|
106
106
|
this.assertSocketIsOpen();
|
|
107
107
|
this.sendJson(message);
|
|
108
108
|
}
|
|
@@ -3,8 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../Ba
|
|
|
3
3
|
import * as core from "../../../../../../../../core/index.js";
|
|
4
4
|
import * as Deepgram from "../../../../../../../index.js";
|
|
5
5
|
export declare namespace AudioClient {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
8
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -77,39 +77,17 @@ class AudioClient {
|
|
|
77
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
78
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
79
79
|
const { callback, callback_method: callbackMethod, mip_opt_out: mipOptOut, tag, bit_rate: bitRate, container, encoding, model, sample_rate: sampleRate } = request, _body = __rest(request, ["callback", "callback_method", "mip_opt_out", "tag", "bit_rate", "container", "encoding", "model", "sample_rate"]);
|
|
80
|
-
const _queryParams = {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (Array.isArray(tag)) {
|
|
92
|
-
_queryParams.tag = tag.map((item) => item);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
_queryParams.tag = tag;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (bitRate != null) {
|
|
99
|
-
_queryParams.bit_rate = bitRate.toString();
|
|
100
|
-
}
|
|
101
|
-
if (container != null) {
|
|
102
|
-
_queryParams.container = container;
|
|
103
|
-
}
|
|
104
|
-
if (encoding != null) {
|
|
105
|
-
_queryParams.encoding = encoding;
|
|
106
|
-
}
|
|
107
|
-
if (model != null) {
|
|
108
|
-
_queryParams.model = model;
|
|
109
|
-
}
|
|
110
|
-
if (sampleRate != null) {
|
|
111
|
-
_queryParams.sample_rate = sampleRate.toString();
|
|
112
|
-
}
|
|
80
|
+
const _queryParams = {
|
|
81
|
+
callback,
|
|
82
|
+
callback_method: callbackMethod != null ? callbackMethod : undefined,
|
|
83
|
+
mip_opt_out: mipOptOut,
|
|
84
|
+
tag,
|
|
85
|
+
bit_rate: bitRate,
|
|
86
|
+
container: container != null ? container : undefined,
|
|
87
|
+
encoding: encoding != null ? encoding : undefined,
|
|
88
|
+
model: model != null ? model : undefined,
|
|
89
|
+
sample_rate: sampleRate,
|
|
90
|
+
};
|
|
113
91
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
114
92
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
115
93
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -3,7 +3,7 @@ export declare const SpeakV1SampleRate: {
|
|
|
3
3
|
readonly EightThousand: "8000";
|
|
4
4
|
readonly SixteenThousand: "16000";
|
|
5
5
|
readonly TwentyFourThousand: "24000";
|
|
6
|
-
readonly
|
|
6
|
+
readonly ThirtyTwoThousand: "32000";
|
|
7
7
|
readonly FortyEightThousand: "48000";
|
|
8
8
|
};
|
|
9
9
|
export type SpeakV1SampleRate = (typeof SpeakV1SampleRate)[keyof typeof SpeakV1SampleRate];
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import * as core from "../core/index.js";
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
4
|
-
apiKey?: core.Supplier<string | undefined>;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
2
|
+
declare const PARAM_KEY: "apiKey";
|
|
7
3
|
export declare class HeaderAuthProvider implements core.AuthProvider {
|
|
8
|
-
private readonly
|
|
4
|
+
private readonly options;
|
|
9
5
|
constructor(options: HeaderAuthProvider.Options);
|
|
10
|
-
static canCreate(options: HeaderAuthProvider.Options): boolean;
|
|
11
|
-
getAuthRequest(
|
|
6
|
+
static canCreate(options: Partial<HeaderAuthProvider.Options>): boolean;
|
|
7
|
+
getAuthRequest({ endpointMetadata, }?: {
|
|
12
8
|
endpointMetadata?: core.EndpointMetadata;
|
|
13
9
|
}): Promise<core.AuthRequest>;
|
|
14
10
|
}
|
|
11
|
+
export declare namespace HeaderAuthProvider {
|
|
12
|
+
const AUTH_SCHEME: "ApiKeyAuth";
|
|
13
|
+
const AUTH_CONFIG_ERROR_MESSAGE: string;
|
|
14
|
+
type Options = AuthOptions;
|
|
15
|
+
type AuthOptions = {
|
|
16
|
+
[PARAM_KEY]?: core.Supplier<string> | undefined;
|
|
17
|
+
};
|
|
18
|
+
function createInstance(options: Options): core.AuthProvider;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -46,28 +46,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
46
46
|
exports.HeaderAuthProvider = void 0;
|
|
47
47
|
const core = __importStar(require("../core/index.js"));
|
|
48
48
|
const errors = __importStar(require("../errors/index.js"));
|
|
49
|
+
const PARAM_KEY = "apiKey";
|
|
50
|
+
const ENV_HEADER_KEY = "DEEPGRAM_API_KEY";
|
|
51
|
+
const HEADER_NAME = "Authorization";
|
|
49
52
|
class HeaderAuthProvider {
|
|
50
53
|
constructor(options) {
|
|
51
|
-
this.
|
|
54
|
+
this.options = options;
|
|
52
55
|
}
|
|
53
56
|
static canCreate(options) {
|
|
54
57
|
var _a;
|
|
55
|
-
return options
|
|
58
|
+
return (options === null || options === void 0 ? void 0 : options[PARAM_KEY]) != null || ((_a = process.env) === null || _a === void 0 ? void 0 : _a[ENV_HEADER_KEY]) != null;
|
|
56
59
|
}
|
|
57
|
-
getAuthRequest(
|
|
58
|
-
return __awaiter(this,
|
|
60
|
+
getAuthRequest() {
|
|
61
|
+
return __awaiter(this, arguments, void 0, function* ({ endpointMetadata, } = {}) {
|
|
59
62
|
var _a, _b;
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
63
|
+
const headerValue = (_a = (yield core.Supplier.get(this.options[PARAM_KEY]))) !== null && _a !== void 0 ? _a : (_b = process.env) === null || _b === void 0 ? void 0 : _b[ENV_HEADER_KEY];
|
|
64
|
+
if (headerValue == null) {
|
|
62
65
|
throw new errors.DeepgramError({
|
|
63
|
-
message:
|
|
66
|
+
message: HeaderAuthProvider.AUTH_CONFIG_ERROR_MESSAGE,
|
|
64
67
|
});
|
|
65
68
|
}
|
|
66
|
-
const headerValue = `Token ${apiKey}`;
|
|
67
69
|
return {
|
|
68
|
-
headers: {
|
|
70
|
+
headers: { [HEADER_NAME]: headerValue },
|
|
69
71
|
};
|
|
70
72
|
});
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
exports.HeaderAuthProvider = HeaderAuthProvider;
|
|
76
|
+
(function (HeaderAuthProvider) {
|
|
77
|
+
HeaderAuthProvider.AUTH_SCHEME = "ApiKeyAuth";
|
|
78
|
+
HeaderAuthProvider.AUTH_CONFIG_ERROR_MESSAGE = `Please provide '${PARAM_KEY}' when initializing the client, or set the '${ENV_HEADER_KEY}' environment variable`;
|
|
79
|
+
function createInstance(options) {
|
|
80
|
+
return new HeaderAuthProvider(options);
|
|
81
|
+
}
|
|
82
|
+
HeaderAuthProvider.createInstance = createInstance;
|
|
83
|
+
})(HeaderAuthProvider || (exports.HeaderAuthProvider = HeaderAuthProvider = {}));
|