spitch 1.48.0 → 1.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +16 -50
- package/api-promise.d.mts +1 -0
- package/api-promise.d.mts.map +1 -1
- package/api-promise.d.ts +2 -1
- package/api-promise.d.ts.map +1 -1
- package/api-promise.js +15 -2
- package/api-promise.js.map +1 -1
- package/api-promise.mjs +1 -0
- package/api-promise.mjs.map +1 -1
- package/client.d.mts +4 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +21 -19
- package/client.d.ts.map +1 -1
- package/client.js +94 -29
- package/client.js.map +1 -1
- package/client.mjs +37 -5
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts +3 -3
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.js +15 -5
- package/core/api-promise.js.map +1 -1
- package/core/api-promise.mjs +11 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/error.js +1 -1
- package/core/error.js.map +1 -1
- package/core/error.mjs.map +1 -1
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +4 -4
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +17 -7
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +11 -1
- package/core/pagination.mjs.map +1 -1
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts +1 -1
- package/core/resource.d.ts.map +1 -1
- package/core/uploads.d.mts.map +1 -1
- package/core/uploads.d.ts +2 -2
- package/core/uploads.d.ts.map +1 -1
- package/core/uploads.js +1 -1
- package/core/uploads.js.map +1 -1
- package/core/uploads.mjs.map +1 -1
- package/error.d.mts +1 -0
- package/error.d.mts.map +1 -1
- package/error.d.ts +2 -1
- package/error.d.ts.map +1 -1
- package/error.js +15 -2
- package/error.js.map +1 -1
- package/error.mjs +1 -0
- package/error.mjs.map +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +6 -6
- package/index.d.ts.map +1 -1
- package/index.js +6 -6
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/internal/detect-platform.js +1 -1
- package/internal/detect-platform.js.map +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/headers.js +1 -1
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts +2 -2
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +1 -1
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +4 -4
- package/internal/request-options.d.ts.map +1 -1
- package/internal/shims.d.mts +6 -0
- package/internal/shims.d.mts.map +1 -1
- package/internal/shims.d.ts +8 -2
- package/internal/shims.d.ts.map +1 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.js +2 -2
- package/internal/to-file.js.map +1 -1
- package/internal/to-file.mjs.map +1 -1
- package/internal/types.d.mts +6 -6
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +6 -6
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts +3 -3
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.js +1 -1
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/base64.js +2 -2
- package/internal/utils/base64.js.map +1 -1
- package/internal/utils/base64.mjs.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts +2 -2
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +3 -1
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.js +1 -1
- package/internal/utils/path.js.map +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/query.js +1 -1
- package/internal/utils/query.js.map +1 -1
- package/internal/utils/query.mjs.map +1 -1
- package/internal/utils/values.js +1 -1
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs.map +1 -1
- package/internal/utils.d.mts.map +1 -1
- package/internal/utils.d.ts +7 -7
- package/internal/utils.d.ts.map +1 -1
- package/internal/utils.js +21 -8
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs.map +1 -1
- package/package.json +1 -1
- package/pagination.d.mts +1 -0
- package/pagination.d.mts.map +1 -1
- package/pagination.d.ts +2 -1
- package/pagination.d.ts.map +1 -1
- package/pagination.js +15 -2
- package/pagination.js.map +1 -1
- package/pagination.mjs +1 -0
- package/pagination.mjs.map +1 -1
- package/resource.d.mts +1 -0
- package/resource.d.mts.map +1 -1
- package/resource.d.ts +2 -1
- package/resource.d.ts.map +1 -1
- package/resource.js +15 -2
- package/resource.js.map +1 -1
- package/resource.mjs +1 -0
- package/resource.mjs.map +1 -1
- package/resources/balance.d.mts +13 -0
- package/resources/balance.d.mts.map +1 -0
- package/resources/balance.d.ts +13 -0
- package/resources/balance.d.ts.map +1 -0
- package/resources/balance.js +12 -0
- package/resources/balance.js.map +1 -0
- package/resources/balance.mjs +8 -0
- package/resources/balance.mjs.map +1 -0
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +5 -5
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +4 -4
- package/resources/files.js.map +1 -1
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +6 -4
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/speech.d.mts +37 -22
- package/resources/speech.d.mts.map +1 -1
- package/resources/speech.d.ts +41 -26
- package/resources/speech.d.ts.map +1 -1
- package/resources/speech.js +4 -5
- package/resources/speech.js.map +1 -1
- package/resources/speech.mjs +1 -2
- package/resources/speech.mjs.map +1 -1
- package/resources/text.d.mts +24 -4
- package/resources/text.d.mts.map +1 -1
- package/resources/text.d.ts +27 -7
- package/resources/text.d.ts.map +1 -1
- package/resources/text.js +2 -2
- package/resources/text.js.map +1 -1
- package/resources/text.mjs +1 -1
- package/resources/text.mjs.map +1 -1
- package/resources.d.mts.map +1 -1
- package/resources.d.ts +1 -1
- package/resources.d.ts.map +1 -1
- package/resources.js +15 -2
- package/resources.js.map +1 -1
- package/resources.mjs.map +1 -1
- package/src/client.ts +29 -4
- package/src/internal/types.ts +6 -8
- package/src/internal/utils/log.ts +2 -0
- package/src/resources/balance.ts +16 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/speech.ts +45 -26
- package/src/resources/text.ts +27 -5
- package/src/version.ts +1 -1
- package/uploads.d.mts +1 -0
- package/uploads.d.mts.map +1 -1
- package/uploads.d.ts +2 -1
- package/uploads.d.ts.map +1 -1
- package/uploads.js +15 -2
- package/uploads.js.map +1 -1
- package/uploads.mjs +1 -0
- package/uploads.mjs.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/internal/tslib.js +0 -81
- package/internal/tslib.mjs +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.50.0 (unreleased)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.49.0...v1.50.0](https://github.com/spi-tch/spitch-typescript/compare/v1.49.0...v1.50.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* Check prepaid USD credit with `client.balance.get()` in Node.js. The response preserves the exact decimal amount. [Balance example](examples/check-balance.mjs)
|
|
10
|
+
|
|
11
|
+
* **api:** manual updates ([562bf3e](https://github.com/spi-tch/spitch-typescript/commit/562bf3e9d105b8236ec31161661b78619f2d72df))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **client:** send content-type header for requests with an omitted optional body ([45c057f](https://github.com/spi-tch/spitch-typescript/commit/45c057f4c79b934303a9c8af9f7425f68c0f0410))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
|
|
21
|
+
* **internal:** codegen related update ([9552ee7](https://github.com/spi-tch/spitch-typescript/commit/9552ee7fde471812283123e29dcff0d59473a9d9))
|
|
22
|
+
* redact api-key headers in debug logs ([35db412](https://github.com/spi-tch/spitch-typescript/commit/35db4128adfca940f9b4f6dd2a03107dbe9c5219))
|
|
23
|
+
* **tests:** remove redundant File import ([f264fa7](https://github.com/spi-tch/spitch-typescript/commit/f264fa76e7aec3b9d8f78b3280e6a7343bdd2ca6))
|
|
24
|
+
|
|
25
|
+
## 1.49.0 (2026-04-30)
|
|
26
|
+
|
|
27
|
+
Full Changelog: [v1.48.0...v1.49.0](https://github.com/spi-tch/spitch-typescript/compare/v1.48.0...v1.49.0)
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **api:** manual updates ([4a94645](https://github.com/spi-tch/spitch-typescript/commit/4a946455673b1eff357a1c7b793f24c173ed6baf))
|
|
32
|
+
* **api:** new features ([c4bf950](https://github.com/spi-tch/spitch-typescript/commit/c4bf9505337f09ddece28c0965c3b26259c5480c))
|
|
33
|
+
* support setting headers via env ([f34c4cd](https://github.com/spi-tch/spitch-typescript/commit/f34c4cd6bc54c3938f1103eb4c547ae6c9630652))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Chores
|
|
37
|
+
|
|
38
|
+
* **format:** run eslint and prettier separately ([6fef537](https://github.com/spi-tch/spitch-typescript/commit/6fef537019aee8be0e4a9c54ea8325eaae77cf60))
|
|
39
|
+
* **internal:** codegen related update ([958f081](https://github.com/spi-tch/spitch-typescript/commit/958f081393bcab79e039f27b991db5d2ec111c32))
|
|
40
|
+
* **internal:** more robust bootstrap script ([bff841e](https://github.com/spi-tch/spitch-typescript/commit/bff841e4f29daf987d411a2b5a2cf1780ccd19dc))
|
|
41
|
+
* **tests:** bump steady to v0.22.1 ([af2f8b0](https://github.com/spi-tch/spitch-typescript/commit/af2f8b07acd5e4623fcdec2d2d15a3d6e74d980c))
|
|
42
|
+
|
|
3
43
|
## 1.48.0 (2026-04-17)
|
|
4
44
|
|
|
5
45
|
Full Changelog: [v1.47.0...v1.48.0](https://github.com/spi-tch/spitch-typescript/compare/v1.47.0...v1.48.0)
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This library provides convenient access to the Spitch REST API from server-side
|
|
|
6
6
|
|
|
7
7
|
The REST API documentation can be found on [docs.spitch.app](https://docs.spitch.app). The full API of this library can be found in [api.md](api.md).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Spitch maintains this SDK. See [CONTRIBUTING.md](CONTRIBUTING.md) for development and release instructions.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -26,11 +26,7 @@ const client = new Spitch({
|
|
|
26
26
|
apiKey: process.env['SPITCH_API_KEY'], // This is the default and can be omitted
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
const response = await client.speech.generate({
|
|
30
|
-
language: 'yo',
|
|
31
|
-
text: 'Bawo ni, ololufe?',
|
|
32
|
-
voice: 'femi',
|
|
33
|
-
});
|
|
29
|
+
const response = await client.speech.generate({ text: 'Bawo ni, ololufe?', voice: 'femi' });
|
|
34
30
|
|
|
35
31
|
const content = await response.blob();
|
|
36
32
|
console.log(content);
|
|
@@ -48,11 +44,7 @@ const client = new Spitch({
|
|
|
48
44
|
apiKey: process.env['SPITCH_API_KEY'], // This is the default and can be omitted
|
|
49
45
|
});
|
|
50
46
|
|
|
51
|
-
const params: Spitch.SpeechGenerateParams = {
|
|
52
|
-
language: 'yo',
|
|
53
|
-
text: 'Bawo ni, ololufe?',
|
|
54
|
-
voice: 'sade',
|
|
55
|
-
};
|
|
47
|
+
const params: Spitch.SpeechGenerateParams = { text: 'Bawo ni, ololufe?', voice: 'sade' };
|
|
56
48
|
const response: Response = await client.speech.generate(params);
|
|
57
49
|
```
|
|
58
50
|
|
|
@@ -74,23 +66,17 @@ import Spitch, { toFile } from 'spitch';
|
|
|
74
66
|
const client = new Spitch();
|
|
75
67
|
|
|
76
68
|
// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
|
|
77
|
-
await client.speech.transcribe({
|
|
69
|
+
await client.speech.transcribe({ content: fs.createReadStream('/path/to/file') });
|
|
78
70
|
|
|
79
71
|
// Or if you have the web `File` API you can pass a `File` instance:
|
|
80
|
-
await client.speech.transcribe({
|
|
72
|
+
await client.speech.transcribe({ content: new File(['my bytes'], 'file') });
|
|
81
73
|
|
|
82
74
|
// You can also pass a `fetch` `Response`:
|
|
83
|
-
await client.speech.transcribe({
|
|
75
|
+
await client.speech.transcribe({ content: await fetch('https://somesite/file') });
|
|
84
76
|
|
|
85
77
|
// Finally, if none of the above are convenient, you can use our `toFile` helper:
|
|
86
|
-
await client.speech.transcribe({
|
|
87
|
-
|
|
88
|
-
content: await toFile(Buffer.from('my bytes'), 'file'),
|
|
89
|
-
});
|
|
90
|
-
await client.speech.transcribe({
|
|
91
|
-
language: 'yo',
|
|
92
|
-
content: await toFile(new Uint8Array([0, 1, 2]), 'file'),
|
|
93
|
-
});
|
|
78
|
+
await client.speech.transcribe({ content: await toFile(Buffer.from('my bytes'), 'file') });
|
|
79
|
+
await client.speech.transcribe({ content: await toFile(new Uint8Array([0, 1, 2]), 'file') });
|
|
94
80
|
```
|
|
95
81
|
|
|
96
82
|
## Handling errors
|
|
@@ -102,11 +88,7 @@ a subclass of `APIError` will be thrown:
|
|
|
102
88
|
<!-- prettier-ignore -->
|
|
103
89
|
```ts
|
|
104
90
|
const response = await client.speech
|
|
105
|
-
.generate({
|
|
106
|
-
language: 'yo',
|
|
107
|
-
text: 'Bawo ni, ololufe?',
|
|
108
|
-
voice: 'sade',
|
|
109
|
-
})
|
|
91
|
+
.generate({ text: 'Bawo ni, ololufe?', voice: 'sade' })
|
|
110
92
|
.catch(async (err) => {
|
|
111
93
|
if (err instanceof Spitch.APIError) {
|
|
112
94
|
console.log(err.status); // 400
|
|
@@ -147,11 +129,7 @@ const client = new Spitch({
|
|
|
147
129
|
});
|
|
148
130
|
|
|
149
131
|
// Or, configure per-request:
|
|
150
|
-
await client.speech.generate({
|
|
151
|
-
language: 'yo',
|
|
152
|
-
text: 'Bawo ni, ololufe?',
|
|
153
|
-
voice: 'sade',
|
|
154
|
-
}, {
|
|
132
|
+
await client.speech.generate({ text: 'Bawo ni, ololufe?', voice: 'sade' }, {
|
|
155
133
|
maxRetries: 5,
|
|
156
134
|
});
|
|
157
135
|
```
|
|
@@ -168,11 +146,7 @@ const client = new Spitch({
|
|
|
168
146
|
});
|
|
169
147
|
|
|
170
148
|
// Override per-request:
|
|
171
|
-
await client.speech.generate({
|
|
172
|
-
language: 'yo',
|
|
173
|
-
text: 'Bawo ni, ololufe?',
|
|
174
|
-
voice: 'sade',
|
|
175
|
-
}, {
|
|
149
|
+
await client.speech.generate({ text: 'Bawo ni, ololufe?', voice: 'sade' }, {
|
|
176
150
|
timeout: 5 * 1000,
|
|
177
151
|
});
|
|
178
152
|
```
|
|
@@ -227,21 +201,13 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
|
|
|
227
201
|
const client = new Spitch();
|
|
228
202
|
|
|
229
203
|
const response = await client.speech
|
|
230
|
-
.generate({
|
|
231
|
-
language: 'yo',
|
|
232
|
-
text: 'Bawo ni, ololufe?',
|
|
233
|
-
voice: 'sade',
|
|
234
|
-
})
|
|
204
|
+
.generate({ text: 'Bawo ni, ololufe?', voice: 'sade' })
|
|
235
205
|
.asResponse();
|
|
236
206
|
console.log(response.headers.get('X-My-Header'));
|
|
237
207
|
console.log(response.statusText); // access the underlying Response object
|
|
238
208
|
|
|
239
209
|
const { data: response, response: raw } = await client.speech
|
|
240
|
-
.generate({
|
|
241
|
-
language: 'yo',
|
|
242
|
-
text: 'Bawo ni, ololufe?',
|
|
243
|
-
voice: 'sade',
|
|
244
|
-
})
|
|
210
|
+
.generate({ text: 'Bawo ni, ololufe?', voice: 'sade' })
|
|
245
211
|
.withResponse();
|
|
246
212
|
console.log(raw.headers.get('X-My-Header'));
|
|
247
213
|
console.log(response);
|
|
@@ -383,7 +349,7 @@ const client = new Spitch({
|
|
|
383
349
|
To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
|
|
384
350
|
options to requests:
|
|
385
351
|
|
|
386
|
-
|
|
352
|
+
**Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
|
|
387
353
|
|
|
388
354
|
```ts
|
|
389
355
|
import Spitch from 'spitch';
|
|
@@ -397,7 +363,7 @@ const client = new Spitch({
|
|
|
397
363
|
});
|
|
398
364
|
```
|
|
399
365
|
|
|
400
|
-
|
|
366
|
+
**Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
|
|
401
367
|
|
|
402
368
|
```ts
|
|
403
369
|
import Spitch from 'spitch';
|
|
@@ -409,7 +375,7 @@ const client = new Spitch({
|
|
|
409
375
|
});
|
|
410
376
|
```
|
|
411
377
|
|
|
412
|
-
|
|
378
|
+
**Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
|
|
413
379
|
|
|
414
380
|
```ts
|
|
415
381
|
import Spitch from 'npm:spitch';
|
package/api-promise.d.mts
CHANGED
package/api-promise.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,uCAAmC"}
|
package/api-promise.d.ts
CHANGED
package/api-promise.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,cAAc,oBAAoB,CAAC"}
|
package/api-promise.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("./internal/tslib.js");
|
|
4
17
|
/** @deprecated Import from ./core/api-promise instead */
|
|
5
|
-
|
|
18
|
+
__exportStar(require("./core/api-promise"), exports);
|
|
6
19
|
//# sourceMappingURL=api-promise.js.map
|
package/api-promise.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-promise.js","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-promise.js","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAyD;AACzD,qDAAmC"}
|
package/api-promise.mjs
CHANGED
package/api-promise.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-promise.mjs","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"api-promise.mjs","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,uCAAmC"}
|
package/client.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ export type { Logger, LogLevel } from "./internal/utils/log.mjs";
|
|
|
4
4
|
import * as Opts from "./internal/request-options.mjs";
|
|
5
5
|
import * as Errors from "./core/error.mjs";
|
|
6
6
|
import * as Pagination from "./core/pagination.mjs";
|
|
7
|
+
import { Balance, type BalanceResponse } from "./resources/balance.mjs";
|
|
7
8
|
import { type FilesCursorParams, FilesCursorResponse } from "./core/pagination.mjs";
|
|
8
9
|
import * as Uploads from "./core/uploads.mjs";
|
|
9
10
|
import * as API from "./resources/index.mjs";
|
|
@@ -103,7 +104,7 @@ export declare class Spitch {
|
|
|
103
104
|
*
|
|
104
105
|
* @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
|
|
105
106
|
* @param {boolean | null | undefined} [opts.dataRetention=true]
|
|
106
|
-
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.
|
|
107
|
+
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spitch.app] - Override the default base URL for the API.
|
|
107
108
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
108
109
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
109
110
|
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -186,6 +187,7 @@ export declare class Spitch {
|
|
|
186
187
|
*/
|
|
187
188
|
speech: API.Speech;
|
|
188
189
|
text: API.Text;
|
|
190
|
+
balance: API.Balance;
|
|
189
191
|
files: API.Files;
|
|
190
192
|
}
|
|
191
193
|
export declare namespace Spitch {
|
|
@@ -194,6 +196,6 @@ export declare namespace Spitch {
|
|
|
194
196
|
export { type FilesCursorParams as FilesCursorParams, type FilesCursorResponse as FilesCursorResponse };
|
|
195
197
|
export { Speech as Speech, type Segment as Segment, type Transcription as Transcription, type SpeechGenerateParams as SpeechGenerateParams, type SpeechTranscribeParams as SpeechTranscribeParams, };
|
|
196
198
|
export { Text as Text, type Diacritics as Diacritics, type Translation as Translation, type TextToneMarkParams as TextToneMarkParams, type TextTranslateParams as TextTranslateParams, };
|
|
197
|
-
export { Files as Files, type FileMeta as FileMeta, type FileUsage as FileUsage, type FileDeleteResponse as FileDeleteResponse, type FileDownloadResponse as FileDownloadResponse, type FileMetasFilesCursor as FileMetasFilesCursor, type FileListParams as FileListParams, type FileDownloadParams as FileDownloadParams, type FileUploadParams as FileUploadParams, };
|
|
199
|
+
export { Balance as Balance, type BalanceResponse as BalanceResponse, Files as Files, type FileMeta as FileMeta, type FileUsage as FileUsage, type FileDeleteResponse as FileDeleteResponse, type FileDownloadResponse as FileDownloadResponse, type FileMetasFilesCursor as FileMetasFilesCursor, type FileListParams as FileListParams, type FileDownloadParams as FileDownloadParams, type FileUploadParams as FileUploadParams, };
|
|
198
200
|
}
|
|
199
201
|
//# sourceMappingURL=client.d.mts.map
|
package/client.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY,qCAAiC;AACnF,OAAO,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,6BAAyB;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Ac,CAAC;IAEjD,MAAM,QAAQ,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;IACnD,OAAO,EAAE,KAAK,iBAAiB,IAAI,iBAAiB,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;IAExG,OAAO,EACL,MAAM,IAAI,MAAM,EAChB,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;IAEF,OAAO,EACL,IAAI,IAAI,IAAI,EACZ,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,IAAI,KAAK,EACd,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
package/client.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import type { RequestInit, RequestInfo } from
|
|
2
|
-
import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from
|
|
3
|
-
export type { Logger, LogLevel } from
|
|
4
|
-
import * as Opts from
|
|
5
|
-
import * as Errors from
|
|
6
|
-
import * as Pagination from
|
|
7
|
-
import { type
|
|
8
|
-
import
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
1
|
+
import type { RequestInit, RequestInfo } from './internal/builtin-types';
|
|
2
|
+
import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from './internal/types';
|
|
3
|
+
export type { Logger, LogLevel } from './internal/utils/log';
|
|
4
|
+
import * as Opts from './internal/request-options';
|
|
5
|
+
import * as Errors from './core/error';
|
|
6
|
+
import * as Pagination from './core/pagination';
|
|
7
|
+
import { Balance, type BalanceResponse } from './resources/balance';
|
|
8
|
+
import { type FilesCursorParams, FilesCursorResponse } from './core/pagination';
|
|
9
|
+
import * as Uploads from './core/uploads';
|
|
10
|
+
import * as API from './resources/index';
|
|
11
|
+
import { APIPromise } from './core/api-promise';
|
|
12
|
+
import { FileDeleteResponse, FileDownloadParams, FileDownloadResponse, FileListParams, FileMeta, FileMetasFilesCursor, FileUploadParams, FileUsage, Files } from './resources/files';
|
|
13
|
+
import { Segment, Speech, SpeechGenerateParams, SpeechTranscribeParams, Transcription } from './resources/speech';
|
|
14
|
+
import { Diacritics, Text, TextToneMarkParams, TextTranslateParams, Translation } from './resources/text';
|
|
15
|
+
import { type Fetch } from './internal/builtin-types';
|
|
16
|
+
import { HeadersLike, NullableHeaders } from './internal/headers';
|
|
17
|
+
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
18
|
+
import { type LogLevel, type Logger } from './internal/utils/log';
|
|
18
19
|
export interface ClientOptions {
|
|
19
20
|
/**
|
|
20
21
|
* Defaults to process.env['SPITCH_API_KEY'].
|
|
@@ -103,7 +104,7 @@ export declare class Spitch {
|
|
|
103
104
|
*
|
|
104
105
|
* @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
|
|
105
106
|
* @param {boolean | null | undefined} [opts.dataRetention=true]
|
|
106
|
-
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.
|
|
107
|
+
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spitch.app] - Override the default base URL for the API.
|
|
107
108
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
108
109
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
109
110
|
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -186,6 +187,7 @@ export declare class Spitch {
|
|
|
186
187
|
*/
|
|
187
188
|
speech: API.Speech;
|
|
188
189
|
text: API.Text;
|
|
190
|
+
balance: API.Balance;
|
|
189
191
|
files: API.Files;
|
|
190
192
|
}
|
|
191
193
|
export declare namespace Spitch {
|
|
@@ -194,6 +196,6 @@ export declare namespace Spitch {
|
|
|
194
196
|
export { type FilesCursorParams as FilesCursorParams, type FilesCursorResponse as FilesCursorResponse };
|
|
195
197
|
export { Speech as Speech, type Segment as Segment, type Transcription as Transcription, type SpeechGenerateParams as SpeechGenerateParams, type SpeechTranscribeParams as SpeechTranscribeParams, };
|
|
196
198
|
export { Text as Text, type Diacritics as Diacritics, type Translation as Translation, type TextToneMarkParams as TextToneMarkParams, type TextTranslateParams as TextTranslateParams, };
|
|
197
|
-
export { Files as Files, type FileMeta as FileMeta, type FileUsage as FileUsage, type FileDeleteResponse as FileDeleteResponse, type FileDownloadResponse as FileDownloadResponse, type FileMetasFilesCursor as FileMetasFilesCursor, type FileListParams as FileListParams, type FileDownloadParams as FileDownloadParams, type FileUploadParams as FileUploadParams, };
|
|
199
|
+
export { Balance as Balance, type BalanceResponse as BalanceResponse, Files as Files, type FileMeta as FileMeta, type FileUsage as FileUsage, type FileDeleteResponse as FileDeleteResponse, type FileDownloadResponse as FileDownloadResponse, type FileMetasFilesCursor as FileMetasFilesCursor, type FileListParams as FileListParams, type FileDownloadParams as FileDownloadParams, type FileUploadParams as FileUploadParams, };
|
|
198
200
|
}
|
|
199
201
|
//# sourceMappingURL=client.d.ts.map
|
package/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY,MAAM,0BAA0B,CAAC;AACnF,OAAO,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI5G,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAGnD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAgB,KAAK,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,KAAK,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1G,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO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AoB,IAAI,oBAAoB,EACjD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
package/client.js
CHANGED
|
@@ -1,30 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
37
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
38
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
39
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
40
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
41
|
+
};
|
|
42
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
43
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
44
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
45
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
46
|
+
};
|
|
3
47
|
var _Spitch_instances, _a, _Spitch_encoder, _Spitch_baseURLOverridden;
|
|
4
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
49
|
exports.Spitch = void 0;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const Uploads =
|
|
19
|
-
const API =
|
|
20
|
-
const api_promise_1 = require("./core/api-promise
|
|
21
|
-
const files_1 = require("./resources/files
|
|
22
|
-
const speech_1 = require("./resources/speech
|
|
23
|
-
const text_1 = require("./resources/text
|
|
24
|
-
const headers_1 = require("./internal/headers
|
|
25
|
-
const env_1 = require("./internal/utils/env
|
|
26
|
-
const log_1 = require("./internal/utils/log
|
|
27
|
-
const values_2 = require("./internal/utils/values
|
|
50
|
+
const uuid_1 = require("./internal/utils/uuid");
|
|
51
|
+
const values_1 = require("./internal/utils/values");
|
|
52
|
+
const sleep_1 = require("./internal/utils/sleep");
|
|
53
|
+
const errors_1 = require("./internal/errors");
|
|
54
|
+
const detect_platform_1 = require("./internal/detect-platform");
|
|
55
|
+
const Shims = __importStar(require("./internal/shims"));
|
|
56
|
+
const Opts = __importStar(require("./internal/request-options"));
|
|
57
|
+
const query_1 = require("./internal/utils/query");
|
|
58
|
+
const version_1 = require("./version");
|
|
59
|
+
const Errors = __importStar(require("./core/error"));
|
|
60
|
+
const Pagination = __importStar(require("./core/pagination"));
|
|
61
|
+
const balance_1 = require("./resources/balance");
|
|
62
|
+
const Uploads = __importStar(require("./core/uploads"));
|
|
63
|
+
const API = __importStar(require("./resources/index"));
|
|
64
|
+
const api_promise_1 = require("./core/api-promise");
|
|
65
|
+
const files_1 = require("./resources/files");
|
|
66
|
+
const speech_1 = require("./resources/speech");
|
|
67
|
+
const text_1 = require("./resources/text");
|
|
68
|
+
const headers_1 = require("./internal/headers");
|
|
69
|
+
const env_1 = require("./internal/utils/env");
|
|
70
|
+
const log_1 = require("./internal/utils/log");
|
|
71
|
+
const values_2 = require("./internal/utils/values");
|
|
28
72
|
/**
|
|
29
73
|
* API Client for interfacing with the Spitch API.
|
|
30
74
|
*/
|
|
@@ -34,7 +78,7 @@ class Spitch {
|
|
|
34
78
|
*
|
|
35
79
|
* @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
|
|
36
80
|
* @param {boolean | null | undefined} [opts.dataRetention=true]
|
|
37
|
-
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.
|
|
81
|
+
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spitch.app] - Override the default base URL for the API.
|
|
38
82
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
39
83
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
40
84
|
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -50,6 +94,7 @@ class Spitch {
|
|
|
50
94
|
*/
|
|
51
95
|
this.speech = new API.Speech(this);
|
|
52
96
|
this.text = new API.Text(this);
|
|
97
|
+
this.balance = new API.Balance(this);
|
|
53
98
|
this.files = new API.Files(this);
|
|
54
99
|
if (apiKey === undefined) {
|
|
55
100
|
throw new Errors.SpitchError("The SPITCH_API_KEY environment variable is missing or empty; either provide it, or instantiate the Spitch client with an apiKey option, like new Spitch({ apiKey: 'My API Key' }).");
|
|
@@ -58,7 +103,7 @@ class Spitch {
|
|
|
58
103
|
apiKey,
|
|
59
104
|
dataRetention,
|
|
60
105
|
...opts,
|
|
61
|
-
baseURL: baseURL || `https://api.
|
|
106
|
+
baseURL: baseURL || `https://api.spitch.app`,
|
|
62
107
|
};
|
|
63
108
|
this.baseURL = options.baseURL;
|
|
64
109
|
this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1 minute */;
|
|
@@ -73,7 +118,18 @@ class Spitch {
|
|
|
73
118
|
this.fetchOptions = options.fetchOptions;
|
|
74
119
|
this.maxRetries = options.maxRetries ?? 2;
|
|
75
120
|
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
76
|
-
|
|
121
|
+
__classPrivateFieldSet(this, _Spitch_encoder, Opts.FallbackEncoder, "f");
|
|
122
|
+
const customHeadersEnv = (0, env_1.readEnv)('SPITCH_CUSTOM_HEADERS');
|
|
123
|
+
if (customHeadersEnv) {
|
|
124
|
+
const parsed = {};
|
|
125
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
126
|
+
const colon = line.indexOf(':');
|
|
127
|
+
if (colon >= 0) {
|
|
128
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
|
|
132
|
+
}
|
|
77
133
|
this._options = options;
|
|
78
134
|
this.apiKey = apiKey;
|
|
79
135
|
this.dataRetention = dataRetention;
|
|
@@ -122,7 +178,7 @@ class Spitch {
|
|
|
122
178
|
return Errors.APIError.generate(status, error, message, headers);
|
|
123
179
|
}
|
|
124
180
|
buildURL(path, query, defaultBaseURL) {
|
|
125
|
-
const baseURL = (!
|
|
181
|
+
const baseURL = (!__classPrivateFieldGet(this, _Spitch_instances, "m", _Spitch_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
|
|
126
182
|
const url = (0, values_1.isAbsoluteURL)(path) ?
|
|
127
183
|
new URL(path)
|
|
128
184
|
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
@@ -423,8 +479,16 @@ class Spitch {
|
|
|
423
479
|
// would capture all request options, and cause a memory leak.
|
|
424
480
|
return () => controller.abort();
|
|
425
481
|
}
|
|
426
|
-
buildBody({ options
|
|
482
|
+
buildBody({ options }) {
|
|
483
|
+
const { body, headers: rawHeaders } = options;
|
|
427
484
|
if (!body) {
|
|
485
|
+
// A resource method always passes a `body` key when its operation defines a
|
|
486
|
+
// request body, even if the caller omitted an optional body param. Keep the
|
|
487
|
+
// content-type for those, and only elide it for operations with no body at
|
|
488
|
+
// all (e.g. GET/DELETE).
|
|
489
|
+
if (body == null && 'body' in options) {
|
|
490
|
+
return __classPrivateFieldGet(this, _Spitch_encoder, "f").call(this, { body, headers: (0, headers_1.buildHeaders)([rawHeaders]) });
|
|
491
|
+
}
|
|
428
492
|
return { bodyHeaders: undefined, body: undefined };
|
|
429
493
|
}
|
|
430
494
|
const headers = (0, headers_1.buildHeaders)([rawHeaders]);
|
|
@@ -459,13 +523,13 @@ class Spitch {
|
|
|
459
523
|
};
|
|
460
524
|
}
|
|
461
525
|
else {
|
|
462
|
-
return
|
|
526
|
+
return __classPrivateFieldGet(this, _Spitch_encoder, "f").call(this, { body, headers });
|
|
463
527
|
}
|
|
464
528
|
}
|
|
465
529
|
}
|
|
466
530
|
exports.Spitch = Spitch;
|
|
467
531
|
_a = Spitch, _Spitch_encoder = new WeakMap(), _Spitch_instances = new WeakSet(), _Spitch_baseURLOverridden = function _Spitch_baseURLOverridden() {
|
|
468
|
-
return this.baseURL !== 'https://api.
|
|
532
|
+
return this.baseURL !== 'https://api.spitch.app';
|
|
469
533
|
};
|
|
470
534
|
Spitch.Spitch = _a;
|
|
471
535
|
Spitch.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
@@ -485,5 +549,6 @@ Spitch.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
|
485
549
|
Spitch.toFile = Uploads.toFile;
|
|
486
550
|
Spitch.Speech = speech_1.Speech;
|
|
487
551
|
Spitch.Text = text_1.Text;
|
|
552
|
+
Spitch.Balance = balance_1.Balance;
|
|
488
553
|
Spitch.Files = files_1.Files;
|
|
489
554
|
//# sourceMappingURL=client.js.map
|