@sync.so/sdk 0.1.9 → 0.2.2

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 (129) hide show
  1. package/Client.d.ts +5 -2
  2. package/Client.js +8 -3
  3. package/README.md +6 -6
  4. package/api/resources/batch/client/Client.d.ts +89 -0
  5. package/api/resources/batch/client/Client.js +298 -0
  6. package/api/resources/batch/client/index.d.ts +1 -0
  7. package/api/resources/batch/client/index.js +17 -0
  8. package/api/resources/batch/client/requests/CreateBatchRequest.d.ts +21 -0
  9. package/api/resources/batch/client/requests/CreateBatchRequest.js +5 -0
  10. package/api/resources/batch/client/requests/ListBatchesRequest.d.ts +22 -0
  11. package/api/resources/batch/client/requests/ListBatchesRequest.js +5 -0
  12. package/api/resources/batch/client/requests/index.d.ts +2 -0
  13. package/api/resources/batch/client/requests/index.js +2 -0
  14. package/api/resources/batch/index.d.ts +1 -0
  15. package/api/resources/batch/index.js +17 -0
  16. package/api/resources/common/errors/PaymentRequiredError.d.ts +9 -0
  17. package/api/resources/common/errors/PaymentRequiredError.js +52 -0
  18. package/api/resources/common/errors/TooManyRequestsError.d.ts +9 -0
  19. package/api/resources/common/errors/TooManyRequestsError.js +52 -0
  20. package/api/resources/common/errors/index.d.ts +2 -0
  21. package/api/resources/common/errors/index.js +2 -0
  22. package/api/resources/common/types/ActiveSpeaker.d.ts +10 -0
  23. package/api/resources/common/types/ActiveSpeaker.js +5 -0
  24. package/api/resources/common/types/BatchId.d.ts +7 -0
  25. package/api/resources/common/types/BatchId.js +5 -0
  26. package/api/resources/common/types/BatchMetrics.d.ts +13 -0
  27. package/api/resources/common/types/BatchMetrics.js +5 -0
  28. package/api/resources/common/types/BatchResponse.d.ts +17 -0
  29. package/api/resources/common/types/BatchResponse.js +5 -0
  30. package/api/resources/common/types/BatchStatus.d.ts +14 -0
  31. package/api/resources/common/types/BatchStatus.js +13 -0
  32. package/api/resources/common/types/CreateBatchResponse.d.ts +5 -0
  33. package/api/resources/common/types/CreateBatchResponse.js +5 -0
  34. package/api/resources/common/types/CreateGenerationDto.d.ts +2 -0
  35. package/api/resources/common/types/Generation.d.ts +4 -0
  36. package/api/resources/common/types/GenerationOptions.d.ts +6 -14
  37. package/api/resources/common/types/Model.d.ts +1 -4
  38. package/api/resources/common/types/Model.js +0 -3
  39. package/api/resources/common/types/SyncMode.d.ts +20 -2
  40. package/api/resources/common/types/SyncMode.js +1 -1
  41. package/api/resources/common/types/ValidationResponse.d.ts +7 -0
  42. package/api/resources/common/types/ValidationResponse.js +5 -0
  43. package/api/resources/common/types/index.d.ts +7 -0
  44. package/api/resources/common/types/index.js +7 -0
  45. package/api/resources/generations/client/Client.d.ts +22 -3
  46. package/api/resources/generations/client/Client.js +96 -6
  47. package/api/resources/generations/client/requests/CreateGenerationRequest.d.ts +17 -0
  48. package/api/resources/generations/client/requests/CreateGenerationRequest.js +5 -0
  49. package/api/resources/generations/client/requests/index.d.ts +1 -0
  50. package/api/resources/index.d.ts +2 -0
  51. package/api/resources/index.js +3 -1
  52. package/api/resources/webhooks/types/GenerationNotification.d.ts +4 -0
  53. package/core/form-data-utils/FormDataWrapper.d.ts +63 -0
  54. package/core/form-data-utils/FormDataWrapper.js +227 -0
  55. package/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
  56. package/core/form-data-utils/encodeAsFormParameter.js +18 -0
  57. package/core/form-data-utils/index.d.ts +2 -0
  58. package/core/form-data-utils/index.js +20 -0
  59. package/core/index.d.ts +1 -0
  60. package/core/index.js +1 -0
  61. package/dist/Client.d.ts +5 -2
  62. package/dist/Client.js +8 -3
  63. package/dist/api/resources/batch/client/Client.d.ts +89 -0
  64. package/dist/api/resources/batch/client/Client.js +298 -0
  65. package/dist/api/resources/batch/client/index.d.ts +1 -0
  66. package/dist/api/resources/batch/client/index.js +17 -0
  67. package/dist/api/resources/batch/client/requests/CreateBatchRequest.d.ts +21 -0
  68. package/dist/api/resources/batch/client/requests/CreateBatchRequest.js +5 -0
  69. package/dist/api/resources/batch/client/requests/ListBatchesRequest.d.ts +22 -0
  70. package/dist/api/resources/batch/client/requests/ListBatchesRequest.js +5 -0
  71. package/dist/api/resources/batch/client/requests/index.d.ts +2 -0
  72. package/dist/api/resources/batch/client/requests/index.js +2 -0
  73. package/dist/api/resources/batch/index.d.ts +1 -0
  74. package/dist/api/resources/batch/index.js +17 -0
  75. package/dist/api/resources/common/errors/PaymentRequiredError.d.ts +9 -0
  76. package/dist/api/resources/common/errors/PaymentRequiredError.js +52 -0
  77. package/dist/api/resources/common/errors/TooManyRequestsError.d.ts +9 -0
  78. package/dist/api/resources/common/errors/TooManyRequestsError.js +52 -0
  79. package/dist/api/resources/common/errors/index.d.ts +2 -0
  80. package/dist/api/resources/common/errors/index.js +2 -0
  81. package/dist/api/resources/common/types/ActiveSpeaker.d.ts +10 -0
  82. package/dist/api/resources/common/types/ActiveSpeaker.js +5 -0
  83. package/dist/api/resources/common/types/BatchId.d.ts +7 -0
  84. package/dist/api/resources/common/types/BatchId.js +5 -0
  85. package/dist/api/resources/common/types/BatchMetrics.d.ts +13 -0
  86. package/dist/api/resources/common/types/BatchMetrics.js +5 -0
  87. package/dist/api/resources/common/types/BatchResponse.d.ts +17 -0
  88. package/dist/api/resources/common/types/BatchResponse.js +5 -0
  89. package/dist/api/resources/common/types/BatchStatus.d.ts +14 -0
  90. package/dist/api/resources/common/types/BatchStatus.js +13 -0
  91. package/dist/api/resources/common/types/CreateBatchResponse.d.ts +5 -0
  92. package/dist/api/resources/common/types/CreateBatchResponse.js +5 -0
  93. package/dist/api/resources/common/types/CreateGenerationDto.d.ts +2 -0
  94. package/dist/api/resources/common/types/Generation.d.ts +4 -0
  95. package/dist/api/resources/common/types/GenerationOptions.d.ts +6 -14
  96. package/dist/api/resources/common/types/Model.d.ts +1 -4
  97. package/dist/api/resources/common/types/Model.js +0 -3
  98. package/dist/api/resources/common/types/SyncMode.d.ts +20 -2
  99. package/dist/api/resources/common/types/SyncMode.js +1 -1
  100. package/dist/api/resources/common/types/ValidationResponse.d.ts +7 -0
  101. package/dist/api/resources/common/types/ValidationResponse.js +5 -0
  102. package/dist/api/resources/common/types/index.d.ts +7 -0
  103. package/dist/api/resources/common/types/index.js +7 -0
  104. package/dist/api/resources/generations/client/Client.d.ts +22 -3
  105. package/dist/api/resources/generations/client/Client.js +96 -6
  106. package/dist/api/resources/generations/client/requests/CreateGenerationRequest.d.ts +17 -0
  107. package/dist/api/resources/generations/client/requests/CreateGenerationRequest.js +5 -0
  108. package/dist/api/resources/generations/client/requests/index.d.ts +1 -0
  109. package/dist/api/resources/index.d.ts +2 -0
  110. package/dist/api/resources/index.js +3 -1
  111. package/dist/api/resources/webhooks/types/GenerationNotification.d.ts +4 -0
  112. package/dist/core/form-data-utils/FormDataWrapper.d.ts +63 -0
  113. package/dist/core/form-data-utils/FormDataWrapper.js +227 -0
  114. package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
  115. package/dist/core/form-data-utils/encodeAsFormParameter.js +18 -0
  116. package/dist/core/form-data-utils/index.d.ts +2 -0
  117. package/dist/core/form-data-utils/index.js +20 -0
  118. package/dist/core/index.d.ts +1 -0
  119. package/dist/core/index.js +1 -0
  120. package/dist/environments.d.ts +2 -1
  121. package/dist/environments.js +1 -0
  122. package/dist/version.d.ts +1 -1
  123. package/dist/version.js +1 -1
  124. package/environments.d.ts +2 -1
  125. package/environments.js +1 -0
  126. package/package.json +3 -2
  127. package/reference.md +272 -0
  128. package/version.d.ts +1 -1
  129. package/version.js +1 -1
