glitch-javascript-sdk 1.7.8 → 1.7.9
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 +57 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Ads.d.ts +36 -0
- package/dist/esm/index.js +57 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +36 -0
- package/package.json +1 -1
- package/src/api/Ads.ts +447 -377
- package/src/routes/AdsRoute.ts +128 -113
package/src/api/Ads.ts
CHANGED
|
@@ -4,406 +4,476 @@ import Response from "../util/Response";
|
|
|
4
4
|
import { AxiosPromise } from "axios";
|
|
5
5
|
|
|
6
6
|
class Ads {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
// ----------------------------------------------------------------------
|
|
8
|
+
// AD CAMPAIGNS
|
|
9
|
+
// ----------------------------------------------------------------------
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
/**
|
|
12
|
+
* List Ad Campaigns.
|
|
13
|
+
*
|
|
14
|
+
* Example usage:
|
|
15
|
+
* Ads.listCampaigns({ community: 'uuid-of-community', platform: 'tiktok' })
|
|
16
|
+
*
|
|
17
|
+
* @param params Query parameters (e.g. community, platform, advertiser_id, etc.)
|
|
18
|
+
* @returns A paginated list of AdCampaign resources
|
|
19
|
+
*/
|
|
20
|
+
public static listCampaigns<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
21
|
+
return Requests.processRoute(AdsRoute.routes.getCampaigns, undefined, undefined, params);
|
|
22
|
+
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Create a new Ad Campaign.
|
|
26
|
+
*
|
|
27
|
+
* @param data The Ad Campaign payload (JSON) to create
|
|
28
|
+
* @param params Optional query parameters
|
|
29
|
+
* @returns The newly created AdCampaign resource
|
|
30
|
+
*/
|
|
31
|
+
public static createCampaign<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
32
|
+
return Requests.processRoute(AdsRoute.routes.createCampaign, data, {}, params);
|
|
33
|
+
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve a single Ad Campaign by ID.
|
|
37
|
+
*
|
|
38
|
+
* @param campaign_id The UUID of the campaign to fetch
|
|
39
|
+
* @param params Optional query parameters
|
|
40
|
+
* @returns The requested AdCampaign resource
|
|
41
|
+
*/
|
|
42
|
+
public static viewCampaign<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
43
|
+
return Requests.processRoute(
|
|
44
|
+
AdsRoute.routes.retrieveCampaign,
|
|
45
|
+
{},
|
|
46
|
+
{ campaign_id: campaign_id },
|
|
47
|
+
params
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Update an existing Ad Campaign by ID.
|
|
53
|
+
*
|
|
54
|
+
* @param campaign_id The UUID of the campaign to update
|
|
55
|
+
* @param data The partial or full updated AdCampaign payload
|
|
56
|
+
* @param params Optional query parameters
|
|
57
|
+
* @returns The updated AdCampaign resource
|
|
58
|
+
*/
|
|
59
|
+
public static updateCampaign<T>(
|
|
60
|
+
campaign_id: string,
|
|
61
|
+
data?: object,
|
|
62
|
+
params?: Record<string, any>
|
|
63
|
+
): AxiosPromise<Response<T>> {
|
|
64
|
+
return Requests.processRoute(
|
|
65
|
+
AdsRoute.routes.updateCampaign,
|
|
66
|
+
data,
|
|
67
|
+
{ campaign_id: campaign_id },
|
|
68
|
+
params
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Delete an Ad Campaign by ID.
|
|
74
|
+
*
|
|
75
|
+
* @param campaign_id The UUID of the campaign to delete
|
|
76
|
+
* @param params Optional query parameters
|
|
77
|
+
* @returns A 204 No Content response on success
|
|
78
|
+
*/
|
|
79
|
+
public static deleteCampaign<T>(
|
|
80
|
+
campaign_id: string,
|
|
81
|
+
params?: Record<string, any>
|
|
82
|
+
): AxiosPromise<Response<T>> {
|
|
83
|
+
return Requests.processRoute(
|
|
84
|
+
AdsRoute.routes.deleteCampaign,
|
|
85
|
+
{},
|
|
86
|
+
{ campaign_id: campaign_id },
|
|
87
|
+
params
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
// ----------------------------------------------------------------------
|
|
92
|
+
// AD GROUPS (AD SETS)
|
|
93
|
+
// ----------------------------------------------------------------------
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
95
|
+
/**
|
|
96
|
+
* List Ad Groups (ad sets) for a specific campaign.
|
|
97
|
+
*
|
|
98
|
+
* Example usage:
|
|
99
|
+
* Ads.listGroups('some-campaign-uuid', { promotion_type: 'WEBSITE' })
|
|
100
|
+
*
|
|
101
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
102
|
+
* @param params Optional query parameters (e.g. promotion_type, operation_status, etc.)
|
|
103
|
+
* @returns A paginated list of AdGroup resources
|
|
104
|
+
*/
|
|
105
|
+
public static listGroups<T>(
|
|
106
|
+
campaign_id: string,
|
|
107
|
+
params?: Record<string, any>
|
|
108
|
+
): AxiosPromise<Response<T>> {
|
|
109
|
+
return Requests.processRoute(
|
|
110
|
+
AdsRoute.routes.getGroups,
|
|
111
|
+
{},
|
|
112
|
+
{ campaign_id },
|
|
113
|
+
params
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Create a new Ad Group (ad set) under a specific campaign.
|
|
119
|
+
*
|
|
120
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
121
|
+
* @param data The AdGroup creation payload
|
|
122
|
+
* @param params Optional query parameters
|
|
123
|
+
* @returns The newly created AdGroup resource
|
|
124
|
+
*/
|
|
125
|
+
public static createGroup<T>(
|
|
126
|
+
campaign_id: string,
|
|
127
|
+
data?: object,
|
|
128
|
+
params?: Record<string, any>
|
|
129
|
+
): AxiosPromise<Response<T>> {
|
|
130
|
+
return Requests.processRoute(
|
|
131
|
+
AdsRoute.routes.createGroup,
|
|
132
|
+
data,
|
|
133
|
+
{ campaign_id },
|
|
134
|
+
params
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Retrieve a single Ad Group by ID, under a specific campaign.
|
|
140
|
+
*
|
|
141
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
142
|
+
* @param group_id The UUID of the AdGroup to fetch
|
|
143
|
+
* @param params Optional query parameters
|
|
144
|
+
* @returns The requested AdGroup resource
|
|
145
|
+
*/
|
|
146
|
+
public static viewGroup<T>(
|
|
147
|
+
campaign_id: string,
|
|
148
|
+
group_id: string,
|
|
149
|
+
params?: Record<string, any>
|
|
150
|
+
): AxiosPromise<Response<T>> {
|
|
151
|
+
return Requests.processRoute(
|
|
152
|
+
AdsRoute.routes.retrieveGroup,
|
|
153
|
+
{},
|
|
154
|
+
{ campaign_id, group_id },
|
|
155
|
+
params
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Update an Ad Group (ad set) by ID.
|
|
161
|
+
*
|
|
162
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
163
|
+
* @param group_id The UUID of the AdGroup to update
|
|
164
|
+
* @param data Updated fields for the AdGroup
|
|
165
|
+
* @param params Optional query parameters
|
|
166
|
+
* @returns The updated AdGroup resource
|
|
167
|
+
*/
|
|
168
|
+
public static updateGroup<T>(
|
|
169
|
+
campaign_id: string,
|
|
170
|
+
group_id: string,
|
|
171
|
+
data?: object,
|
|
172
|
+
params?: Record<string, any>
|
|
173
|
+
): AxiosPromise<Response<T>> {
|
|
174
|
+
return Requests.processRoute(
|
|
175
|
+
AdsRoute.routes.updateGroup,
|
|
176
|
+
data,
|
|
177
|
+
{ campaign_id, group_id },
|
|
178
|
+
params
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Delete an Ad Group (ad set) by ID, under a specific campaign.
|
|
184
|
+
*
|
|
185
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
186
|
+
* @param group_id The UUID of the AdGroup to delete
|
|
187
|
+
* @param params Optional query parameters
|
|
188
|
+
* @returns A 204 No Content response on success
|
|
189
|
+
*/
|
|
190
|
+
public static deleteGroup<T>(
|
|
191
|
+
campaign_id: string,
|
|
192
|
+
group_id: string,
|
|
193
|
+
params?: Record<string, any>
|
|
194
|
+
): AxiosPromise<Response<T>> {
|
|
195
|
+
return Requests.processRoute(
|
|
196
|
+
AdsRoute.routes.deleteGroup,
|
|
197
|
+
{},
|
|
198
|
+
{ campaign_id, group_id },
|
|
199
|
+
params
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
202
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
// ----------------------------------------------------------------------
|
|
204
|
+
// ADS (CREATIVES)
|
|
205
|
+
// ----------------------------------------------------------------------
|
|
206
206
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
207
|
+
/**
|
|
208
|
+
* List Ads (creatives).
|
|
209
|
+
*
|
|
210
|
+
* Supports filtering by ad_group_id, social_media_post_id, operation_status, etc.
|
|
211
|
+
*
|
|
212
|
+
* @param params Optional query parameters for filtering/sorting
|
|
213
|
+
* @returns A paginated list of Ad resources
|
|
214
|
+
*/
|
|
215
|
+
public static listAds<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
216
|
+
return Requests.processRoute(AdsRoute.routes.getAds, undefined, undefined, params);
|
|
217
|
+
}
|
|
218
218
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
219
|
+
/**
|
|
220
|
+
* Create a new Ad (creative).
|
|
221
|
+
*
|
|
222
|
+
* @param data The Ad creation payload
|
|
223
|
+
* @param params Optional query parameters
|
|
224
|
+
* @returns The newly created Ad resource
|
|
225
|
+
*/
|
|
226
|
+
public static createAd<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
227
|
+
return Requests.processRoute(AdsRoute.routes.createAd, data, {}, params);
|
|
228
|
+
}
|
|
229
229
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Retrieve a single Ad by ID.
|
|
232
|
+
*
|
|
233
|
+
* @param ad_id The UUID of the Ad to fetch
|
|
234
|
+
* @param params Optional query parameters
|
|
235
|
+
* @returns The requested Ad resource
|
|
236
|
+
*/
|
|
237
|
+
public static viewAd<T>(
|
|
238
|
+
ad_id: string,
|
|
239
|
+
params?: Record<string, any>
|
|
240
|
+
): AxiosPromise<Response<T>> {
|
|
241
|
+
return Requests.processRoute(
|
|
242
|
+
AdsRoute.routes.retrieveAd,
|
|
243
|
+
{},
|
|
244
|
+
{ ad_id },
|
|
245
|
+
params
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
249
|
+
/**
|
|
250
|
+
* Update an existing Ad by ID.
|
|
251
|
+
*
|
|
252
|
+
* @param ad_id The UUID of the Ad to update
|
|
253
|
+
* @param data The partial or full Ad payload
|
|
254
|
+
* @param params Optional query parameters
|
|
255
|
+
* @returns The updated Ad resource
|
|
256
|
+
*/
|
|
257
|
+
public static updateAd<T>(
|
|
258
|
+
ad_id: string,
|
|
259
|
+
data?: object,
|
|
260
|
+
params?: Record<string, any>
|
|
261
|
+
): AxiosPromise<Response<T>> {
|
|
262
|
+
return Requests.processRoute(
|
|
263
|
+
AdsRoute.routes.updateAd,
|
|
264
|
+
data,
|
|
265
|
+
{ ad_id },
|
|
266
|
+
params
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
269
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Delete an Ad by ID.
|
|
272
|
+
*
|
|
273
|
+
* @param ad_id The UUID of the Ad to delete
|
|
274
|
+
* @param params Optional query parameters
|
|
275
|
+
* @returns A 204 No Content response on success
|
|
276
|
+
*/
|
|
277
|
+
public static deleteAd<T>(
|
|
278
|
+
ad_id: string,
|
|
279
|
+
params?: Record<string, any>
|
|
280
|
+
): AxiosPromise<Response<T>> {
|
|
281
|
+
return Requests.processRoute(
|
|
282
|
+
AdsRoute.routes.deleteAd,
|
|
283
|
+
{},
|
|
284
|
+
{ ad_id },
|
|
285
|
+
params
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
288
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
// ----------------------------------------------------------------------
|
|
290
|
+
// AD GROUP TRIGGERS
|
|
291
|
+
// ----------------------------------------------------------------------
|
|
292
292
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
293
|
+
/**
|
|
294
|
+
* List triggers defined for a given Ad Group.
|
|
295
|
+
*
|
|
296
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
297
|
+
* @param group_id The UUID of the Ad Group
|
|
298
|
+
* @param params Optional query parameters (pagination, etc.)
|
|
299
|
+
* @returns A paginated list of AdGroupTrigger resources
|
|
300
|
+
*/
|
|
301
|
+
public static listTriggers<T>(
|
|
302
|
+
campaign_id: string,
|
|
303
|
+
group_id: string,
|
|
304
|
+
params?: Record<string, any>
|
|
305
|
+
): AxiosPromise<Response<T>> {
|
|
306
|
+
return Requests.processRoute(
|
|
307
|
+
AdsRoute.routes.getTriggers,
|
|
308
|
+
{},
|
|
309
|
+
{ campaign_id, group_id },
|
|
310
|
+
params
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
313
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
314
|
+
/**
|
|
315
|
+
* Create a new Ad Group Trigger.
|
|
316
|
+
*
|
|
317
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
318
|
+
* @param group_id The UUID of the Ad Group
|
|
319
|
+
* @param data The trigger creation payload
|
|
320
|
+
* @param params Optional query parameters
|
|
321
|
+
* @returns The newly created AdGroupTrigger resource
|
|
322
|
+
*/
|
|
323
|
+
public static createTrigger<T>(
|
|
324
|
+
campaign_id: string,
|
|
325
|
+
group_id: string,
|
|
326
|
+
data?: object,
|
|
327
|
+
params?: Record<string, any>
|
|
328
|
+
): AxiosPromise<Response<T>> {
|
|
329
|
+
return Requests.processRoute(
|
|
330
|
+
AdsRoute.routes.createTrigger,
|
|
331
|
+
data,
|
|
332
|
+
{ campaign_id, group_id },
|
|
333
|
+
params
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
336
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Retrieve a single Ad Group Trigger by ID.
|
|
339
|
+
*
|
|
340
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
341
|
+
* @param group_id The UUID of the Ad Group
|
|
342
|
+
* @param trigger_id The UUID of the trigger
|
|
343
|
+
* @param params Optional query parameters
|
|
344
|
+
* @returns The requested AdGroupTrigger resource
|
|
345
|
+
*/
|
|
346
|
+
public static viewTrigger<T>(
|
|
347
|
+
campaign_id: string,
|
|
348
|
+
group_id: string,
|
|
349
|
+
trigger_id: string,
|
|
350
|
+
params?: Record<string, any>
|
|
351
|
+
): AxiosPromise<Response<T>> {
|
|
352
|
+
return Requests.processRoute(
|
|
353
|
+
AdsRoute.routes.retrieveTrigger,
|
|
354
|
+
{},
|
|
355
|
+
{ campaign_id, group_id, trigger_id },
|
|
356
|
+
params
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
359
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
360
|
+
/**
|
|
361
|
+
* Update an existing Ad Group Trigger by ID.
|
|
362
|
+
*
|
|
363
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
364
|
+
* @param group_id The UUID of the Ad Group
|
|
365
|
+
* @param trigger_id The UUID of the trigger to update
|
|
366
|
+
* @param data Updated trigger fields
|
|
367
|
+
* @param params Optional query parameters
|
|
368
|
+
* @returns The updated AdGroupTrigger resource
|
|
369
|
+
*/
|
|
370
|
+
public static updateTrigger<T>(
|
|
371
|
+
campaign_id: string,
|
|
372
|
+
group_id: string,
|
|
373
|
+
trigger_id: string,
|
|
374
|
+
data?: object,
|
|
375
|
+
params?: Record<string, any>
|
|
376
|
+
): AxiosPromise<Response<T>> {
|
|
377
|
+
return Requests.processRoute(
|
|
378
|
+
AdsRoute.routes.updateTrigger,
|
|
379
|
+
data,
|
|
380
|
+
{ campaign_id, group_id, trigger_id },
|
|
381
|
+
params
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Delete an Ad Group Trigger by ID.
|
|
387
|
+
*
|
|
388
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
389
|
+
* @param group_id The UUID of the Ad Group
|
|
390
|
+
* @param trigger_id The UUID of the trigger
|
|
391
|
+
* @param params Optional query parameters
|
|
392
|
+
* @returns A 204 No Content response on success
|
|
393
|
+
*/
|
|
394
|
+
public static deleteTrigger<T>(
|
|
395
|
+
campaign_id: string,
|
|
396
|
+
group_id: string,
|
|
397
|
+
trigger_id: string,
|
|
398
|
+
params?: Record<string, any>
|
|
399
|
+
): AxiosPromise<Response<T>> {
|
|
400
|
+
return Requests.processRoute(
|
|
401
|
+
AdsRoute.routes.deleteTrigger,
|
|
402
|
+
{},
|
|
403
|
+
{ campaign_id, group_id, trigger_id },
|
|
404
|
+
params
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* List platform-level businesses for the given campaign ID,
|
|
410
|
+
* as defined by /ads/campaigns/{id}/businesses on the backend.
|
|
411
|
+
*
|
|
412
|
+
* Typically relevant for Reddit (list businesses), or might return a
|
|
413
|
+
* "not supported" message for Meta/TikTok.
|
|
414
|
+
*
|
|
415
|
+
* @param campaign_id The UUID of the Ad Campaign
|
|
416
|
+
* @param params Optional query parameters, e.g. page.size, etc.
|
|
417
|
+
* @returns A response object with data (business list or messages)
|
|
418
|
+
*/
|
|
419
|
+
public static listCampaignBusinesses<T>(
|
|
420
|
+
campaign_id: string,
|
|
421
|
+
params?: Record<string, any>
|
|
422
|
+
): AxiosPromise<Response<T>> {
|
|
423
|
+
return Requests.processRoute(
|
|
424
|
+
AdsRoute.routes.getCampaignBusinesses,
|
|
425
|
+
undefined, // no request body
|
|
426
|
+
{ campaign_id }, // path params
|
|
427
|
+
params // query params
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* List Ad Accounts for the given campaign ID,
|
|
433
|
+
* as defined by /ads/campaigns/{id}/ad_accounts on the backend.
|
|
434
|
+
*
|
|
435
|
+
* E.g. for Reddit, you can pass ?business_id= to get business-level ad accounts,
|
|
436
|
+
* or for Twitter, it might just return a user’s ad accounts, etc.
|
|
437
|
+
*
|
|
438
|
+
* @param campaign_id The UUID of the Ad Campaign
|
|
439
|
+
* @param params Optional query parameters, e.g. business_id, page.size, etc.
|
|
440
|
+
* @returns A response object with data (ad account list)
|
|
441
|
+
*/
|
|
442
|
+
public static listCampaignAdAccounts<T>(
|
|
443
|
+
campaign_id: string,
|
|
444
|
+
params?: Record<string, any>
|
|
445
|
+
): AxiosPromise<Response<T>> {
|
|
446
|
+
return Requests.processRoute(
|
|
447
|
+
AdsRoute.routes.getCampaignAdAccounts,
|
|
448
|
+
undefined,
|
|
449
|
+
{ campaign_id },
|
|
450
|
+
params
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* List funding instruments for the given campaign ID,
|
|
456
|
+
* as defined by /ads/campaigns/{id}/funding_instruments on the backend.
|
|
457
|
+
*
|
|
458
|
+
* For Twitter, pass ?account_id=...
|
|
459
|
+
* For Reddit, pass ?ad_account_id=... or ?business_id=...
|
|
460
|
+
*
|
|
461
|
+
* @param campaign_id The UUID of the Ad Campaign
|
|
462
|
+
* @param params Optional query parameters
|
|
463
|
+
* @returns A response object with data (funding instruments)
|
|
464
|
+
*/
|
|
465
|
+
public static listCampaignFundingInstruments<T>(
|
|
466
|
+
campaign_id: string,
|
|
467
|
+
params?: Record<string, any>
|
|
468
|
+
): AxiosPromise<Response<T>> {
|
|
469
|
+
return Requests.processRoute(
|
|
470
|
+
AdsRoute.routes.getCampaignFundingInstruments,
|
|
471
|
+
undefined,
|
|
472
|
+
{ campaign_id },
|
|
473
|
+
params
|
|
474
|
+
);
|
|
475
|
+
}
|
|
384
476
|
|
|
385
|
-
/**
|
|
386
|
-
* Delete an Ad Group Trigger by ID.
|
|
387
|
-
*
|
|
388
|
-
* @param campaign_id The UUID of the parent Ad Campaign
|
|
389
|
-
* @param group_id The UUID of the Ad Group
|
|
390
|
-
* @param trigger_id The UUID of the trigger
|
|
391
|
-
* @param params Optional query parameters
|
|
392
|
-
* @returns A 204 No Content response on success
|
|
393
|
-
*/
|
|
394
|
-
public static deleteTrigger<T>(
|
|
395
|
-
campaign_id: string,
|
|
396
|
-
group_id: string,
|
|
397
|
-
trigger_id: string,
|
|
398
|
-
params?: Record<string, any>
|
|
399
|
-
): AxiosPromise<Response<T>> {
|
|
400
|
-
return Requests.processRoute(
|
|
401
|
-
AdsRoute.routes.deleteTrigger,
|
|
402
|
-
{},
|
|
403
|
-
{ campaign_id, group_id, trigger_id },
|
|
404
|
-
params
|
|
405
|
-
);
|
|
406
|
-
}
|
|
407
477
|
}
|
|
408
478
|
|
|
409
479
|
export default Ads;
|