glitch-javascript-sdk 2.9.8 → 3.0.0

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.
@@ -97,6 +97,37 @@ export interface S3ConfirmRequest {
97
97
  title?: string;
98
98
  filename?: string;
99
99
  }
100
+ /**
101
+ * Interfaces for the Video Editor Manifest
102
+ */
103
+ export interface VideoEdit {
104
+ type: 'trim' | 'crop' | 'text' | 'speed' | 'overlay' | 'thumbnail';
105
+ params: TrimParams | CropParams | TextParams | SpeedParams | any;
106
+ }
107
+ export interface TrimParams {
108
+ start: number;
109
+ duration: number;
110
+ }
111
+ export interface CropParams {
112
+ x: number;
113
+ y: number;
114
+ width: number;
115
+ height: number;
116
+ }
117
+ export interface TextParams {
118
+ text: string;
119
+ x: string | number;
120
+ y: string | number;
121
+ fontSize: number;
122
+ fontColor: string;
123
+ }
124
+ export interface SpeedParams {
125
+ multiplier: number;
126
+ }
127
+ export interface VideoProcessRequest {
128
+ edits: VideoEdit[];
129
+ output_format?: 'mp4' | 'webm';
130
+ }
100
131
  declare class Media {
101
132
  /**
102
133
  * Upload media content using a File object.
@@ -249,5 +280,14 @@ declare class Media {
249
280
  * @returns AxiosPromise containing the created Media resource.
250
281
  */
251
282
  static confirmS3Upload<T>(data: S3ConfirmRequest): AxiosPromise<Response<T>>;
283
+ /**
284
+ * Submit a video for processing (Trim, Crop, Text, etc.)
285
+ * This triggers a background job on the server.
286
+ *
287
+ * @param media_id The UUID of the source video.
288
+ * @param data The edit manifest containing the array of transformations.
289
+ * @returns Promise with the pending_media_id.
290
+ */
291
+ static process<T>(media_id: string, data: VideoProcessRequest): AxiosPromise<Response<T>>;
252
292
  }
253
293
  export default Media;
@@ -416,5 +416,54 @@ declare class Users {
416
416
  title_id?: string;
417
417
  page?: number;
418
418
  }): AxiosPromise<Response<T>>;
419
+ /**
420
+ * List the authenticated user's media library (clips, screenshots, AI generated).
421
+ *
422
+ * @param params Optional filters: { type: 'clip'|'screenshot'|'ai_generated', title_id: string }
423
+ */
424
+ static listMedia<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
425
+ /**
426
+ * Add a Media record to the user's personal library.
427
+ *
428
+ * @param data { media_id: string, type: string, title_id?: string, label?: string, studio_metadata?: object }
429
+ */
430
+ static storeMedia<T>(data: object): AxiosPromise<Response<T>>;
431
+ /**
432
+ * Retrieve details for a specific library item.
433
+ */
434
+ static viewMedia<T>(id: string): AxiosPromise<Response<T>>;
435
+ /**
436
+ * Update a library item's label or metadata.
437
+ */
438
+ static updateMedia<T>(id: string, data: object): AxiosPromise<Response<T>>;
439
+ /**
440
+ * Remove an item from the user's library (Soft Delete).
441
+ */
442
+ static deleteMedia<T>(id: string): AxiosPromise<Response<T>>;
443
+ /**
444
+ * Apply AI transformations (Style Transfer/Upscale) to a library item.
445
+ *
446
+ * @param id The UUID of the UserMedia record.
447
+ * @param data { prompt: string, tool: 'style_transfer'|'upscale' }
448
+ */
449
+ static modifyMedia<T>(id: string, data: {
450
+ prompt: string;
451
+ tool: string;
452
+ }): AxiosPromise<Response<T>>;
453
+ /**
454
+ * Get AI-generated suggestions for the best 15-second window to trim a video.
455
+ */
456
+ static suggestSmartTrim<T>(id: string): AxiosPromise<Response<T>>;
457
+ /**
458
+ * Share a library item to social media as User Generated Content (UGC).
459
+ *
460
+ * @param id The UUID of the UserMedia record.
461
+ * @param data { platform: string, title?: string, content: string }
462
+ */
463
+ static shareMedia<T>(id: string, data: {
464
+ platform: string;
465
+ title?: string;
466
+ content: string;
467
+ }): AxiosPromise<Response<T>>;
419
468
  }
420
469
  export default Users;
package/dist/esm/index.js CHANGED
@@ -8805,6 +8805,16 @@ var UserRoutes = /** @class */ (function () {
8805
8805
  userProgressionStats: { url: '/users/{user_id}/progression/stats', method: HTTP_METHODS.GET },
8806
8806
  userProgressionAchievements: { url: '/users/{user_id}/progression/achievements', method: HTTP_METHODS.GET },
8807
8807
  userProgressionHistory: { url: '/users/{user_id}/progression/history', method: HTTP_METHODS.GET },
8808
+ // --- User Media Library (Viral Clip Studio) ---
8809
+ listMedia: { url: '/users/me/media', method: HTTP_METHODS.GET },
8810
+ storeMedia: { url: '/users/me/media', method: HTTP_METHODS.POST },
8811
+ viewMedia: { url: '/users/me/media/{id}', method: HTTP_METHODS.GET },
8812
+ updateMedia: { url: '/users/me/media/{id}', method: HTTP_METHODS.PUT },
8813
+ deleteMedia: { url: '/users/me/media/{id}', method: HTTP_METHODS.DELETE },
8814
+ // AI & Social Actions
8815
+ modifyMedia: { url: '/users/me/media/{id}/modify', method: HTTP_METHODS.POST },
8816
+ suggestSmartTrim: { url: '/users/me/media/{id}/smart-trim', method: HTTP_METHODS.GET },
8817
+ shareMedia: { url: '/users/me/media/{id}/share', method: HTTP_METHODS.POST },
8808
8818
  };
8809
8819
  return UserRoutes;
8810
8820
  }());
