@sync.so/sdk 0.1.6

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 (269) hide show
  1. package/Client.d.ts +31 -0
  2. package/Client.js +17 -0
  3. package/README.md +183 -0
  4. package/api/index.d.ts +1 -0
  5. package/api/index.js +17 -0
  6. package/api/resources/common/errors/BadRequestError.d.ts +9 -0
  7. package/api/resources/common/errors/BadRequestError.js +52 -0
  8. package/api/resources/common/errors/InternalServerError.d.ts +9 -0
  9. package/api/resources/common/errors/InternalServerError.js +52 -0
  10. package/api/resources/common/errors/NotFoundError.d.ts +9 -0
  11. package/api/resources/common/errors/NotFoundError.js +52 -0
  12. package/api/resources/common/errors/UnauthorizedError.d.ts +9 -0
  13. package/api/resources/common/errors/UnauthorizedError.js +52 -0
  14. package/api/resources/common/errors/index.d.ts +4 -0
  15. package/api/resources/common/errors/index.js +20 -0
  16. package/api/resources/common/index.d.ts +2 -0
  17. package/api/resources/common/index.js +18 -0
  18. package/api/resources/common/types/Audio.d.ts +11 -0
  19. package/api/resources/common/types/Audio.js +5 -0
  20. package/api/resources/common/types/CreateGenerationDto.d.ts +14 -0
  21. package/api/resources/common/types/CreateGenerationDto.js +5 -0
  22. package/api/resources/common/types/ElevenLabs.d.ts +10 -0
  23. package/api/resources/common/types/ElevenLabs.js +5 -0
  24. package/api/resources/common/types/EstimatedGenerationCost.d.ts +9 -0
  25. package/api/resources/common/types/EstimatedGenerationCost.js +5 -0
  26. package/api/resources/common/types/Generation.d.ts +25 -0
  27. package/api/resources/common/types/Generation.js +5 -0
  28. package/api/resources/common/types/GenerationError.d.ts +12 -0
  29. package/api/resources/common/types/GenerationError.js +5 -0
  30. package/api/resources/common/types/GenerationErrorMessage.d.ts +7 -0
  31. package/api/resources/common/types/GenerationErrorMessage.js +5 -0
  32. package/api/resources/common/types/GenerationId.d.ts +7 -0
  33. package/api/resources/common/types/GenerationId.js +5 -0
  34. package/api/resources/common/types/GenerationOptions.d.ts +22 -0
  35. package/api/resources/common/types/GenerationOptions.js +5 -0
  36. package/api/resources/common/types/GenerationStatus.d.ts +13 -0
  37. package/api/resources/common/types/GenerationStatus.js +12 -0
  38. package/api/resources/common/types/Input.d.ts +8 -0
  39. package/api/resources/common/types/Input.js +5 -0
  40. package/api/resources/common/types/Model.d.ts +14 -0
  41. package/api/resources/common/types/Model.js +13 -0
  42. package/api/resources/common/types/SegmentFrames.d.ts +7 -0
  43. package/api/resources/common/types/SegmentFrames.js +5 -0
  44. package/api/resources/common/types/SegmentSecs.d.ts +7 -0
  45. package/api/resources/common/types/SegmentSecs.js +5 -0
  46. package/api/resources/common/types/SyncMode.d.ts +11 -0
  47. package/api/resources/common/types/SyncMode.js +13 -0
  48. package/api/resources/common/types/Tts.d.ts +12 -0
  49. package/api/resources/common/types/Tts.js +5 -0
  50. package/api/resources/common/types/TtsProviderConfig.d.ts +5 -0
  51. package/api/resources/common/types/TtsProviderConfig.js +5 -0
  52. package/api/resources/common/types/Video.d.ts +13 -0
  53. package/api/resources/common/types/Video.js +5 -0
  54. package/api/resources/common/types/index.d.ts +18 -0
  55. package/api/resources/common/types/index.js +34 -0
  56. package/api/resources/generate/client/Client.d.ts +106 -0
  57. package/api/resources/generate/client/Client.js +346 -0
  58. package/api/resources/generate/client/index.d.ts +1 -0
  59. package/api/resources/generate/client/index.js +17 -0
  60. package/api/resources/generate/client/requests/LipsyncListGenerationsRequest.d.ts +14 -0
  61. package/api/resources/generate/client/requests/LipsyncListGenerationsRequest.js +5 -0
  62. package/api/resources/generate/client/requests/index.d.ts +1 -0
  63. package/api/resources/generate/client/requests/index.js +2 -0
  64. package/api/resources/generate/index.d.ts +1 -0
  65. package/api/resources/generate/index.js +17 -0
  66. package/api/resources/index.d.ts +7 -0
  67. package/api/resources/index.js +46 -0
  68. package/api/resources/webhooks/index.d.ts +1 -0
  69. package/api/resources/webhooks/index.js +17 -0
  70. package/api/resources/webhooks/types/GenerationNotification.d.ts +24 -0
  71. package/api/resources/webhooks/types/GenerationNotification.js +5 -0
  72. package/api/resources/webhooks/types/WebhookStatus.d.ts +11 -0
  73. package/api/resources/webhooks/types/WebhookStatus.js +10 -0
  74. package/api/resources/webhooks/types/index.d.ts +2 -0
  75. package/api/resources/webhooks/types/index.js +18 -0
  76. package/core/fetcher/APIResponse.d.ts +20 -0
  77. package/core/fetcher/APIResponse.js +2 -0
  78. package/core/fetcher/Fetcher.d.ts +39 -0
  79. package/core/fetcher/Fetcher.js +107 -0
  80. package/core/fetcher/Headers.d.ts +2 -0
  81. package/core/fetcher/Headers.js +84 -0
  82. package/core/fetcher/HttpResponsePromise.d.ts +58 -0
  83. package/core/fetcher/HttpResponsePromise.js +103 -0
  84. package/core/fetcher/RawResponse.d.ts +29 -0
  85. package/core/fetcher/RawResponse.js +44 -0
  86. package/core/fetcher/Supplier.d.ts +4 -0
  87. package/core/fetcher/Supplier.js +22 -0
  88. package/core/fetcher/createRequestUrl.d.ts +1 -0
  89. package/core/fetcher/createRequestUrl.js +12 -0
  90. package/core/fetcher/getFetchFn.d.ts +4 -0
  91. package/core/fetcher/getFetchFn.js +68 -0
  92. package/core/fetcher/getHeader.d.ts +1 -0
  93. package/core/fetcher/getHeader.js +11 -0
  94. package/core/fetcher/getRequestBody.d.ts +7 -0
  95. package/core/fetcher/getRequestBody.js +23 -0
  96. package/core/fetcher/getResponseBody.d.ts +1 -0
  97. package/core/fetcher/getResponseBody.js +54 -0
  98. package/core/fetcher/index.d.ts +8 -0
  99. package/core/fetcher/index.js +15 -0
  100. package/core/fetcher/makeRequest.d.ts +1 -0
  101. package/core/fetcher/makeRequest.js +42 -0
  102. package/core/fetcher/requestWithRetries.d.ts +1 -0
  103. package/core/fetcher/requestWithRetries.js +40 -0
  104. package/core/fetcher/signals.d.ts +11 -0
  105. package/core/fetcher/signals.js +36 -0
  106. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  107. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  108. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  109. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  110. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  111. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  112. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  113. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  114. package/core/index.d.ts +2 -0
  115. package/core/index.js +18 -0
  116. package/core/json.d.ts +15 -0
  117. package/core/json.js +24 -0
  118. package/core/runtime/index.d.ts +1 -0
  119. package/core/runtime/index.js +5 -0
  120. package/core/runtime/runtime.d.ts +9 -0
  121. package/core/runtime/runtime.js +103 -0
  122. package/dist/Client.d.ts +31 -0
  123. package/dist/Client.js +17 -0
  124. package/dist/api/index.d.ts +1 -0
  125. package/dist/api/index.js +17 -0
  126. package/dist/api/resources/common/errors/BadRequestError.d.ts +9 -0
  127. package/dist/api/resources/common/errors/BadRequestError.js +52 -0
  128. package/dist/api/resources/common/errors/InternalServerError.d.ts +9 -0
  129. package/dist/api/resources/common/errors/InternalServerError.js +52 -0
  130. package/dist/api/resources/common/errors/NotFoundError.d.ts +9 -0
  131. package/dist/api/resources/common/errors/NotFoundError.js +52 -0
  132. package/dist/api/resources/common/errors/UnauthorizedError.d.ts +9 -0
  133. package/dist/api/resources/common/errors/UnauthorizedError.js +52 -0
  134. package/dist/api/resources/common/errors/index.d.ts +4 -0
  135. package/dist/api/resources/common/errors/index.js +20 -0
  136. package/dist/api/resources/common/index.d.ts +2 -0
  137. package/dist/api/resources/common/index.js +18 -0
  138. package/dist/api/resources/common/types/Audio.d.ts +11 -0
  139. package/dist/api/resources/common/types/Audio.js +5 -0
  140. package/dist/api/resources/common/types/CreateGenerationDto.d.ts +14 -0
  141. package/dist/api/resources/common/types/CreateGenerationDto.js +5 -0
  142. package/dist/api/resources/common/types/ElevenLabs.d.ts +10 -0
  143. package/dist/api/resources/common/types/ElevenLabs.js +5 -0
  144. package/dist/api/resources/common/types/EstimatedGenerationCost.d.ts +9 -0
  145. package/dist/api/resources/common/types/EstimatedGenerationCost.js +5 -0
  146. package/dist/api/resources/common/types/Generation.d.ts +25 -0
  147. package/dist/api/resources/common/types/Generation.js +5 -0
  148. package/dist/api/resources/common/types/GenerationError.d.ts +12 -0
  149. package/dist/api/resources/common/types/GenerationError.js +5 -0
  150. package/dist/api/resources/common/types/GenerationErrorMessage.d.ts +7 -0
  151. package/dist/api/resources/common/types/GenerationErrorMessage.js +5 -0
  152. package/dist/api/resources/common/types/GenerationId.d.ts +7 -0
  153. package/dist/api/resources/common/types/GenerationId.js +5 -0
  154. package/dist/api/resources/common/types/GenerationOptions.d.ts +22 -0
  155. package/dist/api/resources/common/types/GenerationOptions.js +5 -0
  156. package/dist/api/resources/common/types/GenerationStatus.d.ts +13 -0
  157. package/dist/api/resources/common/types/GenerationStatus.js +12 -0
  158. package/dist/api/resources/common/types/Input.d.ts +8 -0
  159. package/dist/api/resources/common/types/Input.js +5 -0
  160. package/dist/api/resources/common/types/Model.d.ts +14 -0
  161. package/dist/api/resources/common/types/Model.js +13 -0
  162. package/dist/api/resources/common/types/SegmentFrames.d.ts +7 -0
  163. package/dist/api/resources/common/types/SegmentFrames.js +5 -0
  164. package/dist/api/resources/common/types/SegmentSecs.d.ts +7 -0
  165. package/dist/api/resources/common/types/SegmentSecs.js +5 -0
  166. package/dist/api/resources/common/types/SyncMode.d.ts +11 -0
  167. package/dist/api/resources/common/types/SyncMode.js +13 -0
  168. package/dist/api/resources/common/types/Tts.d.ts +12 -0
  169. package/dist/api/resources/common/types/Tts.js +5 -0
  170. package/dist/api/resources/common/types/TtsProviderConfig.d.ts +5 -0
  171. package/dist/api/resources/common/types/TtsProviderConfig.js +5 -0
  172. package/dist/api/resources/common/types/Video.d.ts +13 -0
  173. package/dist/api/resources/common/types/Video.js +5 -0
  174. package/dist/api/resources/common/types/index.d.ts +18 -0
  175. package/dist/api/resources/common/types/index.js +34 -0
  176. package/dist/api/resources/generate/client/Client.d.ts +106 -0
  177. package/dist/api/resources/generate/client/Client.js +346 -0
  178. package/dist/api/resources/generate/client/index.d.ts +1 -0
  179. package/dist/api/resources/generate/client/index.js +17 -0
  180. package/dist/api/resources/generate/client/requests/LipsyncListGenerationsRequest.d.ts +14 -0
  181. package/dist/api/resources/generate/client/requests/LipsyncListGenerationsRequest.js +5 -0
  182. package/dist/api/resources/generate/client/requests/index.d.ts +1 -0
  183. package/dist/api/resources/generate/client/requests/index.js +2 -0
  184. package/dist/api/resources/generate/index.d.ts +1 -0
  185. package/dist/api/resources/generate/index.js +17 -0
  186. package/dist/api/resources/index.d.ts +7 -0
  187. package/dist/api/resources/index.js +46 -0
  188. package/dist/api/resources/webhooks/index.d.ts +1 -0
  189. package/dist/api/resources/webhooks/index.js +17 -0
  190. package/dist/api/resources/webhooks/types/GenerationNotification.d.ts +24 -0
  191. package/dist/api/resources/webhooks/types/GenerationNotification.js +5 -0
  192. package/dist/api/resources/webhooks/types/WebhookStatus.d.ts +11 -0
  193. package/dist/api/resources/webhooks/types/WebhookStatus.js +10 -0
  194. package/dist/api/resources/webhooks/types/index.d.ts +2 -0
  195. package/dist/api/resources/webhooks/types/index.js +18 -0
  196. package/dist/core/fetcher/APIResponse.d.ts +20 -0
  197. package/dist/core/fetcher/APIResponse.js +2 -0
  198. package/dist/core/fetcher/Fetcher.d.ts +39 -0
  199. package/dist/core/fetcher/Fetcher.js +107 -0
  200. package/dist/core/fetcher/Headers.d.ts +2 -0
  201. package/dist/core/fetcher/Headers.js +84 -0
  202. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  203. package/dist/core/fetcher/HttpResponsePromise.js +103 -0
  204. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  205. package/dist/core/fetcher/RawResponse.js +44 -0
  206. package/dist/core/fetcher/Supplier.d.ts +4 -0
  207. package/dist/core/fetcher/Supplier.js +22 -0
  208. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  209. package/dist/core/fetcher/createRequestUrl.js +12 -0
  210. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  211. package/dist/core/fetcher/getFetchFn.js +68 -0
  212. package/dist/core/fetcher/getHeader.d.ts +1 -0
  213. package/dist/core/fetcher/getHeader.js +11 -0
  214. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  215. package/dist/core/fetcher/getRequestBody.js +23 -0
  216. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  217. package/dist/core/fetcher/getResponseBody.js +54 -0
  218. package/dist/core/fetcher/index.d.ts +8 -0
  219. package/dist/core/fetcher/index.js +15 -0
  220. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  221. package/dist/core/fetcher/makeRequest.js +42 -0
  222. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  223. package/dist/core/fetcher/requestWithRetries.js +40 -0
  224. package/dist/core/fetcher/signals.d.ts +11 -0
  225. package/dist/core/fetcher/signals.js +36 -0
  226. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  227. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  228. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  229. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  230. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  231. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  232. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  233. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  234. package/dist/core/index.d.ts +2 -0
  235. package/dist/core/index.js +18 -0
  236. package/dist/core/json.d.ts +15 -0
  237. package/dist/core/json.js +24 -0
  238. package/dist/core/runtime/index.d.ts +1 -0
  239. package/dist/core/runtime/index.js +5 -0
  240. package/dist/core/runtime/runtime.d.ts +9 -0
  241. package/dist/core/runtime/runtime.js +103 -0
  242. package/dist/environments.d.ts +7 -0
  243. package/dist/environments.js +9 -0
  244. package/dist/errors/SyncError.d.ts +15 -0
  245. package/dist/errors/SyncError.js +30 -0
  246. package/dist/errors/SyncTimeoutError.d.ts +6 -0
  247. package/dist/errors/SyncTimeoutError.js +13 -0
  248. package/dist/errors/index.d.ts +2 -0
  249. package/dist/errors/index.js +7 -0
  250. package/dist/index.d.ts +4 -0
  251. package/dist/index.js +44 -0
  252. package/dist/version.d.ts +1 -0
  253. package/dist/version.js +4 -0
  254. package/environments.d.ts +7 -0
  255. package/environments.js +9 -0
  256. package/errors/SyncError.d.ts +15 -0
  257. package/errors/SyncError.js +30 -0
  258. package/errors/SyncTimeoutError.d.ts +6 -0
  259. package/errors/SyncTimeoutError.js +13 -0
  260. package/errors/index.d.ts +2 -0
  261. package/errors/index.js +7 -0
  262. package/index.d.ts +4 -0
  263. package/index.js +44 -0
  264. package/jest.config.mjs +8 -0
  265. package/package.json +43 -0
  266. package/reference.md +225 -0
  267. package/scripts/rename-to-esm-files.js +115 -0
  268. package/version.d.ts +1 -0
  269. package/version.js +4 -0
