spitch 0.0.1-alpha.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.
Files changed (179) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +201 -0
  3. package/README.md +290 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +89 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +242 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +901 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +869 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +53 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +143 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +127 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +117 -0
  87. package/index.d.ts +117 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +111 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +83 -0
  92. package/index.mjs.map +1 -0
  93. package/package.json +103 -0
  94. package/resource.d.ts +6 -0
  95. package/resource.d.ts.map +1 -0
  96. package/resource.js +11 -0
  97. package/resource.js.map +1 -0
  98. package/resource.mjs +7 -0
  99. package/resource.mjs.map +1 -0
  100. package/resources/index.d.ts +3 -0
  101. package/resources/index.d.ts.map +1 -0
  102. package/resources/index.js +9 -0
  103. package/resources/index.js.map +1 -0
  104. package/resources/index.mjs +4 -0
  105. package/resources/index.mjs.map +1 -0
  106. package/resources/speech.d.ts +44 -0
  107. package/resources/speech.d.ts.map +1 -0
  108. package/resources/speech.js +48 -0
  109. package/resources/speech.js.map +1 -0
  110. package/resources/speech.mjs +21 -0
  111. package/resources/speech.mjs.map +1 -0
  112. package/resources/text.d.ts +19 -0
  113. package/resources/text.d.ts.map +1 -0
  114. package/resources/text.js +17 -0
  115. package/resources/text.js.map +1 -0
  116. package/resources/text.mjs +13 -0
  117. package/resources/text.mjs.map +1 -0
  118. package/shims/node.d.ts +30 -0
  119. package/shims/node.d.ts.map +1 -0
  120. package/shims/node.js +31 -0
  121. package/shims/node.js.map +1 -0
  122. package/shims/node.mjs +5 -0
  123. package/shims/node.mjs.map +1 -0
  124. package/shims/web.d.ts +26 -0
  125. package/shims/web.d.ts.map +1 -0
  126. package/shims/web.js +31 -0
  127. package/shims/web.js.map +1 -0
  128. package/shims/web.mjs +5 -0
  129. package/shims/web.mjs.map +1 -0
  130. package/src/_shims/MultipartBody.ts +9 -0
  131. package/src/_shims/README.md +46 -0
  132. package/src/_shims/auto/runtime-bun.ts +4 -0
  133. package/src/_shims/auto/runtime-node.ts +4 -0
  134. package/src/_shims/auto/runtime.ts +4 -0
  135. package/src/_shims/auto/types-node.ts +4 -0
  136. package/src/_shims/auto/types.d.ts +101 -0
  137. package/src/_shims/auto/types.js +3 -0
  138. package/src/_shims/auto/types.mjs +3 -0
  139. package/src/_shims/bun-runtime.ts +14 -0
  140. package/src/_shims/index.d.ts +81 -0
  141. package/src/_shims/index.js +13 -0
  142. package/src/_shims/index.mjs +7 -0
  143. package/src/_shims/manual-types.d.ts +12 -0
  144. package/src/_shims/manual-types.js +3 -0
  145. package/src/_shims/manual-types.mjs +3 -0
  146. package/src/_shims/node-runtime.ts +81 -0
  147. package/src/_shims/node-types.d.ts +42 -0
  148. package/src/_shims/node-types.js +3 -0
  149. package/src/_shims/node-types.mjs +3 -0
  150. package/src/_shims/registry.ts +65 -0
  151. package/src/_shims/web-runtime.ts +103 -0
  152. package/src/_shims/web-types.d.ts +83 -0
  153. package/src/_shims/web-types.js +3 -0
  154. package/src/_shims/web-types.mjs +3 -0
  155. package/src/core.ts +1190 -0
  156. package/src/error.ts +146 -0
  157. package/src/index.ts +193 -0
  158. package/src/lib/.keep +4 -0
  159. package/src/resource.ts +11 -0
  160. package/src/resources/index.ts +4 -0
  161. package/src/resources/speech.ts +61 -0
  162. package/src/resources/text.ts +27 -0
  163. package/src/shims/node.ts +50 -0
  164. package/src/shims/web.ts +50 -0
  165. package/src/tsconfig.json +11 -0
  166. package/src/uploads.ts +255 -0
  167. package/src/version.ts +1 -0
  168. package/uploads.d.ts +75 -0
  169. package/uploads.d.ts.map +1 -0
  170. package/uploads.js +171 -0
  171. package/uploads.js.map +1 -0
  172. package/uploads.mjs +158 -0
  173. package/uploads.mjs.map +1 -0
  174. package/version.d.ts +2 -0
  175. package/version.d.ts.map +1 -0
  176. package/version.js +5 -0
  177. package/version.js.map +1 -0
  178. package/version.mjs +2 -0
  179. package/version.mjs.map +1 -0
