@stack0/sdk 0.5.6 → 0.5.8

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.
@@ -306,6 +306,52 @@ interface ExtractAudioResponse {
306
306
  jobId: string;
307
307
  status: TranscodingStatus;
308
308
  }
309
+ type GifStatus = "pending" | "processing" | "completed" | "failed";
310
+ interface GenerateGifRequest {
311
+ /** Project slug */
312
+ projectSlug: string;
313
+ /** ID of the video asset to generate GIF from */
314
+ assetId: string;
315
+ /** Start time in seconds (default: 0) */
316
+ startTime?: number;
317
+ /** Duration in seconds (0.5-30, default: 5) */
318
+ duration?: number;
319
+ /** Output width in pixels (100-800, default: 480) */
320
+ width?: number;
321
+ /** Frames per second (5-30, default: 10) */
322
+ fps?: number;
323
+ /** Use two-pass palette optimization for smaller file size (default: true) */
324
+ optimizePalette?: boolean;
325
+ }
326
+ interface VideoGif {
327
+ id: string;
328
+ assetId: string;
329
+ /** Start time in seconds */
330
+ startTime: number;
331
+ /** Duration in seconds */
332
+ duration: number;
333
+ /** Frames per second */
334
+ fps: number;
335
+ /** CDN URL of the generated GIF (null if pending/processing) */
336
+ url: string | null;
337
+ /** Width in pixels */
338
+ width: number | null;
339
+ /** Height in pixels */
340
+ height: number | null;
341
+ /** File size in bytes */
342
+ sizeBytes: number | null;
343
+ /** Number of frames in the GIF */
344
+ frameCount: number | null;
345
+ /** Current status of the GIF generation */
346
+ status: GifStatus;
347
+ /** Error message if failed */
348
+ errorMessage: string | null;
349
+ createdAt: Date;
350
+ completedAt: Date | null;
351
+ }
352
+ interface ListGifsRequest {
353
+ assetId: string;
354
+ }
309
355
  type PrivateFileStatus = "pending" | "ready" | "failed" | "deleted";
