spitch 1.47.0 → 1.49.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 +67 -0
- package/README.md +12 -18
- package/client.d.mts +5 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +5 -4
- package/client.d.ts.map +1 -1
- package/client.js +39 -23
- package/client.js.map +1 -1
- package/client.mjs +39 -23
- package/client.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/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/internal/utils/query.d.mts +5 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +5 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +23 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +20 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +12 -1
- package/resources/files.d.mts +4 -0
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +4 -0
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +6 -0
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +6 -0
- package/resources/files.mjs.map +1 -1
- package/resources/speech.d.mts +37 -22
- package/resources/speech.d.mts.map +1 -1
- package/resources/speech.d.ts +37 -22
- package/resources/speech.d.ts.map +1 -1
- package/resources/speech.js +1 -2
- 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 +24 -4
- package/resources/text.d.ts.map +1 -1
- package/resources/text.js +1 -1
- package/resources/text.mjs +1 -1
- package/src/client.ts +50 -30
- package/src/internal/types.ts +6 -8
- package/src/internal/utils/env.ts +2 -2
- package/src/internal/utils/query.ts +23 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/files.ts +7 -0
- package/src/resources/speech.ts +45 -26
- package/src/resources/text.ts +27 -5
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { SpitchError } from '../../core/error';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
7
|
+
*/
|
|
8
|
+
export function stringifyQuery(query: object | Record<string, unknown>) {
|
|
9
|
+
return Object.entries(query)
|
|
10
|
+
.filter(([_, value]) => typeof value !== 'undefined')
|
|
11
|
+
.map(([key, value]) => {
|
|
12
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
13
|
+
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
14
|
+
}
|
|
15
|
+
if (value === null) {
|
|
16
|
+
return `${encodeURIComponent(key)}=`;
|
|
17
|
+
}
|
|
18
|
+
throw new SpitchError(
|
|
19
|
+
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
|
|
20
|
+
);
|
|
21
|
+
})
|
|
22
|
+
.join('&');
|
|
23
|
+
}
|
package/src/internal/utils.ts
CHANGED
package/src/resources/files.ts
CHANGED
|
@@ -37,6 +37,13 @@ export class Files extends APIResource {
|
|
|
37
37
|
return this._client.get(path`/v1/files/${fileID}/url`, { query, ...options });
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Get File
|
|
42
|
+
*/
|
|
43
|
+
get(fileID: string, options?: RequestOptions): APIPromise<FileMeta> {
|
|
44
|
+
return this._client.get(path`/v1/files/${fileID}`, options);
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
/**
|
|
41
48
|
* Upload a file to your storage.
|
|
42
49
|
*/
|
package/src/resources/speech.ts
CHANGED
|
@@ -12,8 +12,7 @@ import { multipartFormRequestOptions } from '../internal/uploads';
|
|
|
12
12
|
*/
|
|
13
13
|
export class Speech extends APIResource {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* format. Audio is retured in chunks.
|
|
15
|
+
* Generate audio
|
|
17
16
|
*/
|
|
18
17
|
generate(body: SpeechGenerateParams, options?: RequestOptions): APIPromise<Response> {
|
|
19
18
|
return this._client.post('/v1/speech', {
|
|
@@ -64,28 +63,26 @@ export interface Transcription {
|
|
|
64
63
|
/**
|
|
65
64
|
* for audit purposes.
|
|
66
65
|
*/
|
|
67
|
-
request_id
|
|
68
|
-
|
|
69
|
-
text: string;
|
|
66
|
+
request_id?: string;
|
|
70
67
|
|
|
71
68
|
/**
|
|
72
|
-
* sentence-level or word-level groupings of your transcript. Each
|
|
73
|
-
* word) will fall within a time range.
|
|
69
|
+
* Either `sentence-level` or `word-level` groupings of your transcript. Each
|
|
70
|
+
* sentence (or word) will fall within a time range.
|
|
74
71
|
*/
|
|
75
72
|
segments?: Array<Segment> | null;
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
* @deprecated sentence-level or word-level groupings of your transcript. Each
|
|
79
|
-
* sentence (or word) will fall within a time range.
|
|
80
|
-
*/
|
|
81
|
-
timestamps?: Array<Segment> | null;
|
|
74
|
+
text?: string;
|
|
82
75
|
}
|
|
83
76
|
|
|
84
77
|
export interface SpeechGenerateParams {
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The text for which you want to generate audio.
|
|
80
|
+
*/
|
|
87
81
|
text: string;
|
|
88
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The voice you want to be used for audio generation.
|
|
85
|
+
*/
|
|
89
86
|
voice:
|
|
90
87
|
| 'sade'
|
|
91
88
|
| 'segun'
|
|
@@ -101,38 +98,60 @@ export interface SpeechGenerateParams {
|
|
|
101
98
|
| 'lucy'
|
|
102
99
|
| 'henry'
|
|
103
100
|
| 'kani'
|
|
101
|
+
| 'remi'
|
|
102
|
+
| 'kingsley'
|
|
104
103
|
| 'ngozi'
|
|
105
104
|
| 'amara'
|
|
106
105
|
| 'obinna'
|
|
107
106
|
| 'ebuka'
|
|
108
107
|
| 'hana'
|
|
109
|
-
| '
|
|
108
|
+
| 'haile'
|
|
110
109
|
| 'tena'
|
|
111
|
-
| 'tesfaye'
|
|
110
|
+
| 'tesfaye'
|
|
111
|
+
| 'ufoma'
|
|
112
|
+
| 'tega'
|
|
113
|
+
| 'justice'
|
|
114
|
+
| 'boma';
|
|
112
115
|
|
|
113
116
|
/**
|
|
114
|
-
*
|
|
117
|
+
* The audio format for the returned audio data, defaults to `wav`.
|
|
115
118
|
*/
|
|
116
119
|
format?: 'mp3' | 'wav' | 'ogg_opus' | 'webm_opus' | 'mulaw' | 'alaw' | 'flac' | 'pcm_s16le';
|
|
117
120
|
|
|
118
|
-
|
|
121
|
+
/**
|
|
122
|
+
* This is optional; an ISO 639 language code to be used for the generation.
|
|
123
|
+
*/
|
|
124
|
+
language?: string;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The speed of the voice, defaults to `1.0`
|
|
128
|
+
*/
|
|
129
|
+
speed?: number;
|
|
119
130
|
}
|
|
120
131
|
|
|
121
132
|
export interface SpeechTranscribeParams {
|
|
122
|
-
|
|
133
|
+
/**
|
|
134
|
+
* The audio file or content that you want to transcribe. This could be;
|
|
135
|
+
* `file bytes`, a `url to an audio file` (ensure the link does not require
|
|
136
|
+
* authentication to access the file) or a `file UUID`.
|
|
137
|
+
*/
|
|
138
|
+
content: Uploadable | string;
|
|
123
139
|
|
|
124
|
-
|
|
140
|
+
/**
|
|
141
|
+
* This is optional, an ISO-639 language code that corresponds to the language in
|
|
142
|
+
* the `content`.
|
|
143
|
+
*/
|
|
144
|
+
language?: string | null;
|
|
125
145
|
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated Select the model to be used to perform the transcription, this param
|
|
148
|
+
* has been deprecated.
|
|
149
|
+
*/
|
|
126
150
|
model?: 'mansa_v1' | 'legacy' | null;
|
|
127
151
|
|
|
128
152
|
special_words?: string | null;
|
|
129
153
|
|
|
130
|
-
timestamp?: 'sentence' | 'word' |
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* @deprecated
|
|
134
|
-
*/
|
|
135
|
-
url?: string | null;
|
|
154
|
+
timestamp?: 'sentence' | 'word' | null;
|
|
136
155
|
}
|
|
137
156
|
|
|
138
157
|
export declare namespace Speech {
|
package/src/resources/text.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
6
6
|
|
|
7
7
|
export class Text extends APIResource {
|
|
8
8
|
/**
|
|
9
|
-
* Add
|
|
9
|
+
* Add appropriate tone marks to text.
|
|
10
10
|
*/
|
|
11
11
|
toneMark(body: TextToneMarkParams, options?: RequestOptions): APIPromise<Diacritics> {
|
|
12
12
|
return this._client.post('/v1/diacritics', { body, ...options });
|
|
@@ -34,17 +34,39 @@ export interface Translation {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface TextToneMarkParams {
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Only Yoruba is supported at the moment.
|
|
39
|
+
*/
|
|
40
|
+
language: string;
|
|
38
41
|
|
|
39
42
|
text: string;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
export interface TextTranslateParams {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
/**
|
|
47
|
+
* An ISO 639 code of the language you want to translate to.
|
|
48
|
+
*/
|
|
49
|
+
target: string;
|
|
46
50
|
|
|
51
|
+
/**
|
|
52
|
+
* The text to be translated.
|
|
53
|
+
*/
|
|
47
54
|
text: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Whether to be `formal` or `casual`.
|
|
58
|
+
*/
|
|
59
|
+
formality?: 'casual' | 'formal';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An ISO 639 code of the language you're translating from
|
|
63
|
+
*/
|
|
64
|
+
source?: string | null;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The tone of the translated text.
|
|
68
|
+
*/
|
|
69
|
+
tone?: 'neutral' | 'warm' | 'professional' | 'narration';
|
|
48
70
|
}
|
|
49
71
|
|
|
50
72
|
export declare namespace Text {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.49.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.49.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.49.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.49.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|