glitch-javascript-sdk 2.0.4 → 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 +88 -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/Titles.d.ts +13 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +88 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/AccessKeysRoute.d.ts +7 -0
- package/dist/index.d.ts +66 -0
- package/package.json +1 -1
- package/src/api/AccessKeys.ts +49 -0
- package/src/api/Campaigns.ts +16 -0
- package/src/api/Titles.ts +23 -1
- 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/TitlesRoute.ts +3 -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
|
|
@@ -3778,6 +3815,19 @@ declare class Titles {
|
|
|
3778
3815
|
* Matches GET /titles/{title_id}/purchases/reports/item-type-stats
|
|
3779
3816
|
*/
|
|
3780
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>>;
|
|
3781
3831
|
}
|
|
3782
3832
|
|
|
3783
3833
|
declare class Campaigns {
|
|
@@ -4375,6 +4425,21 @@ declare class Campaigns {
|
|
|
4375
4425
|
* @returns promise
|
|
4376
4426
|
*/
|
|
4377
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>>;
|
|
4378
4443
|
}
|
|
4379
4444
|
|
|
4380
4445
|
declare class Subscriptions {
|
|
@@ -6333,6 +6398,7 @@ declare class Glitch {
|
|
|
6333
6398
|
};
|
|
6334
6399
|
static api: {
|
|
6335
6400
|
Ads: typeof Ads;
|
|
6401
|
+
AccessKeys: typeof AccessKeys;
|
|
6336
6402
|
Auth: typeof Auth;
|
|
6337
6403
|
Campaigns: typeof Campaigns;
|
|
6338
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/Titles.ts
CHANGED
|
@@ -696,7 +696,29 @@ class Titles {
|
|
|
696
696
|
{ title_id },
|
|
697
697
|
params
|
|
698
698
|
);
|
|
699
|
-
}
|
|
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
|
+
}
|
|
700
722
|
|
|
701
723
|
|
|
702
724
|
|
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
|
};
|
|
@@ -93,6 +93,9 @@ 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
|
+
|
|
96
99
|
// ─────────────────────────────────────────────────────────────────
|
|
97
100
|
// Purchase/Revenue Endpoints
|
|
98
101
|
// ─────────────────────────────────────────────────────────────────
|