glitch-javascript-sdk 2.0.3 → 2.0.5
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 +227 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/AccessKeys.d.ts +39 -0
- package/dist/esm/api/Campaigns.d.ts +15 -0
- package/dist/esm/api/ShortLinks.d.ts +20 -0
- package/dist/esm/api/Titles.d.ts +58 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +227 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/AccessKeysRoute.d.ts +7 -0
- package/dist/index.d.ts +131 -0
- package/package.json +1 -1
- package/src/api/AccessKeys.ts +49 -0
- package/src/api/Campaigns.ts +16 -0
- package/src/api/ShortLinks.ts +52 -0
- package/src/api/Titles.ts +168 -0
- package/src/api/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/routes/AccessKeysRoute.ts +14 -0
- package/src/routes/CampaignsRoute.ts +1 -0
- package/src/routes/ShortLinksRoute.ts +5 -0
- package/src/routes/TitlesRoute.ts +46 -0
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,43 @@ declare class Auth {
|
|
|
129
129
|
static resetPassword<T>(data: object): AxiosPromise<Response<T>>;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
declare class AccessKeys {
|
|
133
|
+
/**
|
|
134
|
+
* List all access keys for a given title.
|
|
135
|
+
*
|
|
136
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/get_titles__title_id__keys
|
|
137
|
+
*
|
|
138
|
+
* @param title_id The UUID of the title.
|
|
139
|
+
* @param params Optional query parameters for pagination.
|
|
140
|
+
* @returns promise
|
|
141
|
+
*/
|
|
142
|
+
static list<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
143
|
+
/**
|
|
144
|
+
* Bulk create access keys from a string of codes.
|
|
145
|
+
*
|
|
146
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/post_titles__title_id__keys
|
|
147
|
+
*
|
|
148
|
+
* @param title_id The UUID of the title.
|
|
149
|
+
* @param data The platform and codes to upload.
|
|
150
|
+
* @param data.platform The platform for the keys (e.g., 'steam').
|
|
151
|
+
* @param data.codes A string of codes separated by newlines, commas, or spaces.
|
|
152
|
+
* @returns Promise
|
|
153
|
+
*/
|
|
154
|
+
static store<T>(title_id: string, data: {
|
|
155
|
+
platform: string;
|
|
156
|
+
codes: string;
|
|
157
|
+
}, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
158
|
+
/**
|
|
159
|
+
* Deletes an unassigned access key.
|
|
160
|
+
*
|
|
161
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/delete_keys__key_id_
|
|
162
|
+
*
|
|
163
|
+
* @param key_id The UUID of the access key to delete.
|
|
164
|
+
* @returns promise
|
|
165
|
+
*/
|
|
166
|
+
static delete<T>(key_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
167
|
+
}
|
|
168
|
+
|
|
132
169
|
declare class Competitions {
|
|
133
170
|
/**
|
|
134
171
|
* List all the competitions
|
|
@@ -3733,6 +3770,64 @@ declare class Titles {
|
|
|
3733
3770
|
* Update a specific chat message.
|
|
3734
3771
|
*/
|
|
3735
3772
|
static chatUpdateMessage<T>(title_id: string, message_id: string, data: object): AxiosPromise<Response<T>>;
|
|
3773
|
+
/**
|
|
3774
|
+
* List all purchase events for a specific title.
|
|
3775
|
+
* Matches GET /titles/{title_id}/purchases
|
|
3776
|
+
*/
|
|
3777
|
+
static listPurchases<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3778
|
+
/**
|
|
3779
|
+
* Retrieve a single purchase record by ID.
|
|
3780
|
+
* Matches GET /titles/{title_id}/purchases/{purchase_id}
|
|
3781
|
+
*/
|
|
3782
|
+
static viewPurchase<T>(title_id: string, purchase_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3783
|
+
/**
|
|
3784
|
+
* Create a new purchase record.
|
|
3785
|
+
* Matches POST /titles/{title_id}/purchases
|
|
3786
|
+
*/
|
|
3787
|
+
static createPurchase<T>(title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3788
|
+
/**
|
|
3789
|
+
* Get a summary of total revenue, grouped by day or purchase_type.
|
|
3790
|
+
* Matches GET /titles/{title_id}/purchases/summary
|
|
3791
|
+
*/
|
|
3792
|
+
static purchaseSummary<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3793
|
+
/**
|
|
3794
|
+
* Revenue by time (daily, weekly, or monthly).
|
|
3795
|
+
* Matches GET /titles/{title_id}/purchases/reports/time
|
|
3796
|
+
*/
|
|
3797
|
+
static purchaseRevenueByTime<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3798
|
+
/**
|
|
3799
|
+
* 30-day LTV (Lifetime Value) per install.
|
|
3800
|
+
* Matches GET /titles/{title_id}/purchases/reports/ltv30
|
|
3801
|
+
*/
|
|
3802
|
+
static purchaseLtv30<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3803
|
+
/**
|
|
3804
|
+
* Show breakdown of revenue per currency, with optional USD conversion.
|
|
3805
|
+
* Matches GET /titles/{title_id}/purchases/reports/currency
|
|
3806
|
+
*/
|
|
3807
|
+
static purchaseCurrencyBreakdown<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3808
|
+
/**
|
|
3809
|
+
* Distribution of installs by total revenue, plus a histogram array.
|
|
3810
|
+
* Matches GET /titles/{title_id}/purchases/reports/install-distribution
|
|
3811
|
+
*/
|
|
3812
|
+
static installRevenueDistribution<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3813
|
+
/**
|
|
3814
|
+
* Stats by item SKU, purchase type, and repeat purchase analysis.
|
|
3815
|
+
* Matches GET /titles/{title_id}/purchases/reports/item-type-stats
|
|
3816
|
+
*/
|
|
3817
|
+
static itemAndPurchaseTypeStats<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3818
|
+
/**
|
|
3819
|
+
* Bulk import access keys for a title from a CSV or Excel file.
|
|
3820
|
+
* The file must contain 'platform' and 'code' columns.
|
|
3821
|
+
*
|
|
3822
|
+
* @see https://api.glitch.fun/api/documentation#/Titles/importTitleKeys
|
|
3823
|
+
*
|
|
3824
|
+
* @param title_id The UUID of the title.
|
|
3825
|
+
* @param file The CSV or Excel file to upload.
|
|
3826
|
+
* @param data Optional additional form data.
|
|
3827
|
+
* @param params Optional query parameters.
|
|
3828
|
+
* @returns AxiosPromise
|
|
3829
|
+
*/
|
|
3830
|
+
static importKeys<T>(title_id: string, file: File | Blob, data?: Record<string, any>, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3736
3831
|
}
|
|
3737
3832
|
|
|
3738
3833
|
declare class Campaigns {
|
|
@@ -4330,6 +4425,21 @@ declare class Campaigns {
|
|
|
4330
4425
|
* @returns promise
|
|
4331
4426
|
*/
|
|
4332
4427
|
static updateSourcedCreator<T>(campaign_id: string, sourced_creator_id: string, data: object): AxiosPromise<Response<T>>;
|
|
4428
|
+
/**
|
|
4429
|
+
* Assigns an available access key to an influencer for a specific campaign.
|
|
4430
|
+
* This will find the next available key for the given platform and assign it.
|
|
4431
|
+
*
|
|
4432
|
+
* @see https://api.glitch.fun/api/documentation#/Campaigns/assignKey
|
|
4433
|
+
*
|
|
4434
|
+
* @param campaign_id The ID of the campaign.
|
|
4435
|
+
* @param user_id The ID of the user (influencer).
|
|
4436
|
+
* @param data The platform for which to assign a key.
|
|
4437
|
+
* @param data.platform The platform of the key to assign (e.g., 'steam').
|
|
4438
|
+
* @returns promise
|
|
4439
|
+
*/
|
|
4440
|
+
static assignKeyToInfluencer<T>(campaign_id: string, user_id: string, data: {
|
|
4441
|
+
platform: string;
|
|
4442
|
+
}, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4333
4443
|
}
|
|
4334
4444
|
|
|
4335
4445
|
declare class Subscriptions {
|
|
@@ -5765,6 +5875,26 @@ declare class ShortLinks {
|
|
|
5765
5875
|
* Update a short link
|
|
5766
5876
|
*/
|
|
5767
5877
|
static update<T>(id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
5878
|
+
/**
|
|
5879
|
+
* Get click-summary report
|
|
5880
|
+
* - Example usage: ShortLinks.clickSummary({ short_link_id: 'uuid-here' })
|
|
5881
|
+
*/
|
|
5882
|
+
static clickSummary<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
5883
|
+
/**
|
|
5884
|
+
* Get geo & device breakdown report
|
|
5885
|
+
* - Example usage: ShortLinks.geoDeviceBreakdown({ short_link_id: 'uuid-here' })
|
|
5886
|
+
*/
|
|
5887
|
+
static geoDeviceBreakdown<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
5888
|
+
/**
|
|
5889
|
+
* Get time-series report
|
|
5890
|
+
* - Example usage: ShortLinks.timeSeries({ short_link_id: 'uuid-here', group_by: 'day' })
|
|
5891
|
+
*/
|
|
5892
|
+
static timeSeries<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
5893
|
+
/**
|
|
5894
|
+
* Get referrer & UTM report
|
|
5895
|
+
* - Example usage: ShortLinks.referrerReport({ short_link_id: 'uuid-here' })
|
|
5896
|
+
*/
|
|
5897
|
+
static referrerReport<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
5768
5898
|
}
|
|
5769
5899
|
|
|
5770
5900
|
declare class AIUsage {
|
|
@@ -6268,6 +6398,7 @@ declare class Glitch {
|
|
|
6268
6398
|
};
|
|
6269
6399
|
static api: {
|
|
6270
6400
|
Ads: typeof Ads;
|
|
6401
|
+
AccessKeys: typeof AccessKeys;
|
|
6271
6402
|
Auth: typeof Auth;
|
|
6272
6403
|
Campaigns: typeof Campaigns;
|
|
6273
6404
|
Competitions: typeof Competitions;
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import AccessKeysRoute from "../routes/AccessKeysRoute";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise } from "axios";
|
|
5
|
+
|
|
6
|
+
class AccessKeys {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* List all access keys for a given title.
|
|
10
|
+
*
|
|
11
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/get_titles__title_id__keys
|
|
12
|
+
*
|
|
13
|
+
* @param title_id The UUID of the title.
|
|
14
|
+
* @param params Optional query parameters for pagination.
|
|
15
|
+
* @returns promise
|
|
16
|
+
*/
|
|
17
|
+
public static list<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
18
|
+
return Requests.processRoute(AccessKeysRoute.routes.list, undefined, { title_id }, params);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Bulk create access keys from a string of codes.
|
|
23
|
+
*
|
|
24
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/post_titles__title_id__keys
|
|
25
|
+
*
|
|
26
|
+
* @param title_id The UUID of the title.
|
|
27
|
+
* @param data The platform and codes to upload.
|
|
28
|
+
* @param data.platform The platform for the keys (e.g., 'steam').
|
|
29
|
+
* @param data.codes A string of codes separated by newlines, commas, or spaces.
|
|
30
|
+
* @returns Promise
|
|
31
|
+
*/
|
|
32
|
+
public static store<T>(title_id: string, data: { platform: string, codes: string }, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
33
|
+
return Requests.processRoute(AccessKeysRoute.routes.store, data, { title_id }, params);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Deletes an unassigned access key.
|
|
38
|
+
*
|
|
39
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/delete_keys__key_id_
|
|
40
|
+
*
|
|
41
|
+
* @param key_id The UUID of the access key to delete.
|
|
42
|
+
* @returns promise
|
|
43
|
+
*/
|
|
44
|
+
public static delete<T>(key_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
45
|
+
return Requests.processRoute(AccessKeysRoute.routes.delete, {}, { key_id }, params);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default AccessKeys;
|
package/src/api/Campaigns.ts
CHANGED
|
@@ -846,6 +846,22 @@ class Campaigns {
|
|
|
846
846
|
public static updateSourcedCreator<T>(campaign_id: string, sourced_creator_id: string, data: object): AxiosPromise<Response<T>> {
|
|
847
847
|
return Requests.processRoute(CampaignsRoute.routes.updateSourcedCreator, data, { campaign_id, sourced_creator_id });
|
|
848
848
|
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Assigns an available access key to an influencer for a specific campaign.
|
|
852
|
+
* This will find the next available key for the given platform and assign it.
|
|
853
|
+
*
|
|
854
|
+
* @see https://api.glitch.fun/api/documentation#/Campaigns/assignKey
|
|
855
|
+
*
|
|
856
|
+
* @param campaign_id The ID of the campaign.
|
|
857
|
+
* @param user_id The ID of the user (influencer).
|
|
858
|
+
* @param data The platform for which to assign a key.
|
|
859
|
+
* @param data.platform The platform of the key to assign (e.g., 'steam').
|
|
860
|
+
* @returns promise
|
|
861
|
+
*/
|
|
862
|
+
public static assignKeyToInfluencer<T>(campaign_id: string, user_id: string, data: { platform: string }, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
863
|
+
return Requests.processRoute(CampaignsRoute.routes.assignKeyToInfluencer, data, { campaign_id, user_id }, params);
|
|
864
|
+
}
|
|
849
865
|
}
|
|
850
866
|
|
|
851
867
|
export default Campaigns;
|
package/src/api/ShortLinks.ts
CHANGED
|
@@ -36,6 +36,58 @@ class ShortLinks {
|
|
|
36
36
|
// public static delete<T>(id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
37
37
|
// return Requests.processRoute(ShortLinksRoute.routes.deleteShortLink, {}, { id }, params);
|
|
38
38
|
// }
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get click-summary report
|
|
42
|
+
* - Example usage: ShortLinks.clickSummary({ short_link_id: 'uuid-here' })
|
|
43
|
+
*/
|
|
44
|
+
public static clickSummary<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
45
|
+
return Requests.processRoute(
|
|
46
|
+
ShortLinksRoute.routes.clickSummary,
|
|
47
|
+
undefined,
|
|
48
|
+
undefined,
|
|
49
|
+
params
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get geo & device breakdown report
|
|
55
|
+
* - Example usage: ShortLinks.geoDeviceBreakdown({ short_link_id: 'uuid-here' })
|
|
56
|
+
*/
|
|
57
|
+
public static geoDeviceBreakdown<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
58
|
+
return Requests.processRoute(
|
|
59
|
+
ShortLinksRoute.routes.geoDeviceBreakdown,
|
|
60
|
+
undefined,
|
|
61
|
+
undefined,
|
|
62
|
+
params
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Get time-series report
|
|
68
|
+
* - Example usage: ShortLinks.timeSeries({ short_link_id: 'uuid-here', group_by: 'day' })
|
|
69
|
+
*/
|
|
70
|
+
public static timeSeries<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
71
|
+
return Requests.processRoute(
|
|
72
|
+
ShortLinksRoute.routes.timeSeries,
|
|
73
|
+
undefined,
|
|
74
|
+
undefined,
|
|
75
|
+
params
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get referrer & UTM report
|
|
81
|
+
* - Example usage: ShortLinks.referrerReport({ short_link_id: 'uuid-here' })
|
|
82
|
+
*/
|
|
83
|
+
public static referrerReport<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
84
|
+
return Requests.processRoute(
|
|
85
|
+
ShortLinksRoute.routes.referrerReport,
|
|
86
|
+
undefined,
|
|
87
|
+
undefined,
|
|
88
|
+
params
|
|
89
|
+
);
|
|
90
|
+
}
|
|
39
91
|
}
|
|
40
92
|
|
|
41
93
|
export default ShortLinks;
|
package/src/api/Titles.ts
CHANGED
|
@@ -552,6 +552,174 @@ class Titles {
|
|
|
552
552
|
);
|
|
553
553
|
}
|
|
554
554
|
|
|
555
|
+
/**
|
|
556
|
+
* List all purchase events for a specific title.
|
|
557
|
+
* Matches GET /titles/{title_id}/purchases
|
|
558
|
+
*/
|
|
559
|
+
public static listPurchases<T>(
|
|
560
|
+
title_id: string,
|
|
561
|
+
params?: Record<string, any>
|
|
562
|
+
): AxiosPromise<Response<T>> {
|
|
563
|
+
return Requests.processRoute(
|
|
564
|
+
TitlesRoute.routes.purchasesList,
|
|
565
|
+
{},
|
|
566
|
+
{ title_id },
|
|
567
|
+
params
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Retrieve a single purchase record by ID.
|
|
573
|
+
* Matches GET /titles/{title_id}/purchases/{purchase_id}
|
|
574
|
+
*/
|
|
575
|
+
public static viewPurchase<T>(
|
|
576
|
+
title_id: string,
|
|
577
|
+
purchase_id: string,
|
|
578
|
+
params?: Record<string, any>
|
|
579
|
+
): AxiosPromise<Response<T>> {
|
|
580
|
+
return Requests.processRoute(
|
|
581
|
+
TitlesRoute.routes.purchasesShow,
|
|
582
|
+
{},
|
|
583
|
+
{ title_id, purchase_id },
|
|
584
|
+
params
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Create a new purchase record.
|
|
590
|
+
* Matches POST /titles/{title_id}/purchases
|
|
591
|
+
*/
|
|
592
|
+
public static createPurchase<T>(
|
|
593
|
+
title_id: string,
|
|
594
|
+
data: object,
|
|
595
|
+
params?: Record<string, any>
|
|
596
|
+
): AxiosPromise<Response<T>> {
|
|
597
|
+
return Requests.processRoute(
|
|
598
|
+
TitlesRoute.routes.purchasesCreate,
|
|
599
|
+
data,
|
|
600
|
+
{ title_id },
|
|
601
|
+
params
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Get a summary of total revenue, grouped by day or purchase_type.
|
|
607
|
+
* Matches GET /titles/{title_id}/purchases/summary
|
|
608
|
+
*/
|
|
609
|
+
public static purchaseSummary<T>(
|
|
610
|
+
title_id: string,
|
|
611
|
+
params?: Record<string, any>
|
|
612
|
+
): AxiosPromise<Response<T>> {
|
|
613
|
+
return Requests.processRoute(
|
|
614
|
+
TitlesRoute.routes.purchasesSummary,
|
|
615
|
+
{},
|
|
616
|
+
{ title_id },
|
|
617
|
+
params
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Revenue by time (daily, weekly, or monthly).
|
|
623
|
+
* Matches GET /titles/{title_id}/purchases/reports/time
|
|
624
|
+
*/
|
|
625
|
+
public static purchaseRevenueByTime<T>(
|
|
626
|
+
title_id: string,
|
|
627
|
+
params?: Record<string, any>
|
|
628
|
+
): AxiosPromise<Response<T>> {
|
|
629
|
+
return Requests.processRoute(
|
|
630
|
+
TitlesRoute.routes.purchasesTimeReport,
|
|
631
|
+
{},
|
|
632
|
+
{ title_id },
|
|
633
|
+
params
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* 30-day LTV (Lifetime Value) per install.
|
|
639
|
+
* Matches GET /titles/{title_id}/purchases/reports/ltv30
|
|
640
|
+
*/
|
|
641
|
+
public static purchaseLtv30<T>(
|
|
642
|
+
title_id: string,
|
|
643
|
+
params?: Record<string, any>
|
|
644
|
+
): AxiosPromise<Response<T>> {
|
|
645
|
+
return Requests.processRoute(
|
|
646
|
+
TitlesRoute.routes.purchasesLtv30Report,
|
|
647
|
+
{},
|
|
648
|
+
{ title_id },
|
|
649
|
+
params
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Show breakdown of revenue per currency, with optional USD conversion.
|
|
655
|
+
* Matches GET /titles/{title_id}/purchases/reports/currency
|
|
656
|
+
*/
|
|
657
|
+
public static purchaseCurrencyBreakdown<T>(
|
|
658
|
+
title_id: string,
|
|
659
|
+
params?: Record<string, any>
|
|
660
|
+
): AxiosPromise<Response<T>> {
|
|
661
|
+
return Requests.processRoute(
|
|
662
|
+
TitlesRoute.routes.purchasesCurrencyBreakdown,
|
|
663
|
+
{},
|
|
664
|
+
{ title_id },
|
|
665
|
+
params
|
|
666
|
+
);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Distribution of installs by total revenue, plus a histogram array.
|
|
671
|
+
* Matches GET /titles/{title_id}/purchases/reports/install-distribution
|
|
672
|
+
*/
|
|
673
|
+
public static installRevenueDistribution<T>(
|
|
674
|
+
title_id: string,
|
|
675
|
+
params?: Record<string, any>
|
|
676
|
+
): AxiosPromise<Response<T>> {
|
|
677
|
+
return Requests.processRoute(
|
|
678
|
+
TitlesRoute.routes.purchasesInstallDistribution,
|
|
679
|
+
{},
|
|
680
|
+
{ title_id },
|
|
681
|
+
params
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Stats by item SKU, purchase type, and repeat purchase analysis.
|
|
687
|
+
* Matches GET /titles/{title_id}/purchases/reports/item-type-stats
|
|
688
|
+
*/
|
|
689
|
+
public static itemAndPurchaseTypeStats<T>(
|
|
690
|
+
title_id: string,
|
|
691
|
+
params?: Record<string, any>
|
|
692
|
+
): AxiosPromise<Response<T>> {
|
|
693
|
+
return Requests.processRoute(
|
|
694
|
+
TitlesRoute.routes.purchasesItemTypeStats,
|
|
695
|
+
{},
|
|
696
|
+
{ title_id },
|
|
697
|
+
params
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Bulk import access keys for a title from a CSV or Excel file.
|
|
703
|
+
* The file must contain 'platform' and 'code' columns.
|
|
704
|
+
*
|
|
705
|
+
* @see https://api.glitch.fun/api/documentation#/Titles/importTitleKeys
|
|
706
|
+
*
|
|
707
|
+
* @param title_id The UUID of the title.
|
|
708
|
+
* @param file The CSV or Excel file to upload.
|
|
709
|
+
* @param data Optional additional form data.
|
|
710
|
+
* @param params Optional query parameters.
|
|
711
|
+
* @returns AxiosPromise
|
|
712
|
+
*/
|
|
713
|
+
public static importKeys<T>(
|
|
714
|
+
title_id: string,
|
|
715
|
+
file: File | Blob,
|
|
716
|
+
data?: Record<string, any>,
|
|
717
|
+
params?: Record<string, any>
|
|
718
|
+
): AxiosPromise<Response<T>> {
|
|
719
|
+
const url = TitlesRoute.routes.importKeys.url.replace("{title_id}", title_id);
|
|
720
|
+
return Requests.uploadFile<T>(url, "file", file, data, params);
|
|
721
|
+
}
|
|
722
|
+
|
|
555
723
|
|
|
556
724
|
|
|
557
725
|
}
|
package/src/api/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Auth from "./Auth";
|
|
2
2
|
import Ads from "./Ads";
|
|
3
|
+
import AccessKeys from "./AccessKeys";
|
|
3
4
|
import Competitions from "./Competitions";
|
|
4
5
|
import Communities from "./Communities";
|
|
5
6
|
import Users from "./Users";
|
|
@@ -38,6 +39,7 @@ import AIUsage from "./AIUsage";
|
|
|
38
39
|
import MarketingAgencies from "./MarketingAgencies";
|
|
39
40
|
|
|
40
41
|
export {Ads};
|
|
42
|
+
export {AccessKeys};
|
|
41
43
|
export {Auth};
|
|
42
44
|
export {Competitions};
|
|
43
45
|
export {Communities};
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Config } from "./config";
|
|
|
4
4
|
|
|
5
5
|
//API
|
|
6
6
|
import Auth from "./api/Auth";
|
|
7
|
+
import AccessKeys from "./api/AccessKeys"
|
|
7
8
|
import Competitions from "./api/Competitions";
|
|
8
9
|
import {Communities, Social} from "./api";
|
|
9
10
|
import { Ads } from "./api";
|
|
@@ -72,6 +73,7 @@ class Glitch {
|
|
|
72
73
|
|
|
73
74
|
public static api = {
|
|
74
75
|
Ads: Ads,
|
|
76
|
+
AccessKeys : AccessKeys,
|
|
75
77
|
Auth: Auth,
|
|
76
78
|
Campaigns : Campaigns,
|
|
77
79
|
Competitions: Competitions,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
3
|
+
|
|
4
|
+
class AccessKeysRoute {
|
|
5
|
+
|
|
6
|
+
public static routes: { [key: string]: Route } = {
|
|
7
|
+
list: { url: '/titles/{title_id}/keys', method: HTTP_METHODS.GET },
|
|
8
|
+
store: { url: '/titles/{title_id}/keys', method: HTTP_METHODS.POST },
|
|
9
|
+
delete: { url: '/keys/{key_id}', method: HTTP_METHODS.DELETE },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default AccessKeysRoute;
|
|
@@ -69,6 +69,7 @@ class CampaignsRoute {
|
|
|
69
69
|
getSourcedCreators: { url: '/campaigns/{campaign_id}/sourcing/creators', method: HTTP_METHODS.GET },
|
|
70
70
|
getSourcedCreator: { url: '/campaigns/{campaign_id}/sourcing/creators/{sourced_creator_id}', method: HTTP_METHODS.GET },
|
|
71
71
|
updateSourcedCreator: { url: '/campaigns/{campaign_id}/sourcing/creators/{sourced_creator_id}', method: HTTP_METHODS.PUT },
|
|
72
|
+
assignKeyToInfluencer: { url: '/campaigns/{campaign_id}/influencers/{user_id}/assign-key', method: HTTP_METHODS.POST },
|
|
72
73
|
|
|
73
74
|
|
|
74
75
|
};
|
|
@@ -9,6 +9,11 @@ class ShortLinksRoute {
|
|
|
9
9
|
updateShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.PUT },
|
|
10
10
|
// Delete can be added if supported
|
|
11
11
|
// deleteShortLink: { url: '/shortlinks/{id}', method: HTTP_METHODS.DELETE }
|
|
12
|
+
|
|
13
|
+
clickSummary: { url: '/shortlinks/reports/click-summary', method: HTTP_METHODS.GET },
|
|
14
|
+
geoDeviceBreakdown:{ url: '/shortlinks/reports/geo-device', method: HTTP_METHODS.GET },
|
|
15
|
+
timeSeries: { url: '/shortlinks/reports/time-series', method: HTTP_METHODS.GET },
|
|
16
|
+
referrerReport: { url: '/shortlinks/reports/referrer', method: HTTP_METHODS.GET },
|
|
12
17
|
};
|
|
13
18
|
}
|
|
14
19
|
|
|
@@ -93,6 +93,52 @@ class TitlesRoute {
|
|
|
93
93
|
method: HTTP_METHODS.PUT
|
|
94
94
|
},
|
|
95
95
|
|
|
96
|
+
importKeys: { url: '/titles/{title_id}/import-keys', method: HTTP_METHODS.POST },
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// ─────────────────────────────────────────────────────────────────
|
|
100
|
+
// Purchase/Revenue Endpoints
|
|
101
|
+
// ─────────────────────────────────────────────────────────────────
|
|
102
|
+
purchasesList: {
|
|
103
|
+
url: "/titles/{title_id}/purchases",
|
|
104
|
+
method: HTTP_METHODS.GET,
|
|
105
|
+
},
|
|
106
|
+
purchasesShow: {
|
|
107
|
+
url: "/titles/{title_id}/purchases/{purchase_id}",
|
|
108
|
+
method: HTTP_METHODS.GET,
|
|
109
|
+
},
|
|
110
|
+
purchasesCreate: {
|
|
111
|
+
url: "/titles/{title_id}/purchases",
|
|
112
|
+
method: HTTP_METHODS.POST,
|
|
113
|
+
},
|
|
114
|
+
purchasesSummary: {
|
|
115
|
+
url: "/titles/{title_id}/purchases/summary",
|
|
116
|
+
method: HTTP_METHODS.GET,
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// Advanced analytics sub-routes
|
|
120
|
+
purchasesTimeReport: {
|
|
121
|
+
url: "/titles/{title_id}/purchases/reports/time",
|
|
122
|
+
method: HTTP_METHODS.GET,
|
|
123
|
+
},
|
|
124
|
+
purchasesLtv30Report: {
|
|
125
|
+
url: "/titles/{title_id}/purchases/reports/ltv30",
|
|
126
|
+
method: HTTP_METHODS.GET,
|
|
127
|
+
},
|
|
128
|
+
purchasesCurrencyBreakdown: {
|
|
129
|
+
url: "/titles/{title_id}/purchases/reports/currency",
|
|
130
|
+
method: HTTP_METHODS.GET,
|
|
131
|
+
},
|
|
132
|
+
purchasesInstallDistribution: {
|
|
133
|
+
url: "/titles/{title_id}/purchases/reports/install-distribution",
|
|
134
|
+
method: HTTP_METHODS.GET,
|
|
135
|
+
},
|
|
136
|
+
purchasesItemTypeStats: {
|
|
137
|
+
url: "/titles/{title_id}/purchases/reports/item-type-stats",
|
|
138
|
+
method: HTTP_METHODS.GET,
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
|
|
96
142
|
};
|
|
97
143
|
|
|
98
144
|
}
|