package/Client.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "./environments";
5
+ import * as core from "./core";
6
+ import { Generate } from "./api/resources/generate/client/Client";
7
+ export declare namespace SyncClient {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.SyncEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ apiKey: core.Supplier<string>;
13
+ fetcher?: core.FetchFunction;
14
+ }
15
+ interface RequestOptions {
16
+ /** The maximum time to wait for a response in seconds. */
17
+ timeoutInSeconds?: number;
18
+ /** The number of times to retry the request. Defaults to 2. */
19
+ maxRetries?: number;
20
+ /** A hook to abort the request. */
21
+ abortSignal?: AbortSignal;
22
+ /** Additional headers to include in the request. */
23
+ headers?: Record<string, string>;
24
+ }
25
+ }
26
+ export declare class SyncClient {
27
+ protected readonly _options: SyncClient.Options;
28
+ protected _generate: Generate | undefined;
29
+ constructor(_options: SyncClient.Options);
30
+ get generate(): Generate;
31
+ }
package/Client.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SyncClient = void 0;
7
+ const Client_1 = require("./api/resources/generate/client/Client");
8
+ class SyncClient {
9
+ constructor(_options) {
10
+ this._options = _options;
11
+ }
12
+ get generate() {
13
+ var _a;
14
+ return ((_a = this._generate) !== null && _a !== void 0 ? _a : (this._generate = new Client_1.Generate(this._options)));
15
+ }
16
+ }
17
+ exports.SyncClient = SyncClient;
package/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # Sync TypeScript Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fsynchronicity-labs%2Fsync-typescript-sdk)
4
+ [![npm shield](https://img.shields.io/npm/v/@sync.so/sdk)](https://www.npmjs.com/package/@sync.so/sdk)
5
+
6
+ The Sync TypeScript library provides convenient access to the Sync API from TypeScript.
7
+
8
+ ## Documentation
9
+
10
+ API reference documentation is available [here](https://docs.sync.so/api-reference).
11
+
12
+ ## Installation
13
+
14
+ ```sh
15
+ npm i -s @sync.so/sdk
16
+ ```
17
+
18
+ ## Reference
19
+
20
+ A full reference for this library is available [here](./reference.md).
21
+
22
+ ## Usage
23
+
24
+ Instantiate and use the client with the following:
25
+
26
+ ```typescript
27
+ import { SyncClient } from "@sync.so/sdk";
28
+
29
+ const client = new SyncClient({ apiKey: "YOUR_API_KEY" });
30
+ await client.generate.createGeneration({
31
+ input: [
32
+ {
33
+ type: "video",
34
+ url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortvid-03a10044-7741-4cfc-816a-5bccd392d1ee.mp4",
35
+ },
36
+ {
37
+ type: "audio",
38
+ url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortaud-27623a4f-edab-4c6a-8383-871b18961a4a.wav",
39
+ },
40
+ ],
41
+ model: "lipsync-2",
42
+ options: {
43
+ sync_mode: "loop",
44
+ },
45
+ });
46
+ ```
47
+
48
+ ## Request And Response Types
49
+
50
+ The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
51
+ following namespace:
52
+
53
+ ```typescript
54
+ import { Sync } from "@sync.so/sdk";
55
+
56
+ const request: Sync.LipsyncListGenerationsRequest = {
57
+ ...
58
+ };
59
+ ```
60
+
61
+ ## Exception Handling
62
+
63
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
64
+ will be thrown.
65
+
66
+ ```typescript
67
+ import { SyncError } from "@sync.so/sdk";
68
+
69
+ try {
70
+ await client.generate.createGeneration(...);
71
+ } catch (err) {
72
+ if (err instanceof SyncError) {
73
+ console.log(err.statusCode);
74
+ console.log(err.message);
75
+ console.log(err.body);
76
+ console.log(err.rawResponse);
77
+ }
78
+ }
79
+ ```
80
+
81
+ ## Advanced
82
+
83
+ ### Additional Headers
84
+
85
+ If you would like to send additional headers as part of the request, use the `headers` request option.
86
+
87
+ ```typescript
88
+ const response = await client.generate.createGeneration(..., {
89
+ headers: {
90
+ 'X-Custom-Header': 'custom value'
91
+ }
92
+ });
93
+ ```
94
+
95
+ ### Retries
96
+
97
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
98
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
99
+ retry limit (default: 2).
100
+
101
+ A request is deemed retryable when any of the following HTTP status codes is returned:
102
+
103
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
104
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
105
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
106
+
107
+ Use the `maxRetries` request option to configure this behavior.
108
+
109
+ ```typescript
110
+ const response = await client.generate.createGeneration(..., {
111
+ maxRetries: 0 // override maxRetries at the request level
112
+ });
113
+ ```
114
+
115
+ ### Timeouts
116
+
117
+ The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
118
+
119
+ ```typescript
120
+ const response = await client.generate.createGeneration(..., {
121
+ timeoutInSeconds: 30 // override timeout to 30s
122
+ });
123
+ ```
124
+
125
+ ### Aborting Requests
126
+
127
+ The SDK allows users to abort requests at any point by passing in an abort signal.
128
+
129
+ ```typescript
130
+ const controller = new AbortController();
131
+ const response = await client.generate.createGeneration(..., {
132
+ abortSignal: controller.signal
133
+ });
134
+ controller.abort(); // aborts the request
135
+ ```
136
+
137
+ ### Access Raw Response Data
138
+
139
+ The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
140
+ The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
141
+
142
+ ```typescript
143
+ const { data, rawResponse } = await client.generate.createGeneration(...).withRawResponse();
144
+
145
+ console.log(data);
146
+ console.log(rawResponse.headers['X-My-Header']);
147
+ ```
148
+
149
+ ### Runtime Compatibility
150
+
151
+ The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following
152
+ runtimes:
153
+
154
+ - Node.js 18+
155
+ - Vercel
156
+ - Cloudflare Workers
157
+ - Deno v1.25+
158
+ - Bun 1.0+
159
+ - React Native
160
+
161
+ ### Customizing Fetch Client
162
+
163
+ The SDK provides a way for your to customize the underlying HTTP client / Fetch function. If you're running in an
164
+ unsupported environment, this provides a way for you to break glass and ensure the SDK works.
165
+
166
+ ```typescript
167
+ import { SyncClient } from "@sync.so/sdk";
168
+
169
+ const client = new SyncClient({
170
+ ...
171
+ fetcher: // provide your implementation here
172
+ });
173
+ ```
174
+
175
+ ## Contributing
176
+
177
+ While we value open-source contributions to this SDK, this library is generated programmatically.
178
+ Additions made directly to this library would have to be moved over to our generation code,
179
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
180
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
181
+ an issue first to discuss with us!
182
+
183
+ On the other hand, contributions to the README are always very welcome!
package/api/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./resources";
package/api/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./resources"), exports);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../../../errors/index";
5
+ import * as Sync from "../../../index";
6
+ import * as core from "../../../../core";
7
+ export declare class BadRequestError extends errors.SyncError {
8
+ constructor(body: Sync.GenerationError, rawResponse?: core.RawResponse);
9
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.BadRequestError = void 0;
40
+ const errors = __importStar(require("../../../../errors/index"));
41
+ class BadRequestError extends errors.SyncError {
42
+ constructor(body, rawResponse) {
43
+ super({
44
+ message: "BadRequestError",
45
+ statusCode: 400,
46
+ body: body,
47
+ rawResponse: rawResponse,
48
+ });
49
+ Object.setPrototypeOf(this, BadRequestError.prototype);
50
+ }
51
+ }
52
+ exports.BadRequestError = BadRequestError;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../../../errors/index";
5
+ import * as Sync from "../../../index";
6
+ import * as core from "../../../../core";
7
+ export declare class InternalServerError extends errors.SyncError {
8
+ constructor(body: Sync.GenerationError, rawResponse?: core.RawResponse);
9
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.InternalServerError = void 0;
40
+ const errors = __importStar(require("../../../../errors/index"));
41
+ class InternalServerError extends errors.SyncError {
42
+ constructor(body, rawResponse) {
43
+ super({
44
+ message: "InternalServerError",
45
+ statusCode: 500,
46
+ body: body,
47
+ rawResponse: rawResponse,
48
+ });
49
+ Object.setPrototypeOf(this, InternalServerError.prototype);
50
+ }
51
+ }
52
+ exports.InternalServerError = InternalServerError;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../../../errors/index";
5
+ import * as Sync from "../../../index";
6
+ import * as core from "../../../../core";
7
+ export declare class NotFoundError extends errors.SyncError {
8
+ constructor(body: Sync.GenerationError, rawResponse?: core.RawResponse);
9
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.NotFoundError = void 0;
40
+ const errors = __importStar(require("../../../../errors/index"));
41
+ class NotFoundError extends errors.SyncError {
42
+ constructor(body, rawResponse) {
43
+ super({
44
+ message: "NotFoundError",
45
+ statusCode: 404,
46
+ body: body,
47
+ rawResponse: rawResponse,
48
+ });
49
+ Object.setPrototypeOf(this, NotFoundError.prototype);
50
+ }
51
+ }
52
+ exports.NotFoundError = NotFoundError;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as errors from "../../../../errors/index";
5
+ import * as Sync from "../../../index";
6
+ import * as core from "../../../../core";
7
+ export declare class UnauthorizedError extends errors.SyncError {
8
+ constructor(body: Sync.GenerationError, rawResponse?: core.RawResponse);
9
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.UnauthorizedError = void 0;
40
+ const errors = __importStar(require("../../../../errors/index"));
41
+ class UnauthorizedError extends errors.SyncError {
42
+ constructor(body, rawResponse) {
43
+ super({
44
+ message: "UnauthorizedError",
45
+ statusCode: 401,
46
+ body: body,
47
+ rawResponse: rawResponse,
48
+ });
49
+ Object.setPrototypeOf(this, UnauthorizedError.prototype);
50
+ }
51
+ }
52
+ exports.UnauthorizedError = UnauthorizedError;
@@ -0,0 +1,4 @@
1
+ export * from "./BadRequestError";
2
+ export * from "./InternalServerError";
3
+ export * from "./NotFoundError";
4
+ export * from "./UnauthorizedError";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BadRequestError"), exports);
18
+ __exportStar(require("./InternalServerError"), exports);
19
+ __exportStar(require("./NotFoundError"), exports);
20
+ __exportStar(require("./UnauthorizedError"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./errors";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./errors"), exports);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Recorded/Captured audio input
6
+ */
7
+ export interface Audio {
8
+ type: "audio";
9
+ /** URL of the audio to be used for generation */
10
+ url: string;
11
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Sync from "../../../index";
5
+ export interface CreateGenerationDto {
6
+ /** name of the model to use for generation. */
7
+ model: Sync.Model;
8
+ /** Array of input objects. Must include one video input item and one audio input item. Audio input items can be provided as either: recorded/captured audio url or a text-to-speech input with tts provider configuration. */
9
+ input: Sync.Input[];
10
+ /** additional options available for generation. */
11
+ options?: Sync.GenerationOptions;
12
+ /** webhook url for generation status updates. once the generation completes we will send a POST request to the webhook url with the generation data. */
13
+ webhookUrl?: string;
14
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ElevenLabs {
5
+ name: "elevenlabs";
6
+ /** id of the voice to be used for generation */
7
+ voiceId: string;
8
+ /** script to be used for generation */
9
+ script: string;
10
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface EstimatedGenerationCost {
5
+ /** The estimated frame count for the generation. */
6
+ estimatedFrameCount: number;
7
+ /** The estimated cost of the generation in USD. */
8
+ estimatedGenerationCost: number;
9
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Sync from "../../../index";
5
+ export interface Generation {
6
+ /** The date and time the generation was created. */
7
+ createdAt: string;
8
+ /** The error message if the generation failed. */
9
+ error?: string;
10
+ id: Sync.GenerationId;
11
+ /** An array of input objects used for generation. */
12
+ input: Sync.Input[];
13
+ /** The name of the model used for generation. */
14
+ model: Sync.Model;
15
+ /** Options for the generation. */
16
+ options?: Sync.GenerationOptions;
17
+ /** The duration of the output media. */
18
+ outputDuration?: number;
19
+ /** The URL of the output media. */
20
+ outputUrl?: string;
21
+ /** The status of the generation. */
22
+ status: Sync.GenerationStatus;
23
+ /** The URL to the webhook endpoint. */
24
+ webhookUrl?: string;
25
+ }