glitch-javascript-sdk 1.9.1 → 1.9.3

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.
@@ -1,5 +1,5 @@
1
1
  import Response from "../util/Response";
2
- import { AxiosPromise } from "axios";
2
+ import { AxiosPromise, AxiosProgressEvent } from "axios";
3
3
  declare class Ads {
4
4
  /**
5
5
  * List Ad Campaigns.
@@ -285,9 +285,12 @@ declare class Ads {
285
285
  static viewFacebookAdPost<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
286
286
  static updateFacebookAdPost<T>(post_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
287
287
  static deleteFacebookAdPost<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
288
- static tiktokUploadImage<T>(data: FormData, params?: Record<string, any>): AxiosPromise<Response<T>>;
289
- static tiktokUploadVideo<T>(data: FormData, params?: Record<string, any>): AxiosPromise<Response<T>>;
290
- static tiktokUploadMusic<T>(data: FormData, params?: Record<string, any>): AxiosPromise<Response<T>>;
288
+ static tiktokUploadImageFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
289
+ static tiktokUploadVideoFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
290
+ static tiktokUploadMusicFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
291
+ static tiktokUploadImageBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
292
+ static tiktokUploadVideoBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
293
+ static tiktokUploadMusicBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
291
294
  static tiktokGetMediaInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
292
295
  /**
293
296
  * Sync an Ad with the remote platform.
@@ -71,6 +71,19 @@ declare class Scheduler {
71
71
  * @returns promise
72
72
  */
73
73
  static getSchedulePosts<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
74
+ /**
75
+ * Rewrite / generate content for a promotion schedule.
76
+ *
77
+ * @see https://api.glitch.fun/api/documentation#/Scheduler/generateTitleContent
78
+ *
79
+ * @param scheduler_id UUID of the promotion schedule.
80
+ * @param data Body payload. At minimum you must supply
81
+ * `{ platform: 'twitter' }` plus either `content`
82
+ * **or** a `media` array containing at least one
83
+ * `{ id: '<media-uuid>' }`.
84
+ * @returns Axios promise with `{ content, title? }`
85
+ */
86
+ static generateTitleContent<T>(scheduler_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
74
87
  /**
75
88
  * List title updates for a promotion schedule.
76
89
  *
package/dist/esm/index.js CHANGED
@@ -7316,14 +7316,25 @@ var Ads = /** @class */ (function () {
7316
7316
  Ads.deleteFacebookAdPost = function (post_id, params) {
7317
7317
  return Requests.processRoute(AdsRoute.routes.deleteFacebookAdPost, {}, { post_id: post_id }, params);
7318
7318
  };
7319
- Ads.tiktokUploadImage = function (data, params) {
7320
- return Requests.processRoute(AdsRoute.routes.tiktokUploadImage, data, {}, params);
7319
+ // TikTok Uploads: FILE
7320
+ Ads.tiktokUploadImageFile = function (file, data, params, onUploadProgress) {
7321
+ return Requests.uploadFile(AdsRoute.routes.tiktokUploadImage.url, 'image_file', file, data, params, onUploadProgress);
7321
7322
  };
7322
- Ads.tiktokUploadVideo = function (data, params) {
7323
- return Requests.processRoute(AdsRoute.routes.tiktokUploadVideo, data, {}, params);
7323
+ Ads.tiktokUploadVideoFile = function (file, data, params, onUploadProgress) {
7324
+ return Requests.uploadFile(AdsRoute.routes.tiktokUploadVideo.url, 'video_file', file, data, params, onUploadProgress);
7324
7325
  };
7325
- Ads.tiktokUploadMusic = function (data, params) {
7326
- return Requests.processRoute(AdsRoute.routes.tiktokUploadMusic, data, {}, params);
7326
+ Ads.tiktokUploadMusicFile = function (file, data, params, onUploadProgress) {
7327
+ return Requests.uploadFile(AdsRoute.routes.tiktokUploadMusic.url, 'music_file', file, data, params, onUploadProgress);
7328
+ };
7329
+ // TikTok Uploads: BLOB
7330
+ Ads.tiktokUploadImageBlob = function (blob, data, params, onUploadProgress) {
7331
+ return Requests.uploadBlob(AdsRoute.routes.tiktokUploadImage.url, 'image_file', blob, data, params, onUploadProgress);
7332
+ };
7333
+ Ads.tiktokUploadVideoBlob = function (blob, data, params, onUploadProgress) {
7334
+ return Requests.uploadBlob(AdsRoute.routes.tiktokUploadVideo.url, 'video_file', blob, data, params, onUploadProgress);
7335
+ };
7336
+ Ads.tiktokUploadMusicBlob = function (blob, data, params, onUploadProgress) {
7337
+ return Requests.uploadBlob(AdsRoute.routes.tiktokUploadMusic.url, 'music_file', blob, data, params, onUploadProgress);
7327
7338
  };
7328
7339
  Ads.tiktokGetMediaInfo = function (params) {
7329
7340
  return Requests.processRoute(AdsRoute.routes.tiktokGetMediaInfo, undefined, undefined, params);
@@ -12867,6 +12878,10 @@ var SchedulerRoute = /** @class */ (function () {
12867
12878
  url: "/schedulers/{scheduler_id}/funding_instruments",
12868
12879
  method: HTTP_METHODS.GET,
12869
12880
  },
12881
+ generateContent: {
12882
+ url: '/schedulers/{scheduler_id}/generateContent',
12883
+ method: HTTP_METHODS.POST
12884
+ },
12870
12885
  };
12871
12886
  return SchedulerRoute;
12872
12887
  }());
@@ -12958,6 +12973,24 @@ var Scheduler = /** @class */ (function () {
12958
12973
  Scheduler.getSchedulePosts = function (scheduler_id, params) {
12959
12974
  return Requests.processRoute(SchedulerRoute.routes.getSchedulePosts, {}, { scheduler_id: scheduler_id }, params);
12960
12975
  };
12976
+ /**
12977
+ * Rewrite / generate content for a promotion schedule.
12978
+ *
12979
+ * @see https://api.glitch.fun/api/documentation#/Scheduler/generateTitleContent
12980
+ *
12981
+ * @param scheduler_id UUID of the promotion schedule.
12982
+ * @param data Body payload. At minimum you must supply
12983
+ * `{ platform: 'twitter' }` plus either `content`
12984
+ * **or** a `media` array containing at least one
12985
+ * `{ id: '<media-uuid>' }`.
12986
+ * @returns Axios promise with `{ content, title? }`
12987
+ */
12988
+ Scheduler.generateTitleContent = function (scheduler_id, data, params) {
12989
+ return Requests.processRoute(SchedulerRoute.routes.generateContent, data, // request body
12990
+ { scheduler_id: scheduler_id }, // path params
12991
+ params // query params
12992
+ );
12993
+ };
12961
12994
  /**
12962
12995
  * List title updates for a promotion schedule.
12963
12996
  *