package/src/error.ts ADDED
@@ -0,0 +1,146 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { castToError, Headers } from './core';
4
+
5
+ export class SpitchError extends Error {}
6
+
7
+ export class APIError extends SpitchError {
8
+ readonly status: number | undefined;
9
+ readonly headers: Headers | undefined;
10
+ readonly error: Object | undefined;
11
+
12
+ constructor(
13
+ status: number | undefined,
14
+ error: Object | undefined,
15
+ message: string | undefined,
16
+ headers: Headers | undefined,
17
+ ) {
18
+ super(`${APIError.makeMessage(status, error, message)}`);
19
+ this.status = status;
20
+ this.headers = headers;
21
+ this.error = error;
22
+ }
23
+
24
+ private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
25
+ const msg =
26
+ error?.message ?
27
+ typeof error.message === 'string' ?
28
+ error.message
29
+ : JSON.stringify(error.message)
30
+ : error ? JSON.stringify(error)
31
+ : message;
32
+
33
+ if (status && msg) {
34
+ return `${status} ${msg}`;
35
+ }
36
+ if (status) {
37
+ return `${status} status code (no body)`;
38
+ }
39
+ if (msg) {
40
+ return msg;
41
+ }
42
+ return '(no status code or body)';
43
+ }
44
+
45
+ static generate(
46
+ status: number | undefined,
47
+ errorResponse: Object | undefined,
48
+ message: string | undefined,
49
+ headers: Headers | undefined,
50
+ ) {
51
+ if (!status) {
52
+ return new APIConnectionError({ message, cause: castToError(errorResponse) });
53
+ }
54
+
55
+ const error = errorResponse as Record<string, any>;
56
+
57
+ if (status === 400) {
58
+ return new BadRequestError(status, error, message, headers);
59
+ }
60
+
61
+ if (status === 401) {
62
+ return new AuthenticationError(status, error, message, headers);
63
+ }
64
+
65
+ if (status === 403) {
66
+ return new PermissionDeniedError(status, error, message, headers);
67
+ }
68
+
69
+ if (status === 404) {
70
+ return new NotFoundError(status, error, message, headers);
71
+ }
72
+
73
+ if (status === 409) {
74
+ return new ConflictError(status, error, message, headers);
75
+ }
76
+
77
+ if (status === 422) {
78
+ return new UnprocessableEntityError(status, error, message, headers);
79
+ }
80
+
81
+ if (status === 429) {
82
+ return new RateLimitError(status, error, message, headers);
83
+ }
84
+
85
+ if (status >= 500) {
86
+ return new InternalServerError(status, error, message, headers);
87
+ }
88
+
89
+ return new APIError(status, error, message, headers);
90
+ }
91
+ }
92
+
93
+ export class APIUserAbortError extends APIError {
94
+ override readonly status: undefined = undefined;
95
+
96
+ constructor({ message }: { message?: string } = {}) {
97
+ super(undefined, undefined, message || 'Request was aborted.', undefined);
98
+ }
99
+ }
100
+
101
+ export class APIConnectionError extends APIError {
102
+ override readonly status: undefined = undefined;
103
+
104
+ constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) {
105
+ super(undefined, undefined, message || 'Connection error.', undefined);
106
+ // in some environments the 'cause' property is already declared
107
+ // @ts-ignore
108
+ if (cause) this.cause = cause;
109
+ }
110
+ }
111
+
112
+ export class APIConnectionTimeoutError extends APIConnectionError {
113
+ constructor({ message }: { message?: string } = {}) {
114
+ super({ message: message ?? 'Request timed out.' });
115
+ }
116
+ }
117
+
118
+ export class BadRequestError extends APIError {
119
+ override readonly status: 400 = 400;
120
+ }
121
+
122
+ export class AuthenticationError extends APIError {
123
+ override readonly status: 401 = 401;
124
+ }
125
+
126
+ export class PermissionDeniedError extends APIError {
127
+ override readonly status: 403 = 403;
128
+ }
129
+
130
+ export class NotFoundError extends APIError {
131
+ override readonly status: 404 = 404;
132
+ }
133
+
134
+ export class ConflictError extends APIError {
135
+ override readonly status: 409 = 409;
136
+ }
137
+
138
+ export class UnprocessableEntityError extends APIError {
139
+ override readonly status: 422 = 422;
140
+ }
141
+
142
+ export class RateLimitError extends APIError {
143
+ override readonly status: 429 = 429;
144
+ }
145
+
146
+ export class InternalServerError extends APIError {}
package/src/index.ts ADDED
@@ -0,0 +1,193 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import * as Errors from './error';
4
+ import * as Uploads from './uploads';
5
+ import { type Agent } from './_shims/index';
6
+ import * as Core from './core';
7
+ import * as API from './resources/index';
8
+
9
+ export interface ClientOptions {
10
+ /**
11
+ * Defaults to process.env['SPITCH_API_KEY'].
12
+ */
13
+ apiKey?: string | undefined;
14
+
15
+ /**
16
+ * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
17
+ *
18
+ * Defaults to process.env['SPITCH_BASE_URL'].
19
+ */
20
+ baseURL?: string | null | undefined;
21
+
22
+ /**
23
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
24
+ * from the server before timing out a single request.
25
+ *
26
+ * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
27
+ * much longer than this timeout before the promise succeeds or fails.
28
+ */
29
+ timeout?: number;
30
+
31
+ /**
32
+ * An HTTP agent used to manage HTTP(S) connections.
33
+ *
34
+ * If not provided, an agent will be constructed by default in the Node.js environment,
35
+ * otherwise no agent is used.
36
+ */
37
+ httpAgent?: Agent;
38
+
39
+ /**
40
+ * Specify a custom `fetch` function implementation.
41
+ *
42
+ * If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
43
+ * defined globally.
44
+ */
45
+ fetch?: Core.Fetch | undefined;
46
+
47
+ /**
48
+ * The maximum number of times that the client will retry a request in case of a
49
+ * temporary failure, like a network error or a 5XX error from the server.
50
+ *
51
+ * @default 2
52
+ */
53
+ maxRetries?: number;
54
+
55
+ /**
56
+ * Default headers to include with every request to the API.
57
+ *
58
+ * These can be removed in individual requests by explicitly setting the
59
+ * header to `undefined` or `null` in request options.
60
+ */
61
+ defaultHeaders?: Core.Headers;
62
+
63
+ /**
64
+ * Default query parameters to include with every request to the API.
65
+ *
66
+ * These can be removed in individual requests by explicitly setting the
67
+ * param to `undefined` in request options.
68
+ */
69
+ defaultQuery?: Core.DefaultQuery;
70
+ }
71
+
72
+ /**
73
+ * API Client for interfacing with the Spitch API.
74
+ */
75
+ export class Spitch extends Core.APIClient {
76
+ apiKey: string;
77
+
78
+ private _options: ClientOptions;
79
+
80
+ /**
81
+ * API Client for interfacing with the Spitch API.
82
+ *
83
+ * @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
84
+ * @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spi-tch.com] - Override the default base URL for the API.
85
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
86
+ * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
87
+ * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
88
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
89
+ * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
90
+ * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
91
+ */
92
+ constructor({
93
+ baseURL = Core.readEnv('SPITCH_BASE_URL'),
94
+ apiKey = Core.readEnv('SPITCH_API_KEY'),
95
+ ...opts
96
+ }: ClientOptions = {}) {
97
+ if (apiKey === undefined) {
98
+ throw new Errors.SpitchError(
99
+ "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' }).",
100
+ );
101
+ }
102
+
103
+ const options: ClientOptions = {
104
+ apiKey,
105
+ ...opts,
106
+ baseURL: baseURL || `https://api.spi-tch.com`,
107
+ };
108
+
109
+ super({
110
+ baseURL: options.baseURL!,
111
+ timeout: options.timeout ?? 60000 /* 1 minute */,
112
+ httpAgent: options.httpAgent,
113
+ maxRetries: options.maxRetries,
114
+ fetch: options.fetch,
115
+ });
116
+
117
+ this._options = options;
118
+
119
+ this.apiKey = apiKey;
120
+ }
121
+
122
+ speech: API.Speech = new API.Speech(this);
123
+ text: API.Text = new API.Text(this);
124
+
125
+ protected override defaultQuery(): Core.DefaultQuery | undefined {
126
+ return this._options.defaultQuery;
127
+ }
128
+
129
+ protected override defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers {
130
+ return {
131
+ ...super.defaultHeaders(opts),
132
+ ...this._options.defaultHeaders,
133
+ };
134
+ }
135
+
136
+ protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {
137
+ return { Authorization: `Bearer ${this.apiKey}` };
138
+ }
139
+
140
+ static Spitch = this;
141
+ static DEFAULT_TIMEOUT = 60000; // 1 minute
142
+
143
+ static SpitchError = Errors.SpitchError;
144
+ static APIError = Errors.APIError;
145
+ static APIConnectionError = Errors.APIConnectionError;
146
+ static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
147
+ static APIUserAbortError = Errors.APIUserAbortError;
148
+ static NotFoundError = Errors.NotFoundError;
149
+ static ConflictError = Errors.ConflictError;
150
+ static RateLimitError = Errors.RateLimitError;
151
+ static BadRequestError = Errors.BadRequestError;
152
+ static AuthenticationError = Errors.AuthenticationError;
153
+ static InternalServerError = Errors.InternalServerError;
154
+ static PermissionDeniedError = Errors.PermissionDeniedError;
155
+ static UnprocessableEntityError = Errors.UnprocessableEntityError;
156
+
157
+ static toFile = Uploads.toFile;
158
+ static fileFromPath = Uploads.fileFromPath;
159
+ }
160
+
161
+ export const {
162
+ SpitchError,
163
+ APIError,
164
+ APIConnectionError,
165
+ APIConnectionTimeoutError,
166
+ APIUserAbortError,
167
+ NotFoundError,
168
+ ConflictError,
169
+ RateLimitError,
170
+ BadRequestError,
171
+ AuthenticationError,
172
+ InternalServerError,
173
+ PermissionDeniedError,
174
+ UnprocessableEntityError,
175
+ } = Errors;
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 SpeechTranscibeResponse = API.SpeechTranscibeResponse;
185
+ export import SpeechGenerateParams = API.SpeechGenerateParams;
186
+ export import SpeechTranscibeParams = API.SpeechTranscibeParams;
187
+
188
+ export import Text = API.Text;
189
+ export import TextToneMarkResponse = API.TextToneMarkResponse;
190
+ export import TextToneMarkParams = API.TextToneMarkParams;
191
+ }
192
+
193
+ export default Spitch;
package/src/lib/.keep ADDED
@@ -0,0 +1,4 @@
1
+ File generated from our OpenAPI spec by Stainless.
2
+
3
+ This directory can be used to store custom files to expand the SDK.
4
+ It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
@@ -0,0 +1,11 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import type { Spitch } from './index';
4
+
5
+ export class APIResource {
6
+ protected _client: Spitch;
7
+
8
+ constructor(client: Spitch) {
9
+ this._client = client;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { SpeechTranscibeResponse, SpeechGenerateParams, SpeechTranscibeParams, Speech } from './speech';
4
+ export { TextToneMarkResponse, TextToneMarkParams, Text } from './text';
@@ -0,0 +1,61 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+ import * as SpeechAPI from './speech';
6
+ import { type Response } from '../_shims/index';
7
+
8
+ export class Speech extends APIResource {
9
+ /**
10
+ * Synthesize
11
+ */
12
+ generate(params: SpeechGenerateParams, options?: Core.RequestOptions): Core.APIPromise<Response> {
13
+ const { stream, ...body } = params;
14
+ return this._client.post('/v1/speech', { query: { stream }, body, ...options, __binaryResponse: true });
15
+ }
16
+
17
+ /**
18
+ * Transcribe
19
+ */
20
+ transcibe(body: SpeechTranscibeParams, options?: Core.RequestOptions): Core.APIPromise<unknown> {
21
+ return this._client.post('/v1/transcriptions', Core.multipartFormRequestOptions({ body, ...options }));
22
+ }
23
+ }
24
+
25
+ export type SpeechTranscibeResponse = unknown;
26
+
27
+ export interface SpeechGenerateParams {
28
+ /**
29
+ * Body param:
30
+ */
31
+ language: 'yo' | 'en' | 'ha' | 'ig';
32
+
33
+ /**
34
+ * Body param:
35
+ */
36
+ text: string;
37
+
38
+ /**
39
+ * Query param:
40
+ */
41
+ stream?: boolean;
42
+
43
+ /**
44
+ * Body param:
45
+ */
46
+ voice?: 'sade' | 'segun' | 'femi' | 'funmi';
47
+ }
48
+
49
+ export interface SpeechTranscibeParams {
50
+ language: 'yo' | 'en' | 'ha' | 'ig';
51
+
52
+ content?: Core.Uploadable | null;
53
+
54
+ url?: string | null;
55
+ }
56
+
57
+ export namespace Speech {
58
+ export import SpeechTranscibeResponse = SpeechAPI.SpeechTranscibeResponse;
59
+ export import SpeechGenerateParams = SpeechAPI.SpeechGenerateParams;
60
+ export import SpeechTranscibeParams = SpeechAPI.SpeechTranscibeParams;
61
+ }
@@ -0,0 +1,27 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+ import * as TextAPI from './text';
6
+
7
+ export class Text extends APIResource {
8
+ /**
9
+ * Tone Mark
10
+ */
11
+ toneMark(body: TextToneMarkParams, options?: Core.RequestOptions): Core.APIPromise<unknown> {
12
+ return this._client.post('/v1/diacritics', { body, ...options });
13
+ }
14
+ }
15
+
16
+ export type TextToneMarkResponse = unknown;
17
+
18
+ export interface TextToneMarkParams {
19
+ language: 'yo' | 'en' | 'ha' | 'ig';
20
+
21
+ text: string;
22
+ }
23
+
24
+ export namespace Text {
25
+ export import TextToneMarkResponse = TextAPI.TextToneMarkResponse;
26
+ export import TextToneMarkParams = TextAPI.TextToneMarkParams;
27
+ }
@@ -0,0 +1,50 @@
1
+ // @ts-ignore
2
+ import * as types from '../_shims/node-types';
3
+ import { setShims } from '../_shims/registry';
4
+ import { getRuntime } from '../_shims/node-runtime';
5
+ setShims(getRuntime());
6
+
7
+ declare module '../_shims/manual-types' {
8
+ export namespace manual {
9
+ // @ts-ignore
10
+ export type Agent = types.Agent;
11
+ // @ts-ignore
12
+ export import fetch = types.fetch;
13
+ // @ts-ignore
14
+ export type Request = types.Request;
15
+ // @ts-ignore
16
+ export type RequestInfo = types.RequestInfo;
17
+ // @ts-ignore
18
+ export type RequestInit = types.RequestInit;
19
+ // @ts-ignore
20
+ export type Response = types.Response;
21
+ // @ts-ignore
22
+ export type ResponseInit = types.ResponseInit;
23
+ // @ts-ignore
24
+ export type ResponseType = types.ResponseType;
25
+ // @ts-ignore
26
+ export type BodyInit = types.BodyInit;
27
+ // @ts-ignore
28
+ export type Headers = types.Headers;
29
+ // @ts-ignore
30
+ export type HeadersInit = types.HeadersInit;
31
+ // @ts-ignore
32
+ export type BlobPropertyBag = types.BlobPropertyBag;
33
+ // @ts-ignore
34
+ export type FilePropertyBag = types.FilePropertyBag;
35
+ // @ts-ignore
36
+ export type FileFromPathOptions = types.FileFromPathOptions;
37
+ // @ts-ignore
38
+ export import FormData = types.FormData;
39
+ // @ts-ignore
40
+ export import File = types.File;
41
+ // @ts-ignore
42
+ export import Blob = types.Blob;
43
+ // @ts-ignore
44
+ export type Readable = types.Readable;
45
+ // @ts-ignore
46
+ export type FsReadStream = types.FsReadStream;
47
+ // @ts-ignore
48
+ export import ReadableStream = types.ReadableStream;
49
+ }
50
+ }
@@ -0,0 +1,50 @@
1
+ // @ts-ignore
2
+ import * as types from '../_shims/web-types';
3
+ import { setShims } from '../_shims/registry';
4
+ import { getRuntime } from '../_shims/web-runtime';
5
+ setShims(getRuntime({ manuallyImported: true }));
6
+
7
+ declare module '../_shims/manual-types' {
8
+ export namespace manual {
9
+ // @ts-ignore
10
+ export type Agent = types.Agent;
11
+ // @ts-ignore
12
+ export import fetch = types.fetch;
13
+ // @ts-ignore
14
+ export type Request = types.Request;
15
+ // @ts-ignore
16
+ export type RequestInfo = types.RequestInfo;
17
+ // @ts-ignore
18
+ export type RequestInit = types.RequestInit;
19
+ // @ts-ignore
20
+ export type Response = types.Response;
21
+ // @ts-ignore
22
+ export type ResponseInit = types.ResponseInit;
23
+ // @ts-ignore
24
+ export type ResponseType = types.ResponseType;
25
+ // @ts-ignore
26
+ export type BodyInit = types.BodyInit;
27
+ // @ts-ignore
28
+ export type Headers = types.Headers;
29
+ // @ts-ignore
30
+ export type HeadersInit = types.HeadersInit;
31
+ // @ts-ignore
32
+ export type BlobPropertyBag = types.BlobPropertyBag;
33
+ // @ts-ignore
34
+ export type FilePropertyBag = types.FilePropertyBag;
35
+ // @ts-ignore
36
+ export type FileFromPathOptions = types.FileFromPathOptions;
37
+ // @ts-ignore
38
+ export import FormData = types.FormData;
39
+ // @ts-ignore
40
+ export import File = types.File;
41
+ // @ts-ignore
42
+ export import Blob = types.Blob;
43
+ // @ts-ignore
44
+ export type Readable = types.Readable;
45
+ // @ts-ignore
46
+ export type FsReadStream = types.FsReadStream;
47
+ // @ts-ignore
48
+ export import ReadableStream = types.ReadableStream;
49
+ }
50
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ // this config is included in the published src directory to prevent TS errors
3
+ // from appearing when users go to source, and VSCode opens the source .ts file
4
+ // via declaration maps
5
+ "include": ["index.ts"],
6
+ "compilerOptions": {
7
+ "target": "es2015",
8
+ "lib": ["DOM"],
9
+ "moduleResolution": "node"
10
+ }
11
+ }