glitch-javascript-sdk 1.9.2 → 1.9.4
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 +76 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Ads.d.ts +16 -0
- package/dist/esm/api/Scheduler.d.ts +27 -0
- package/dist/esm/index.js +76 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +43 -0
- package/package.json +1 -1
- package/src/api/Ads.ts +87 -49
- package/src/api/Scheduler.ts +62 -0
- package/src/routes/AdsRoute.ts +8 -0
- package/src/routes/SchedulerRoute.ts +6 -0
package/dist/index.d.ts
CHANGED
|
@@ -1000,6 +1000,22 @@ declare class Ads {
|
|
|
1000
1000
|
static twitterBatchTargetingCriteria<T>(data: object[], params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
1001
1001
|
static lookupTwitterTargeting<T>(resource: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
1002
1002
|
static twitterTargetingSuggestions<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
|
|
1003
|
+
/**
|
|
1004
|
+
* Deep-sync a campaign tree (campaign → groups → ads) with its remote platform.
|
|
1005
|
+
*
|
|
1006
|
+
* @param campaign_id UUID of the campaign to sync
|
|
1007
|
+
* @param params Optional query params
|
|
1008
|
+
* @returns Fully-hydrated AdCampaign resource
|
|
1009
|
+
*/
|
|
1010
|
+
static syncCampaignTree<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Deep-sync all the campaigns for a scheduler.
|
|
1013
|
+
*
|
|
1014
|
+
* @param scheduler_id UUID of the campaign to sync
|
|
1015
|
+
* @param params Optional query params
|
|
1016
|
+
* @returns Fully-hydrated AdCampaign resource
|
|
1017
|
+
*/
|
|
1018
|
+
static syncSchedulerCampaigns<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
1003
1019
|
}
|
|
1004
1020
|
|
|
1005
1021
|
declare class Communities {
|
|
@@ -4760,6 +4776,19 @@ declare class Scheduler {
|
|
|
4760
4776
|
* @returns promise
|
|
4761
4777
|
*/
|
|
4762
4778
|
static getSchedulePosts<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4779
|
+
/**
|
|
4780
|
+
* Rewrite / generate content for a promotion schedule.
|
|
4781
|
+
*
|
|
4782
|
+
* @see https://api.glitch.fun/api/documentation#/Scheduler/generateTitleContent
|
|
4783
|
+
*
|
|
4784
|
+
* @param scheduler_id UUID of the promotion schedule.
|
|
4785
|
+
* @param data Body payload. At minimum you must supply
|
|
4786
|
+
* `{ platform: 'twitter' }` plus either `content`
|
|
4787
|
+
* **or** a `media` array containing at least one
|
|
4788
|
+
* `{ id: '<media-uuid>' }`.
|
|
4789
|
+
* @returns Axios promise with `{ content, title? }`
|
|
4790
|
+
*/
|
|
4791
|
+
static generateTitleContent<T>(scheduler_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4763
4792
|
/**
|
|
4764
4793
|
* List title updates for a promotion schedule.
|
|
4765
4794
|
*
|
|
@@ -4978,6 +5007,20 @@ declare class Scheduler {
|
|
|
4978
5007
|
* @returns promise
|
|
4979
5008
|
*/
|
|
4980
5009
|
static getDiscordChannels<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
5010
|
+
/**
|
|
5011
|
+
* Clear Google Ads OAuth credentials from a promotion schedule.
|
|
5012
|
+
*
|
|
5013
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
5014
|
+
* @returns promise
|
|
5015
|
+
*/
|
|
5016
|
+
static clearGoogleAdsAuth<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
5017
|
+
/**
|
|
5018
|
+
* Clear Tiktok Ads OAuth credentials from a promotion schedule.
|
|
5019
|
+
*
|
|
5020
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
5021
|
+
* @returns promise
|
|
5022
|
+
*/
|
|
5023
|
+
static clearTiktokAdsAuth<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4981
5024
|
/**
|
|
4982
5025
|
* Get aggregated reports for a promotion schedule.
|
|
4983
5026
|
*
|
package/package.json
CHANGED
package/src/api/Ads.ts
CHANGED
|
@@ -744,60 +744,60 @@ class Ads {
|
|
|
744
744
|
}
|
|
745
745
|
|
|
746
746
|
// TikTok Uploads: FILE
|
|
747
|
-
public static tiktokUploadImageFile<T>(
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
): AxiosPromise<Response<T>> {
|
|
753
|
-
|
|
754
|
-
}
|
|
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
|
+
}
|
|
755
755
|
|
|
756
|
-
public static tiktokUploadVideoFile<T>(
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
): AxiosPromise<Response<T>> {
|
|
762
|
-
|
|
763
|
-
}
|
|
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
|
+
}
|
|
764
764
|
|
|
765
|
-
public static tiktokUploadMusicFile<T>(
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
): AxiosPromise<Response<T>> {
|
|
771
|
-
|
|
772
|
-
}
|
|
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
773
|
|
|
774
|
-
// TikTok Uploads: BLOB
|
|
775
|
-
public static tiktokUploadImageBlob<T>(
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
): AxiosPromise<Response<T>> {
|
|
781
|
-
|
|
782
|
-
}
|
|
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
783
|
|
|
784
|
-
public static tiktokUploadVideoBlob<T>(
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
): AxiosPromise<Response<T>> {
|
|
790
|
-
|
|
791
|
-
}
|
|
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
792
|
|
|
793
|
-
public static tiktokUploadMusicBlob<T>(
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
): AxiosPromise<Response<T>> {
|
|
799
|
-
|
|
800
|
-
}
|
|
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
|
+
}
|
|
801
801
|
|
|
802
802
|
public static tiktokGetMediaInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>> {
|
|
803
803
|
return Requests.processRoute(
|
|
@@ -989,6 +989,44 @@ public static tiktokUploadMusicBlob<T>(
|
|
|
989
989
|
return Requests.processRoute(AdsRoute.routes.twitterTargetingSuggestions, undefined, undefined, params);
|
|
990
990
|
}
|
|
991
991
|
|
|
992
|
+
/**
|
|
993
|
+
* Deep-sync a campaign tree (campaign → groups → ads) with its remote platform.
|
|
994
|
+
*
|
|
995
|
+
* @param campaign_id UUID of the campaign to sync
|
|
996
|
+
* @param params Optional query params
|
|
997
|
+
* @returns Fully-hydrated AdCampaign resource
|
|
998
|
+
*/
|
|
999
|
+
public static syncCampaignTree<T>(
|
|
1000
|
+
campaign_id: string,
|
|
1001
|
+
params?: Record<string, any>
|
|
1002
|
+
): AxiosPromise<Response<T>> {
|
|
1003
|
+
return Requests.processRoute(
|
|
1004
|
+
AdsRoute.routes.syncCampaignTree,
|
|
1005
|
+
undefined,
|
|
1006
|
+
{ campaign_id },
|
|
1007
|
+
params
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Deep-sync all the campaigns for a scheduler.
|
|
1014
|
+
*
|
|
1015
|
+
* @param scheduler_id UUID of the campaign to sync
|
|
1016
|
+
* @param params Optional query params
|
|
1017
|
+
* @returns Fully-hydrated AdCampaign resource
|
|
1018
|
+
*/
|
|
1019
|
+
public static syncSchedulerCampaigns<T>(
|
|
1020
|
+
scheduler_id: string,
|
|
1021
|
+
params?: Record<string, any>
|
|
1022
|
+
): AxiosPromise<Response<T>> {
|
|
1023
|
+
return Requests.processRoute(
|
|
1024
|
+
AdsRoute.routes.syncSchedulerCampaigns,
|
|
1025
|
+
undefined,
|
|
1026
|
+
{ scheduler_id },
|
|
1027
|
+
params
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
992
1030
|
|
|
993
1031
|
|
|
994
1032
|
}
|
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
|
*
|
|
@@ -394,6 +420,42 @@ class Scheduler {
|
|
|
394
420
|
return Requests.processRoute(SchedulerRoute.routes.getDiscordChannels, {}, { scheduler_id }, params);
|
|
395
421
|
}
|
|
396
422
|
|
|
423
|
+
/**
|
|
424
|
+
* Clear Google Ads OAuth credentials from a promotion schedule.
|
|
425
|
+
*
|
|
426
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
427
|
+
* @returns promise
|
|
428
|
+
*/
|
|
429
|
+
public static clearGoogleAdsAuth<T>(
|
|
430
|
+
scheduler_id: string,
|
|
431
|
+
params?: Record<string, any>
|
|
432
|
+
): AxiosPromise<Response<T>> {
|
|
433
|
+
return Requests.processRoute(
|
|
434
|
+
SchedulerRoute.routes.clearGoogleAdsAuth,
|
|
435
|
+
{}, // no body
|
|
436
|
+
{ scheduler_id }, // path params
|
|
437
|
+
params // optional query params
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Clear Tiktok Ads OAuth credentials from a promotion schedule.
|
|
443
|
+
*
|
|
444
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
445
|
+
* @returns promise
|
|
446
|
+
*/
|
|
447
|
+
public static clearTiktokAdsAuth<T>(
|
|
448
|
+
scheduler_id: string,
|
|
449
|
+
params?: Record<string, any>
|
|
450
|
+
): AxiosPromise<Response<T>> {
|
|
451
|
+
return Requests.processRoute(
|
|
452
|
+
SchedulerRoute.routes.clearTiktokAdsAuth,
|
|
453
|
+
{}, // no body
|
|
454
|
+
{ scheduler_id }, // path params
|
|
455
|
+
params // optional query params
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
397
459
|
/**
|
|
398
460
|
* Get aggregated reports for a promotion schedule.
|
|
399
461
|
*
|
package/src/routes/AdsRoute.ts
CHANGED
|
@@ -365,6 +365,14 @@ class AdsRoute {
|
|
|
365
365
|
url: "/ads/twitter/targeting/suggestions",
|
|
366
366
|
method: HTTP_METHODS.GET,
|
|
367
367
|
},
|
|
368
|
+
syncCampaignTree: {
|
|
369
|
+
url: "/ads/campaigns/{campaign_id}/sync_tree",
|
|
370
|
+
method: HTTP_METHODS.POST,
|
|
371
|
+
},
|
|
372
|
+
syncSchedulerCampaigns: {
|
|
373
|
+
url: "/ads/campaigns/scheduler/{scheduler_id}/syncAll",
|
|
374
|
+
method: HTTP_METHODS.POST,
|
|
375
|
+
},
|
|
368
376
|
|
|
369
377
|
};
|
|
370
378
|
}
|
|
@@ -40,6 +40,8 @@ class SchedulerRoute {
|
|
|
40
40
|
clearSteamAuth: { url: '/schedulers/{scheduler_id}/clearSteamAuth', method: HTTP_METHODS.DELETE },
|
|
41
41
|
clearDiscordAuth: { url: '/schedulers/{scheduler_id}/clearDiscordAuth', method: HTTP_METHODS.DELETE },
|
|
42
42
|
clearBlueskyAuth: { url: '/schedulers/{scheduler_id}/clearBlueskyAuth', method: HTTP_METHODS.DELETE },
|
|
43
|
+
clearTiktokAdsAuth: { url: '/schedulers/{scheduler_id}/clearTiktokAdsAuth', method: HTTP_METHODS.DELETE },
|
|
44
|
+
clearGoogleAdsAuth: { url: '/schedulers/{scheduler_id}/clearGoogleAdsAuth', method: HTTP_METHODS.DELETE },
|
|
43
45
|
|
|
44
46
|
//Social Utility Routes
|
|
45
47
|
getFacebookGroups: { url: '/schedulers/{scheduler_id}/facebook/groups', method: HTTP_METHODS.GET },
|
|
@@ -103,6 +105,10 @@ class SchedulerRoute {
|
|
|
103
105
|
url: "/schedulers/{scheduler_id}/funding_instruments",
|
|
104
106
|
method: HTTP_METHODS.GET,
|
|
105
107
|
},
|
|
108
|
+
generateContent: {
|
|
109
|
+
url: '/schedulers/{scheduler_id}/generateContent',
|
|
110
|
+
method: HTTP_METHODS.POST
|
|
111
|
+
},
|
|
106
112
|
|
|
107
113
|
|
|
108
114
|
|