@@ -9313,6 +9323,64 @@ var Users = /** @class */ (function () {
9313
9323
  Users.getProgressionHistory = function (user_id, params) {
9314
9324
  return Requests.processRoute(UserRoutes.routes.userProgressionHistory, undefined, { user_id: user_id }, params);
9315
9325
  };
9326
+ /**
9327
+ * List the authenticated user's media library (clips, screenshots, AI generated).
9328
+ *
9329
+ * @param params Optional filters: { type: 'clip'|'screenshot'|'ai_generated', title_id: string }
9330
+ */
9331
+ Users.listMedia = function (params) {
9332
+ return Requests.processRoute(UserRoutes.routes.listMedia, undefined, undefined, params);
9333
+ };
9334
+ /**
9335
+ * Add a Media record to the user's personal library.
9336
+ *
9337
+ * @param data { media_id: string, type: string, title_id?: string, label?: string, studio_metadata?: object }
9338
+ */
9339
+ Users.storeMedia = function (data) {
9340
+ return Requests.processRoute(UserRoutes.routes.storeMedia, data);
9341
+ };
9342
+ /**
9343
+ * Retrieve details for a specific library item.
9344
+ */
9345
+ Users.viewMedia = function (id) {
9346
+ return Requests.processRoute(UserRoutes.routes.viewMedia, undefined, { id: id });
9347
+ };
9348
+ /**
9349
+ * Update a library item's label or metadata.
9350
+ */
9351
+ Users.updateMedia = function (id, data) {
9352
+ return Requests.processRoute(UserRoutes.routes.updateMedia, data, { id: id });
9353
+ };
9354
+ /**
9355
+ * Remove an item from the user's library (Soft Delete).
9356
+ */
9357
+ Users.deleteMedia = function (id) {
9358
+ return Requests.processRoute(UserRoutes.routes.deleteMedia, undefined, { id: id });
9359
+ };
9360
+ /**
9361
+ * Apply AI transformations (Style Transfer/Upscale) to a library item.
9362
+ *
9363
+ * @param id The UUID of the UserMedia record.
9364
+ * @param data { prompt: string, tool: 'style_transfer'|'upscale' }
9365
+ */
9366
+ Users.modifyMedia = function (id, data) {
9367
+ return Requests.processRoute(UserRoutes.routes.modifyMedia, data, { id: id });
9368
+ };
9369
+ /**
9370
+ * Get AI-generated suggestions for the best 15-second window to trim a video.
9371
+ */
9372
+ Users.suggestSmartTrim = function (id) {
9373
+ return Requests.processRoute(UserRoutes.routes.suggestSmartTrim, undefined, { id: id });
9374
+ };
9375
+ /**
9376
+ * Share a library item to social media as User Generated Content (UGC).
9377
+ *
9378
+ * @param id The UUID of the UserMedia record.
9379
+ * @param data { platform: string, title?: string, content: string }
9380
+ */
9381
+ Users.shareMedia = function (id, data) {
9382
+ return Requests.processRoute(UserRoutes.routes.shareMedia, data, { id: id });
9383
+ };
9316
9384
  return Users;
9317
9385
  }());
9318
9386
 
@@ -14845,6 +14913,7 @@ var MediaRoute = /** @class */ (function () {
14845
14913
  uploadTikTokMusic: { url: '/media/tiktok/music', method: HTTP_METHODS.POST },
14846
14914
  getPresignedUrl: { url: '/media/presigned-url', method: HTTP_METHODS.POST },
14847
14915
  confirmS3Upload: { url: '/media/s3-confirm', method: HTTP_METHODS.POST },
14916
+ processVideo: { url: '/media/{media_id}/process', method: HTTP_METHODS.POST },
14848
14917
  };
14849
14918
  return MediaRoute;
14850
14919
  }());
@@ -15096,6 +15165,17 @@ var Media = /** @class */ (function () {
15096
15165
  Media.confirmS3Upload = function (data) {
15097
15166
  return Requests.processRoute(MediaRoute.routes.confirmS3Upload, data);
15098
15167
  };
15168
+ /**
15169
+ * Submit a video for processing (Trim, Crop, Text, etc.)
15170
+ * This triggers a background job on the server.
15171
+ *
15172
+ * @param media_id The UUID of the source video.
15173
+ * @param data The edit manifest containing the array of transformations.
15174
+ * @returns Promise with the pending_media_id.
15175
+ */
15176
+ Media.process = function (media_id, data) {
15177
+ return Requests.processRoute(MediaRoute.routes.processVideo, data, { media_id: media_id });
15178
+ };
15099
15179
  return Media;
15100
15180
  }());
15101
15181