spitch 0.0.1-alpha.1 → 0.1.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 +18 -5
- package/LICENSE +1 -1
- package/README.md +201 -65
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +192 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +192 -0
- package/client.d.ts.map +1 -0
- package/client.js +473 -0
- package/client.js.map +1 -0
- package/client.mjs +469 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +54 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +54 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +101 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +95 -0
- package/core/pagination.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +1 -52
- package/error.d.ts.map +1 -1
- package/error.js +3 -140
- package/error.js.map +1 -1
- package/error.mjs +1 -126
- package/error.mjs.map +1 -1
- package/index.d.mts +7 -117
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -116
- package/index.d.ts.map +1 -1
- package/index.js +28 -107
- package/index.js.map +1 -1
- package/index.mjs +6 -81
- package/index.mjs.map +1 -1
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +35 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +85 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +79 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +117 -72
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +1 -5
- package/resource.d.ts.map +1 -1
- package/resource.js +3 -8
- package/resource.js.map +1 -1
- package/resource.mjs +1 -6
- package/resource.mjs.map +1 -1
- package/resources/files.d.mts +74 -0
- package/resources/files.d.mts.map +1 -0
- package/resources/files.d.ts +74 -0
- package/resources/files.d.ts.map +1 -0
- package/resources/files.js +48 -0
- package/resources/files.js.map +1 -0
- package/resources/files.mjs +44 -0
- package/resources/files.mjs.map +1 -0
- package/resources/index.d.mts +4 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/speech.d.mts +45 -0
- package/resources/speech.d.mts.map +1 -0
- package/resources/speech.d.ts +29 -28
- package/resources/speech.d.ts.map +1 -1
- package/resources/speech.js +12 -32
- package/resources/speech.js.map +1 -1
- package/resources/speech.mjs +12 -9
- package/resources/speech.mjs.map +1 -1
- package/resources/text.d.mts +34 -0
- package/resources/text.d.mts.map +1 -0
- package/resources/text.d.ts +23 -8
- package/resources/text.d.ts.map +1 -1
- package/resources/text.js +7 -3
- package/resources/text.js.map +1 -1
- package/resources/text.mjs +7 -3
- package/resources/text.mjs.map +1 -1
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +790 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/pagination.ts +157 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -146
- package/src/index.ts +7 -177
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +126 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/pagination.ts +2 -0
- package/src/resource.ts +2 -11
- package/src/resources/files.ts +136 -0
- package/src/resources/index.ts +19 -2
- package/src/resources/speech.ts +77 -32
- package/src/resources/text.ts +38 -9
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +2 -2
- package/src/uploads.ts +2 -255
- package/src/version.ts +1 -1
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +1 -74
- package/uploads.d.ts.map +1 -1
- package/uploads.js +3 -168
- package/uploads.js.map +1 -1
- package/uploads.mjs +1 -157
- package/uploads.mjs.map +1 -1
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- 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/_shims/MultipartBody.d.ts +0 -9
- package/_shims/MultipartBody.d.ts.map +0 -1
- package/_shims/MultipartBody.js +0 -16
- package/_shims/MultipartBody.js.map +0 -1
- package/_shims/MultipartBody.mjs +0 -12
- package/_shims/MultipartBody.mjs.map +0 -1
- package/_shims/README.md +0 -46
- package/_shims/auto/runtime-bun.d.ts +0 -5
- package/_shims/auto/runtime-bun.d.ts.map +0 -1
- package/_shims/auto/runtime-bun.js +0 -21
- package/_shims/auto/runtime-bun.js.map +0 -1
- package/_shims/auto/runtime-bun.mjs +0 -2
- package/_shims/auto/runtime-bun.mjs.map +0 -1
- package/_shims/auto/runtime-node.d.ts +0 -5
- package/_shims/auto/runtime-node.d.ts.map +0 -1
- package/_shims/auto/runtime-node.js +0 -21
- package/_shims/auto/runtime-node.js.map +0 -1
- package/_shims/auto/runtime-node.mjs +0 -2
- package/_shims/auto/runtime-node.mjs.map +0 -1
- package/_shims/auto/runtime.d.ts +0 -5
- package/_shims/auto/runtime.d.ts.map +0 -1
- package/_shims/auto/runtime.js +0 -21
- package/_shims/auto/runtime.js.map +0 -1
- package/_shims/auto/runtime.mjs +0 -2
- package/_shims/auto/runtime.mjs.map +0 -1
- package/_shims/auto/types-node.d.ts +0 -5
- package/_shims/auto/types-node.d.ts.map +0 -1
- package/_shims/auto/types-node.js +0 -21
- package/_shims/auto/types-node.js.map +0 -1
- package/_shims/auto/types-node.mjs +0 -2
- package/_shims/auto/types-node.mjs.map +0 -1
- package/_shims/auto/types.d.ts +0 -101
- package/_shims/auto/types.js +0 -3
- package/_shims/auto/types.mjs +0 -3
- package/_shims/bun-runtime.d.ts +0 -6
- package/_shims/bun-runtime.d.ts.map +0 -1
- package/_shims/bun-runtime.js +0 -14
- package/_shims/bun-runtime.js.map +0 -1
- package/_shims/bun-runtime.mjs +0 -10
- package/_shims/bun-runtime.mjs.map +0 -1
- package/_shims/index.d.ts +0 -81
- package/_shims/index.js +0 -13
- package/_shims/index.mjs +0 -7
- package/_shims/manual-types.d.ts +0 -12
- package/_shims/manual-types.js +0 -3
- package/_shims/manual-types.mjs +0 -3
- package/_shims/node-runtime.d.ts +0 -3
- package/_shims/node-runtime.d.ts.map +0 -1
- package/_shims/node-runtime.js +0 -89
- package/_shims/node-runtime.js.map +0 -1
- package/_shims/node-runtime.mjs +0 -56
- package/_shims/node-runtime.mjs.map +0 -1
- package/_shims/node-types.d.ts +0 -42
- package/_shims/node-types.js +0 -3
- package/_shims/node-types.mjs +0 -3
- package/_shims/registry.d.ts +0 -37
- package/_shims/registry.d.ts.map +0 -1
- package/_shims/registry.js +0 -41
- package/_shims/registry.js.map +0 -1
- package/_shims/registry.mjs +0 -37
- package/_shims/registry.mjs.map +0 -1
- package/_shims/web-runtime.d.ts +0 -5
- package/_shims/web-runtime.d.ts.map +0 -1
- package/_shims/web-runtime.js +0 -78
- package/_shims/web-runtime.js.map +0 -1
- package/_shims/web-runtime.mjs +0 -71
- package/_shims/web-runtime.mjs.map +0 -1
- package/_shims/web-types.d.ts +0 -83
- package/_shims/web-types.js +0 -3
- package/_shims/web-types.mjs +0 -3
- package/core.d.ts +0 -242
- package/core.d.ts.map +0 -1
- package/core.js +0 -901
- package/core.js.map +0 -1
- package/core.mjs +0 -869
- package/core.mjs.map +0 -1
- package/shims/node.d.ts +0 -30
- package/shims/node.d.ts.map +0 -1
- package/shims/node.js +0 -31
- package/shims/node.js.map +0 -1
- package/shims/node.mjs +0 -5
- package/shims/node.mjs.map +0 -1
- package/shims/web.d.ts +0 -26
- package/shims/web.d.ts.map +0 -1
- package/shims/web.js +0 -31
- package/shims/web.js.map +0 -1
- package/shims/web.mjs +0 -5
- package/shims/web.mjs.map +0 -1
- package/src/_shims/MultipartBody.ts +0 -9
- package/src/_shims/README.md +0 -46
- package/src/_shims/auto/runtime-bun.ts +0 -4
- package/src/_shims/auto/runtime-node.ts +0 -4
- package/src/_shims/auto/runtime.ts +0 -4
- package/src/_shims/auto/types-node.ts +0 -4
- package/src/_shims/auto/types.d.ts +0 -101
- package/src/_shims/auto/types.js +0 -3
- package/src/_shims/auto/types.mjs +0 -3
- package/src/_shims/bun-runtime.ts +0 -14
- package/src/_shims/index.d.ts +0 -81
- package/src/_shims/index.js +0 -13
- package/src/_shims/index.mjs +0 -7
- package/src/_shims/manual-types.d.ts +0 -12
- package/src/_shims/manual-types.js +0 -3
- package/src/_shims/manual-types.mjs +0 -3
- package/src/_shims/node-runtime.ts +0 -81
- package/src/_shims/node-types.d.ts +0 -42
- package/src/_shims/node-types.js +0 -3
- package/src/_shims/node-types.mjs +0 -3
- package/src/_shims/registry.ts +0 -65
- package/src/_shims/web-runtime.ts +0 -103
- package/src/_shims/web-types.d.ts +0 -83
- package/src/_shims/web-types.js +0 -3
- package/src/_shims/web-types.mjs +0 -3
- package/src/core.ts +0 -1190
- package/src/shims/node.ts +0 -50
- package/src/shims/web.ts +0 -50
package/index.d.mts
CHANGED
|
@@ -1,117 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
* Defaults to process.env['SPITCH_API_KEY'].
|
|
9
|
-
*/
|
|
10
|
-
apiKey?: string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
13
|
-
*
|
|
14
|
-
* Defaults to process.env['SPITCH_BASE_URL'].
|
|
15
|
-
*/
|
|
16
|
-
baseURL?: string | null | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
19
|
-
* from the server before timing out a single request.
|
|
20
|
-
*
|
|
21
|
-
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
22
|
-
* much longer than this timeout before the promise succeeds or fails.
|
|
23
|
-
*/
|
|
24
|
-
timeout?: number;
|
|
25
|
-
/**
|
|
26
|
-
* An HTTP agent used to manage HTTP(S) connections.
|
|
27
|
-
*
|
|
28
|
-
* If not provided, an agent will be constructed by default in the Node.js environment,
|
|
29
|
-
* otherwise no agent is used.
|
|
30
|
-
*/
|
|
31
|
-
httpAgent?: Agent;
|
|
32
|
-
/**
|
|
33
|
-
* Specify a custom `fetch` function implementation.
|
|
34
|
-
*
|
|
35
|
-
* If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
|
|
36
|
-
* defined globally.
|
|
37
|
-
*/
|
|
38
|
-
fetch?: Core.Fetch | undefined;
|
|
39
|
-
/**
|
|
40
|
-
* The maximum number of times that the client will retry a request in case of a
|
|
41
|
-
* temporary failure, like a network error or a 5XX error from the server.
|
|
42
|
-
*
|
|
43
|
-
* @default 2
|
|
44
|
-
*/
|
|
45
|
-
maxRetries?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Default headers to include with every request to the API.
|
|
48
|
-
*
|
|
49
|
-
* These can be removed in individual requests by explicitly setting the
|
|
50
|
-
* header to `undefined` or `null` in request options.
|
|
51
|
-
*/
|
|
52
|
-
defaultHeaders?: Core.Headers;
|
|
53
|
-
/**
|
|
54
|
-
* Default query parameters to include with every request to the API.
|
|
55
|
-
*
|
|
56
|
-
* These can be removed in individual requests by explicitly setting the
|
|
57
|
-
* param to `undefined` in request options.
|
|
58
|
-
*/
|
|
59
|
-
defaultQuery?: Core.DefaultQuery;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* API Client for interfacing with the Spitch API.
|
|
63
|
-
*/
|
|
64
|
-
export declare class Spitch extends Core.APIClient {
|
|
65
|
-
apiKey: string;
|
|
66
|
-
private _options;
|
|
67
|
-
/**
|
|
68
|
-
* API Client for interfacing with the Spitch API.
|
|
69
|
-
*
|
|
70
|
-
* @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
|
|
71
|
-
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spi-tch.com] - Override the default base URL for the API.
|
|
72
|
-
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
73
|
-
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
74
|
-
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
75
|
-
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
76
|
-
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
77
|
-
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
78
|
-
*/
|
|
79
|
-
constructor({ baseURL, apiKey, ...opts }?: ClientOptions);
|
|
80
|
-
speech: API.Speech;
|
|
81
|
-
text: API.Text;
|
|
82
|
-
protected defaultQuery(): Core.DefaultQuery | undefined;
|
|
83
|
-
protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
84
|
-
protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
85
|
-
static Spitch: typeof Spitch;
|
|
86
|
-
static DEFAULT_TIMEOUT: number;
|
|
87
|
-
static SpitchError: typeof Errors.SpitchError;
|
|
88
|
-
static APIError: typeof Errors.APIError;
|
|
89
|
-
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
90
|
-
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
91
|
-
static APIUserAbortError: typeof Errors.APIUserAbortError;
|
|
92
|
-
static NotFoundError: typeof Errors.NotFoundError;
|
|
93
|
-
static ConflictError: typeof Errors.ConflictError;
|
|
94
|
-
static RateLimitError: typeof Errors.RateLimitError;
|
|
95
|
-
static BadRequestError: typeof Errors.BadRequestError;
|
|
96
|
-
static AuthenticationError: typeof Errors.AuthenticationError;
|
|
97
|
-
static InternalServerError: typeof Errors.InternalServerError;
|
|
98
|
-
static PermissionDeniedError: typeof Errors.PermissionDeniedError;
|
|
99
|
-
static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
|
|
100
|
-
static toFile: typeof Uploads.toFile;
|
|
101
|
-
static fileFromPath: typeof Uploads.fileFromPath;
|
|
102
|
-
}
|
|
103
|
-
export declare const SpitchError: typeof Errors.SpitchError, APIError: typeof Errors.APIError, APIConnectionError: typeof Errors.APIConnectionError, APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError, APIUserAbortError: typeof Errors.APIUserAbortError, NotFoundError: typeof Errors.NotFoundError, ConflictError: typeof Errors.ConflictError, RateLimitError: typeof Errors.RateLimitError, BadRequestError: typeof Errors.BadRequestError, AuthenticationError: typeof Errors.AuthenticationError, InternalServerError: typeof Errors.InternalServerError, PermissionDeniedError: typeof Errors.PermissionDeniedError, UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
|
|
104
|
-
export import toFile = Uploads.toFile;
|
|
105
|
-
export import fileFromPath = Uploads.fileFromPath;
|
|
106
|
-
export declare namespace Spitch {
|
|
107
|
-
export import RequestOptions = Core.RequestOptions;
|
|
108
|
-
export import Speech = API.Speech;
|
|
109
|
-
export import SpeechTranscibeResponse = API.SpeechTranscibeResponse;
|
|
110
|
-
export import SpeechGenerateParams = API.SpeechGenerateParams;
|
|
111
|
-
export import SpeechTranscibeParams = API.SpeechTranscibeParams;
|
|
112
|
-
export import Text = API.Text;
|
|
113
|
-
export import TextToneMarkResponse = API.TextToneMarkResponse;
|
|
114
|
-
export import TextToneMarkParams = API.TextToneMarkParams;
|
|
115
|
-
}
|
|
116
|
-
export default Spitch;
|
|
117
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export { Spitch as default } from "./client.mjs";
|
|
2
|
+
export { type Uploadable, toFile } from "./core/uploads.mjs";
|
|
3
|
+
export { APIPromise } from "./core/api-promise.mjs";
|
|
4
|
+
export { Spitch, type ClientOptions } from "./client.mjs";
|
|
5
|
+
export { PagePromise } from "./core/pagination.mjs";
|
|
6
|
+
export { SpitchError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
7
|
+
//# sourceMappingURL=index.d.mts.map
|
package/index.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,MAAM,IAAI,OAAO,EAAE;OAErB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE;OAC9B,EAAE,WAAW,EAAE;OACf,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/index.d.ts
CHANGED
|
@@ -1,117 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
/**
|
|
8
|
-
* Defaults to process.env['SPITCH_API_KEY'].
|
|
9
|
-
*/
|
|
10
|
-
apiKey?: string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
13
|
-
*
|
|
14
|
-
* Defaults to process.env['SPITCH_BASE_URL'].
|
|
15
|
-
*/
|
|
16
|
-
baseURL?: string | null | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
19
|
-
* from the server before timing out a single request.
|
|
20
|
-
*
|
|
21
|
-
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
22
|
-
* much longer than this timeout before the promise succeeds or fails.
|
|
23
|
-
*/
|
|
24
|
-
timeout?: number;
|
|
25
|
-
/**
|
|
26
|
-
* An HTTP agent used to manage HTTP(S) connections.
|
|
27
|
-
*
|
|
28
|
-
* If not provided, an agent will be constructed by default in the Node.js environment,
|
|
29
|
-
* otherwise no agent is used.
|
|
30
|
-
*/
|
|
31
|
-
httpAgent?: Agent;
|
|
32
|
-
/**
|
|
33
|
-
* Specify a custom `fetch` function implementation.
|
|
34
|
-
*
|
|
35
|
-
* If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
|
|
36
|
-
* defined globally.
|
|
37
|
-
*/
|
|
38
|
-
fetch?: Core.Fetch | undefined;
|
|
39
|
-
/**
|
|
40
|
-
* The maximum number of times that the client will retry a request in case of a
|
|
41
|
-
* temporary failure, like a network error or a 5XX error from the server.
|
|
42
|
-
*
|
|
43
|
-
* @default 2
|
|
44
|
-
*/
|
|
45
|
-
maxRetries?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Default headers to include with every request to the API.
|
|
48
|
-
*
|
|
49
|
-
* These can be removed in individual requests by explicitly setting the
|
|
50
|
-
* header to `undefined` or `null` in request options.
|
|
51
|
-
*/
|
|
52
|
-
defaultHeaders?: Core.Headers;
|
|
53
|
-
/**
|
|
54
|
-
* Default query parameters to include with every request to the API.
|
|
55
|
-
*
|
|
56
|
-
* These can be removed in individual requests by explicitly setting the
|
|
57
|
-
* param to `undefined` in request options.
|
|
58
|
-
*/
|
|
59
|
-
defaultQuery?: Core.DefaultQuery;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* API Client for interfacing with the Spitch API.
|
|
63
|
-
*/
|
|
64
|
-
export declare class Spitch extends Core.APIClient {
|
|
65
|
-
apiKey: string;
|
|
66
|
-
private _options;
|
|
67
|
-
/**
|
|
68
|
-
* API Client for interfacing with the Spitch API.
|
|
69
|
-
*
|
|
70
|
-
* @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
|
|
71
|
-
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spi-tch.com] - Override the default base URL for the API.
|
|
72
|
-
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
73
|
-
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
74
|
-
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
75
|
-
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
76
|
-
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
77
|
-
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
78
|
-
*/
|
|
79
|
-
constructor({ baseURL, apiKey, ...opts }?: ClientOptions);
|
|
80
|
-
speech: API.Speech;
|
|
81
|
-
text: API.Text;
|
|
82
|
-
protected defaultQuery(): Core.DefaultQuery | undefined;
|
|
83
|
-
protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
84
|
-
protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
85
|
-
static Spitch: typeof Spitch;
|
|
86
|
-
static DEFAULT_TIMEOUT: number;
|
|
87
|
-
static SpitchError: typeof Errors.SpitchError;
|
|
88
|
-
static APIError: typeof Errors.APIError;
|
|
89
|
-
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
90
|
-
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
91
|
-
static APIUserAbortError: typeof Errors.APIUserAbortError;
|
|
92
|
-
static NotFoundError: typeof Errors.NotFoundError;
|
|
93
|
-
static ConflictError: typeof Errors.ConflictError;
|
|
94
|
-
static RateLimitError: typeof Errors.RateLimitError;
|
|
95
|
-
static BadRequestError: typeof Errors.BadRequestError;
|
|
96
|
-
static AuthenticationError: typeof Errors.AuthenticationError;
|
|
97
|
-
static InternalServerError: typeof Errors.InternalServerError;
|
|
98
|
-
static PermissionDeniedError: typeof Errors.PermissionDeniedError;
|
|
99
|
-
static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
|
|
100
|
-
static toFile: typeof Uploads.toFile;
|
|
101
|
-
static fileFromPath: typeof Uploads.fileFromPath;
|
|
102
|
-
}
|
|
103
|
-
export declare const SpitchError: typeof Errors.SpitchError, APIError: typeof Errors.APIError, APIConnectionError: typeof Errors.APIConnectionError, APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError, APIUserAbortError: typeof Errors.APIUserAbortError, NotFoundError: typeof Errors.NotFoundError, ConflictError: typeof Errors.ConflictError, RateLimitError: typeof Errors.RateLimitError, BadRequestError: typeof Errors.BadRequestError, AuthenticationError: typeof Errors.AuthenticationError, InternalServerError: typeof Errors.InternalServerError, PermissionDeniedError: typeof Errors.PermissionDeniedError, UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
|
|
104
|
-
export import toFile = Uploads.toFile;
|
|
105
|
-
export import fileFromPath = Uploads.fileFromPath;
|
|
106
|
-
export declare namespace Spitch {
|
|
107
|
-
export import RequestOptions = Core.RequestOptions;
|
|
108
|
-
export import Speech = API.Speech;
|
|
109
|
-
export import SpeechTranscibeResponse = API.SpeechTranscibeResponse;
|
|
110
|
-
export import SpeechGenerateParams = API.SpeechGenerateParams;
|
|
111
|
-
export import SpeechTranscibeParams = API.SpeechTranscibeParams;
|
|
112
|
-
export import Text = API.Text;
|
|
113
|
-
export import TextToneMarkResponse = API.TextToneMarkResponse;
|
|
114
|
-
export import TextToneMarkParams = API.TextToneMarkParams;
|
|
115
|
-
}
|
|
116
|
-
export default Spitch;
|
|
1
|
+
export { Spitch as default } from "./client.js";
|
|
2
|
+
export { type Uploadable, toFile } from "./core/uploads.js";
|
|
3
|
+
export { APIPromise } from "./core/api-promise.js";
|
|
4
|
+
export { Spitch, type ClientOptions } from "./client.js";
|
|
5
|
+
export { PagePromise } from "./core/pagination.js";
|
|
6
|
+
export { SpitchError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
|
|
117
7
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,MAAM,IAAI,OAAO,EAAE;OAErB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE;OAC9B,EAAE,WAAW,EAAE;OACf,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/index.js
CHANGED
|
@@ -1,111 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
|
|
4
|
-
|
|
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 (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var _a;
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.fileFromPath = exports.toFile = exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.SpitchError = exports.Spitch = void 0;
|
|
29
|
-
const Errors = __importStar(require("./error.js"));
|
|
30
|
-
const Uploads = __importStar(require("./uploads.js"));
|
|
31
|
-
const Core = __importStar(require("./core.js"));
|
|
32
|
-
const API = __importStar(require("./resources/index.js"));
|
|
33
|
-
/**
|
|
34
|
-
* API Client for interfacing with the Spitch API.
|
|
35
|
-
*/
|
|
36
|
-
class Spitch extends Core.APIClient {
|
|
37
|
-
/**
|
|
38
|
-
* API Client for interfacing with the Spitch API.
|
|
39
|
-
*
|
|
40
|
-
* @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
|
|
41
|
-
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spi-tch.com] - Override the default base URL for the API.
|
|
42
|
-
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
43
|
-
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
44
|
-
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
45
|
-
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
46
|
-
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
47
|
-
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
48
|
-
*/
|
|
49
|
-
constructor({ baseURL = Core.readEnv('SPITCH_BASE_URL'), apiKey = Core.readEnv('SPITCH_API_KEY'), ...opts } = {}) {
|
|
50
|
-
if (apiKey === undefined) {
|
|
51
|
-
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' }).");
|
|
52
|
-
}
|
|
53
|
-
const options = {
|
|
54
|
-
apiKey,
|
|
55
|
-
...opts,
|
|
56
|
-
baseURL: baseURL || `https://api.spi-tch.com`,
|
|
57
|
-
};
|
|
58
|
-
super({
|
|
59
|
-
baseURL: options.baseURL,
|
|
60
|
-
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
61
|
-
httpAgent: options.httpAgent,
|
|
62
|
-
maxRetries: options.maxRetries,
|
|
63
|
-
fetch: options.fetch,
|
|
64
|
-
});
|
|
65
|
-
this.speech = new API.Speech(this);
|
|
66
|
-
this.text = new API.Text(this);
|
|
67
|
-
this._options = options;
|
|
68
|
-
this.apiKey = apiKey;
|
|
69
|
-
}
|
|
70
|
-
defaultQuery() {
|
|
71
|
-
return this._options.defaultQuery;
|
|
72
|
-
}
|
|
73
|
-
defaultHeaders(opts) {
|
|
74
|
-
return {
|
|
75
|
-
...super.defaultHeaders(opts),
|
|
76
|
-
...this._options.defaultHeaders,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
authHeaders(opts) {
|
|
80
|
-
return { Authorization: `Bearer ${this.apiKey}` };
|
|
81
|
-
}
|
|
3
|
+
exports = module.exports = function (...args) {
|
|
4
|
+
return new exports.default(...args)
|
|
82
5
|
}
|
|
83
|
-
exports
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
exports
|
|
104
|
-
exports
|
|
105
|
-
(function (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
exports = module.exports = Spitch;
|
|
110
|
-
exports.default = Spitch;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.SpitchError = exports.PagePromise = exports.Spitch = exports.APIPromise = exports.toFile = exports.default = void 0;
|
|
8
|
+
var client_1 = require("./client.js");
|
|
9
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.Spitch; } });
|
|
10
|
+
var uploads_1 = require("./core/uploads.js");
|
|
11
|
+
Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
|
|
12
|
+
var api_promise_1 = require("./core/api-promise.js");
|
|
13
|
+
Object.defineProperty(exports, "APIPromise", { enumerable: true, get: function () { return api_promise_1.APIPromise; } });
|
|
14
|
+
var client_2 = require("./client.js");
|
|
15
|
+
Object.defineProperty(exports, "Spitch", { enumerable: true, get: function () { return client_2.Spitch; } });
|
|
16
|
+
var pagination_1 = require("./core/pagination.js");
|
|
17
|
+
Object.defineProperty(exports, "PagePromise", { enumerable: true, get: function () { return pagination_1.PagePromise; } });
|
|
18
|
+
var error_1 = require("./core/error.js");
|
|
19
|
+
Object.defineProperty(exports, "SpitchError", { enumerable: true, get: function () { return error_1.SpitchError; } });
|
|
20
|
+
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
|
|
21
|
+
Object.defineProperty(exports, "APIConnectionError", { enumerable: true, get: function () { return error_1.APIConnectionError; } });
|
|
22
|
+
Object.defineProperty(exports, "APIConnectionTimeoutError", { enumerable: true, get: function () { return error_1.APIConnectionTimeoutError; } });
|
|
23
|
+
Object.defineProperty(exports, "APIUserAbortError", { enumerable: true, get: function () { return error_1.APIUserAbortError; } });
|
|
24
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return error_1.NotFoundError; } });
|
|
25
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return error_1.ConflictError; } });
|
|
26
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return error_1.RateLimitError; } });
|
|
27
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return error_1.BadRequestError; } });
|
|
28
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return error_1.AuthenticationError; } });
|
|
29
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
|
|
30
|
+
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
|
|
31
|
+
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
111
32
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAA6C;AAApC,iGAAA,MAAM,OAAW;AAE1B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAAsD;AAA7C,gGAAA,MAAM,OAAA;AACf,mDAAgD;AAAvC,yGAAA,WAAW,OAAA;AACpB,yCAcsB;AAbpB,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA"}
|
package/index.mjs
CHANGED
|
@@ -1,83 +1,8 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* API Client for interfacing with the Spitch API.
|
|
9
|
-
*/
|
|
10
|
-
export class Spitch extends Core.APIClient {
|
|
11
|
-
/**
|
|
12
|
-
* API Client for interfacing with the Spitch API.
|
|
13
|
-
*
|
|
14
|
-
* @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
|
|
15
|
-
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spi-tch.com] - Override the default base URL for the API.
|
|
16
|
-
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
17
|
-
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
18
|
-
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
19
|
-
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
20
|
-
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
21
|
-
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
22
|
-
*/
|
|
23
|
-
constructor({ baseURL = Core.readEnv('SPITCH_BASE_URL'), apiKey = Core.readEnv('SPITCH_API_KEY'), ...opts } = {}) {
|
|
24
|
-
if (apiKey === undefined) {
|
|
25
|
-
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' }).");
|
|
26
|
-
}
|
|
27
|
-
const options = {
|
|
28
|
-
apiKey,
|
|
29
|
-
...opts,
|
|
30
|
-
baseURL: baseURL || `https://api.spi-tch.com`,
|
|
31
|
-
};
|
|
32
|
-
super({
|
|
33
|
-
baseURL: options.baseURL,
|
|
34
|
-
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
35
|
-
httpAgent: options.httpAgent,
|
|
36
|
-
maxRetries: options.maxRetries,
|
|
37
|
-
fetch: options.fetch,
|
|
38
|
-
});
|
|
39
|
-
this.speech = new API.Speech(this);
|
|
40
|
-
this.text = new API.Text(this);
|
|
41
|
-
this._options = options;
|
|
42
|
-
this.apiKey = apiKey;
|
|
43
|
-
}
|
|
44
|
-
defaultQuery() {
|
|
45
|
-
return this._options.defaultQuery;
|
|
46
|
-
}
|
|
47
|
-
defaultHeaders(opts) {
|
|
48
|
-
return {
|
|
49
|
-
...super.defaultHeaders(opts),
|
|
50
|
-
...this._options.defaultHeaders,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
authHeaders(opts) {
|
|
54
|
-
return { Authorization: `Bearer ${this.apiKey}` };
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
_a = Spitch;
|
|
58
|
-
Spitch.Spitch = _a;
|
|
59
|
-
Spitch.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
60
|
-
Spitch.SpitchError = Errors.SpitchError;
|
|
61
|
-
Spitch.APIError = Errors.APIError;
|
|
62
|
-
Spitch.APIConnectionError = Errors.APIConnectionError;
|
|
63
|
-
Spitch.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
64
|
-
Spitch.APIUserAbortError = Errors.APIUserAbortError;
|
|
65
|
-
Spitch.NotFoundError = Errors.NotFoundError;
|
|
66
|
-
Spitch.ConflictError = Errors.ConflictError;
|
|
67
|
-
Spitch.RateLimitError = Errors.RateLimitError;
|
|
68
|
-
Spitch.BadRequestError = Errors.BadRequestError;
|
|
69
|
-
Spitch.AuthenticationError = Errors.AuthenticationError;
|
|
70
|
-
Spitch.InternalServerError = Errors.InternalServerError;
|
|
71
|
-
Spitch.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
72
|
-
Spitch.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
73
|
-
Spitch.toFile = Uploads.toFile;
|
|
74
|
-
Spitch.fileFromPath = Uploads.fileFromPath;
|
|
75
|
-
export const { SpitchError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } = Errors;
|
|
76
|
-
export var toFile = Uploads.toFile;
|
|
77
|
-
export var fileFromPath = Uploads.fileFromPath;
|
|
78
|
-
(function (Spitch) {
|
|
79
|
-
Spitch.Speech = API.Speech;
|
|
80
|
-
Spitch.Text = API.Text;
|
|
81
|
-
})(Spitch || (Spitch = {}));
|
|
82
|
-
export default Spitch;
|
|
2
|
+
export { Spitch as default } from "./client.mjs";
|
|
3
|
+
export { toFile } from "./core/uploads.mjs";
|
|
4
|
+
export { APIPromise } from "./core/api-promise.mjs";
|
|
5
|
+
export { Spitch } from "./client.mjs";
|
|
6
|
+
export { PagePromise } from "./core/pagination.mjs";
|
|
7
|
+
export { SpitchError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
83
8
|
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,MAAM,IAAI,OAAO,EAAE;OAErB,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAsB;OAC9B,EAAE,WAAW,EAAE;OACf,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
2
|
+
/**
|
|
3
|
+
* An alias to the builtin `RequestInit` type so we can
|
|
4
|
+
* easily alias it in import statements if there are name clashes.
|
|
5
|
+
*
|
|
6
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit
|
|
7
|
+
*/
|
|
8
|
+
type _RequestInit = RequestInit;
|
|
9
|
+
/**
|
|
10
|
+
* An alias to the builtin `Response` type so we can
|
|
11
|
+
* easily alias it in import statements if there are name clashes.
|
|
12
|
+
*
|
|
13
|
+
* https://developer.mozilla.org/docs/Web/API/Response
|
|
14
|
+
*/
|
|
15
|
+
type _Response = Response;
|
|
16
|
+
/**
|
|
17
|
+
* The type for the first argument to `fetch`.
|
|
18
|
+
*
|
|
19
|
+
* https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
|
|
20
|
+
*/
|
|
21
|
+
type _RequestInfo = Request | URL | string;
|
|
22
|
+
/**
|
|
23
|
+
* The type for constructing `RequestInit` Headers.
|
|
24
|
+
*
|
|
25
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#setting_headers
|
|
26
|
+
*/
|
|
27
|
+
type _HeadersInit = RequestInit['headers'];
|
|
28
|
+
/**
|
|
29
|
+
* The type for constructing `RequestInit` body.
|
|
30
|
+
*
|
|
31
|
+
* https://developer.mozilla.org/docs/Web/API/RequestInit#body
|
|
32
|
+
*/
|
|
33
|
+
type _BodyInit = RequestInit['body'];
|
|
34
|
+
/**
|
|
35
|
+
* An alias to the builtin `Array<T>` type so we can
|
|
36
|
+
* easily alias it in import statements if there are name clashes.
|
|
37
|
+
*/
|
|
38
|
+
type _Array<T> = Array<T>;
|
|
39
|
+
/**
|
|
40
|
+
* An alias to the builtin `Record<K, T>` type so we can
|
|
41
|
+
* easily alias it in import statements if there are name clashes.
|
|
42
|
+
*/
|
|
43
|
+
type _Record<K extends keyof any, T> = Record<K, T>;
|
|
44
|
+
export type { _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response, };
|
|
45
|
+
/**
|
|
46
|
+
* A copy of the builtin `EndingType` type as it isn't fully supported in certain
|
|
47
|
+
* environments and attempting to reference the global version will error.
|
|
48
|
+
*
|
|
49
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L27941
|
|
50
|
+
*/
|
|
51
|
+
type EndingType = 'native' | 'transparent';
|
|
52
|
+
/**
|
|
53
|
+
* A copy of the builtin `BlobPropertyBag` type as it isn't fully supported in certain
|
|
54
|
+
* environments and attempting to reference the global version will error.
|
|
55
|
+
*
|
|
56
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L154
|
|
57
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#options
|
|
58
|
+
*/
|
|
59
|
+
export interface BlobPropertyBag {
|
|
60
|
+
endings?: EndingType;
|
|
61
|
+
type?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A copy of the builtin `FilePropertyBag` type as it isn't fully supported in certain
|
|
65
|
+
* environments and attempting to reference the global version will error.
|
|
66
|
+
*
|
|
67
|
+
* https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L503
|
|
68
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/File/File#options
|
|
69
|
+
*/
|
|
70
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
|
71
|
+
lastModified?: number;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=builtin-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-types.d.mts","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC;AAEhC;;;;;GAKG;AACH,KAAK,SAAS,GAAG,QAAQ,CAAC;AAE1B;;;;GAIG;AACH,KAAK,YAAY,GAAG,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC;AAE3C;;;;GAIG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;GAIG;AACH,KAAK,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAErC;;;GAGG;AACH,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1B;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpD,YAAY,EACV,MAAM,IAAI,KAAK,EACf,SAAS,IAAI,QAAQ,EACrB,YAAY,IAAI,WAAW,EAC3B,OAAO,IAAI,MAAM,EACjB,YAAY,IAAI,WAAW,EAC3B,YAAY,IAAI,WAAW,EAC3B,SAAS,IAAI,QAAQ,GACtB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|