glitch-javascript-sdk 1.7.8 → 1.8.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.
- package/dist/cjs/index.js +114 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Ads.d.ts +36 -0
- package/dist/esm/api/Scheduler.d.ts +36 -0
- package/dist/esm/index.js +114 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +72 -0
- package/package.json +1 -1
- package/src/api/Ads.ts +447 -377
- package/src/api/Scheduler.ts +69 -0
- package/src/routes/AdsRoute.ts +128 -113
- package/src/routes/SchedulerRoute.ts +16 -0
package/src/api/Scheduler.ts
CHANGED
|
@@ -527,6 +527,75 @@ class Scheduler {
|
|
|
527
527
|
);
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
+
/**
|
|
531
|
+
* List platform-level businesses for the given campaign ID,
|
|
532
|
+
* as defined by /schedulers/{scheduler_id}/businesses on the backend.
|
|
533
|
+
*
|
|
534
|
+
* Typically relevant for Reddit (list businesses), or might return a
|
|
535
|
+
* "not supported" message for Meta/TikTok.
|
|
536
|
+
*
|
|
537
|
+
* @param scheduler_id The UUID of the Ad Campaign
|
|
538
|
+
* @param params Optional query parameters, e.g. page.size, etc.
|
|
539
|
+
* @returns A response object with data (business list or messages)
|
|
540
|
+
*/
|
|
541
|
+
public static listCampaignBusinesses<T>(
|
|
542
|
+
scheduler_id: string,
|
|
543
|
+
params?: Record<string, any>
|
|
544
|
+
): AxiosPromise<Response<T>> {
|
|
545
|
+
return Requests.processRoute(
|
|
546
|
+
SchedulerRoute.routes.getCampaignBusinesses,
|
|
547
|
+
undefined, // no request body
|
|
548
|
+
{ scheduler_id }, // path params
|
|
549
|
+
params // query params
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* List Ad Accounts for the given campaign ID,
|
|
555
|
+
* as defined by /schedulers/{scheduler_id}/ad_accounts on the backend.
|
|
556
|
+
*
|
|
557
|
+
* E.g. for Reddit, you can pass ?business_id= to get business-level ad accounts,
|
|
558
|
+
* or for Twitter, it might just return a user’s ad accounts, etc.
|
|
559
|
+
*
|
|
560
|
+
* @param scheduler_id The UUID of the Ad Campaign
|
|
561
|
+
* @param params Optional query parameters, e.g. business_id, page.size, etc.
|
|
562
|
+
* @returns A response object with data (ad account list)
|
|
563
|
+
*/
|
|
564
|
+
public static listCampaignAdAccounts<T>(
|
|
565
|
+
scheduler_id: string,
|
|
566
|
+
params?: Record<string, any>
|
|
567
|
+
): AxiosPromise<Response<T>> {
|
|
568
|
+
return Requests.processRoute(
|
|
569
|
+
SchedulerRoute.routes.getCampaignAdAccounts,
|
|
570
|
+
undefined,
|
|
571
|
+
{ scheduler_id },
|
|
572
|
+
params
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* List funding instruments for the given campaign ID,
|
|
578
|
+
* as defined by /schedulers/{scheduler_id}/funding_instruments on the backend.
|
|
579
|
+
*
|
|
580
|
+
* For Twitter, pass ?account_id=...
|
|
581
|
+
* For Reddit, pass ?ad_account_id=... or ?business_id=...
|
|
582
|
+
*
|
|
583
|
+
* @param scheduler_id The UUID of the Ad Campaign
|
|
584
|
+
* @param params Optional query parameters
|
|
585
|
+
* @returns A response object with data (funding instruments)
|
|
586
|
+
*/
|
|
587
|
+
public static listCampaignFundingInstruments<T>(
|
|
588
|
+
scheduler_id: string,
|
|
589
|
+
params?: Record<string, any>
|
|
590
|
+
): AxiosPromise<Response<T>> {
|
|
591
|
+
return Requests.processRoute(
|
|
592
|
+
SchedulerRoute.routes.getCampaignFundingInstruments,
|
|
593
|
+
undefined,
|
|
594
|
+
{ scheduler_id },
|
|
595
|
+
params
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
|
|
530
599
|
}
|
|
531
600
|
|
|
532
601
|
export default Scheduler;
|
package/src/routes/AdsRoute.ts
CHANGED
|
@@ -9,119 +9,134 @@ import HTTP_METHODS from "../constants/HttpMethods";
|
|
|
9
9
|
* - Ad Group Triggers
|
|
10
10
|
*/
|
|
11
11
|
class AdsRoute {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
12
|
+
public static routes: { [key: string]: Route } = {
|
|
13
|
+
// ----------------------------------------------------------------
|
|
14
|
+
// AD CAMPAIGNS
|
|
15
|
+
// ----------------------------------------------------------------
|
|
16
|
+
getCampaigns: {
|
|
17
|
+
url: "/ads/campaigns",
|
|
18
|
+
method: HTTP_METHODS.GET,
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
createCampaign: {
|
|
22
|
+
url: "/ads/campaigns",
|
|
23
|
+
method: HTTP_METHODS.POST,
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
retrieveCampaign: {
|
|
27
|
+
url: "/ads/campaigns/{campaign_id}",
|
|
28
|
+
method: HTTP_METHODS.GET,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
updateCampaign: {
|
|
32
|
+
url: "/ads/campaigns/{campaign_id}",
|
|
33
|
+
method: HTTP_METHODS.PUT,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
deleteCampaign: {
|
|
37
|
+
url: "/ads/campaigns/{campaign_id}",
|
|
38
|
+
method: HTTP_METHODS.DELETE,
|
|
39
|
+
},
|
|
40
|
+
getCampaignBusinesses: {
|
|
41
|
+
url: "/ads/campaigns/{campaign_id}/businesses",
|
|
42
|
+
method: HTTP_METHODS.GET,
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
getCampaignAdAccounts: {
|
|
46
|
+
url: "/ads/campaigns/{campaign_id}/ad_accounts",
|
|
47
|
+
method: HTTP_METHODS.GET,
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
getCampaignFundingInstruments: {
|
|
51
|
+
url: "/ads/campaigns/{campaign_id}/funding_instruments",
|
|
52
|
+
method: HTTP_METHODS.GET,
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
// ----------------------------------------------------------------
|
|
58
|
+
// AD GROUPS (AKA AD SETS)
|
|
59
|
+
// ----------------------------------------------------------------
|
|
60
|
+
getGroups: {
|
|
61
|
+
url: "/ads/campaigns/{campaign_id}/groups",
|
|
62
|
+
method: HTTP_METHODS.GET,
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
createGroup: {
|
|
66
|
+
url: "/ads/campaigns/{campaign_id}/groups",
|
|
67
|
+
method: HTTP_METHODS.POST,
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
retrieveGroup: {
|
|
71
|
+
url: "/ads/campaigns/{campaign_id}/groups/{group_id}",
|
|
72
|
+
method: HTTP_METHODS.GET,
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
updateGroup: {
|
|
76
|
+
url: "/ads/campaigns/{campaign_id}/groups/{group_id}",
|
|
77
|
+
method: HTTP_METHODS.PUT,
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
deleteGroup: {
|
|
81
|
+
url: "/ads/campaigns/{campaign_id}/groups/{group_id}",
|
|
82
|
+
method: HTTP_METHODS.DELETE,
|
|
83
|
+
},
|
|
84
|
+
// ----------------------------------------------------------------
|
|
85
|
+
// ADS (CREATIVES)
|
|
86
|
+
// ----------------------------------------------------------------
|
|
87
|
+
getAds: {
|
|
88
|
+
url: "/ads/creatives",
|
|
89
|
+
method: HTTP_METHODS.GET,
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
createAd: {
|
|
93
|
+
url: "/ads/creatives",
|
|
94
|
+
method: HTTP_METHODS.POST,
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
retrieveAd: {
|
|
98
|
+
url: "/ads/creatives/{ad_id}",
|
|
99
|
+
method: HTTP_METHODS.GET,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
updateAd: {
|
|
103
|
+
url: "/ads/creatives/{ad_id}",
|
|
104
|
+
method: HTTP_METHODS.PUT,
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
deleteAd: {
|
|
108
|
+
url: "/ads/creatives/{ad_id}",
|
|
109
|
+
method: HTTP_METHODS.DELETE,
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
// ----------------------------------------------------------------
|
|
113
|
+
// AD GROUP TRIGGERS
|
|
114
|
+
// ----------------------------------------------------------------
|
|
115
|
+
getTriggers: {
|
|
116
|
+
url: "/ads/campaigns/{campaign_id}/groups/{group_id}/triggers",
|
|
117
|
+
method: HTTP_METHODS.GET,
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
createTrigger: {
|
|
121
|
+
url: "/ads/campaigns/{campaign_id}/groups/{group_id}/triggers",
|
|
122
|
+
method: HTTP_METHODS.POST,
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
retrieveTrigger: {
|
|
126
|
+
url: "/ads/campaigns/{campaign_id}/groups/{group_id}/triggers/{trigger_id}",
|
|
127
|
+
method: HTTP_METHODS.GET,
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
updateTrigger: {
|
|
131
|
+
url: "/ads/campaigns/{campaign_id}/groups/{group_id}/triggers/{trigger_id}",
|
|
132
|
+
method: HTTP_METHODS.PUT,
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
deleteTrigger: {
|
|
136
|
+
url: "/ads/campaigns/{campaign_id}/groups/{group_id}/triggers/{trigger_id}",
|
|
137
|
+
method: HTTP_METHODS.DELETE,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
125
140
|
}
|
|
126
141
|
|
|
127
142
|
export default AdsRoute;
|
|
@@ -87,6 +87,22 @@ class SchedulerRoute {
|
|
|
87
87
|
method: HTTP_METHODS.GET
|
|
88
88
|
},
|
|
89
89
|
|
|
90
|
+
getCampaignBusinesses: {
|
|
91
|
+
url: "/schedulers/{scheduler_id}/businesses",
|
|
92
|
+
method: HTTP_METHODS.GET,
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
getCampaignAdAccounts: {
|
|
96
|
+
url: "/schedulers/{scheduler_id}/ad_accounts",
|
|
97
|
+
method: HTTP_METHODS.GET,
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
getCampaignFundingInstruments: {
|
|
101
|
+
url: "/schedulers/{scheduler_id}/funding_instruments",
|
|
102
|
+
method: HTTP_METHODS.GET,
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
|
|
90
106
|
|
|
91
107
|
};
|
|
92
108
|
}
|