@blitzreels/sdk 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,14 +1,21 @@
1
+ import { createAiEditResource, } from "./resources/ai-edit.js";
2
+ import { createCaptionsResource, } from "./resources/captions.js";
3
+ import { createTimelineResource, } from "./resources/timeline.js";
1
4
  const DEFAULT_BASE_URL = "https://www.blitzreels.com/api/v1";
2
5
  export class BlitzReelsError extends Error {
3
6
  status;
4
7
  requestId;
5
8
  body;
9
+ code;
10
+ retryable;
6
11
  constructor(options) {
7
12
  super(options.message);
8
13
  this.name = "BlitzReelsError";
9
14
  this.status = options.status;
10
15
  this.requestId = options.requestId;
11
16
  this.body = options.body;
17
+ this.code = options.code ?? classifyBlitzReelsErrorCode(options);
18
+ this.retryable = options.retryable ?? isRetryableBlitzReelsStatus(options);
12
19
  }
13
20
  }
14
21
  function normalizeBaseUrl({ baseUrl, }) {
@@ -29,6 +36,37 @@ function appendQuery({ url, query, }) {
29
36
  }
30
37
  }
31
38
  }
39
+ function classifyBlitzReelsErrorCode({ status, body, }) {
40
+ const bodyCode = extractErrorCode({ body });
41
+ if (bodyCode) {
42
+ return bodyCode;
43
+ }
44
+ if (status === 401 || status === 403) {
45
+ return "auth_error";
46
+ }
47
+ if (status === 404) {
48
+ return "not_found";
49
+ }
50
+ if (status === 409) {
51
+ return "conflict";
52
+ }
53
+ if (status === 408) {
54
+ return "timeout";
55
+ }
56
+ if (status === 400 || status === 422) {
57
+ return "validation_error";
58
+ }
59
+ if (status === 429) {
60
+ return "rate_limited";
61
+ }
62
+ if (status >= 500) {
63
+ return "server_error";
64
+ }
65
+ return "api_error";
66
+ }
67
+ function isRetryableBlitzReelsStatus({ status }) {
68
+ return status === 408 || status === 429 || status >= 500;
69
+ }
32
70
  function extractErrorMessage({ body }) {
33
71
  if (body === null || typeof body !== "object") {
34
72
  return null;
@@ -37,6 +75,44 @@ function extractErrorMessage({ body }) {
37
75
  const message = record.message ?? record.error;
38
76
  return typeof message === "string" ? message : null;
39
77
  }
78
+ function extractErrorCode({ body, }) {
79
+ if (body === null || typeof body !== "object") {
80
+ return null;
81
+ }
82
+ const value = body.code;
83
+ if (value === "api_error" ||
84
+ value === "auth_error" ||
85
+ value === "not_found" ||
86
+ value === "conflict" ||
87
+ value === "validation_error" ||
88
+ value === "rate_limited" ||
89
+ value === "timeout" ||
90
+ value === "server_error") {
91
+ return value;
92
+ }
93
+ return null;
94
+ }
95
+ function normalizeMediaPositionPreset({ value, }) {
96
+ if (value === "full-screen") {
97
+ return "fullscreen";
98
+ }
99
+ if (value === "top-left") {
100
+ return "pip-top-left";
101
+ }
102
+ if (value === "top-right") {
103
+ return "pip-top-right";
104
+ }
105
+ if (value === "bottom-left") {
106
+ return "pip-bottom-left";
107
+ }
108
+ if (value === "bottom-right") {
109
+ return "pip-bottom-right";
110
+ }
111
+ return value;
112
+ }
113
+ function normalizeMediaAnimationPreset({ value, }) {
114
+ return value === "slideIn" ? "slideUp" : value;
115
+ }
40
116
  function sleep({ ms }) {
41
117
  return new Promise((resolve) => setTimeout(resolve, ms));
42
118
  }
@@ -87,12 +163,18 @@ export class BlitzReelsClient {
87
163
  auth;
88
164
  projects;
89
165
  timeline;
166
+ effects;
90
167
  workspace;
91
168
  media;
169
+ clips;
92
170
  text;
93
171
  audio;
172
+ audioLibrary;
173
+ stockMedia;
174
+ library;
94
175
  silence;
95
176
  mistakes;
177
+ aiEdit;
96
178
  captions;
97
179
  exports;
98
180
  jobs;
@@ -158,13 +240,27 @@ export class BlitzReelsClient {
158
240
  inspect: (options) => this.request({
159
241
  method: "GET",
160
242
  path: `/projects/${encodeURIComponent(options.projectId)}/context`,
161
- query: { mode: options.mode },
243
+ query: {
244
+ mode: options.mode,
245
+ asset_limit: options.assetLimit,
246
+ asset_offset: options.assetOffset,
247
+ timeline_limit: options.timelineLimit,
248
+ timeline_offset: options.timelineOffset,
249
+ transcript_limit: options.transcriptLimit,
250
+ transcript_offset: options.transcriptOffset,
251
+ caption_word_limit: options.captionWordLimit,
252
+ caption_word_offset: options.captionWordOffset,
253
+ },
162
254
  body: undefined,
163
255
  }),
164
256
  timeline: (options) => this.request({
165
257
  method: "GET",
166
258
  path: `/projects/${encodeURIComponent(options.projectId)}/context`,
167
- query: { mode: "timeline" },
259
+ query: {
260
+ mode: "timeline",
261
+ timeline_limit: options.limit,
262
+ timeline_offset: options.offset,
263
+ },
168
264
  body: undefined,
169
265
  }),
170
266
  renderSnapshot: (options) => this.request({
@@ -188,48 +284,100 @@ export class BlitzReelsClient {
188
284
  },
189
285
  }),
190
286
  };
191
- this.timeline = {
192
- transform: (options) => this.request({
193
- method: "POST",
194
- path: `/projects/${encodeURIComponent(options.projectId)}/timeline/edits`,
195
- query: undefined,
196
- body: {
197
- action: "transform",
198
- timeline_item_id: options.timelineItemId,
199
- position_x: options.positionX,
200
- position_y: options.positionY,
201
- width_px: options.widthPx,
202
- height_px: options.heightPx,
203
- keep_aspect_ratio: options.keepAspectRatio,
204
- },
205
- }),
206
- move: (options) => this.request({
207
- method: "POST",
208
- path: `/projects/${encodeURIComponent(options.projectId)}/timeline/edits`,
209
- query: undefined,
210
- body: {
211
- action: "move",
212
- timeline_item_id: options.timelineItemId,
213
- new_start_seconds: options.newStartSeconds,
214
- new_layer_index: options.newLayerIndex,
215
- },
216
- }),
217
- delete: (options) => this.request({
218
- method: "POST",
219
- path: `/projects/${encodeURIComponent(options.projectId)}/timeline/edits`,
220
- query: undefined,
221
- body: {
222
- action: "delete",
223
- timeline_item_ids: options.timelineItemIds,
224
- auto_pack: options.autoPack,
225
- },
226
- }),
227
- deleteItem: (options) => this.request({
228
- method: "DELETE",
229
- path: `/projects/${encodeURIComponent(options.projectId)}/timeline/items/${encodeURIComponent(options.timelineItemId)}`,
230
- query: undefined,
231
- body: undefined,
232
- }),
287
+ this.timeline = createTimelineResource({
288
+ request: (options) => this.request(options),
289
+ });
290
+ this.aiEdit = createAiEditResource({
291
+ request: (options) => this.request(options),
292
+ });
293
+ this.effects = {
294
+ zoom: {
295
+ add: (options) => this.request({
296
+ method: "POST",
297
+ path: `/projects/${encodeURIComponent(options.projectId)}/effects/zoom`,
298
+ query: undefined,
299
+ body: {
300
+ timeline_item_id: options.timelineItemId,
301
+ content_item_id: options.contentItemId,
302
+ effect_id: options.effectId,
303
+ name: options.name,
304
+ start_time_seconds: options.startTimeSeconds,
305
+ duration_seconds: options.durationSeconds,
306
+ easing: options.easing,
307
+ layer_index: options.layerIndex,
308
+ order_index: options.orderIndex,
309
+ settings: options.settings,
310
+ },
311
+ }),
312
+ update: (options) => this.request({
313
+ method: "PATCH",
314
+ path: `/projects/${encodeURIComponent(options.projectId)}/effects/zoom/${encodeURIComponent(options.timelineItemId)}`,
315
+ query: undefined,
316
+ body: {
317
+ duration_seconds: options.durationSeconds,
318
+ easing: options.easing,
319
+ settings: options.settings,
320
+ },
321
+ }),
322
+ },
323
+ mask: {
324
+ add: (options) => this.request({
325
+ method: "POST",
326
+ path: `/projects/${encodeURIComponent(options.projectId)}/effects/mask`,
327
+ query: undefined,
328
+ body: {
329
+ timeline_item_id: options.timelineItemId,
330
+ content_item_id: options.contentItemId,
331
+ effect_id: options.effectId,
332
+ name: options.name,
333
+ start_time_seconds: options.startTimeSeconds,
334
+ duration_seconds: options.durationSeconds,
335
+ easing: options.easing,
336
+ layer_index: options.layerIndex,
337
+ order_index: options.orderIndex,
338
+ settings: options.settings,
339
+ },
340
+ }),
341
+ update: (options) => this.request({
342
+ method: "PATCH",
343
+ path: `/projects/${encodeURIComponent(options.projectId)}/effects/mask/${encodeURIComponent(options.timelineItemId)}`,
344
+ query: undefined,
345
+ body: {
346
+ duration_seconds: options.durationSeconds,
347
+ easing: options.easing,
348
+ settings: options.settings,
349
+ },
350
+ }),
351
+ },
352
+ colorgrade: {
353
+ add: (options) => this.request({
354
+ method: "POST",
355
+ path: `/projects/${encodeURIComponent(options.projectId)}/effects/colorgrade`,
356
+ query: undefined,
357
+ body: {
358
+ timeline_item_id: options.timelineItemId,
359
+ content_item_id: options.contentItemId,
360
+ effect_id: options.effectId,
361
+ name: options.name,
362
+ start_time_seconds: options.startTimeSeconds,
363
+ duration_seconds: options.durationSeconds,
364
+ easing: options.easing,
365
+ layer_index: options.layerIndex,
366
+ order_index: options.orderIndex,
367
+ settings: options.settings,
368
+ },
369
+ }),
370
+ update: (options) => this.request({
371
+ method: "PATCH",
372
+ path: `/projects/${encodeURIComponent(options.projectId)}/effects/colorgrade/${encodeURIComponent(options.timelineItemId)}`,
373
+ query: undefined,
374
+ body: {
375
+ duration_seconds: options.durationSeconds,
376
+ easing: options.easing,
377
+ settings: options.settings,
378
+ },
379
+ }),
380
+ },
233
381
  };
234
382
  this.workspace = {
235
383
  getSettings: () => this.request({
@@ -279,6 +427,12 @@ export class BlitzReelsClient {
279
427
  query: undefined,
280
428
  body: undefined,
281
429
  }),
430
+ clippingStatus: (options) => this.request({
431
+ method: "GET",
432
+ path: `/workspace/media/assets/${encodeURIComponent(options.assetId)}/clipping-status`,
433
+ query: { project_id: options.projectId },
434
+ body: undefined,
435
+ }),
282
436
  delete: (options) => this.request({
283
437
  method: "POST",
284
438
  path: `/workspace/media/assets/${encodeURIComponent(options.assetId)}/delete`,
@@ -351,20 +505,76 @@ export class BlitzReelsClient {
351
505
  asset_id: options.assetId,
352
506
  start_seconds: options.startSeconds ?? 0,
353
507
  duration_seconds: options.durationSeconds,
354
- position_preset: options.positionPreset,
508
+ position_preset: normalizeMediaPositionPreset({
509
+ value: options.positionPreset,
510
+ }),
355
511
  position_x: options.positionX,
356
512
  position_y: options.positionY,
357
513
  width_px: options.widthPx,
358
514
  height_px: options.heightPx,
515
+ keep_aspect_ratio: options.keepAspectRatio,
359
516
  scale: options.scale,
360
517
  opacity: options.opacity,
361
- animation_preset: options.animationPreset,
518
+ animation_preset: normalizeMediaAnimationPreset({
519
+ value: options.animationPreset,
520
+ }),
362
521
  layer_index: options.layerIndex,
363
522
  },
364
523
  ],
365
524
  allow_duplicate: options.allowDuplicate,
366
525
  },
367
526
  }),
527
+ updateOverlay: (options) => this.request({
528
+ method: "PATCH",
529
+ path: `/projects/${encodeURIComponent(options.projectId)}/timeline/media/${encodeURIComponent(options.timelineItemId)}`,
530
+ query: undefined,
531
+ body: {
532
+ position_preset: normalizeMediaPositionPreset({
533
+ value: options.positionPreset,
534
+ }),
535
+ position_x: options.positionX,
536
+ position_y: options.positionY,
537
+ width_px: options.widthPx,
538
+ height_px: options.heightPx,
539
+ keep_aspect_ratio: options.keepAspectRatio,
540
+ scale: options.scale,
541
+ opacity: options.opacity,
542
+ animation_preset: normalizeMediaAnimationPreset({
543
+ value: options.animationPreset,
544
+ }),
545
+ remove_animations: options.removeAnimations,
546
+ blurred_background: options.blurredBackground,
547
+ },
548
+ }),
549
+ shorts: {
550
+ list: (options) => this.request({
551
+ method: "GET",
552
+ path: `/workspace/media/assets/${encodeURIComponent(options.assetId)}/short-suggestions`,
553
+ query: undefined,
554
+ body: undefined,
555
+ }),
556
+ generate: (options) => this.request({
557
+ method: "POST",
558
+ path: `/workspace/media/assets/${encodeURIComponent(options.assetId)}/short-suggestions`,
559
+ query: undefined,
560
+ body: {
561
+ content_profile: options.contentProfile,
562
+ auto_trim_silence: options.autoTrimSilence,
563
+ },
564
+ }),
565
+ apply: (options) => this.request({
566
+ method: "POST",
567
+ path: `/workspace/media/assets/${encodeURIComponent(options.assetId)}/short-suggestions/${encodeURIComponent(options.suggestionId)}/apply`,
568
+ query: undefined,
569
+ body: {
570
+ project_id: options.projectId,
571
+ caption_style_id: options.captionStyleId,
572
+ mark_saved: options.markSaved,
573
+ allow_unverified_export: options.allowUnverifiedExport,
574
+ automatic_layout: options.automaticLayout,
575
+ },
576
+ }),
577
+ },
368
578
  folders: {
369
579
  list: (options) => this.request({
370
580
  method: "GET",
@@ -402,6 +612,89 @@ export class BlitzReelsClient {
402
612
  }),
403
613
  },
404
614
  };
615
+ this.clips = {
616
+ create: (options) => this.request({
617
+ method: "POST",
618
+ path: "/clips",
619
+ query: undefined,
620
+ body: {
621
+ project_name: options.projectName,
622
+ source: {
623
+ source_type: options.source.sourceType,
624
+ asset_id: options.source.assetId,
625
+ youtube_url: options.source.youtubeUrl,
626
+ },
627
+ selection: {
628
+ selection_mode: options.selection.mode,
629
+ suggestion_id: options.selection.suggestionId,
630
+ start_seconds: options.selection.startSeconds,
631
+ end_seconds: options.selection.endSeconds,
632
+ },
633
+ target: {
634
+ aspect_ratio: options.target.aspectRatio,
635
+ min_duration_seconds: options.target.minDurationSeconds,
636
+ max_duration_seconds: options.target.maxDurationSeconds,
637
+ },
638
+ layout: {
639
+ layout_mode: options.layout.mode,
640
+ content_type_hint: options.layout.contentTypeHint,
641
+ },
642
+ captions: {
643
+ enabled: options.captions.enabled,
644
+ style_id: options.captions.styleId,
645
+ },
646
+ qa: {
647
+ qa_mode: options.qa.mode,
648
+ },
649
+ export: {
650
+ auto_export: options.export.autoExport,
651
+ },
652
+ },
653
+ }),
654
+ get: (options) => this.request({
655
+ method: "GET",
656
+ path: `/clips/${encodeURIComponent(options.clipId)}`,
657
+ query: undefined,
658
+ body: undefined,
659
+ }),
660
+ reselect: (options) => this.request({
661
+ method: "POST",
662
+ path: `/clips/${encodeURIComponent(options.clipId)}/reselect`,
663
+ query: undefined,
664
+ body: {
665
+ selection: {
666
+ selection_mode: options.selection.mode,
667
+ suggestion_id: options.selection.suggestionId,
668
+ start_seconds: options.selection.startSeconds,
669
+ end_seconds: options.selection.endSeconds,
670
+ },
671
+ target: options.target === null || options.target === undefined
672
+ ? null
673
+ : {
674
+ min_duration_seconds: options.target.minDurationSeconds,
675
+ max_duration_seconds: options.target.maxDurationSeconds,
676
+ },
677
+ },
678
+ }),
679
+ repair: (options) => this.request({
680
+ method: "POST",
681
+ path: `/clips/${encodeURIComponent(options.clipId)}/repair`,
682
+ query: undefined,
683
+ body: {
684
+ repair_mode: options.repairMode,
685
+ },
686
+ }),
687
+ export: (options) => this.request({
688
+ method: "POST",
689
+ path: `/clips/${encodeURIComponent(options.clipId)}/export`,
690
+ query: undefined,
691
+ body: {
692
+ resolution: options.resolution,
693
+ format: options.format,
694
+ allow_blocking_qa_bypass: options.allowBlockingQaBypass,
695
+ },
696
+ }),
697
+ };
405
698
  this.text = {
406
699
  add: (options) => this.request({
407
700
  method: "POST",
@@ -429,6 +722,7 @@ export class BlitzReelsClient {
429
722
  text: options.text,
430
723
  name: options.name,
431
724
  spec: options.spec,
725
+ durationSeconds: options.durationSeconds,
432
726
  }),
433
727
  remove: (options) => this.request({
434
728
  method: "DELETE",
@@ -456,6 +750,102 @@ export class BlitzReelsClient {
456
750
  ],
457
751
  },
458
752
  }),
753
+ update: (options) => this.request({
754
+ method: "PATCH",
755
+ path: `/projects/${encodeURIComponent(options.projectId)}/timeline/audio/${encodeURIComponent(options.timelineItemId)}`,
756
+ query: undefined,
757
+ body: {
758
+ duration_seconds: options.durationSeconds,
759
+ volume: options.volume,
760
+ fade_in_seconds: options.fadeInSeconds,
761
+ fade_out_seconds: options.fadeOutSeconds,
762
+ },
763
+ }),
764
+ };
765
+ this.audioLibrary = {
766
+ search: (options) => this.request({
767
+ method: "GET",
768
+ path: "/audio-library/search",
769
+ query: {
770
+ query: options.query,
771
+ provider: options.provider,
772
+ license: options.license,
773
+ audio_type: options.audioType,
774
+ min_duration_seconds: options.minDurationSeconds,
775
+ max_duration_seconds: options.maxDurationSeconds,
776
+ limit: options.limit,
777
+ page: options.page,
778
+ },
779
+ body: undefined,
780
+ }),
781
+ importAsset: (options) => this.request({
782
+ method: "POST",
783
+ path: "/audio-library/import",
784
+ query: undefined,
785
+ body: {
786
+ provider: options.provider,
787
+ external_id: options.externalId,
788
+ folder_id: options.folderId,
789
+ project_id: options.projectId,
790
+ start_seconds: options.startSeconds,
791
+ duration_seconds: options.durationSeconds,
792
+ volume: options.volume,
793
+ fade_in_seconds: options.fadeInSeconds,
794
+ fade_out_seconds: options.fadeOutSeconds,
795
+ loop: options.loop,
796
+ audio_type: options.audioType,
797
+ },
798
+ }),
799
+ };
800
+ this.stockMedia = {
801
+ search: (options) => this.request({
802
+ method: "GET",
803
+ path: "/workspace/stock-media/search",
804
+ query: {
805
+ query: options.query,
806
+ asset_type: options.assetType,
807
+ provider: options.provider,
808
+ orientation: options.orientation,
809
+ page: options.page,
810
+ limit: options.limit,
811
+ },
812
+ body: undefined,
813
+ }),
814
+ importAsset: (options) => this.request({
815
+ method: "POST",
816
+ path: "/workspace/stock-media/import",
817
+ query: undefined,
818
+ body: {
819
+ provider: options.provider,
820
+ provider_asset_id: options.providerAssetId,
821
+ asset_type: options.assetType,
822
+ variant_id: options.variantId,
823
+ folder_id: options.folderId,
824
+ audio_type: options.audioType,
825
+ },
826
+ }),
827
+ };
828
+ this.library = {
829
+ search: (options) => this.request({
830
+ method: "GET",
831
+ path: "/library/broll/search",
832
+ query: {
833
+ query: options.query,
834
+ asset_type: options.assetType,
835
+ audio_type: options.audioType,
836
+ limit: options.limit,
837
+ offset: options.offset,
838
+ },
839
+ body: undefined,
840
+ }),
841
+ importAsset: (options) => this.request({
842
+ method: "POST",
843
+ path: `/library/broll/${encodeURIComponent(options.libraryAssetId)}/import`,
844
+ query: undefined,
845
+ body: {
846
+ folder_id: options.folderId,
847
+ },
848
+ }),
459
849
  };
460
850
  this.silence = {
461
851
  plan: (options) => this.request({
@@ -464,6 +854,8 @@ export class BlitzReelsClient {
464
854
  query: undefined,
465
855
  body: {
466
856
  timeline_item_id: options.timelineItemId,
857
+ all_media_items: options.allMediaItems,
858
+ strategy: options.strategy,
467
859
  padding_ms: options.paddingMs,
468
860
  silence_threshold_db: options.silenceThresholdDb,
469
861
  min_silence_duration_seconds: options.minSilenceDurationSeconds,
@@ -477,6 +869,7 @@ export class BlitzReelsClient {
477
869
  query: undefined,
478
870
  body: {
479
871
  timeline_item_id: options.timelineItemId,
872
+ all_media_items: options.allMediaItems,
480
873
  padding_ms: options.paddingMs,
481
874
  silence_threshold_db: options.silenceThresholdDb,
482
875
  min_silence_duration_seconds: options.minSilenceDurationSeconds,
@@ -484,6 +877,11 @@ export class BlitzReelsClient {
484
877
  use_caption_validation: options.useCaptionValidation,
485
878
  delete_silent_clips: options.deleteSilentClips,
486
879
  manual_segment_overrides: options.manualSegmentOverrides,
880
+ segments: options.segments?.map((segment) => ({
881
+ timeline_item_id: segment.timelineItemId,
882
+ start_seconds: segment.startSeconds,
883
+ end_seconds: segment.endSeconds,
884
+ })),
487
885
  preview_confirmed: options.previewConfirmed,
488
886
  },
489
887
  }),
@@ -510,111 +908,9 @@ export class BlitzReelsClient {
510
908
  },
511
909
  }),
512
910
  };
513
- this.captions = {
514
- listWords: (options) => this.request({
515
- method: "GET",
516
- path: `/projects/${encodeURIComponent(options.projectId)}/captions/words`,
517
- query: {
518
- timeline_item_id: options.timelineItemId,
519
- match_text: options.matchText,
520
- limit: options.limit,
521
- offset: options.offset,
522
- },
523
- body: undefined,
524
- }),
525
- updateWordText: (options) => this.request({
526
- method: "POST",
527
- path: `/projects/${encodeURIComponent(options.projectId)}/captions/words/text`,
528
- query: undefined,
529
- body: {
530
- word_id: options.wordId,
531
- new_text: options.newText,
532
- },
533
- }),
534
- batchUpdateWordText: (options) => this.request({
535
- method: "POST",
536
- path: `/projects/${encodeURIComponent(options.projectId)}/captions/words/batch-text`,
537
- query: undefined,
538
- body: {
539
- updates: options.updates,
540
- },
541
- }),
542
- setWordStyle: (options) => this.request({
543
- method: "POST",
544
- path: `/projects/${encodeURIComponent(options.projectId)}/captions/words/style`,
545
- query: undefined,
546
- body: {
547
- style: options.style,
548
- clear_existing: options.clearExisting,
549
- word_ids: options.wordIds,
550
- match_text: options.matchText,
551
- match_pattern: options.matchPattern,
552
- timeline_item_id: options.timelineItemId,
553
- },
554
- }),
555
- setWordEmphasis: (options) => this.request({
556
- method: "POST",
557
- path: `/projects/${encodeURIComponent(options.projectId)}/captions/words/emphasis`,
558
- query: undefined,
559
- body: {
560
- emphasis: options.emphasis,
561
- word_ids: options.wordIds,
562
- match_text: options.matchText,
563
- match_pattern: options.matchPattern,
564
- timeline_item_id: options.timelineItemId,
565
- },
566
- }),
567
- deleteWords: (options) => this.request({
568
- method: "POST",
569
- path: `/projects/${encodeURIComponent(options.projectId)}/captions/words/delete`,
570
- query: undefined,
571
- body: { word_ids: options.wordIds },
572
- }),
573
- mergeWords: (options) => this.request({
574
- method: "POST",
575
- path: `/projects/${encodeURIComponent(options.projectId)}/captions/words/merge`,
576
- query: undefined,
577
- body: { word_ids: options.wordIds, text: options.text },
578
- }),
579
- splitWord: (options) => this.request({
580
- method: "POST",
581
- path: `/projects/${encodeURIComponent(options.projectId)}/captions/words/split`,
582
- query: undefined,
583
- body: { word_id: options.wordId, words: options.words },
584
- }),
585
- listThemes: () => this.request({
586
- method: "GET",
587
- path: "/caption-themes",
588
- query: undefined,
589
- body: undefined,
590
- }),
591
- setDefaultTheme: (options) => this.request({
592
- method: "POST",
593
- path: `/caption-themes/${encodeURIComponent(options.themeId)}/set-default`,
594
- query: undefined,
595
- body: {},
596
- }),
597
- setProjectTheme: (options) => this.request({
598
- method: "POST",
599
- path: `/projects/${encodeURIComponent(options.projectId)}/caption-theme`,
600
- query: undefined,
601
- body: {
602
- theme_id: options.themeId,
603
- },
604
- }),
605
- previewTheme: (options) => this.request({
606
- method: "POST",
607
- path: "/caption-themes/preview",
608
- query: undefined,
609
- body: {
610
- settings: options.settings,
611
- sample_text: options.sampleText,
612
- aspect_ratio: options.aspectRatio,
613
- target_width: options.targetWidth,
614
- image_format: options.imageFormat,
615
- },
616
- }),
617
- };
911
+ this.captions = createCaptionsResource({
912
+ request: (options) => this.request(options),
913
+ });
618
914
  this.exports = {
619
915
  start: (options) => this.request({
620
916
  method: "POST",
@@ -623,7 +919,7 @@ export class BlitzReelsClient {
623
919
  body: {
624
920
  resolution: options.resolution,
625
921
  format: options.format,
626
- include_captions: options.includeCaptions,
922
+ cover_frame_seconds: options.coverFrameSeconds,
627
923
  },
628
924
  }),
629
925
  get: (options) => this.request({
@@ -727,6 +1023,7 @@ export class BlitzReelsClient {
727
1023
  body: {
728
1024
  name: options.name,
729
1025
  spec,
1026
+ duration_seconds: options.durationSeconds,
730
1027
  },
731
1028
  });
732
1029
  }