@sync.so/sdk 0.1.8 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +7 -2
  3. package/README.md +2 -2
  4. package/api/resources/batch/client/Client.d.ts +89 -0
  5. package/api/resources/batch/client/Client.js +297 -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 +2 -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 +23 -4
  46. package/api/resources/generations/client/Client.js +97 -8
  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 +2 -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 +3 -0
  62. package/dist/Client.js +7 -2
  63. package/dist/api/resources/batch/client/Client.d.ts +89 -0
  64. package/dist/api/resources/batch/client/Client.js +297 -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 +2 -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 +23 -4
  105. package/dist/api/resources/generations/client/Client.js +97 -8
  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 +2 -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 +276 -4
  128. package/version.d.ts +1 -1
  129. package/version.js +1 -1
@@ -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.TooManyRequestsError = void 0;
40
+ const errors = __importStar(require("../../../../errors/index"));
41
+ class TooManyRequestsError extends errors.SyncError {
42
+ constructor(body, rawResponse) {
43
+ super({
44
+ message: "TooManyRequestsError",
45
+ statusCode: 429,
46
+ body: body,
47
+ rawResponse: rawResponse,
48
+ });
49
+ Object.setPrototypeOf(this, TooManyRequestsError.prototype);
50
+ }
51
+ }
52
+ exports.TooManyRequestsError = TooManyRequestsError;
@@ -2,3 +2,5 @@ export * from "./BadRequestError";
2
2
  export * from "./InternalServerError";
3
3
  export * from "./NotFoundError";
4
4
  export * from "./UnauthorizedError";
5
+ export * from "./TooManyRequestsError";
6
+ export * from "./PaymentRequiredError";
@@ -18,3 +18,5 @@ __exportStar(require("./BadRequestError"), exports);
18
18
  __exportStar(require("./InternalServerError"), exports);
19
19
  __exportStar(require("./NotFoundError"), exports);
20
20
  __exportStar(require("./UnauthorizedError"), exports);
21
+ __exportStar(require("./TooManyRequestsError"), exports);
22
+ __exportStar(require("./PaymentRequiredError"), exports);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Active speaker detection configuration
6
+ */
7
+ export interface ActiveSpeaker {
8
+ /** Whether to automatically detect and apply generation to the active speaker */
9
+ auto_detect?: boolean;
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,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * A unique identifier for the batch.
6
+ */
7
+ export type BatchId = string;
@@ -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,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface BatchMetrics {
5
+ /** Total number of generation requests in the batch. */
6
+ total_generations: number;
7
+ /** Number of successfully completed generations. */
8
+ success_count: number;
9
+ /** Number of failed generations. */
10
+ failed_count: number;
11
+ /** Number of generations still pending or processing. */
12
+ pending_count: number;
13
+ }
@@ -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,17 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Sync from "../../../index";
5
+ export interface BatchResponse {
6
+ id: Sync.BatchId;
7
+ /** The date and time the batch was created. */
8
+ created_at: string;
9
+ /** The current status of the batch. */
10
+ status: Sync.BatchStatus;
11
+ /** Metrics about the batch processing progress. */
12
+ metrics: Sync.BatchMetrics;
13
+ /** The webhook URL for batch status notifications. */
14
+ webhookUrl?: string;
15
+ /** The URL to download the batch results file (available when completed). */
16
+ outputUrl: 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 });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * The status of the batch processing.
6
+ */
7
+ export type BatchStatus = "PENDING" | "JOBS_CREATED" | "PROCESSING" | "COMPLETED" | "FAILED";
8
+ export declare const BatchStatus: {
9
+ readonly Pending: "PENDING";
10
+ readonly JobsCreated: "JOBS_CREATED";
11
+ readonly Processing: "PROCESSING";
12
+ readonly Completed: "COMPLETED";
13
+ readonly Failed: "FAILED";
14
+ };
@@ -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
  }
