@speechall/sdk 0.0.1 → 2.0.4
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/.beads/README.md +81 -0
- package/.beads/config.yaml +62 -0
- package/.beads/issues.jsonl +46 -0
- package/.beads/metadata.json +4 -0
- package/.env.example +5 -0
- package/.fernignore +45 -0
- package/.gitattributes +3 -0
- package/.github/copilot-instructions.md +78 -0
- package/.github/workflows/auto-release-simple.yml.deprecated +106 -0
- package/.github/workflows/auto-release.yml +67 -0
- package/.github/workflows/ci.yml +41 -0
- package/.github/workflows/release.yml +57 -0
- package/AGENTS.md +94 -0
- package/CHANGELOG.md +58 -0
- package/CLAUDE.md +75 -0
- package/README.md +294 -155
- package/examples/CLAUDE.md +136 -0
- package/examples/advanced-options.ts +213 -0
- package/examples/basic-transcription.ts +66 -0
- package/examples/error-handling.ts +251 -0
- package/examples/list-models.ts +112 -0
- package/examples/remote-transcription.ts +60 -0
- package/fern/fern.config.json +4 -0
- package/fern/generators.yml +43 -0
- package/jest.config.js +11 -0
- package/package.json +26 -44
- package/regenerate.sh +45 -0
- package/scripts/fix-generated-code.sh +25 -0
- package/src/BaseClient.ts +82 -0
- package/src/Client.ts +30 -0
- package/src/api/errors/BadRequestError.ts +22 -0
- package/src/api/errors/GatewayTimeoutError.ts +22 -0
- package/src/api/errors/InternalServerError.ts +22 -0
- package/src/api/errors/NotFoundError.ts +22 -0
- package/src/api/errors/PaymentRequiredError.ts +22 -0
- package/src/api/errors/ServiceUnavailableError.ts +22 -0
- package/src/api/errors/TooManyRequestsError.ts +22 -0
- package/src/api/errors/UnauthorizedError.ts +22 -0
- package/src/api/errors/index.ts +8 -0
- package/src/api/index.ts +3 -0
- package/src/api/resources/index.ts +5 -0
- package/src/api/resources/replacementRules/client/Client.ts +148 -0
- package/src/api/resources/replacementRules/client/index.ts +1 -0
- package/src/api/resources/replacementRules/client/requests/CreateReplacementRulesetRequest.ts +25 -0
- package/src/api/resources/replacementRules/client/requests/index.ts +1 -0
- package/src/api/resources/replacementRules/index.ts +2 -0
- package/src/api/resources/replacementRules/types/CreateReplacementRulesetResponse.ts +6 -0
- package/src/api/resources/replacementRules/types/index.ts +1 -0
- package/src/api/resources/speechToText/client/Client.ts +275 -0
- package/src/api/resources/speechToText/client/index.ts +1 -0
- package/src/api/resources/speechToText/client/requests/RemoteTranscriptionConfiguration.ts +20 -0
- package/src/api/resources/speechToText/client/requests/TranscribeRequest.ts +26 -0
- package/src/api/resources/speechToText/client/requests/index.ts +2 -0
- package/src/api/resources/speechToText/index.ts +1 -0
- package/src/api/types/BaseTranscriptionConfiguration.ts +29 -0
- package/src/api/types/ErrorResponse.ts +11 -0
- package/src/api/types/ExactRule.ts +13 -0
- package/src/api/types/RegexGroupRule.ts +28 -0
- package/src/api/types/RegexRule.ts +28 -0
- package/src/api/types/ReplacementRule.ts +25 -0
- package/src/api/types/SpeechToTextModel.ts +90 -0
- package/src/api/types/TranscriptLanguageCode.ts +114 -0
- package/src/api/types/TranscriptOutputFormat.ts +18 -0
- package/src/api/types/TranscriptionDetailed.ts +19 -0
- package/src/api/types/TranscriptionModelIdentifier.ts +80 -0
- package/src/api/types/TranscriptionOnlyText.ts +11 -0
- package/src/api/types/TranscriptionProvider.ts +23 -0
- package/src/api/types/TranscriptionResponse.ts +8 -0
- package/src/api/types/TranscriptionSegment.ts +17 -0
- package/src/api/types/TranscriptionWord.ts +17 -0
- package/src/api/types/index.ts +16 -0
- package/src/auth/BearerAuthProvider.ts +37 -0
- package/src/auth/index.ts +1 -0
- package/src/core/auth/AuthProvider.ts +6 -0
- package/src/core/auth/AuthRequest.ts +9 -0
- package/src/core/auth/BasicAuth.ts +32 -0
- package/src/core/auth/BearerToken.ts +20 -0
- package/src/core/auth/NoOpAuthProvider.ts +8 -0
- package/src/core/auth/index.ts +5 -0
- package/src/core/base64.ts +27 -0
- package/src/core/exports.ts +2 -0
- package/src/core/fetcher/APIResponse.ts +23 -0
- package/src/core/fetcher/BinaryResponse.ts +34 -0
- package/src/core/fetcher/EndpointMetadata.ts +13 -0
- package/src/core/fetcher/EndpointSupplier.ts +14 -0
- package/src/core/fetcher/Fetcher.ts +391 -0
- package/src/core/fetcher/Headers.ts +93 -0
- package/src/core/fetcher/HttpResponsePromise.ts +116 -0
- package/src/core/fetcher/RawResponse.ts +61 -0
- package/src/core/fetcher/Supplier.ts +11 -0
- package/src/core/fetcher/createRequestUrl.ts +6 -0
- package/src/core/fetcher/getErrorResponseBody.ts +33 -0
- package/src/core/fetcher/getFetchFn.ts +3 -0
- package/src/core/fetcher/getHeader.ts +8 -0
- package/src/core/fetcher/getRequestBody.ts +20 -0
- package/src/core/fetcher/getResponseBody.ts +58 -0
- package/src/core/fetcher/index.ts +11 -0
- package/src/core/fetcher/makeRequest.ts +42 -0
- package/src/core/fetcher/requestWithRetries.ts +64 -0
- package/src/core/fetcher/signals.ts +26 -0
- package/src/core/file/exports.ts +1 -0
- package/src/core/file/file.ts +217 -0
- package/src/core/file/index.ts +2 -0
- package/src/core/file/types.ts +81 -0
- package/src/core/headers.ts +35 -0
- package/src/core/index.ts +7 -0
- package/src/core/json.ts +27 -0
- package/src/core/logging/exports.ts +19 -0
- package/src/core/logging/index.ts +1 -0
- package/src/core/logging/logger.ts +203 -0
- package/src/core/runtime/index.ts +1 -0
- package/src/core/runtime/runtime.ts +134 -0
- package/src/core/url/encodePathParam.ts +18 -0
- package/src/core/url/index.ts +3 -0
- package/src/core/url/join.ts +79 -0
- package/src/core/url/qs.ts +74 -0
- package/src/environments.ts +7 -0
- package/src/errors/SpeechallError.ts +58 -0
- package/src/errors/SpeechallTimeoutError.ts +13 -0
- package/src/errors/handleNonStatusCodeError.ts +37 -0
- package/src/errors/index.ts +2 -0
- package/src/exports.ts +1 -0
- package/src/index.ts +6 -0
- package/test-import.ts +17 -0
- package/tests/integration/api.test.ts +93 -0
- package/tests/unit/client.test.ts +91 -0
- package/tsconfig.json +20 -0
- package/dist/api.d.ts +0 -467
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js +0 -592
- package/dist/base.d.ts +0 -32
- package/dist/base.d.ts.map +0 -1
- package/dist/base.js +0 -35
- package/dist/common.d.ts +0 -14
- package/dist/common.d.ts.map +0 -1
- package/dist/common.js +0 -91
- package/dist/configuration.d.ts +0 -23
- package/dist/configuration.d.ts.map +0 -1
- package/dist/configuration.js +0 -25
- package/dist/esm/api.js +0 -574
- package/dist/esm/base.js +0 -27
- package/dist/esm/common.js +0 -79
- package/dist/esm/configuration.js +0 -21
- package/dist/esm/example.js +0 -131
- package/dist/esm/index.js +0 -2
- package/dist/example.d.ts +0 -3
- package/dist/example.d.ts.map +0 -1
- package/dist/example.js +0 -133
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -18
package/dist/esm/api.js
DELETED
|
@@ -1,574 +0,0 @@
|
|
|
1
|
-
import globalAxios from 'axios';
|
|
2
|
-
import { DUMMY_BASE_URL, assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common.js';
|
|
3
|
-
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, operationServerMap } from './base.js';
|
|
4
|
-
export const ExactRuleKindEnum = {
|
|
5
|
-
Exact: 'exact'
|
|
6
|
-
};
|
|
7
|
-
export const OpenAIAudioResponseFormat = {
|
|
8
|
-
Json: 'json',
|
|
9
|
-
Text: 'text',
|
|
10
|
-
Srt: 'srt',
|
|
11
|
-
VerboseJson: 'verbose_json',
|
|
12
|
-
Vtt: 'vtt'
|
|
13
|
-
};
|
|
14
|
-
export const RegexGroupRuleKindEnum = {
|
|
15
|
-
RegexGroup: 'regex_group'
|
|
16
|
-
};
|
|
17
|
-
export const RegexGroupRuleFlagsEnum = {
|
|
18
|
-
I: 'i',
|
|
19
|
-
M: 'm',
|
|
20
|
-
S: 's',
|
|
21
|
-
X: 'x',
|
|
22
|
-
U: 'u'
|
|
23
|
-
};
|
|
24
|
-
export const RegexRuleKindEnum = {
|
|
25
|
-
Regex: 'regex'
|
|
26
|
-
};
|
|
27
|
-
export const RegexRuleFlagsEnum = {
|
|
28
|
-
I: 'i',
|
|
29
|
-
M: 'm',
|
|
30
|
-
S: 's',
|
|
31
|
-
X: 'x',
|
|
32
|
-
U: 'u'
|
|
33
|
-
};
|
|
34
|
-
export const SpeechToTextModelModelTypeEnum = {
|
|
35
|
-
General: 'general',
|
|
36
|
-
PhoneCall: 'phone_call',
|
|
37
|
-
Video: 'video',
|
|
38
|
-
CommandAndSearch: 'command_and_search',
|
|
39
|
-
Medical: 'medical',
|
|
40
|
-
Legal: 'legal',
|
|
41
|
-
Voicemail: 'voicemail',
|
|
42
|
-
Meeting: 'meeting'
|
|
43
|
-
};
|
|
44
|
-
export const SpeechToTextModelAccuracyTierEnum = {
|
|
45
|
-
Basic: 'basic',
|
|
46
|
-
Standard: 'standard',
|
|
47
|
-
Enhanced: 'enhanced',
|
|
48
|
-
Premium: 'premium'
|
|
49
|
-
};
|
|
50
|
-
export const TranscriptLanguageCode = {
|
|
51
|
-
Auto: 'auto',
|
|
52
|
-
En: 'en',
|
|
53
|
-
EnAu: 'en_au',
|
|
54
|
-
EnUk: 'en_uk',
|
|
55
|
-
EnUs: 'en_us',
|
|
56
|
-
Af: 'af',
|
|
57
|
-
Am: 'am',
|
|
58
|
-
Ar: 'ar',
|
|
59
|
-
As: 'as',
|
|
60
|
-
Az: 'az',
|
|
61
|
-
Ba: 'ba',
|
|
62
|
-
Be: 'be',
|
|
63
|
-
Bg: 'bg',
|
|
64
|
-
Bn: 'bn',
|
|
65
|
-
Bo: 'bo',
|
|
66
|
-
Br: 'br',
|
|
67
|
-
Bs: 'bs',
|
|
68
|
-
Ca: 'ca',
|
|
69
|
-
Cs: 'cs',
|
|
70
|
-
Cy: 'cy',
|
|
71
|
-
Da: 'da',
|
|
72
|
-
De: 'de',
|
|
73
|
-
El: 'el',
|
|
74
|
-
Es: 'es',
|
|
75
|
-
Et: 'et',
|
|
76
|
-
Eu: 'eu',
|
|
77
|
-
Fa: 'fa',
|
|
78
|
-
Fi: 'fi',
|
|
79
|
-
Fo: 'fo',
|
|
80
|
-
Fr: 'fr',
|
|
81
|
-
Gl: 'gl',
|
|
82
|
-
Gu: 'gu',
|
|
83
|
-
Ha: 'ha',
|
|
84
|
-
Haw: 'haw',
|
|
85
|
-
He: 'he',
|
|
86
|
-
Hi: 'hi',
|
|
87
|
-
Hr: 'hr',
|
|
88
|
-
Ht: 'ht',
|
|
89
|
-
Hu: 'hu',
|
|
90
|
-
Hy: 'hy',
|
|
91
|
-
Id: 'id',
|
|
92
|
-
Is: 'is',
|
|
93
|
-
It: 'it',
|
|
94
|
-
Ja: 'ja',
|
|
95
|
-
Jw: 'jw',
|
|
96
|
-
Ka: 'ka',
|
|
97
|
-
Kk: 'kk',
|
|
98
|
-
Km: 'km',
|
|
99
|
-
Kn: 'kn',
|
|
100
|
-
Ko: 'ko',
|
|
101
|
-
La: 'la',
|
|
102
|
-
Lb: 'lb',
|
|
103
|
-
Ln: 'ln',
|
|
104
|
-
Lo: 'lo',
|
|
105
|
-
Lt: 'lt',
|
|
106
|
-
Lv: 'lv',
|
|
107
|
-
Mg: 'mg',
|
|
108
|
-
Mi: 'mi',
|
|
109
|
-
Mk: 'mk',
|
|
110
|
-
Ml: 'ml',
|
|
111
|
-
Mn: 'mn',
|
|
112
|
-
Mr: 'mr',
|
|
113
|
-
Ms: 'ms',
|
|
114
|
-
Mt: 'mt',
|
|
115
|
-
My: 'my',
|
|
116
|
-
Ne: 'ne',
|
|
117
|
-
Nl: 'nl',
|
|
118
|
-
Nn: 'nn',
|
|
119
|
-
False: 'false',
|
|
120
|
-
Oc: 'oc',
|
|
121
|
-
Pa: 'pa',
|
|
122
|
-
Pl: 'pl',
|
|
123
|
-
Ps: 'ps',
|
|
124
|
-
Pt: 'pt',
|
|
125
|
-
Ro: 'ro',
|
|
126
|
-
Ru: 'ru',
|
|
127
|
-
Sa: 'sa',
|
|
128
|
-
Sd: 'sd',
|
|
129
|
-
Si: 'si',
|
|
130
|
-
Sk: 'sk',
|
|
131
|
-
Sl: 'sl',
|
|
132
|
-
Sn: 'sn',
|
|
133
|
-
So: 'so',
|
|
134
|
-
Sq: 'sq',
|
|
135
|
-
Sr: 'sr',
|
|
136
|
-
Su: 'su',
|
|
137
|
-
Sv: 'sv',
|
|
138
|
-
Sw: 'sw',
|
|
139
|
-
Ta: 'ta',
|
|
140
|
-
Te: 'te',
|
|
141
|
-
Tg: 'tg',
|
|
142
|
-
Th: 'th',
|
|
143
|
-
Tk: 'tk',
|
|
144
|
-
Tl: 'tl',
|
|
145
|
-
Tr: 'tr',
|
|
146
|
-
Tt: 'tt',
|
|
147
|
-
Uk: 'uk',
|
|
148
|
-
Ur: 'ur',
|
|
149
|
-
Uz: 'uz',
|
|
150
|
-
Vi: 'vi',
|
|
151
|
-
Yi: 'yi',
|
|
152
|
-
Yo: 'yo',
|
|
153
|
-
Zh: 'zh'
|
|
154
|
-
};
|
|
155
|
-
export const TranscriptOutputFormat = {
|
|
156
|
-
Text: 'text',
|
|
157
|
-
JsonText: 'json_text',
|
|
158
|
-
Json: 'json',
|
|
159
|
-
Srt: 'srt',
|
|
160
|
-
Vtt: 'vtt'
|
|
161
|
-
};
|
|
162
|
-
export const TranscriptionModelIdentifier = {
|
|
163
|
-
AmazonTranscribe: 'amazon.transcribe',
|
|
164
|
-
AssemblyaiBest: 'assemblyai.best',
|
|
165
|
-
AssemblyaiNano: 'assemblyai.nano',
|
|
166
|
-
AzureStandard: 'azure.standard',
|
|
167
|
-
CloudflareWhisper: 'cloudflare.whisper',
|
|
168
|
-
DeepgramBase: 'deepgram.base',
|
|
169
|
-
DeepgramBaseConversationalai: 'deepgram.base-conversationalai',
|
|
170
|
-
DeepgramBaseFinance: 'deepgram.base-finance',
|
|
171
|
-
DeepgramBaseGeneral: 'deepgram.base-general',
|
|
172
|
-
DeepgramBaseMeeting: 'deepgram.base-meeting',
|
|
173
|
-
DeepgramBasePhonecall: 'deepgram.base-phonecall',
|
|
174
|
-
DeepgramBaseVideo: 'deepgram.base-video',
|
|
175
|
-
DeepgramBaseVoicemail: 'deepgram.base-voicemail',
|
|
176
|
-
DeepgramEnhanced: 'deepgram.enhanced',
|
|
177
|
-
DeepgramEnhancedFinance: 'deepgram.enhanced-finance',
|
|
178
|
-
DeepgramEnhancedGeneral: 'deepgram.enhanced-general',
|
|
179
|
-
DeepgramEnhancedMeeting: 'deepgram.enhanced-meeting',
|
|
180
|
-
DeepgramEnhancedPhonecall: 'deepgram.enhanced-phonecall',
|
|
181
|
-
DeepgramNova: 'deepgram.nova',
|
|
182
|
-
DeepgramNova2: 'deepgram.nova-2',
|
|
183
|
-
DeepgramNova2Atc: 'deepgram.nova-2-atc',
|
|
184
|
-
DeepgramNova2Automotive: 'deepgram.nova-2-automotive',
|
|
185
|
-
DeepgramNova2Conversationalai: 'deepgram.nova-2-conversationalai',
|
|
186
|
-
DeepgramNova2Drivethru: 'deepgram.nova-2-drivethru',
|
|
187
|
-
DeepgramNova2Finance: 'deepgram.nova-2-finance',
|
|
188
|
-
DeepgramNova2General: 'deepgram.nova-2-general',
|
|
189
|
-
DeepgramNova2Medical: 'deepgram.nova-2-medical',
|
|
190
|
-
DeepgramNova2Meeting: 'deepgram.nova-2-meeting',
|
|
191
|
-
DeepgramNova2Phonecall: 'deepgram.nova-2-phonecall',
|
|
192
|
-
DeepgramNova2Video: 'deepgram.nova-2-video',
|
|
193
|
-
DeepgramNova2Voicemail: 'deepgram.nova-2-voicemail',
|
|
194
|
-
DeepgramNova3: 'deepgram.nova-3',
|
|
195
|
-
DeepgramNovaGeneral: 'deepgram.nova-general',
|
|
196
|
-
DeepgramNovaPhonecall: 'deepgram.nova-phonecall',
|
|
197
|
-
DeepgramWhisper: 'deepgram.whisper',
|
|
198
|
-
DeepgramWhisperBase: 'deepgram.whisper-base',
|
|
199
|
-
DeepgramWhisperLarge: 'deepgram.whisper-large',
|
|
200
|
-
DeepgramWhisperMedium: 'deepgram.whisper-medium',
|
|
201
|
-
DeepgramWhisperSmall: 'deepgram.whisper-small',
|
|
202
|
-
DeepgramWhisperTiny: 'deepgram.whisper-tiny',
|
|
203
|
-
FalaiWhisper: 'falai.whisper',
|
|
204
|
-
FalaiWizper: 'falai.wizper',
|
|
205
|
-
FireworksaiWhisperV3: 'fireworksai.whisper-v3',
|
|
206
|
-
FireworksaiWhisperV3Turbo: 'fireworksai.whisper-v3-turbo',
|
|
207
|
-
GladiaStandard: 'gladia.standard',
|
|
208
|
-
GoogleEnhanced: 'google.enhanced',
|
|
209
|
-
GoogleStandard: 'google.standard',
|
|
210
|
-
GroqDistilWhisperLargeV3En: 'groq.distil-whisper-large-v3-en',
|
|
211
|
-
GroqWhisperLargeV3: 'groq.whisper-large-v3',
|
|
212
|
-
GroqWhisperLargeV3Turbo: 'groq.whisper-large-v3-turbo',
|
|
213
|
-
IbmStandard: 'ibm.standard',
|
|
214
|
-
OpenaiWhisper1: 'openai.whisper-1',
|
|
215
|
-
OpenaiGpt4oTranscribe: 'openai.gpt-4o-transcribe',
|
|
216
|
-
OpenaiGpt4oMiniTranscribe: 'openai.gpt-4o-mini-transcribe',
|
|
217
|
-
RevaiMachine: 'revai.machine',
|
|
218
|
-
SpeechmaticsEnhanced: 'speechmatics.enhanced',
|
|
219
|
-
SpeechmaticsStandard: 'speechmatics.standard'
|
|
220
|
-
};
|
|
221
|
-
export const TranscriptionOptionsTimestampGranularityEnum = {
|
|
222
|
-
Word: 'word',
|
|
223
|
-
Segment: 'segment'
|
|
224
|
-
};
|
|
225
|
-
export const TranscriptionProvider = {
|
|
226
|
-
Amazon: 'amazon',
|
|
227
|
-
Assemblyai: 'assemblyai',
|
|
228
|
-
Azure: 'azure',
|
|
229
|
-
Cloudflare: 'cloudflare',
|
|
230
|
-
Deepgram: 'deepgram',
|
|
231
|
-
Falai: 'falai',
|
|
232
|
-
Fireworksai: 'fireworksai',
|
|
233
|
-
Gladia: 'gladia',
|
|
234
|
-
Google: 'google',
|
|
235
|
-
Groq: 'groq',
|
|
236
|
-
Ibm: 'ibm',
|
|
237
|
-
Openai: 'openai',
|
|
238
|
-
Revai: 'revai',
|
|
239
|
-
Speechmatics: 'speechmatics'
|
|
240
|
-
};
|
|
241
|
-
export const OpenAICompatibleSpeechToTextApiAxiosParamCreator = function (configuration) {
|
|
242
|
-
return {
|
|
243
|
-
openaiCompatibleCreateTranscription: async (file, model, language, prompt, responseFormat, temperature, timestampGranularities, options = {}) => {
|
|
244
|
-
assertParamExists('openaiCompatibleCreateTranscription', 'file', file);
|
|
245
|
-
assertParamExists('openaiCompatibleCreateTranscription', 'model', model);
|
|
246
|
-
const localVarPath = `/openai-compatible/audio/transcriptions`;
|
|
247
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
248
|
-
let baseOptions;
|
|
249
|
-
if (configuration) {
|
|
250
|
-
baseOptions = configuration.baseOptions;
|
|
251
|
-
}
|
|
252
|
-
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
253
|
-
const localVarHeaderParameter = {};
|
|
254
|
-
const localVarQueryParameter = {};
|
|
255
|
-
const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
|
|
256
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
257
|
-
if (file !== undefined) {
|
|
258
|
-
localVarFormParams.append('file', file);
|
|
259
|
-
}
|
|
260
|
-
if (model !== undefined) {
|
|
261
|
-
localVarFormParams.append('model', model);
|
|
262
|
-
}
|
|
263
|
-
if (language !== undefined) {
|
|
264
|
-
localVarFormParams.append('language', language);
|
|
265
|
-
}
|
|
266
|
-
if (prompt !== undefined) {
|
|
267
|
-
localVarFormParams.append('prompt', prompt);
|
|
268
|
-
}
|
|
269
|
-
if (responseFormat !== undefined) {
|
|
270
|
-
localVarFormParams.append('response_format', responseFormat);
|
|
271
|
-
}
|
|
272
|
-
if (temperature !== undefined) {
|
|
273
|
-
localVarFormParams.append('temperature', temperature);
|
|
274
|
-
}
|
|
275
|
-
if (timestampGranularities) {
|
|
276
|
-
localVarFormParams.append('timestamp_granularities[]', timestampGranularities.join(COLLECTION_FORMATS.csv));
|
|
277
|
-
}
|
|
278
|
-
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
|
279
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
280
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
281
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
282
|
-
localVarRequestOptions.data = localVarFormParams;
|
|
283
|
-
return {
|
|
284
|
-
url: toPathString(localVarUrlObj),
|
|
285
|
-
options: localVarRequestOptions,
|
|
286
|
-
};
|
|
287
|
-
},
|
|
288
|
-
openaiCompatibleCreateTranslation: async (file, model, prompt, responseFormat, temperature, options = {}) => {
|
|
289
|
-
assertParamExists('openaiCompatibleCreateTranslation', 'file', file);
|
|
290
|
-
assertParamExists('openaiCompatibleCreateTranslation', 'model', model);
|
|
291
|
-
const localVarPath = `/openai-compatible/audio/translations`;
|
|
292
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
293
|
-
let baseOptions;
|
|
294
|
-
if (configuration) {
|
|
295
|
-
baseOptions = configuration.baseOptions;
|
|
296
|
-
}
|
|
297
|
-
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
298
|
-
const localVarHeaderParameter = {};
|
|
299
|
-
const localVarQueryParameter = {};
|
|
300
|
-
const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
|
|
301
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
302
|
-
if (file !== undefined) {
|
|
303
|
-
localVarFormParams.append('file', file);
|
|
304
|
-
}
|
|
305
|
-
if (model !== undefined) {
|
|
306
|
-
localVarFormParams.append('model', new Blob([JSON.stringify(model)], { type: "application/json", }));
|
|
307
|
-
}
|
|
308
|
-
if (prompt !== undefined) {
|
|
309
|
-
localVarFormParams.append('prompt', prompt);
|
|
310
|
-
}
|
|
311
|
-
if (responseFormat !== undefined) {
|
|
312
|
-
localVarFormParams.append('response_format', responseFormat);
|
|
313
|
-
}
|
|
314
|
-
if (temperature !== undefined) {
|
|
315
|
-
localVarFormParams.append('temperature', temperature);
|
|
316
|
-
}
|
|
317
|
-
localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
|
|
318
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
319
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
320
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
321
|
-
localVarRequestOptions.data = localVarFormParams;
|
|
322
|
-
return {
|
|
323
|
-
url: toPathString(localVarUrlObj),
|
|
324
|
-
options: localVarRequestOptions,
|
|
325
|
-
};
|
|
326
|
-
},
|
|
327
|
-
};
|
|
328
|
-
};
|
|
329
|
-
export const OpenAICompatibleSpeechToTextApiFp = function (configuration) {
|
|
330
|
-
const localVarAxiosParamCreator = OpenAICompatibleSpeechToTextApiAxiosParamCreator(configuration);
|
|
331
|
-
return {
|
|
332
|
-
async openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options) {
|
|
333
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options);
|
|
334
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
335
|
-
const localVarOperationServerBasePath = operationServerMap['OpenAICompatibleSpeechToTextApi.openaiCompatibleCreateTranscription']?.[localVarOperationServerIndex]?.url;
|
|
336
|
-
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
337
|
-
},
|
|
338
|
-
async openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options) {
|
|
339
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options);
|
|
340
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
341
|
-
const localVarOperationServerBasePath = operationServerMap['OpenAICompatibleSpeechToTextApi.openaiCompatibleCreateTranslation']?.[localVarOperationServerIndex]?.url;
|
|
342
|
-
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
343
|
-
},
|
|
344
|
-
};
|
|
345
|
-
};
|
|
346
|
-
export const OpenAICompatibleSpeechToTextApiFactory = function (configuration, basePath, axios) {
|
|
347
|
-
const localVarFp = OpenAICompatibleSpeechToTextApiFp(configuration);
|
|
348
|
-
return {
|
|
349
|
-
openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options) {
|
|
350
|
-
return localVarFp.openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options).then((request) => request(axios, basePath));
|
|
351
|
-
},
|
|
352
|
-
openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options) {
|
|
353
|
-
return localVarFp.openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options).then((request) => request(axios, basePath));
|
|
354
|
-
},
|
|
355
|
-
};
|
|
356
|
-
};
|
|
357
|
-
export class OpenAICompatibleSpeechToTextApi extends BaseAPI {
|
|
358
|
-
openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options) {
|
|
359
|
-
return OpenAICompatibleSpeechToTextApiFp(this.configuration).openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options).then((request) => request(this.axios, this.basePath));
|
|
360
|
-
}
|
|
361
|
-
openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options) {
|
|
362
|
-
return OpenAICompatibleSpeechToTextApiFp(this.configuration).openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options).then((request) => request(this.axios, this.basePath));
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
export const OpenaiCompatibleCreateTranscriptionTimestampGranularitiesEnum = {
|
|
366
|
-
Word: 'word',
|
|
367
|
-
Segment: 'segment'
|
|
368
|
-
};
|
|
369
|
-
export const ReplacementRulesApiAxiosParamCreator = function (configuration) {
|
|
370
|
-
return {
|
|
371
|
-
createReplacementRuleset: async (createReplacementRulesetRequest, options = {}) => {
|
|
372
|
-
assertParamExists('createReplacementRuleset', 'createReplacementRulesetRequest', createReplacementRulesetRequest);
|
|
373
|
-
const localVarPath = `/replacement-rulesets`;
|
|
374
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
375
|
-
let baseOptions;
|
|
376
|
-
if (configuration) {
|
|
377
|
-
baseOptions = configuration.baseOptions;
|
|
378
|
-
}
|
|
379
|
-
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
380
|
-
const localVarHeaderParameter = {};
|
|
381
|
-
const localVarQueryParameter = {};
|
|
382
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
383
|
-
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
384
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
385
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
386
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
387
|
-
localVarRequestOptions.data = serializeDataIfNeeded(createReplacementRulesetRequest, localVarRequestOptions, configuration);
|
|
388
|
-
return {
|
|
389
|
-
url: toPathString(localVarUrlObj),
|
|
390
|
-
options: localVarRequestOptions,
|
|
391
|
-
};
|
|
392
|
-
},
|
|
393
|
-
};
|
|
394
|
-
};
|
|
395
|
-
export const ReplacementRulesApiFp = function (configuration) {
|
|
396
|
-
const localVarAxiosParamCreator = ReplacementRulesApiAxiosParamCreator(configuration);
|
|
397
|
-
return {
|
|
398
|
-
async createReplacementRuleset(createReplacementRulesetRequest, options) {
|
|
399
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createReplacementRuleset(createReplacementRulesetRequest, options);
|
|
400
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
401
|
-
const localVarOperationServerBasePath = operationServerMap['ReplacementRulesApi.createReplacementRuleset']?.[localVarOperationServerIndex]?.url;
|
|
402
|
-
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
403
|
-
},
|
|
404
|
-
};
|
|
405
|
-
};
|
|
406
|
-
export const ReplacementRulesApiFactory = function (configuration, basePath, axios) {
|
|
407
|
-
const localVarFp = ReplacementRulesApiFp(configuration);
|
|
408
|
-
return {
|
|
409
|
-
createReplacementRuleset(createReplacementRulesetRequest, options) {
|
|
410
|
-
return localVarFp.createReplacementRuleset(createReplacementRulesetRequest, options).then((request) => request(axios, basePath));
|
|
411
|
-
},
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
export class ReplacementRulesApi extends BaseAPI {
|
|
415
|
-
createReplacementRuleset(createReplacementRulesetRequest, options) {
|
|
416
|
-
return ReplacementRulesApiFp(this.configuration).createReplacementRuleset(createReplacementRulesetRequest, options).then((request) => request(this.axios, this.basePath));
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
export const SpeechToTextApiAxiosParamCreator = function (configuration) {
|
|
420
|
-
return {
|
|
421
|
-
listSpeechToTextModels: async (options = {}) => {
|
|
422
|
-
const localVarPath = `/speech-to-text-models`;
|
|
423
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
424
|
-
let baseOptions;
|
|
425
|
-
if (configuration) {
|
|
426
|
-
baseOptions = configuration.baseOptions;
|
|
427
|
-
}
|
|
428
|
-
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
429
|
-
const localVarHeaderParameter = {};
|
|
430
|
-
const localVarQueryParameter = {};
|
|
431
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
432
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
433
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
434
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
435
|
-
return {
|
|
436
|
-
url: toPathString(localVarUrlObj),
|
|
437
|
-
options: localVarRequestOptions,
|
|
438
|
-
};
|
|
439
|
-
},
|
|
440
|
-
transcribe: async (model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options = {}) => {
|
|
441
|
-
assertParamExists('transcribe', 'model', model);
|
|
442
|
-
assertParamExists('transcribe', 'body', body);
|
|
443
|
-
const localVarPath = `/transcribe`;
|
|
444
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
445
|
-
let baseOptions;
|
|
446
|
-
if (configuration) {
|
|
447
|
-
baseOptions = configuration.baseOptions;
|
|
448
|
-
}
|
|
449
|
-
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
450
|
-
const localVarHeaderParameter = {};
|
|
451
|
-
const localVarQueryParameter = {};
|
|
452
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
453
|
-
if (model !== undefined) {
|
|
454
|
-
localVarQueryParameter['model'] = model;
|
|
455
|
-
}
|
|
456
|
-
if (language !== undefined) {
|
|
457
|
-
localVarQueryParameter['language'] = language;
|
|
458
|
-
}
|
|
459
|
-
if (outputFormat !== undefined) {
|
|
460
|
-
localVarQueryParameter['output_format'] = outputFormat;
|
|
461
|
-
}
|
|
462
|
-
if (rulesetId !== undefined) {
|
|
463
|
-
localVarQueryParameter['ruleset_id'] = rulesetId;
|
|
464
|
-
}
|
|
465
|
-
if (punctuation !== undefined) {
|
|
466
|
-
localVarQueryParameter['punctuation'] = punctuation;
|
|
467
|
-
}
|
|
468
|
-
if (timestampGranularity !== undefined) {
|
|
469
|
-
localVarQueryParameter['timestamp_granularity'] = timestampGranularity;
|
|
470
|
-
}
|
|
471
|
-
if (diarization !== undefined) {
|
|
472
|
-
localVarQueryParameter['diarization'] = diarization;
|
|
473
|
-
}
|
|
474
|
-
if (initialPrompt !== undefined) {
|
|
475
|
-
localVarQueryParameter['initial_prompt'] = initialPrompt;
|
|
476
|
-
}
|
|
477
|
-
if (temperature !== undefined) {
|
|
478
|
-
localVarQueryParameter['temperature'] = temperature;
|
|
479
|
-
}
|
|
480
|
-
if (smartFormat !== undefined) {
|
|
481
|
-
localVarQueryParameter['smart_format'] = smartFormat;
|
|
482
|
-
}
|
|
483
|
-
if (speakersExpected !== undefined) {
|
|
484
|
-
localVarQueryParameter['speakers_expected'] = speakersExpected;
|
|
485
|
-
}
|
|
486
|
-
if (customVocabulary) {
|
|
487
|
-
localVarQueryParameter['custom_vocabulary'] = customVocabulary;
|
|
488
|
-
}
|
|
489
|
-
localVarHeaderParameter['Content-Type'] = 'audio/*';
|
|
490
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
491
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
492
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
493
|
-
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration);
|
|
494
|
-
return {
|
|
495
|
-
url: toPathString(localVarUrlObj),
|
|
496
|
-
options: localVarRequestOptions,
|
|
497
|
-
};
|
|
498
|
-
},
|
|
499
|
-
transcribeRemote: async (transcriptionOptions, options = {}) => {
|
|
500
|
-
assertParamExists('transcribeRemote', 'transcriptionOptions', transcriptionOptions);
|
|
501
|
-
const localVarPath = `/transcribe-remote`;
|
|
502
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
503
|
-
let baseOptions;
|
|
504
|
-
if (configuration) {
|
|
505
|
-
baseOptions = configuration.baseOptions;
|
|
506
|
-
}
|
|
507
|
-
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
508
|
-
const localVarHeaderParameter = {};
|
|
509
|
-
const localVarQueryParameter = {};
|
|
510
|
-
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
511
|
-
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
512
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
513
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
514
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
515
|
-
localVarRequestOptions.data = serializeDataIfNeeded(transcriptionOptions, localVarRequestOptions, configuration);
|
|
516
|
-
return {
|
|
517
|
-
url: toPathString(localVarUrlObj),
|
|
518
|
-
options: localVarRequestOptions,
|
|
519
|
-
};
|
|
520
|
-
},
|
|
521
|
-
};
|
|
522
|
-
};
|
|
523
|
-
export const SpeechToTextApiFp = function (configuration) {
|
|
524
|
-
const localVarAxiosParamCreator = SpeechToTextApiAxiosParamCreator(configuration);
|
|
525
|
-
return {
|
|
526
|
-
async listSpeechToTextModels(options) {
|
|
527
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.listSpeechToTextModels(options);
|
|
528
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
529
|
-
const localVarOperationServerBasePath = operationServerMap['SpeechToTextApi.listSpeechToTextModels']?.[localVarOperationServerIndex]?.url;
|
|
530
|
-
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
531
|
-
},
|
|
532
|
-
async transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options) {
|
|
533
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options);
|
|
534
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
535
|
-
const localVarOperationServerBasePath = operationServerMap['SpeechToTextApi.transcribe']?.[localVarOperationServerIndex]?.url;
|
|
536
|
-
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
537
|
-
},
|
|
538
|
-
async transcribeRemote(transcriptionOptions, options) {
|
|
539
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.transcribeRemote(transcriptionOptions, options);
|
|
540
|
-
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
541
|
-
const localVarOperationServerBasePath = operationServerMap['SpeechToTextApi.transcribeRemote']?.[localVarOperationServerIndex]?.url;
|
|
542
|
-
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
543
|
-
},
|
|
544
|
-
};
|
|
545
|
-
};
|
|
546
|
-
export const SpeechToTextApiFactory = function (configuration, basePath, axios) {
|
|
547
|
-
const localVarFp = SpeechToTextApiFp(configuration);
|
|
548
|
-
return {
|
|
549
|
-
listSpeechToTextModels(options) {
|
|
550
|
-
return localVarFp.listSpeechToTextModels(options).then((request) => request(axios, basePath));
|
|
551
|
-
},
|
|
552
|
-
transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options) {
|
|
553
|
-
return localVarFp.transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options).then((request) => request(axios, basePath));
|
|
554
|
-
},
|
|
555
|
-
transcribeRemote(transcriptionOptions, options) {
|
|
556
|
-
return localVarFp.transcribeRemote(transcriptionOptions, options).then((request) => request(axios, basePath));
|
|
557
|
-
},
|
|
558
|
-
};
|
|
559
|
-
};
|
|
560
|
-
export class SpeechToTextApi extends BaseAPI {
|
|
561
|
-
listSpeechToTextModels(options) {
|
|
562
|
-
return SpeechToTextApiFp(this.configuration).listSpeechToTextModels(options).then((request) => request(this.axios, this.basePath));
|
|
563
|
-
}
|
|
564
|
-
transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options) {
|
|
565
|
-
return SpeechToTextApiFp(this.configuration).transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options).then((request) => request(this.axios, this.basePath));
|
|
566
|
-
}
|
|
567
|
-
transcribeRemote(transcriptionOptions, options) {
|
|
568
|
-
return SpeechToTextApiFp(this.configuration).transcribeRemote(transcriptionOptions, options).then((request) => request(this.axios, this.basePath));
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
export const TranscribeTimestampGranularityEnum = {
|
|
572
|
-
Word: 'word',
|
|
573
|
-
Segment: 'segment'
|
|
574
|
-
};
|
package/dist/esm/base.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import globalAxios from 'axios';
|
|
2
|
-
export const BASE_PATH = "https://api.speechall.com/v1".replace(/\/+$/, "");
|
|
3
|
-
export const COLLECTION_FORMATS = {
|
|
4
|
-
csv: ",",
|
|
5
|
-
ssv: " ",
|
|
6
|
-
tsv: "\t",
|
|
7
|
-
pipes: "|",
|
|
8
|
-
};
|
|
9
|
-
export class BaseAPI {
|
|
10
|
-
constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
|
|
11
|
-
this.basePath = basePath;
|
|
12
|
-
this.axios = axios;
|
|
13
|
-
if (configuration) {
|
|
14
|
-
this.configuration = configuration;
|
|
15
|
-
this.basePath = configuration.basePath ?? basePath;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
;
|
|
20
|
-
export class RequiredError extends Error {
|
|
21
|
-
constructor(field, msg) {
|
|
22
|
-
super(msg);
|
|
23
|
-
this.field = field;
|
|
24
|
-
this.name = "RequiredError";
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export const operationServerMap = {};
|
package/dist/esm/common.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { RequiredError } from "./base.js";
|
|
2
|
-
export const DUMMY_BASE_URL = 'https://example.com';
|
|
3
|
-
export const assertParamExists = function (functionName, paramName, paramValue) {
|
|
4
|
-
if (paramValue === null || paramValue === undefined) {
|
|
5
|
-
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
export const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
9
|
-
if (configuration && configuration.apiKey) {
|
|
10
|
-
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
11
|
-
? await configuration.apiKey(keyParamName)
|
|
12
|
-
: await configuration.apiKey;
|
|
13
|
-
object[keyParamName] = localVarApiKeyValue;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
export const setBasicAuthToObject = function (object, configuration) {
|
|
17
|
-
if (configuration && (configuration.username || configuration.password)) {
|
|
18
|
-
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
export const setBearerAuthToObject = async function (object, configuration) {
|
|
22
|
-
if (configuration && configuration.accessToken) {
|
|
23
|
-
const accessToken = typeof configuration.accessToken === 'function'
|
|
24
|
-
? await configuration.accessToken()
|
|
25
|
-
: await configuration.accessToken;
|
|
26
|
-
object["Authorization"] = "Bearer " + accessToken;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export const setOAuthToObject = async function (object, name, scopes, configuration) {
|
|
30
|
-
if (configuration && configuration.accessToken) {
|
|
31
|
-
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
32
|
-
? await configuration.accessToken(name, scopes)
|
|
33
|
-
: await configuration.accessToken;
|
|
34
|
-
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
|
|
38
|
-
if (parameter == null)
|
|
39
|
-
return;
|
|
40
|
-
if (typeof parameter === "object") {
|
|
41
|
-
if (Array.isArray(parameter)) {
|
|
42
|
-
parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
if (urlSearchParams.has(key)) {
|
|
50
|
-
urlSearchParams.append(key, parameter);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
urlSearchParams.set(key, parameter);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export const setSearchParams = function (url, ...objects) {
|
|
58
|
-
const searchParams = new URLSearchParams(url.search);
|
|
59
|
-
setFlattenedQueryParams(searchParams, objects);
|
|
60
|
-
url.search = searchParams.toString();
|
|
61
|
-
};
|
|
62
|
-
export const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
63
|
-
const nonString = typeof value !== 'string';
|
|
64
|
-
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
65
|
-
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
66
|
-
: nonString;
|
|
67
|
-
return needsSerialization
|
|
68
|
-
? JSON.stringify(value !== undefined ? value : {})
|
|
69
|
-
: (value || "");
|
|
70
|
-
};
|
|
71
|
-
export const toPathString = function (url) {
|
|
72
|
-
return url.pathname + url.search + url.hash;
|
|
73
|
-
};
|
|
74
|
-
export const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
75
|
-
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
76
|
-
const axiosRequestArgs = { ...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url };
|
|
77
|
-
return axios.request(axiosRequestArgs);
|
|
78
|
-
};
|
|
79
|
-
};
|