spitch 0.1.0-alpha.1 → 1.16.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/CHANGELOG.md +4 -13
- package/LICENSE +1 -1
- package/README.md +61 -27
- package/_shims/index.d.ts +2 -0
- package/_shims/index.js +5 -1
- package/_shims/index.mjs +5 -1
- package/_shims/web-runtime.js +1 -1
- package/_shims/web-runtime.js.map +1 -1
- package/_shims/web-runtime.mjs +1 -1
- package/_shims/web-runtime.mjs.map +1 -1
- package/core.d.ts +22 -9
- package/core.d.ts.map +1 -1
- package/core.js +50 -29
- package/core.js.map +1 -1
- package/core.mjs +51 -30
- package/core.mjs.map +1 -1
- package/error.d.ts +18 -24
- package/error.d.ts.map +1 -1
- package/error.js +1 -31
- package/error.js.map +1 -1
- package/error.mjs +1 -31
- package/error.mjs.map +1 -1
- package/index.d.mts +15 -19
- package/index.d.ts +15 -19
- package/index.d.ts.map +1 -1
- package/index.js +29 -11
- package/index.js.map +1 -1
- package/index.mjs +13 -10
- package/index.mjs.map +1 -1
- package/package.json +4 -4
- package/resource.d.ts +1 -1
- package/resource.d.ts.map +1 -1
- package/resource.js.map +1 -1
- package/resource.mjs.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/speech.d.ts +26 -16
- package/resources/speech.d.ts.map +1 -1
- package/resources/speech.js +8 -4
- package/resources/speech.js.map +1 -1
- package/resources/speech.mjs +8 -4
- package/resources/speech.mjs.map +1 -1
- package/resources/text.d.ts +20 -6
- package/resources/text.d.ts.map +1 -1
- package/resources/text.js +6 -2
- package/resources/text.js.map +1 -1
- package/resources/text.mjs +6 -2
- package/resources/text.mjs.map +1 -1
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +18 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/_shims/index.d.ts +2 -0
- package/src/_shims/index.js +5 -1
- package/src/_shims/index.mjs +5 -1
- package/src/_shims/web-runtime.ts +1 -1
- package/src/core.ts +81 -37
- package/src/error.ts +25 -41
- package/src/index.ts +52 -26
- package/src/resource.ts +1 -1
- package/src/resources/index.ts +10 -5
- package/src/resources/speech.ts +70 -18
- package/src/resources/text.ts +38 -7
- package/src/resources.ts +1 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +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/src/index.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import * as Errors from './error';
|
|
4
|
-
import * as Uploads from './uploads';
|
|
5
3
|
import { type Agent } from './_shims/index';
|
|
6
4
|
import * as Core from './core';
|
|
5
|
+
import * as Errors from './error';
|
|
6
|
+
import * as Uploads from './uploads';
|
|
7
7
|
import * as API from './resources/index';
|
|
8
|
+
import {
|
|
9
|
+
Speech,
|
|
10
|
+
SpeechGenerateParams,
|
|
11
|
+
SpeechTranscribeParams,
|
|
12
|
+
SpeechTranscribeResponse,
|
|
13
|
+
} from './resources/speech';
|
|
14
|
+
import {
|
|
15
|
+
Text,
|
|
16
|
+
TextToneMarkParams,
|
|
17
|
+
TextToneMarkResponse,
|
|
18
|
+
TextTranslateParams,
|
|
19
|
+
TextTranslateResponse,
|
|
20
|
+
} from './resources/text';
|
|
8
21
|
|
|
9
22
|
export interface ClientOptions {
|
|
10
23
|
/**
|
|
@@ -26,7 +39,7 @@ export interface ClientOptions {
|
|
|
26
39
|
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
27
40
|
* much longer than this timeout before the promise succeeds or fails.
|
|
28
41
|
*/
|
|
29
|
-
timeout?: number;
|
|
42
|
+
timeout?: number | undefined;
|
|
30
43
|
|
|
31
44
|
/**
|
|
32
45
|
* An HTTP agent used to manage HTTP(S) connections.
|
|
@@ -34,7 +47,7 @@ export interface ClientOptions {
|
|
|
34
47
|
* If not provided, an agent will be constructed by default in the Node.js environment,
|
|
35
48
|
* otherwise no agent is used.
|
|
36
49
|
*/
|
|
37
|
-
httpAgent?: Agent;
|
|
50
|
+
httpAgent?: Agent | undefined;
|
|
38
51
|
|
|
39
52
|
/**
|
|
40
53
|
* Specify a custom `fetch` function implementation.
|
|
@@ -50,7 +63,7 @@ export interface ClientOptions {
|
|
|
50
63
|
*
|
|
51
64
|
* @default 2
|
|
52
65
|
*/
|
|
53
|
-
maxRetries?: number;
|
|
66
|
+
maxRetries?: number | undefined;
|
|
54
67
|
|
|
55
68
|
/**
|
|
56
69
|
* Default headers to include with every request to the API.
|
|
@@ -58,7 +71,7 @@ export interface ClientOptions {
|
|
|
58
71
|
* These can be removed in individual requests by explicitly setting the
|
|
59
72
|
* header to `undefined` or `null` in request options.
|
|
60
73
|
*/
|
|
61
|
-
defaultHeaders?: Core.Headers;
|
|
74
|
+
defaultHeaders?: Core.Headers | undefined;
|
|
62
75
|
|
|
63
76
|
/**
|
|
64
77
|
* Default query parameters to include with every request to the API.
|
|
@@ -66,7 +79,7 @@ export interface ClientOptions {
|
|
|
66
79
|
* These can be removed in individual requests by explicitly setting the
|
|
67
80
|
* param to `undefined` in request options.
|
|
68
81
|
*/
|
|
69
|
-
defaultQuery?: Core.DefaultQuery;
|
|
82
|
+
defaultQuery?: Core.DefaultQuery | undefined;
|
|
70
83
|
}
|
|
71
84
|
|
|
72
85
|
/**
|
|
@@ -108,6 +121,7 @@ export class Spitch extends Core.APIClient {
|
|
|
108
121
|
|
|
109
122
|
super({
|
|
110
123
|
baseURL: options.baseURL!,
|
|
124
|
+
baseURLOverridden: baseURL ? baseURL !== 'https://api.spi-tch.com' : false,
|
|
111
125
|
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
112
126
|
httpAgent: options.httpAgent,
|
|
113
127
|
maxRetries: options.maxRetries,
|
|
@@ -122,6 +136,13 @@ export class Spitch extends Core.APIClient {
|
|
|
122
136
|
speech: API.Speech = new API.Speech(this);
|
|
123
137
|
text: API.Text = new API.Text(this);
|
|
124
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Check whether the base URL is set to its default.
|
|
141
|
+
*/
|
|
142
|
+
#baseURLOverridden(): boolean {
|
|
143
|
+
return this.baseURL !== 'https://api.spi-tch.com';
|
|
144
|
+
}
|
|
145
|
+
|
|
125
146
|
protected override defaultQuery(): Core.DefaultQuery | undefined {
|
|
126
147
|
return this._options.defaultQuery;
|
|
127
148
|
}
|
|
@@ -158,7 +179,29 @@ export class Spitch extends Core.APIClient {
|
|
|
158
179
|
static fileFromPath = Uploads.fileFromPath;
|
|
159
180
|
}
|
|
160
181
|
|
|
161
|
-
|
|
182
|
+
Spitch.Speech = Speech;
|
|
183
|
+
Spitch.Text = Text;
|
|
184
|
+
export declare namespace Spitch {
|
|
185
|
+
export type RequestOptions = Core.RequestOptions;
|
|
186
|
+
|
|
187
|
+
export {
|
|
188
|
+
Speech as Speech,
|
|
189
|
+
type SpeechTranscribeResponse as SpeechTranscribeResponse,
|
|
190
|
+
type SpeechGenerateParams as SpeechGenerateParams,
|
|
191
|
+
type SpeechTranscribeParams as SpeechTranscribeParams,
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export {
|
|
195
|
+
Text as Text,
|
|
196
|
+
type TextToneMarkResponse as TextToneMarkResponse,
|
|
197
|
+
type TextTranslateResponse as TextTranslateResponse,
|
|
198
|
+
type TextToneMarkParams as TextToneMarkParams,
|
|
199
|
+
type TextTranslateParams as TextTranslateParams,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export { toFile, fileFromPath } from './uploads';
|
|
204
|
+
export {
|
|
162
205
|
SpitchError,
|
|
163
206
|
APIError,
|
|
164
207
|
APIConnectionError,
|
|
@@ -172,23 +215,6 @@ export const {
|
|
|
172
215
|
InternalServerError,
|
|
173
216
|
PermissionDeniedError,
|
|
174
217
|
UnprocessableEntityError,
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export import toFile = Uploads.toFile;
|
|
178
|
-
export import fileFromPath = Uploads.fileFromPath;
|
|
179
|
-
|
|
180
|
-
export namespace Spitch {
|
|
181
|
-
export import RequestOptions = Core.RequestOptions;
|
|
182
|
-
|
|
183
|
-
export import Speech = API.Speech;
|
|
184
|
-
export import SpeechGenerateResponse = API.SpeechGenerateResponse;
|
|
185
|
-
export import SpeechTranscibeResponse = API.SpeechTranscibeResponse;
|
|
186
|
-
export import SpeechGenerateParams = API.SpeechGenerateParams;
|
|
187
|
-
export import SpeechTranscibeParams = API.SpeechTranscibeParams;
|
|
188
|
-
|
|
189
|
-
export import Text = API.Text;
|
|
190
|
-
export import TextToneMarkResponse = API.TextToneMarkResponse;
|
|
191
|
-
export import TextToneMarkParams = API.TextToneMarkParams;
|
|
192
|
-
}
|
|
218
|
+
} from './error';
|
|
193
219
|
|
|
194
220
|
export default Spitch;
|
package/src/resource.ts
CHANGED
package/src/resources/index.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
-
SpeechGenerateResponse,
|
|
5
|
-
SpeechTranscibeResponse,
|
|
6
|
-
SpeechGenerateParams,
|
|
7
|
-
SpeechTranscibeParams,
|
|
8
4
|
Speech,
|
|
5
|
+
type SpeechTranscribeResponse,
|
|
6
|
+
type SpeechGenerateParams,
|
|
7
|
+
type SpeechTranscribeParams,
|
|
9
8
|
} from './speech';
|
|
10
|
-
export {
|
|
9
|
+
export {
|
|
10
|
+
Text,
|
|
11
|
+
type TextToneMarkResponse,
|
|
12
|
+
type TextTranslateResponse,
|
|
13
|
+
type TextToneMarkParams,
|
|
14
|
+
type TextTranslateParams,
|
|
15
|
+
} from './text';
|
package/src/resources/speech.ts
CHANGED
|
@@ -2,34 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../resource';
|
|
4
4
|
import * as Core from '../core';
|
|
5
|
-
import
|
|
5
|
+
import { type Response } from '../_shims/index';
|
|
6
6
|
|
|
7
7
|
export class Speech extends APIResource {
|
|
8
8
|
/**
|
|
9
9
|
* Synthesize
|
|
10
10
|
*/
|
|
11
|
-
generate(params: SpeechGenerateParams, options?: Core.RequestOptions): Core.APIPromise<
|
|
11
|
+
generate(params: SpeechGenerateParams, options?: Core.RequestOptions): Core.APIPromise<Response> {
|
|
12
12
|
const { stream, ...body } = params;
|
|
13
|
-
return this._client.post('/v1/speech', {
|
|
13
|
+
return this._client.post('/v1/speech', {
|
|
14
|
+
query: { stream },
|
|
15
|
+
body,
|
|
16
|
+
...options,
|
|
17
|
+
headers: { Accept: 'audio/wav', ...options?.headers },
|
|
18
|
+
__binaryResponse: true,
|
|
19
|
+
});
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
/**
|
|
17
23
|
* Transcribe
|
|
18
24
|
*/
|
|
19
|
-
|
|
25
|
+
transcribe(
|
|
26
|
+
body: SpeechTranscribeParams,
|
|
27
|
+
options?: Core.RequestOptions,
|
|
28
|
+
): Core.APIPromise<SpeechTranscribeResponse> {
|
|
20
29
|
return this._client.post('/v1/transcriptions', Core.multipartFormRequestOptions({ body, ...options }));
|
|
21
30
|
}
|
|
22
31
|
}
|
|
23
32
|
|
|
24
|
-
export
|
|
33
|
+
export interface SpeechTranscribeResponse {
|
|
34
|
+
request_id: string;
|
|
25
35
|
|
|
26
|
-
|
|
36
|
+
segments?: Array<SpeechTranscribeResponse.Segment | null>;
|
|
37
|
+
|
|
38
|
+
text?: string | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export namespace SpeechTranscribeResponse {
|
|
42
|
+
export interface Segment {
|
|
43
|
+
end?: number;
|
|
44
|
+
|
|
45
|
+
speaker?: number | null;
|
|
46
|
+
|
|
47
|
+
start?: number;
|
|
48
|
+
|
|
49
|
+
text?: number;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
27
52
|
|
|
28
53
|
export interface SpeechGenerateParams {
|
|
29
54
|
/**
|
|
30
55
|
* Body param:
|
|
31
56
|
*/
|
|
32
|
-
language: 'yo' | 'en' | 'ha' | 'ig';
|
|
57
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
33
58
|
|
|
34
59
|
/**
|
|
35
60
|
* Body param:
|
|
@@ -37,27 +62,54 @@ export interface SpeechGenerateParams {
|
|
|
37
62
|
text: string;
|
|
38
63
|
|
|
39
64
|
/**
|
|
40
|
-
*
|
|
65
|
+
* Body param:
|
|
41
66
|
*/
|
|
42
|
-
|
|
67
|
+
voice:
|
|
68
|
+
| 'sade'
|
|
69
|
+
| 'segun'
|
|
70
|
+
| 'femi'
|
|
71
|
+
| 'funmi'
|
|
72
|
+
| 'amina'
|
|
73
|
+
| 'aliyu'
|
|
74
|
+
| 'hasan'
|
|
75
|
+
| 'zainab'
|
|
76
|
+
| 'ngozi'
|
|
77
|
+
| 'amara'
|
|
78
|
+
| 'ebuka'
|
|
79
|
+
| 'obinna'
|
|
80
|
+
| 'lucy'
|
|
81
|
+
| 'lina'
|
|
82
|
+
| 'john'
|
|
83
|
+
| 'jude'
|
|
84
|
+
| 'henry'
|
|
85
|
+
| 'kani'
|
|
86
|
+
| 'hana'
|
|
87
|
+
| 'selam'
|
|
88
|
+
| 'tena'
|
|
89
|
+
| 'tesfaye';
|
|
43
90
|
|
|
44
91
|
/**
|
|
45
|
-
*
|
|
92
|
+
* Query param:
|
|
46
93
|
*/
|
|
47
|
-
|
|
94
|
+
stream?: boolean;
|
|
48
95
|
}
|
|
49
96
|
|
|
50
|
-
export interface
|
|
51
|
-
language: 'yo' | 'en' | 'ha' | 'ig';
|
|
97
|
+
export interface SpeechTranscribeParams {
|
|
98
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
52
99
|
|
|
53
100
|
content?: Core.Uploadable | null;
|
|
54
101
|
|
|
102
|
+
multispeaker?: boolean | null;
|
|
103
|
+
|
|
104
|
+
timestamp?: boolean | null;
|
|
105
|
+
|
|
55
106
|
url?: string | null;
|
|
56
107
|
}
|
|
57
108
|
|
|
58
|
-
export namespace Speech {
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
109
|
+
export declare namespace Speech {
|
|
110
|
+
export {
|
|
111
|
+
type SpeechTranscribeResponse as SpeechTranscribeResponse,
|
|
112
|
+
type SpeechGenerateParams as SpeechGenerateParams,
|
|
113
|
+
type SpeechTranscribeParams as SpeechTranscribeParams,
|
|
114
|
+
};
|
|
63
115
|
}
|
package/src/resources/text.ts
CHANGED
|
@@ -2,26 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../resource';
|
|
4
4
|
import * as Core from '../core';
|
|
5
|
-
import * as TextAPI from './text';
|
|
6
5
|
|
|
7
6
|
export class Text extends APIResource {
|
|
8
7
|
/**
|
|
9
8
|
* Tone Mark
|
|
10
9
|
*/
|
|
11
|
-
toneMark(body: TextToneMarkParams, options?: Core.RequestOptions): Core.APIPromise<
|
|
10
|
+
toneMark(body: TextToneMarkParams, options?: Core.RequestOptions): Core.APIPromise<TextToneMarkResponse> {
|
|
12
11
|
return this._client.post('/v1/diacritics', { body, ...options });
|
|
13
12
|
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Translate
|
|
16
|
+
*/
|
|
17
|
+
translate(
|
|
18
|
+
body: TextTranslateParams,
|
|
19
|
+
options?: Core.RequestOptions,
|
|
20
|
+
): Core.APIPromise<TextTranslateResponse> {
|
|
21
|
+
return this._client.post('/v1/translate', { body, ...options });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface TextToneMarkResponse {
|
|
26
|
+
request_id: string;
|
|
27
|
+
|
|
28
|
+
text?: string;
|
|
14
29
|
}
|
|
15
30
|
|
|
16
|
-
export
|
|
31
|
+
export interface TextTranslateResponse {
|
|
32
|
+
request_id: string;
|
|
33
|
+
|
|
34
|
+
text?: string;
|
|
35
|
+
}
|
|
17
36
|
|
|
18
37
|
export interface TextToneMarkParams {
|
|
19
|
-
language: 'yo' | 'en' | 'ha' | 'ig';
|
|
38
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
39
|
+
|
|
40
|
+
text: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface TextTranslateParams {
|
|
44
|
+
source: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
45
|
+
|
|
46
|
+
target: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
20
47
|
|
|
21
48
|
text: string;
|
|
22
49
|
}
|
|
23
50
|
|
|
24
|
-
export namespace Text {
|
|
25
|
-
export
|
|
26
|
-
|
|
51
|
+
export declare namespace Text {
|
|
52
|
+
export {
|
|
53
|
+
type TextToneMarkResponse as TextToneMarkResponse,
|
|
54
|
+
type TextTranslateResponse as TextTranslateResponse,
|
|
55
|
+
type TextToneMarkParams as TextToneMarkParams,
|
|
56
|
+
type TextTranslateParams as TextTranslateParams,
|
|
57
|
+
};
|
|
27
58
|
}
|
package/src/resources.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './resources/index';
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '
|
|
1
|
+
export const VERSION = '1.16.1'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "
|
|
1
|
+
export declare const VERSION = "1.16.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/version.js
CHANGED
package/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}
|
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '
|
|
1
|
+
export const VERSION = '1.16.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}
|