glitch-javascript-sdk 1.7.6 → 1.7.8
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 +413 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Ads.d.ts +188 -0
- package/dist/esm/api/Titles.d.ts +33 -3
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +413 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/AdsRoute.d.ts +14 -0
- package/dist/index.d.ts +220 -3
- package/package.json +1 -1
- package/src/api/Ads.ts +409 -0
- package/src/api/Titles.ts +71 -10
- package/src/api/index.ts +2 -0
- package/src/index.ts +2 -2
- package/src/routes/AdsRoute.ts +127 -0
- package/src/routes/TitlesRoute.ts +27 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
/**
|
|
3
|
+
* AdsRoute holds all the endpoint definitions for:
|
|
4
|
+
* - Ad Campaigns
|
|
5
|
+
* - Ad Groups (Ad Sets)
|
|
6
|
+
* - Ads (Creatives)
|
|
7
|
+
* - Ad Group Triggers
|
|
8
|
+
*/
|
|
9
|
+
declare class AdsRoute {
|
|
10
|
+
static routes: {
|
|
11
|
+
[key: string]: Route;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export default AdsRoute;
|
package/dist/index.d.ts
CHANGED
|
@@ -642,6 +642,192 @@ declare class Competitions {
|
|
|
642
642
|
static me<T>(competition_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
declare class Ads {
|
|
646
|
+
/**
|
|
647
|
+
* List Ad Campaigns.
|
|
648
|
+
*
|
|
649
|
+
* Example usage:
|
|
650
|
+
* Ads.listCampaigns({ community: 'uuid-of-community', platform: 'tiktok' })
|
|
651
|
+
*
|
|
652
|
+
* @param params Query parameters (e.g. community, platform, advertiser_id, etc.)
|
|
653
|
+
* @returns A paginated list of AdCampaign resources
|
|
654
|
+
*/
|
|
655
|
+
static listCampaigns<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
656
|
+
/**
|
|
657
|
+
* Create a new Ad Campaign.
|
|
658
|
+
*
|
|
659
|
+
* @param data The Ad Campaign payload (JSON) to create
|
|
660
|
+
* @param params Optional query parameters
|
|
661
|
+
* @returns The newly created AdCampaign resource
|
|
662
|
+
*/
|
|
663
|
+
static createCampaign<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
664
|
+
/**
|
|
665
|
+
* Retrieve a single Ad Campaign by ID.
|
|
666
|
+
*
|
|
667
|
+
* @param campaign_id The UUID of the campaign to fetch
|
|
668
|
+
* @param params Optional query parameters
|
|
669
|
+
* @returns The requested AdCampaign resource
|
|
670
|
+
*/
|
|
671
|
+
static viewCampaign<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
672
|
+
/**
|
|
673
|
+
* Update an existing Ad Campaign by ID.
|
|
674
|
+
*
|
|
675
|
+
* @param campaign_id The UUID of the campaign to update
|
|
676
|
+
* @param data The partial or full updated AdCampaign payload
|
|
677
|
+
* @param params Optional query parameters
|
|
678
|
+
* @returns The updated AdCampaign resource
|
|
679
|
+
*/
|
|
680
|
+
static updateCampaign<T>(campaign_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
681
|
+
/**
|
|
682
|
+
* Delete an Ad Campaign by ID.
|
|
683
|
+
*
|
|
684
|
+
* @param campaign_id The UUID of the campaign to delete
|
|
685
|
+
* @param params Optional query parameters
|
|
686
|
+
* @returns A 204 No Content response on success
|
|
687
|
+
*/
|
|
688
|
+
static deleteCampaign<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
689
|
+
/**
|
|
690
|
+
* List Ad Groups (ad sets) for a specific campaign.
|
|
691
|
+
*
|
|
692
|
+
* Example usage:
|
|
693
|
+
* Ads.listGroups('some-campaign-uuid', { promotion_type: 'WEBSITE' })
|
|
694
|
+
*
|
|
695
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
696
|
+
* @param params Optional query parameters (e.g. promotion_type, operation_status, etc.)
|
|
697
|
+
* @returns A paginated list of AdGroup resources
|
|
698
|
+
*/
|
|
699
|
+
static listGroups<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
700
|
+
/**
|
|
701
|
+
* Create a new Ad Group (ad set) under a specific campaign.
|
|
702
|
+
*
|
|
703
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
704
|
+
* @param data The AdGroup creation payload
|
|
705
|
+
* @param params Optional query parameters
|
|
706
|
+
* @returns The newly created AdGroup resource
|
|
707
|
+
*/
|
|
708
|
+
static createGroup<T>(campaign_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
709
|
+
/**
|
|
710
|
+
* Retrieve a single Ad Group by ID, under a specific campaign.
|
|
711
|
+
*
|
|
712
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
713
|
+
* @param group_id The UUID of the AdGroup to fetch
|
|
714
|
+
* @param params Optional query parameters
|
|
715
|
+
* @returns The requested AdGroup resource
|
|
716
|
+
*/
|
|
717
|
+
static viewGroup<T>(campaign_id: string, group_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
718
|
+
/**
|
|
719
|
+
* Update an Ad Group (ad set) by ID.
|
|
720
|
+
*
|
|
721
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
722
|
+
* @param group_id The UUID of the AdGroup to update
|
|
723
|
+
* @param data Updated fields for the AdGroup
|
|
724
|
+
* @param params Optional query parameters
|
|
725
|
+
* @returns The updated AdGroup resource
|
|
726
|
+
*/
|
|
727
|
+
static updateGroup<T>(campaign_id: string, group_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
728
|
+
/**
|
|
729
|
+
* Delete an Ad Group (ad set) by ID, under a specific campaign.
|
|
730
|
+
*
|
|
731
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
732
|
+
* @param group_id The UUID of the AdGroup to delete
|
|
733
|
+
* @param params Optional query parameters
|
|
734
|
+
* @returns A 204 No Content response on success
|
|
735
|
+
*/
|
|
736
|
+
static deleteGroup<T>(campaign_id: string, group_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
737
|
+
/**
|
|
738
|
+
* List Ads (creatives).
|
|
739
|
+
*
|
|
740
|
+
* Supports filtering by ad_group_id, social_media_post_id, operation_status, etc.
|
|
741
|
+
*
|
|
742
|
+
* @param params Optional query parameters for filtering/sorting
|
|
743
|
+
* @returns A paginated list of Ad resources
|
|
744
|
+
*/
|
|
745
|
+
static listAds<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
746
|
+
/**
|
|
747
|
+
* Create a new Ad (creative).
|
|
748
|
+
*
|
|
749
|
+
* @param data The Ad creation payload
|
|
750
|
+
* @param params Optional query parameters
|
|
751
|
+
* @returns The newly created Ad resource
|
|
752
|
+
*/
|
|
753
|
+
static createAd<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
754
|
+
/**
|
|
755
|
+
* Retrieve a single Ad by ID.
|
|
756
|
+
*
|
|
757
|
+
* @param ad_id The UUID of the Ad to fetch
|
|
758
|
+
* @param params Optional query parameters
|
|
759
|
+
* @returns The requested Ad resource
|
|
760
|
+
*/
|
|
761
|
+
static viewAd<T>(ad_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
762
|
+
/**
|
|
763
|
+
* Update an existing Ad by ID.
|
|
764
|
+
*
|
|
765
|
+
* @param ad_id The UUID of the Ad to update
|
|
766
|
+
* @param data The partial or full Ad payload
|
|
767
|
+
* @param params Optional query parameters
|
|
768
|
+
* @returns The updated Ad resource
|
|
769
|
+
*/
|
|
770
|
+
static updateAd<T>(ad_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
771
|
+
/**
|
|
772
|
+
* Delete an Ad by ID.
|
|
773
|
+
*
|
|
774
|
+
* @param ad_id The UUID of the Ad to delete
|
|
775
|
+
* @param params Optional query parameters
|
|
776
|
+
* @returns A 204 No Content response on success
|
|
777
|
+
*/
|
|
778
|
+
static deleteAd<T>(ad_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
779
|
+
/**
|
|
780
|
+
* List triggers defined for a given Ad Group.
|
|
781
|
+
*
|
|
782
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
783
|
+
* @param group_id The UUID of the Ad Group
|
|
784
|
+
* @param params Optional query parameters (pagination, etc.)
|
|
785
|
+
* @returns A paginated list of AdGroupTrigger resources
|
|
786
|
+
*/
|
|
787
|
+
static listTriggers<T>(campaign_id: string, group_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
788
|
+
/**
|
|
789
|
+
* Create a new Ad Group Trigger.
|
|
790
|
+
*
|
|
791
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
792
|
+
* @param group_id The UUID of the Ad Group
|
|
793
|
+
* @param data The trigger creation payload
|
|
794
|
+
* @param params Optional query parameters
|
|
795
|
+
* @returns The newly created AdGroupTrigger resource
|
|
796
|
+
*/
|
|
797
|
+
static createTrigger<T>(campaign_id: string, group_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
798
|
+
/**
|
|
799
|
+
* Retrieve a single Ad Group Trigger by ID.
|
|
800
|
+
*
|
|
801
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
802
|
+
* @param group_id The UUID of the Ad Group
|
|
803
|
+
* @param trigger_id The UUID of the trigger
|
|
804
|
+
* @param params Optional query parameters
|
|
805
|
+
* @returns The requested AdGroupTrigger resource
|
|
806
|
+
*/
|
|
807
|
+
static viewTrigger<T>(campaign_id: string, group_id: string, trigger_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
808
|
+
/**
|
|
809
|
+
* Update an existing Ad Group Trigger by ID.
|
|
810
|
+
*
|
|
811
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
812
|
+
* @param group_id The UUID of the Ad Group
|
|
813
|
+
* @param trigger_id The UUID of the trigger to update
|
|
814
|
+
* @param data Updated trigger fields
|
|
815
|
+
* @param params Optional query parameters
|
|
816
|
+
* @returns The updated AdGroupTrigger resource
|
|
817
|
+
*/
|
|
818
|
+
static updateTrigger<T>(campaign_id: string, group_id: string, trigger_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
819
|
+
/**
|
|
820
|
+
* Delete an Ad Group Trigger by ID.
|
|
821
|
+
*
|
|
822
|
+
* @param campaign_id The UUID of the parent Ad Campaign
|
|
823
|
+
* @param group_id The UUID of the Ad Group
|
|
824
|
+
* @param trigger_id The UUID of the trigger
|
|
825
|
+
* @param params Optional query parameters
|
|
826
|
+
* @returns A 204 No Content response on success
|
|
827
|
+
*/
|
|
828
|
+
static deleteTrigger<T>(campaign_id: string, group_id: string, trigger_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
829
|
+
}
|
|
830
|
+
|
|
645
831
|
declare class Communities {
|
|
646
832
|
/**
|
|
647
833
|
* List all the communities.
|
|
@@ -3010,9 +3196,9 @@ declare class Titles {
|
|
|
3010
3196
|
static retentionAnalysis<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3011
3197
|
static distinctDimensions<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3012
3198
|
/**
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3199
|
+
* List sessions for a specific title, with optional filters and pagination.
|
|
3200
|
+
* Returns a paginated list of sessions with start/end times, session_length, user info, etc.
|
|
3201
|
+
*/
|
|
3016
3202
|
static listSessions<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3017
3203
|
/**
|
|
3018
3204
|
* Get aggregated average session length data (daily/weekly/monthly) for a title.
|
|
@@ -3020,6 +3206,36 @@ declare class Titles {
|
|
|
3020
3206
|
*/
|
|
3021
3207
|
static sessionsAverage<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3022
3208
|
static sessionsHistogram<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3209
|
+
/**
|
|
3210
|
+
* Upload a CSV/Excel file containing daily UTM analytics for a specific title.
|
|
3211
|
+
*
|
|
3212
|
+
* @param title_id The UUID of the title
|
|
3213
|
+
* @param file The CSV or Excel file
|
|
3214
|
+
* @param data Optional form fields (if needed)
|
|
3215
|
+
* @param params Optional query parameters
|
|
3216
|
+
* @returns AxiosPromise
|
|
3217
|
+
*/
|
|
3218
|
+
static importUtmAnalytics<T>(title_id: string, file: File | Blob, data?: Record<string, any>, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3219
|
+
/**
|
|
3220
|
+
* Retrieve the UTM analytics data for a title (paginated, filterable, sortable).
|
|
3221
|
+
*
|
|
3222
|
+
* GET /titles/{title_id}/utm
|
|
3223
|
+
*
|
|
3224
|
+
* @param title_id The UUID of the title
|
|
3225
|
+
* @param params Optional query params: start_date, end_date, source, device_type, sort_by, etc.
|
|
3226
|
+
* @returns AxiosPromise
|
|
3227
|
+
*/
|
|
3228
|
+
static getUtmAnalytics<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3229
|
+
/**
|
|
3230
|
+
* Analyze UTM data with optional group_by (source, campaign, medium, device_type, etc.)
|
|
3231
|
+
*
|
|
3232
|
+
* GET /titles/{title_id}/utm/analysis
|
|
3233
|
+
*
|
|
3234
|
+
* @param title_id The UUID of the title
|
|
3235
|
+
* @param params e.g. ?group_by=source&start_date=YYYY-MM-DD
|
|
3236
|
+
* @returns AxiosPromise
|
|
3237
|
+
*/
|
|
3238
|
+
static analyzeUtmAnalytics<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3023
3239
|
}
|
|
3024
3240
|
|
|
3025
3241
|
declare class Campaigns {
|
|
@@ -4937,6 +5153,7 @@ declare class Glitch {
|
|
|
4937
5153
|
Config: typeof Config;
|
|
4938
5154
|
};
|
|
4939
5155
|
static api: {
|
|
5156
|
+
Ads: typeof Ads;
|
|
4940
5157
|
Auth: typeof Auth;
|
|
4941
5158
|
Campaigns: typeof Campaigns;
|
|
4942
5159
|
Competitions: typeof Competitions;
|
package/package.json
CHANGED
package/src/api/Ads.ts
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import AdsRoute from "../routes/AdsRoute";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise } from "axios";
|
|
5
|
+
|
|
6
|
+
class Ads {
|
|
7
|
+
// ----------------------------------------------------------------------
|
|
8
|
+
// AD CAMPAIGNS
|
|
9
|
+
// ----------------------------------------------------------------------
|
|
10
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
91
|
+
// ----------------------------------------------------------------------
|
|
92
|
+
// AD GROUPS (AD SETS)
|
|
93
|
+
// ----------------------------------------------------------------------
|
|
94
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
203
|
+
// ----------------------------------------------------------------------
|
|
204
|
+
// ADS (CREATIVES)
|
|
205
|
+
// ----------------------------------------------------------------------
|
|
206
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
289
|
+
// ----------------------------------------------------------------------
|
|
290
|
+
// AD GROUP TRIGGERS
|
|
291
|
+
// ----------------------------------------------------------------------
|
|
292
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
export default Ads;
|