310
356
  interface PrivateFile {
311
357
  id: string;
@@ -538,6 +584,54 @@ interface MovePrivateFilesResponse {
538
584
  type MergeStatus = TranscodingStatus;
539
585
  type MergeQuality = VideoQuality;
540
586
  type MergeOutputFormat = "mp4" | "webm";
587
+ /**
588
+ * Text overlay shadow configuration
589
+ */
590
+ interface TextOverlayShadow {
591
+ /** Shadow color in hex format (e.g., "#000000") */
592
+ color?: string;
593
+ /** Horizontal shadow offset in pixels (0-20) */
594
+ offsetX?: number;
595
+ /** Vertical shadow offset in pixels (0-20) */
596
+ offsetY?: number;
597
+ }
598
+ /**
599
+ * Text overlay stroke/outline configuration
600
+ */
601
+ interface TextOverlayStroke {
602
+ /** Stroke color in hex format (e.g., "#000000") */
603
+ color?: string;
604
+ /** Stroke width in pixels (1-10) */
605
+ width?: number;
606
+ }
607
+ /**
608
+ * Text overlay configuration for adding captions to videos/images.
609
+ * Perfect for creating TikTok/Instagram style videos with text overlays.
610
+ */
611
+ interface TextOverlay {
612
+ /** The text to display (1-500 characters) */
613
+ text: string;
614
+ /** Vertical position of the text (default: "bottom") */
615
+ position?: "top" | "center" | "bottom";
616
+ /** Font size in pixels (12-200, default: 48) */
617
+ fontSize?: number;
618
+ /** Font family (default: "Liberation Sans") */
619
+ fontFamily?: string;
620
+ /** Font weight (default: "bold") */
621
+ fontWeight?: "normal" | "bold";
622
+ /** Text color in hex format (default: "#FFFFFF") */
623
+ color?: string;
624
+ /** Background color (e.g., "rgba(0,0,0,0.5)") */
625
+ backgroundColor?: string;
626
+ /** Padding from edges in pixels (0-100, default: 20) */
627
+ padding?: number;
628
+ /** Maximum width as percentage of video width (10-100, default: 90) */
629
+ maxWidth?: number;
630
+ /** Shadow configuration for depth effect */
631
+ shadow?: TextOverlayShadow;
632
+ /** Stroke/outline configuration for better visibility */
633
+ stroke?: TextOverlayStroke;
634
+ }
541
635
  /**
542
636
  * A single input item for the merge operation.
543
637
  * Can be a video, image, or audio file.
@@ -551,6 +645,8 @@ interface MergeInputItem {
551
645
  startTime?: number;
552
646
  /** End time in seconds for trimming (videos only) */
553
647
  endTime?: number;
648
+ /** Text overlay/caption configuration */
649
+ textOverlay?: TextOverlay;
554
650
  }
555
651
  /**
556
652
  * Audio track overlay configuration for merge jobs.
@@ -983,6 +1079,60 @@ declare class CDN {
983
1079
  * ```
984
1080
  */
985
1081
  extractAudio(request: ExtractAudioRequest): Promise<ExtractAudioResponse>;
1082
+ /**
1083
+ * Generate an animated GIF from a video segment
1084
+ *
1085
+ * Creates an optimized GIF from a portion of the video. Uses two-pass
1086
+ * palette generation by default for smaller file sizes with better quality.
1087
+ *
1088
+ * @example
1089
+ * ```typescript
1090
+ * const gif = await cdn.generateGif({
1091
+ * projectSlug: 'my-project',
1092
+ * assetId: 'video-asset-id',
1093
+ * startTime: 5, // Start at 5 seconds
1094
+ * duration: 3, // 3 second GIF
1095
+ * width: 480, // 480px wide
1096
+ * fps: 10, // 10 frames per second
1097
+ * });
1098
+ *
1099
+ * // Poll for completion
1100
+ * let result = await cdn.getGif(gif.id);
1101
+ * while (result?.status === 'pending' || result?.status === 'processing') {
1102
+ * await new Promise(r => setTimeout(r, 1000));
1103
+ * result = await cdn.getGif(gif.id);
1104
+ * }
1105
+ *
1106
+ * console.log(`GIF URL: ${result?.url}`);
1107
+ * ```
1108
+ */
1109
+ generateGif(request: GenerateGifRequest): Promise<VideoGif>;
1110
+ /**
1111
+ * Get a specific GIF by ID
1112
+ *
1113
+ * @example
1114
+ * ```typescript
1115
+ * const gif = await cdn.getGif('gif-id');
1116
+ * if (gif?.status === 'completed') {
1117
+ * console.log(`GIF URL: ${gif.url}`);
1118
+ * console.log(`Size: ${gif.sizeBytes} bytes`);
1119
+ * }
1120
+ * ```
1121
+ */
1122
+ getGif(gifId: string): Promise<VideoGif | null>;
1123
+ /**
1124
+ * List all GIFs generated for a video asset
1125
+ *
1126
+ * @example
1127
+ * ```typescript
1128
+ * const gifs = await cdn.listGifs({ assetId: 'video-asset-id' });
1129
+ * for (const gif of gifs) {
1130
+ * console.log(`GIF at ${gif.startTime}s: ${gif.url}`);
1131
+ * }
1132
+ * ```
1133
+ */
1134
+ listGifs(request: ListGifsRequest): Promise<VideoGif[]>;
1135
+ private convertGifDates;
986
1136
  private convertJobDates;
987
1137
  /**
988
1138
  * Generate a presigned URL for uploading a private file
@@ -1333,4 +1483,4 @@ declare class CDN {
1333
1483
  private convertMergeJobWithOutputDates;
1334
1484
  }
1335
1485
 
1336
- export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateMergeJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type ImageWatermarkConfig, type ImageWatermarkPosition, type ImageWatermarkSizingMode, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
1486
+ export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateMergeJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GenerateGifRequest, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type GifStatus, type ImageWatermarkConfig, type ImageWatermarkPosition, type ImageWatermarkSizingMode, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListGifsRequest, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type TextOverlay, type TextOverlayShadow, type TextOverlayStroke, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoGif, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
@@ -306,6 +306,52 @@ interface ExtractAudioResponse {
306
306
  jobId: string;
307
307
  status: TranscodingStatus;
308
308
  }
309
+ type GifStatus = "pending" | "processing" | "completed" | "failed";
310
+ interface GenerateGifRequest {
311
+ /** Project slug */
312
+ projectSlug: string;
313
+ /** ID of the video asset to generate GIF from */
314
+ assetId: string;
315
+ /** Start time in seconds (default: 0) */
316
+ startTime?: number;
317
+ /** Duration in seconds (0.5-30, default: 5) */
318
+ duration?: number;
319
+ /** Output width in pixels (100-800, default: 480) */
320
+ width?: number;
321
+ /** Frames per second (5-30, default: 10) */
322
+ fps?: number;
323
+ /** Use two-pass palette optimization for smaller file size (default: true) */
324
+ optimizePalette?: boolean;
325
+ }
326
+ interface VideoGif {
327
+ id: string;
328
+ assetId: string;
329
+ /** Start time in seconds */
330
+ startTime: number;
331
+ /** Duration in seconds */
332
+ duration: number;
333
+ /** Frames per second */
334
+ fps: number;
335
+ /** CDN URL of the generated GIF (null if pending/processing) */
336
+ url: string | null;
337
+ /** Width in pixels */
338
+ width: number | null;
339
+ /** Height in pixels */
340
+ height: number | null;
341
+ /** File size in bytes */
342
+ sizeBytes: number | null;
343
+ /** Number of frames in the GIF */
344
+ frameCount: number | null;
345
+ /** Current status of the GIF generation */
346
+ status: GifStatus;
347
+ /** Error message if failed */
348
+ errorMessage: string | null;
349
+ createdAt: Date;
350
+ completedAt: Date | null;
351
+ }
352
+ interface ListGifsRequest {
353
+ assetId: string;
354
+ }
309
355
  type PrivateFileStatus = "pending" | "ready" | "failed" | "deleted";