@@ -0,0 +1,13 @@
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.BatchStatus = void 0;
7
+ exports.BatchStatus = {
8
+ Pending: "PENDING",
9
+ JobsCreated: "JOBS_CREATED",
10
+ Processing: "PROCESSING",
11
+ Completed: "COMPLETED",
12
+ Failed: "FAILED",
13
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Sync from "../../../index";
5
+ export type CreateBatchResponse = Sync.BatchResponse | Sync.ValidationResponse;
@@ -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 });
@@ -11,4 +11,6 @@ export interface CreateGenerationDto {
11
11
  options?: Sync.GenerationOptions;
12
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
13
  webhookUrl?: string;
14
+ /** Base filename for the generated output without extension. The .mp4 extension will be added automatically. Only alphanumeric characters, underscores, and hyphens are allowed, up to 255 characters. */
15
+ outputFileName?: string;
14
16
  }
@@ -7,6 +7,8 @@ export interface Generation {
7
7
  createdAt: string;
8
8
  /** The error message if the generation failed. */
9
9
  error?: string;
10
+ /** The error code if the generation failed. */
11
+ error_code?: string;
10
12
  id: Sync.GenerationId;
11
13
  /** An array of input objects used for generation. */
12
14
  input: Sync.Input[];
@@ -18,6 +20,8 @@ export interface Generation {
18
20
  outputDuration?: number;
19
21
  /** The URL of the output media. */
20
22
  outputUrl?: string;
23
+ /** The URL of the segment output media. */
24
+ segmentOutputUrl?: string;
21
25
  /** The status of the generation. */
22
26
  status: Sync.GenerationStatus;
23
27
  /** The URL to the webhook endpoint. */
@@ -3,20 +3,12 @@
3
3
  */
4
4
  import * as Sync from "../../../index";
5
5
  export interface GenerationOptions {
6
- /** lipsync mode when audio and video durations are out of sync. By default if the audio and video durations are out of sync and audio is longer than video, the video will loop. Otherwise, the video will be cut off at the end of the audio. */
6
+ /** Defines how to handle duration mismatches between video and audio inputs. See the [Media Content Tips](/compatibility-and-tips/media-content-tips#sync-mode-options) guide for a brief overview, or the SyncMode enum below for detailed explanations of each option. */
7
7
  sync_mode?: Sync.SyncMode;
8
- /** generation temperature randomness between 0 and 1. only works for lipsync-2 based models. */
8
+ /** option to control how expressive lipsync can be. 0 -> least expressive, 1 -> most expressive. default:0.5 */
9
9
  temperature?: number;
10
- /** Whether to detect active speaker and apply generation to them */
11
- active_speaker?: boolean;
12
- /** number of frames to pad the video on each side */
13
- pads?: number[];
14
- /** speed up the video by this factor. */
15
- speedup?: number;
16
- /** output format of the generated video. */
17
- output_format?: string;
18
- /** frames per second of the generated video. */
19
- fps?: number;
20
- /** resolution of the generated video. */
21
- output_resolution?: number[];
10
+ /** Active speaker detection configuration. When enabled, automatically detects and applies lipsync only to the active speaker in videos with multiple people. */
11
+ active_speaker_detection?: Sync.ActiveSpeaker;
12
+ /** Whether to detect occlusion during generation, slows down generation speed. */
13
+ occlusion_detection_enabled?: boolean;
22
14
  }
@@ -4,11 +4,8 @@
4
4
  /**
5
5
  * name of the model to use for generation.
6
6
  */
7
- export type Model = "lipsync-2" | "lipsync-1.9.0-beta" | "lipsync-1.8.0" | "lipsync-1.7.1" | "lipsync-1.6.0";
7
+ export type Model = "lipsync-2" | "lipsync-1.9.0-beta";
8
8
  export declare const Model: {
9
9
  readonly Lipsync2: "lipsync-2";
10
10
  readonly Lipsync190Beta: "lipsync-1.9.0-beta";
11
- readonly Lipsync180: "lipsync-1.8.0";
12
- readonly Lipsync171: "lipsync-1.7.1";
13
- readonly Lipsync160: "lipsync-1.6.0";
14
11
  };
@@ -7,7 +7,4 @@ exports.Model = void 0;
7
7
  exports.Model = {
8
8
  Lipsync2: "lipsync-2",
9
9
  Lipsync190Beta: "lipsync-1.9.0-beta",
10
- Lipsync180: "lipsync-1.8.0",
11
- Lipsync171: "lipsync-1.7.1",
12
- Lipsync160: "lipsync-1.6.0",
13
10
  };
@@ -1,10 +1,28 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export type SyncMode = "loop" | "bounce" | "cut_off" | "silence" | "remap";
4
+ /**
5
+ * Defines how to handle duration mismatches between video and audio inputs. Each mode applies different strategies when the video and audio lengths don't match.
6
+ */
7
+ export type SyncMode =
8
+ /**
9
+ * When video duration < audio duration, bounce (reverse playback) the video to match audio duration. Otherwise crop video to match audio duration. */
10
+ "bounce"
11
+ /**
12
+ * When video duration < audio duration, loop the video to match audio duration. Otherwise crop video to match audio duration. */
13
+ | "loop"
14
+ /**
15
+ * When audio duration > video duration, cut off audio to match video duration. Otherwise crop video to match audio duration. */
16
+ | "cut_off"
17
+ /**
18
+ * When video duration > audio duration, add silence to audio to match video duration. Otherwise crop video to match audio duration. */
19
+ | "silence"
20
+ /**
21
+ * Slowdown or speed up video to match audio duration exactly. This maintains the full content of both video and audio by adjusting playback speed. */
22
+ | "remap";
5
23
  export declare const SyncMode: {
6
- readonly Loop: "loop";
7
24
  readonly Bounce: "bounce";
25
+ readonly Loop: "loop";
8
26
  readonly CutOff: "cut_off";
9
27
  readonly Silence: "silence";
10
28
  readonly Remap: "remap";
@@ -5,8 +5,8 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SyncMode = void 0;
7
7
  exports.SyncMode = {
8
- Loop: "loop",
9
8
  Bounce: "bounce",
9
+ Loop: "loop",
10
10
  CutOff: "cut_off",
11
11
  Silence: "silence",
12
12
  Remap: "remap",
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ValidationResponse {
5
+ /** Validation status for dry run requests. */
6
+ status: "VALIDATED";
7
+ }
@@ -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 });
@@ -6,6 +6,7 @@ export * from "./EstimatedGenerationCost";
6
6
  export * from "./Generation";
7
7
  export * from "./GenerationError";
8
8
  export * from "./GenerationErrorMessage";
9
+ export * from "./ActiveSpeaker";
9
10
  export * from "./GenerationOptions";
10
11
  export * from "./SyncMode";
11
12
  export * from "./GenerationStatus";
@@ -16,3 +17,9 @@ export * from "./Audio";
16
17
  export * from "./Video";
17
18
  export * from "./SegmentSecs";
18
19
  export * from "./SegmentFrames";
20
+ export * from "./BatchId";
21
+ export * from "./BatchResponse";
22
+ export * from "./BatchStatus";
23
+ export * from "./BatchMetrics";
24
+ export * from "./ValidationResponse";
25
+ export * from "./CreateBatchResponse";
@@ -22,6 +22,7 @@ __exportStar(require("./EstimatedGenerationCost"), exports);
22
22
  __exportStar(require("./Generation"), exports);
23
23
  __exportStar(require("./GenerationError"), exports);
24
24
  __exportStar(require("./GenerationErrorMessage"), exports);
25
+ __exportStar(require("./ActiveSpeaker"), exports);
25
26
  __exportStar(require("./GenerationOptions"), exports);
26
27
  __exportStar(require("./SyncMode"), exports);
27
28
  __exportStar(require("./GenerationStatus"), exports);
@@ -32,3 +33,9 @@ __exportStar(require("./Audio"), exports);
32
33
  __exportStar(require("./Video"), exports);
33
34
  __exportStar(require("./SegmentSecs"), exports);
34
35
  __exportStar(require("./SegmentFrames"), exports);
36
+ __exportStar(require("./BatchId"), exports);
37
+ __exportStar(require("./BatchResponse"), exports);
38
+ __exportStar(require("./BatchStatus"), exports);
39
+ __exportStar(require("./BatchMetrics"), exports);
40
+ __exportStar(require("./ValidationResponse"), exports);
41
+ __exportStar(require("./CreateBatchResponse"), exports);
@@ -4,12 +4,14 @@
4
4
  import * as environments from "../../../../environments";
5
5
  import * as core from "../../../../core";
6
6
  import * as Sync from "../../../index";
7
+ import * as fs from "fs";
8
+ import { Blob } from "buffer";
7
9
  export declare namespace Generations {
8
10
  interface Options {
9
11
  environment?: core.Supplier<environments.SyncEnvironment | string>;
10
12
  /** Specify a custom URL to connect the client to. */
11
13
  baseUrl?: core.Supplier<string>;
12
- apiKey: core.Supplier<string>;
14
+ apiKey?: core.Supplier<string>;
13
15
  fetcher?: core.FetchFunction;
14
16
  }
15
17
  interface RequestOptions {
@@ -25,7 +27,7 @@ export declare namespace Generations {
25
27
  }
26
28
  export declare class Generations {
27
29
  protected readonly _options: Generations.Options;
28
- constructor(_options: Generations.Options);
30
+ constructor(_options?: Generations.Options);
29
31
  /**
30
32
  * @param {Sync.CreateGenerationDto} request
31
33
  * @param {Generations.RequestOptions} requestOptions - Request-specific configuration.
@@ -51,6 +53,23 @@ export declare class Generations {
51
53
  */
52
54
  create(request: Sync.CreateGenerationDto, requestOptions?: Generations.RequestOptions): core.HttpResponsePromise<Sync.Generation>;
53
55
  private __create;
56
+ /**
57
+ * @param {File | fs.ReadStream | Blob | undefined} video
58
+ * @param {File | fs.ReadStream | Blob | undefined} audio
59
+ * @param {Sync.CreateGenerationRequest} request
60
+ * @param {Generations.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link Sync.BadRequestError}
63
+ * @throws {@link Sync.UnauthorizedError}
64
+ * @throws {@link Sync.InternalServerError}
65
+ *
66
+ * @example
67
+ * await client.generations.createWithFiles(fs.createReadStream("/path/to/your/file"), fs.createReadStream("/path/to/your/file"), {
68
+ * model: "lipsync-2"
69
+ * })
70
+ */
71
+ createWithFiles(video: File | fs.ReadStream | Blob | undefined, audio: File | fs.ReadStream | Blob | undefined, request: Sync.CreateGenerationRequest, requestOptions?: Generations.RequestOptions): core.HttpResponsePromise<Sync.Generation>;
72
+ private __createWithFiles;
54
73
  /**
55
74
  * @param {Sync.GenerationId} id
56
75
  * @param {Generations.RequestOptions} requestOptions - Request-specific configuration.
@@ -101,6 +120,6 @@ export declare class Generations {
101
120
  estimateCost(request: Sync.CreateGenerationDto, requestOptions?: Generations.RequestOptions): core.HttpResponsePromise<Sync.EstimatedGenerationCost[]>;
102
121
  private __estimateCost;
103
122
  protected _getCustomAuthorizationHeaders(): Promise<{
104
- "x-api-key": string;
123
+ "x-api-key": string | undefined;
105
124
  }>;
106
125
  }
@@ -54,8 +54,9 @@ const core = __importStar(require("../../../../core"));
54
54
  const Sync = __importStar(require("../../../index"));
55
55
  const url_join_1 = __importDefault(require("url-join"));
56
56
  const errors = __importStar(require("../../../../errors/index"));
57
+ const json_1 = require("../../../../core/json");
57
58
  class Generations {
58
- constructor(_options) {
59
+ constructor(_options = {}) {
59
60
  this._options = _options;
60
61
  }
61
62
  /**
@@ -90,7 +91,7 @@ class Generations {
90
91
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
91
92
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SyncEnvironment.Default, "/v2/generate"),
92
93
  method: "POST",
93
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.1.9", "User-Agent": "@sync.so/sdk/0.1.9", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
94
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.2.2", "User-Agent": "@sync.so/sdk/0.2.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
94
95
  contentType: "application/json",
95
96
  requestType: "json",
96
97
  body: request,
@@ -134,6 +135,94 @@ class Generations {
134
135
  }
135
136
  });
136
137
  }
138
+ /**
139
+ * @param {File | fs.ReadStream | Blob | undefined} video
140
+ * @param {File | fs.ReadStream | Blob | undefined} audio
141
+ * @param {Sync.CreateGenerationRequest} request
142
+ * @param {Generations.RequestOptions} requestOptions - Request-specific configuration.
143
+ *
144
+ * @throws {@link Sync.BadRequestError}
145
+ * @throws {@link Sync.UnauthorizedError}
146
+ * @throws {@link Sync.InternalServerError}
147
+ *
148
+ * @example
149
+ * await client.generations.createWithFiles(fs.createReadStream("/path/to/your/file"), fs.createReadStream("/path/to/your/file"), {
150
+ * model: "lipsync-2"
151
+ * })
152
+ */
153
+ createWithFiles(video, audio, request, requestOptions) {
154
+ return core.HttpResponsePromise.fromPromise(this.__createWithFiles(video, audio, request, requestOptions));
155
+ }
156
+ __createWithFiles(video, audio, request, requestOptions) {
157
+ return __awaiter(this, void 0, void 0, function* () {
158
+ var _a, _b, _c;
159
+ const _request = yield core.newFormData();
160
+ if (video != null) {
161
+ yield _request.appendFile("video", video);
162
+ }
163
+ if (audio != null) {
164
+ yield _request.appendFile("audio", audio);
165
+ }
166
+ _request.append("model", request.model);
167
+ if (request.input != null) {
168
+ for (const _item of request.input) {
169
+ _request.append("input", typeof _item === "string" ? _item : (0, json_1.toJson)(_item));
170
+ }
171
+ }
172
+ if (request.options != null) {
173
+ _request.append("options", (0, json_1.toJson)(request.options));
174
+ }
175
+ if (request.webhookUrl != null) {
176
+ _request.append("webhookUrl", request.webhookUrl);
177
+ }
178
+ const _maybeEncodedRequest = yield _request.getRequest();
179
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
180
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SyncEnvironment.Default, "/v2/generate"),
181
+ method: "POST",
182
+ headers: Object.assign(Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.2.2", "User-Agent": "@sync.so/sdk/0.2.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
183
+ requestType: "file",
184
+ duplex: _maybeEncodedRequest.duplex,
185
+ body: _maybeEncodedRequest.body,
186
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
187
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
188
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
189
+ });
190
+ if (_response.ok) {
191
+ return { data: _response.body, rawResponse: _response.rawResponse };
192
+ }
193
+ if (_response.error.reason === "status-code") {
194
+ switch (_response.error.statusCode) {
195
+ case 400:
196
+ throw new Sync.BadRequestError(_response.error.body, _response.rawResponse);
197
+ case 401:
198
+ throw new Sync.UnauthorizedError(_response.error.body, _response.rawResponse);
199
+ case 500:
200
+ throw new Sync.InternalServerError(_response.error.body, _response.rawResponse);
201
+ default:
202
+ throw new errors.SyncError({
203
+ statusCode: _response.error.statusCode,
204
+ body: _response.error.body,
205
+ rawResponse: _response.rawResponse,
206
+ });
207
+ }
208
+ }
209
+ switch (_response.error.reason) {
210
+ case "non-json":
211
+ throw new errors.SyncError({
212
+ statusCode: _response.error.statusCode,
213
+ body: _response.error.rawBody,
214
+ rawResponse: _response.rawResponse,
215
+ });
216
+ case "timeout":
217
+ throw new errors.SyncTimeoutError("Timeout exceeded when calling POST /v2/generate.");
218
+ case "unknown":
219
+ throw new errors.SyncError({
220
+ message: _response.error.errorMessage,
221
+ rawResponse: _response.rawResponse,
222
+ });
223
+ }
224
+ });
225
+ }
137
226
  /**
138
227
  * @param {Sync.GenerationId} id
139
228
  * @param {Generations.RequestOptions} requestOptions - Request-specific configuration.
@@ -154,7 +243,7 @@ class Generations {
154
243
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
155
244
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SyncEnvironment.Default, `/v2/generate/${encodeURIComponent(id)}`),
156
245
  method: "GET",
157
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.1.9", "User-Agent": "@sync.so/sdk/0.1.9", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
246
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.2.2", "User-Agent": "@sync.so/sdk/0.2.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
158
247
  contentType: "application/json",
159
248
  requestType: "json",
160
249
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -221,7 +310,7 @@ class Generations {
221
310
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
222
311
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SyncEnvironment.Default, "/v2/generations"),
223
312
  method: "GET",
224
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.1.9", "User-Agent": "@sync.so/sdk/0.1.9", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
313
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.2.2", "User-Agent": "@sync.so/sdk/0.2.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
225
314
  contentType: "application/json",
226
315
  queryParameters: _queryParams,
227
316
  requestType: "json",
@@ -294,7 +383,7 @@ class Generations {
294
383
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
295
384
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SyncEnvironment.Default, "/v2/analyze/cost"),
296
385
  method: "POST",
297
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.1.9", "User-Agent": "@sync.so/sdk/0.1.9", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
386
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.2.2", "User-Agent": "@sync.so/sdk/0.2.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
298
387
  contentType: "application/json",
299
388
  requestType: "json",
300
389
  body: request,
@@ -338,7 +427,8 @@ class Generations {
338
427
  }
339
428
  _getCustomAuthorizationHeaders() {
340
429
  return __awaiter(this, void 0, void 0, function* () {
341
- const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
430
+ var _a;
431
+ const apiKeyValue = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["SYNC_API_KEY"];
342
432
  return { "x-api-key": apiKeyValue };
343
433
  });
344
434
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Sync from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * model: "lipsync-2"
9
+ * }
10
+ */
11
+ export interface CreateGenerationRequest {
12
+ model: Sync.Model;
13
+ /** Array of input objects. Can be used to provide urls for larger files. Each input should either have a file or a url. Audio input items can be provided as either: recorded/captured audio url or a text-to-speech input with tts provider configuration. */
14
+ input?: Sync.Input[];
15
+ options?: Sync.GenerationOptions;
16
+ webhookUrl?: string;
17
+ }
@@ -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 });
@@ -1 +1,2 @@
1
+ export { type CreateGenerationRequest } from "./CreateGenerationRequest";
1
2
  export { type ListGenerationsRequest } from "./ListGenerationsRequest";
@@ -3,5 +3,7 @@ export * from "./common/types";
3
3
  export * as webhooks from "./webhooks";
4
4
  export * from "./webhooks/types";
5
5
  export * from "./common/errors";
6
+ export * as batch from "./batch";
6
7
  export * as generations from "./generations";
8
+ export * from "./batch/client/requests";
7
9
  export * from "./generations/client/requests";
@@ -36,11 +36,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.generations = exports.webhooks = exports.common = void 0;
39
+ exports.generations = exports.batch = exports.webhooks = exports.common = void 0;
40
40
  exports.common = __importStar(require("./common"));
41
41
  __exportStar(require("./common/types"), exports);
42
42
  exports.webhooks = __importStar(require("./webhooks"));
43
43
  __exportStar(require("./webhooks/types"), exports);
44
44
  __exportStar(require("./common/errors"), exports);
45
+ exports.batch = __importStar(require("./batch"));
45
46
  exports.generations = __importStar(require("./generations"));
47
+ __exportStar(require("./batch/client/requests"), exports);
46
48
  __exportStar(require("./generations/client/requests"), exports);
@@ -13,12 +13,16 @@ export interface GenerationNotification {
13
13
  model: Sync.Model;
14
14
  /** error message if the generation failed */
15
15
  error?: string;
16
+ /** error code if the generation failed */
17
+ error_code?: string;
16
18
  /** options used for the generation */
17
19
  options?: Sync.GenerationOptions;
18
20
  /** generated output media duration in seconds */
19
21
  outputDuration?: number;
20
22
  /** url of the generated output media */
21
23
  outputUrl?: string;
24
+ /** url of the segment output media */
25
+ segmentOutputUrl?: string;
22
26
  /** url of the webhook server */
23
27
  webhookUrl?: string;
24
28
  }
@@ -0,0 +1,63 @@
1
+ export type MaybePromise<T> = Promise<T> | T;
2
+ interface FormDataRequest<Body> {
3
+ body: Body;
4
+ headers: Record<string, string>;
5
+ duplex?: "half";
6
+ }
7
+ export interface CrossPlatformFormData {
8
+ setup(): Promise<void>;
9
+ append(key: string, value: unknown): void;
10
+ appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
11
+ getRequest(): MaybePromise<FormDataRequest<unknown>>;
12
+ }
13
+ export declare function newFormData(): Promise<CrossPlatformFormData>;
14
+ export type Node18FormDataFd = {
15
+ append(name: string, value: unknown, fileName?: string): void;
16
+ } | undefined;
17
+ /**
18
+ * Form Data Implementation for Node.js 18+
19
+ */
20
+ export declare class Node18FormData implements CrossPlatformFormData {
21
+ private fd;
22
+ setup(): Promise<void>;
23
+ append(key: string, value: any): void;
24
+ private getFileName;
25
+ appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
26
+ getRequest(): Promise<FormDataRequest<unknown>>;
27
+ }
28
+ export type Node16FormDataFd = {
29
+ append(name: string, value: unknown, options?: string | {
30
+ header?: string | Headers;
31
+ knownLength?: number;
32
+ filename?: string;
33
+ filepath?: string;
34
+ contentType?: string;
35
+ }): void;
36
+ getHeaders(): Record<string, string>;
37
+ } | undefined;
38
+ /**
39
+ * Form Data Implementation for Node.js 16-18
40
+ */
41
+ export declare class Node16FormData implements CrossPlatformFormData {
42
+ private fd;
43
+ setup(): Promise<void>;
44
+ append(key: string, value: any): void;
45
+ private getFileName;
46
+ appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
47
+ getRequest(): FormDataRequest<Node16FormDataFd>;
48
+ }
49
+ export type WebFormDataFd = {
50
+ append(name: string, value: string | Blob, fileName?: string): void;
51
+ } | undefined;
52
+ /**
53
+ * Form Data Implementation for Web
54
+ */
55
+ export declare class WebFormData implements CrossPlatformFormData {
56
+ protected fd: WebFormDataFd;
57
+ setup(): Promise<void>;
58
+ append(key: string, value: any): void;
59
+ private getFileName;
60
+ appendFile(key: string, value: any, fileName?: string): Promise<void>;
61
+ getRequest(): FormDataRequest<WebFormDataFd>;
62
+ }
63
+ export {};