@@ -18,6 +18,8 @@ export interface Generation {
18
18
  outputDuration?: number;
19
19
  /** The URL of the output media. */
20
20
  outputUrl?: string;
21
+ /** The URL of the segment output media. */
22
+ segmentOutputUrl?: string;
21
23
  /** The status of the generation. */
22
24
  status: Sync.GenerationStatus;
23
25
  /** 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,6 +4,8 @@
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>;
@@ -38,10 +40,10 @@ export declare class Generations {
38
40
  * await client.generations.create({
39
41
  * input: [{
40
42
  * type: "video",
41
- * url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortvid-03a10044-7741-4cfc-816a-5bccd392d1ee.mp4"
43
+ * url: "https://assets.sync.so/docs/example-video.mp4"
42
44
  * }, {
43
45
  * type: "audio",
44
- * url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortaud-27623a4f-edab-4c6a-8383-871b18961a4a.wav"
46
+ * url: "https://assets.sync.so/docs/example-audio.wav"
45
47
  * }],
46
48
  * model: "lipsync-2",
47
49
  * options: {
@@ -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.
@@ -87,10 +106,10 @@ export declare class Generations {
87
106
  * await client.generations.estimateCost({
88
107
  * input: [{
89
108
  * type: "video",
90
- * url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortvid-03a10044-7741-4cfc-816a-5bccd392d1ee.mp4"
109
+ * url: "https://assets.sync.so/docs/example-video.mp4"
91
110
  * }, {
92
111
  * type: "audio",
93
- * url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortaud-27623a4f-edab-4c6a-8383-871b18961a4a.wav"
112
+ * url: "https://assets.sync.so/docs/example-audio.wav"
94
113
  * }],
95
114
  * model: "lipsync-2",
96
115
  * options: {
@@ -54,6 +54,7 @@ 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
59
  constructor(_options) {
59
60
  this._options = _options;
@@ -70,10 +71,10 @@ class Generations {
70
71
  * await client.generations.create({
71
72
  * input: [{
72
73
  * type: "video",
73
- * url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortvid-03a10044-7741-4cfc-816a-5bccd392d1ee.mp4"
74
+ * url: "https://assets.sync.so/docs/example-video.mp4"
74
75
  * }, {
75
76
  * type: "audio",
76
- * url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortaud-27623a4f-edab-4c6a-8383-871b18961a4a.wav"
77
+ * url: "https://assets.sync.so/docs/example-audio.wav"
77
78
  * }],
78
79
  * model: "lipsync-2",
79
80
  * options: {
@@ -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.8", "User-Agent": "@sync.so/sdk/0.1.8", "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.1", "User-Agent": "@sync.so/sdk/0.2.1", "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.1", "User-Agent": "@sync.so/sdk/0.2.1", "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.8", "User-Agent": "@sync.so/sdk/0.1.8", "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.1", "User-Agent": "@sync.so/sdk/0.2.1", "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.8", "User-Agent": "@sync.so/sdk/0.1.8", "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.1", "User-Agent": "@sync.so/sdk/0.2.1", "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",
@@ -274,10 +363,10 @@ class Generations {
274
363
  * await client.generations.estimateCost({
275
364
  * input: [{
276
365
  * type: "video",
277
- * url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortvid-03a10044-7741-4cfc-816a-5bccd392d1ee.mp4"
366
+ * url: "https://assets.sync.so/docs/example-video.mp4"
278
367
  * }, {
279
368
  * type: "audio",
280
- * url: "https://synchlabs-public.s3.us-west-2.amazonaws.com/david_demo_shortaud-27623a4f-edab-4c6a-8383-871b18961a4a.wav"
369
+ * url: "https://assets.sync.so/docs/example-audio.wav"
281
370
  * }],
282
371
  * model: "lipsync-2",
283
372
  * options: {
@@ -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.8", "User-Agent": "@sync.so/sdk/0.1.8", "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.1", "User-Agent": "@sync.so/sdk/0.2.1", "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,
@@ -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";