310
356
  interface PrivateFile {
311
357
  id: string;
@@ -538,6 +584,54 @@ interface MovePrivateFilesResponse {
538
584
  type MergeStatus = TranscodingStatus;
539
585
  type MergeQuality = VideoQuality;
540
586
  type MergeOutputFormat = "mp4" | "webm";
587
+ /**
588
+ * Text overlay shadow configuration
589
+ */
590
+ interface TextOverlayShadow {
591
+ /** Shadow color in hex format (e.g., "#000000") */
592
+ color?: string;
593
+ /** Horizontal shadow offset in pixels (0-20) */
594
+ offsetX?: number;
595
+ /** Vertical shadow offset in pixels (0-20) */
596
+ offsetY?: number;
597
+ }
598
+ /**
599
+ * Text overlay stroke/outline configuration
600
+ */
601
+ interface TextOverlayStroke {
602
+ /** Stroke color in hex format (e.g., "#000000") */
603
+ color?: string;
604
+ /** Stroke width in pixels (1-10) */
605
+ width?: number;
606
+ }
607
+ /**
608
+ * Text overlay configuration for adding captions to videos/images.
609
+ * Perfect for creating TikTok/Instagram style videos with text overlays.
610
+ */
611
+ interface TextOverlay {
612
+ /** The text to display (1-500 characters) */
613
+ text: string;
614
+ /** Vertical position of the text (default: "bottom") */
615
+ position?: "top" | "center" | "bottom";
616
+ /** Font size in pixels (12-200, default: 48) */
617
+ fontSize?: number;
618
+ /** Font family (default: "Liberation Sans") */
619
+ fontFamily?: string;
620
+ /** Font weight (default: "bold") */
621
+ fontWeight?: "normal" | "bold";
622
+ /** Text color in hex format (default: "#FFFFFF") */
623
+ color?: string;
624
+ /** Background color (e.g., "rgba(0,0,0,0.5)") */
625
+ backgroundColor?: string;
626
+ /** Padding from edges in pixels (0-100, default: 20) */
627
+ padding?: number;
628
+ /** Maximum width as percentage of video width (10-100, default: 90) */
629
+ maxWidth?: number;
630
+ /** Shadow configuration for depth effect */
631
+ shadow?: TextOverlayShadow;
632
+ /** Stroke/outline configuration for better visibility */
633
+ stroke?: TextOverlayStroke;
634
+ }
541
635
  /**
542
636
  * A single input item for the merge operation.
543
637
  * Can be a video, image, or audio file.
@@ -551,6 +645,8 @@ interface MergeInputItem {
551
645
  startTime?: number;
552
646
  /** End time in seconds for trimming (videos only) */
553
647
  endTime?: number;
648
+ /** Text overlay/caption configuration */
649
+ textOverlay?: TextOverlay;
554
650
  }
555
651
  /**
556
652
  * Audio track overlay configuration for merge jobs.
@@ -983,6 +1079,60 @@ declare class CDN {
983
1079
  * ```
984
1080
  */
985
1081
  extractAudio(request: ExtractAudioRequest): Promise<ExtractAudioResponse>;
1082
+ /**
1083
+ * Generate an animated GIF from a video segment
1084
+ *
1085
+ * Creates an optimized GIF from a portion of the video. Uses two-pass
1086
+ * palette generation by default for smaller file sizes with better quality.
1087
+ *
1088
+ * @example
1089
+ * ```typescript
1090
+ * const gif = await cdn.generateGif({
1091
+ * projectSlug: 'my-project',
1092
+ * assetId: 'video-asset-id',
1093
+ * startTime: 5, // Start at 5 seconds
1094
+ * duration: 3, // 3 second GIF
1095
+ * width: 480, // 480px wide
1096
+ * fps: 10, // 10 frames per second
1097
+ * });
1098
+ *
1099
+ * // Poll for completion
1100
+ * let result = await cdn.getGif(gif.id);
1101
+ * while (result?.status === 'pending' || result?.status === 'processing') {
1102
+ * await new Promise(r => setTimeout(r, 1000));
1103
+ * result = await cdn.getGif(gif.id);
1104
+ * }
1105
+ *
1106
+ * console.log(`GIF URL: ${result?.url}`);
1107
+ * ```
1108
+ */
1109
+ generateGif(request: GenerateGifRequest): Promise<VideoGif>;
1110
+ /**
1111
+ * Get a specific GIF by ID
1112
+ *
1113
+ * @example
1114
+ * ```typescript
1115
+ * const gif = await cdn.getGif('gif-id');
1116
+ * if (gif?.status === 'completed') {
1117
+ * console.log(`GIF URL: ${gif.url}`);
1118
+ * console.log(`Size: ${gif.sizeBytes} bytes`);
1119
+ * }
1120
+ * ```
1121
+ */
1122
+ getGif(gifId: string): Promise<VideoGif | null>;
1123
+ /**
1124
+ * List all GIFs generated for a video asset
1125
+ *
1126
+ * @example
1127
+ * ```typescript
1128
+ * const gifs = await cdn.listGifs({ assetId: 'video-asset-id' });
1129
+ * for (const gif of gifs) {
1130
+ * console.log(`GIF at ${gif.startTime}s: ${gif.url}`);
1131
+ * }
1132
+ * ```
1133
+ */
1134
+ listGifs(request: ListGifsRequest): Promise<VideoGif[]>;
1135
+ private convertGifDates;
986
1136
  private convertJobDates;
987
1137
  /**
988
1138
  * Generate a presigned URL for uploading a private file
@@ -1333,4 +1483,4 @@ declare class CDN {
1333
1483
  private convertMergeJobWithOutputDates;
1334
1484
  }
1335
1485
 
1336
- export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateMergeJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type ImageWatermarkConfig, type ImageWatermarkPosition, type ImageWatermarkSizingMode, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
1486
+ export { type Asset, type AssetStatus, type AssetType, type AudioTrackInput, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CancelMergeJobRequest, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type CreateMergeJobRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GenerateGifRequest, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type GetMergeJobRequest, type GifStatus, type ImageWatermarkConfig, type ImageWatermarkPosition, type ImageWatermarkSizingMode, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListGifsRequest, type ListJobsRequest, type ListJobsResponse, type ListMergeJobsRequest, type ListMergeJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MergeInputItem, type MergeJob, type MergeJobWithOutput, type MergeOutputConfig, type MergeOutputFormat, type MergeQuality, type MergeStatus, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type TextOverlay, type TextOverlayShadow, type TextOverlayStroke, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoGif, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
package/dist/cdn/index.js CHANGED
@@ -558,6 +558,80 @@ var CDN = class {
558
558
  async extractAudio(request) {
559
559
  return this.http.post("/cdn/video/extract-audio", request);
560
560
  }
561
+ // ============================================================================
562
+ // GIF Generation Methods
563
+ // ============================================================================
564
+ /**
565
+ * Generate an animated GIF from a video segment
566
+ *
567
+ * Creates an optimized GIF from a portion of the video. Uses two-pass
568
+ * palette generation by default for smaller file sizes with better quality.
569
+ *
570
+ * @example
571
+ * ```typescript
572
+ * const gif = await cdn.generateGif({
573
+ * projectSlug: 'my-project',
574
+ * assetId: 'video-asset-id',
575
+ * startTime: 5, // Start at 5 seconds
576
+ * duration: 3, // 3 second GIF
577
+ * width: 480, // 480px wide
578
+ * fps: 10, // 10 frames per second
579
+ * });
580
+ *
581
+ * // Poll for completion
582
+ * let result = await cdn.getGif(gif.id);
583
+ * while (result?.status === 'pending' || result?.status === 'processing') {
584
+ * await new Promise(r => setTimeout(r, 1000));
585
+ * result = await cdn.getGif(gif.id);
586
+ * }
587
+ *
588
+ * console.log(`GIF URL: ${result?.url}`);
589
+ * ```
590
+ */
591
+ async generateGif(request) {
592
+ const response = await this.http.post("/cdn/video/gif", request);
593
+ return this.convertGifDates(response);
594
+ }
595
+ /**
596
+ * Get a specific GIF by ID
597
+ *
598
+ * @example
599
+ * ```typescript
600
+ * const gif = await cdn.getGif('gif-id');
601
+ * if (gif?.status === 'completed') {
602
+ * console.log(`GIF URL: ${gif.url}`);
603
+ * console.log(`Size: ${gif.sizeBytes} bytes`);
604
+ * }
605
+ * ```
606
+ */
607
+ async getGif(gifId) {
608
+ const response = await this.http.get(`/cdn/video/gif/${gifId}`);
609
+ return response ? this.convertGifDates(response) : null;
610
+ }
611
+ /**
612
+ * List all GIFs generated for a video asset
613
+ *
614
+ * @example
615
+ * ```typescript
616
+ * const gifs = await cdn.listGifs({ assetId: 'video-asset-id' });
617
+ * for (const gif of gifs) {
618
+ * console.log(`GIF at ${gif.startTime}s: ${gif.url}`);
619
+ * }
620
+ * ```
621
+ */
622
+ async listGifs(request) {
623
+ const response = await this.http.get(`/cdn/video/${request.assetId}/gifs`);
624
+ return response.map((gif) => this.convertGifDates(gif));
625
+ }
626
+ convertGifDates(gif) {
627
+ if (typeof gif.createdAt === "string") {
628
+ gif.createdAt = new Date(gif.createdAt);
629
+ }
630
+ if (gif.completedAt && typeof gif.completedAt === "string") {
631
+ gif.completedAt = new Date(gif.completedAt);
632
+ }
633
+ return gif;
634
+ }
561
635
  convertJobDates(job) {
562
636
  if (typeof job.createdAt === "string") {
563
637
  job.createdAt = new Date(job.createdAt);