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.
- package/dist/cjs/index.js +39 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Ads.d.ts +7 -4
- package/dist/esm/api/Scheduler.d.ts +13 -0
- package/dist/esm/index.js +39 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +19 -3
- package/package.json +1 -1
- package/src/api/Ads.ts +55 -34
- package/src/api/Scheduler.ts +26 -0
- package/src/routes/SchedulerRoute.ts +4 -0
package/dist/index.d.ts
CHANGED
|
@@ -927,9 +927,12 @@ declare class Ads {
|
|
|
927
927
|
static viewFacebookAdPost<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
928
928
|
static updateFacebookAdPost<T>(post_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
929
929
|
static deleteFacebookAdPost<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
930
|
-
static
|
|
931
|
-
static
|
|
932
|
-
static
|
|
930
|
+
static tiktokUploadImageFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
931
|
+
static tiktokUploadVideoFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
932
|
+
static tiktokUploadMusicFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
933
|
+
static tiktokUploadImageBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
934
|
+
static tiktokUploadVideoBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
935
|
+
static tiktokUploadMusicBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
933
936
|
static tiktokGetMediaInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
|
|
934
937
|
/**
|
|
935
938
|
* Sync an Ad with the remote platform.
|
|
@@ -4757,6 +4760,19 @@ declare class Scheduler {
|
|
|
4757
4760
|
* @returns promise
|
|
4758
4761
|
*/
|
|
4759
4762
|
static getSchedulePosts<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4763
|
+
/**
|
|
4764
|
+
* Rewrite / generate content for a promotion schedule.
|
|
4765
|
+
*
|
|
4766
|
+
* @see https://api.glitch.fun/api/documentation#/Scheduler/generateTitleContent
|
|
4767
|
+
*
|
|
4768
|
+
* @param scheduler_id UUID of the promotion schedule.
|
|
4769
|
+
* @param data Body payload. At minimum you must supply
|
|
4770
|
+
* `{ platform: 'twitter' }` plus either `content`
|
|
4771
|
+
* **or** a `media` array containing at least one
|
|
4772
|
+
* `{ id: '<media-uuid>' }`.
|
|
4773
|
+
* @returns Axios promise with `{ content, title? }`
|
|
4774
|
+
*/
|
|
4775
|
+
static generateTitleContent<T>(scheduler_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4760
4776
|
/**
|
|
4761
4777
|
* List title updates for a promotion schedule.
|
|
4762
4778
|
*
|
package/package.json
CHANGED
package/src/api/Ads.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import AdsRoute from "../routes/AdsRoute";
|
|
2
2
|
import Requests from "../util/Requests";
|
|
3
3
|
import Response from "../util/Response";
|
|
4
|
-
import { AxiosPromise } from "axios";
|
|
4
|
+
import { AxiosPromise, AxiosProgressEvent } from "axios";
|
|
5
|
+
|
|
5
6
|
|
|
6
7
|
class Ads {
|
|
7
8
|
// ----------------------------------------------------------------------
|
|
@@ -742,41 +743,61 @@ class Ads {
|
|
|
742
743
|
);
|
|
743
744
|
}
|
|
744
745
|
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
);
|
|
755
|
-
}
|
|
746
|
+
// TikTok Uploads: FILE
|
|
747
|
+
public static tiktokUploadImageFile<T>(
|
|
748
|
+
file: File,
|
|
749
|
+
data?: object,
|
|
750
|
+
params?: Record<string, any>,
|
|
751
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
|
|
752
|
+
): AxiosPromise<Response<T>> {
|
|
753
|
+
return Requests.uploadFile(AdsRoute.routes.tiktokUploadImage.url, 'image_file', file, data, params, onUploadProgress);
|
|
754
|
+
}
|
|
756
755
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
params
|
|
766
|
-
);
|
|
767
|
-
}
|
|
756
|
+
public static tiktokUploadVideoFile<T>(
|
|
757
|
+
file: File,
|
|
758
|
+
data?: object,
|
|
759
|
+
params?: Record<string, any>,
|
|
760
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
|
|
761
|
+
): AxiosPromise<Response<T>> {
|
|
762
|
+
return Requests.uploadFile(AdsRoute.routes.tiktokUploadVideo.url, 'video_file', file, data, params, onUploadProgress);
|
|
763
|
+
}
|
|
768
764
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
765
|
+
public static tiktokUploadMusicFile<T>(
|
|
766
|
+
file: File,
|
|
767
|
+
data?: object,
|
|
768
|
+
params?: Record<string, any>,
|
|
769
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
|
|
770
|
+
): AxiosPromise<Response<T>> {
|
|
771
|
+
return Requests.uploadFile(AdsRoute.routes.tiktokUploadMusic.url, 'music_file', file, data, params, onUploadProgress);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
// TikTok Uploads: BLOB
|
|
775
|
+
public static tiktokUploadImageBlob<T>(
|
|
776
|
+
blob: Blob,
|
|
777
|
+
data?: object,
|
|
778
|
+
params?: Record<string, any>,
|
|
779
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
|
|
780
|
+
): AxiosPromise<Response<T>> {
|
|
781
|
+
return Requests.uploadBlob(AdsRoute.routes.tiktokUploadImage.url, 'image_file', blob, data, params, onUploadProgress);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
public static tiktokUploadVideoBlob<T>(
|
|
785
|
+
blob: Blob,
|
|
786
|
+
data?: object,
|
|
787
|
+
params?: Record<string, any>,
|
|
788
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
|
|
789
|
+
): AxiosPromise<Response<T>> {
|
|
790
|
+
return Requests.uploadBlob(AdsRoute.routes.tiktokUploadVideo.url, 'video_file', blob, data, params, onUploadProgress);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
public static tiktokUploadMusicBlob<T>(
|
|
794
|
+
blob: Blob,
|
|
795
|
+
data?: object,
|
|
796
|
+
params?: Record<string, any>,
|
|
797
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
|
|
798
|
+
): AxiosPromise<Response<T>> {
|
|
799
|
+
return Requests.uploadBlob(AdsRoute.routes.tiktokUploadMusic.url, 'music_file', blob, data, params, onUploadProgress);
|
|
800
|
+
}
|
|
780
801
|
|
|
781
802
|
public static tiktokGetMediaInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>> {
|
|
782
803
|
return Requests.processRoute(
|
package/src/api/Scheduler.ts
CHANGED
|
@@ -95,6 +95,32 @@ class Scheduler {
|
|
|
95
95
|
return Requests.processRoute(SchedulerRoute.routes.getSchedulePosts, {}, { scheduler_id }, params);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Rewrite / generate content for a promotion schedule.
|
|
100
|
+
*
|
|
101
|
+
* @see https://api.glitch.fun/api/documentation#/Scheduler/generateTitleContent
|
|
102
|
+
*
|
|
103
|
+
* @param scheduler_id UUID of the promotion schedule.
|
|
104
|
+
* @param data Body payload. At minimum you must supply
|
|
105
|
+
* `{ platform: 'twitter' }` plus either `content`
|
|
106
|
+
* **or** a `media` array containing at least one
|
|
107
|
+
* `{ id: '<media-uuid>' }`.
|
|
108
|
+
* @returns Axios promise with `{ content, title? }`
|
|
109
|
+
*/
|
|
110
|
+
public static generateTitleContent<T>(
|
|
111
|
+
scheduler_id: string,
|
|
112
|
+
data: object,
|
|
113
|
+
params?: Record<string, any>
|
|
114
|
+
): AxiosPromise<Response<T>> {
|
|
115
|
+
return Requests.processRoute(
|
|
116
|
+
SchedulerRoute.routes.generateContent,
|
|
117
|
+
data, // request body
|
|
118
|
+
{ scheduler_id }, // path params
|
|
119
|
+
params // query params
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
98
124
|
/**
|
|
99
125
|
* List title updates for a promotion schedule.
|
|
100
126
|
*
|