glitch-javascript-sdk 2.0.4 → 2.0.6
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 +113 -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/WebsiteAnalytics.d.ts +17 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +113 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/AccessKeysRoute.d.ts +7 -0
- package/dist/index.d.ts +83 -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/WebsiteAnalytics.ts +25 -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/TitlesRoute.ts +3 -0
- package/src/routes/WebsiteAnalyticsRoute.ts +5 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise } from "axios";
|
|
3
|
+
declare class AccessKeys {
|
|
4
|
+
/**
|
|
5
|
+
* List all access keys for a given title.
|
|
6
|
+
*
|
|
7
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/get_titles__title_id__keys
|
|
8
|
+
*
|
|
9
|
+
* @param title_id The UUID of the title.
|
|
10
|
+
* @param params Optional query parameters for pagination.
|
|
11
|
+
* @returns promise
|
|
12
|
+
*/
|
|
13
|
+
static list<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
14
|
+
/**
|
|
15
|
+
* Bulk create access keys from a string of codes.
|
|
16
|
+
*
|
|
17
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/post_titles__title_id__keys
|
|
18
|
+
*
|
|
19
|
+
* @param title_id The UUID of the title.
|
|
20
|
+
* @param data The platform and codes to upload.
|
|
21
|
+
* @param data.platform The platform for the keys (e.g., 'steam').
|
|
22
|
+
* @param data.codes A string of codes separated by newlines, commas, or spaces.
|
|
23
|
+
* @returns Promise
|
|
24
|
+
*/
|
|
25
|
+
static store<T>(title_id: string, data: {
|
|
26
|
+
platform: string;
|
|
27
|
+
codes: string;
|
|
28
|
+
}, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
29
|
+
/**
|
|
30
|
+
* Deletes an unassigned access key.
|
|
31
|
+
*
|
|
32
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/delete_keys__key_id_
|
|
33
|
+
*
|
|
34
|
+
* @param key_id The UUID of the access key to delete.
|
|
35
|
+
* @returns promise
|
|
36
|
+
*/
|
|
37
|
+
static delete<T>(key_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
38
|
+
}
|
|
39
|
+
export default AccessKeys;
|
|
@@ -595,5 +595,20 @@ declare class Campaigns {
|
|
|
595
595
|
* @returns promise
|
|
596
596
|
*/
|
|
597
597
|
static updateSourcedCreator<T>(campaign_id: string, sourced_creator_id: string, data: object): AxiosPromise<Response<T>>;
|
|
598
|
+
/**
|
|
599
|
+
* Assigns an available access key to an influencer for a specific campaign.
|
|
600
|
+
* This will find the next available key for the given platform and assign it.
|
|
601
|
+
*
|
|
602
|
+
* @see https://api.glitch.fun/api/documentation#/Campaigns/assignKey
|
|
603
|
+
*
|
|
604
|
+
* @param campaign_id The ID of the campaign.
|
|
605
|
+
* @param user_id The ID of the user (influencer).
|
|
606
|
+
* @param data The platform for which to assign a key.
|
|
607
|
+
* @param data.platform The platform of the key to assign (e.g., 'steam').
|
|
608
|
+
* @returns promise
|
|
609
|
+
*/
|
|
610
|
+
static assignKeyToInfluencer<T>(campaign_id: string, user_id: string, data: {
|
|
611
|
+
platform: string;
|
|
612
|
+
}, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
598
613
|
}
|
|
599
614
|
export default Campaigns;
|
package/dist/esm/api/Titles.d.ts
CHANGED
|
@@ -334,5 +334,18 @@ declare class Titles {
|
|
|
334
334
|
* Matches GET /titles/{title_id}/purchases/reports/item-type-stats
|
|
335
335
|
*/
|
|
336
336
|
static itemAndPurchaseTypeStats<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
337
|
+
/**
|
|
338
|
+
* Bulk import access keys for a title from a CSV or Excel file.
|
|
339
|
+
* The file must contain 'platform' and 'code' columns.
|
|
340
|
+
*
|
|
341
|
+
* @see https://api.glitch.fun/api/documentation#/Titles/importTitleKeys
|
|
342
|
+
*
|
|
343
|
+
* @param title_id The UUID of the title.
|
|
344
|
+
* @param file The CSV or Excel file to upload.
|
|
345
|
+
* @param data Optional additional form data.
|
|
346
|
+
* @param params Optional query parameters.
|
|
347
|
+
* @returns AxiosPromise
|
|
348
|
+
*/
|
|
349
|
+
static importKeys<T>(title_id: string, file: File | Blob, data?: Record<string, any>, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
337
350
|
}
|
|
338
351
|
export default Titles;
|
|
@@ -183,5 +183,22 @@ declare class WebsiteAnalytics {
|
|
|
183
183
|
* @returns Promise with UTM performance data
|
|
184
184
|
*/
|
|
185
185
|
static utmPerformance<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
186
|
+
/**
|
|
187
|
+
* Get a combined user journey across short link clicks, web sessions, game installations, etc.
|
|
188
|
+
*
|
|
189
|
+
* @param params Filtering options. All are optional except `title_id`.
|
|
190
|
+
* - title_id: string Required. The UUID of the title to unify user events.
|
|
191
|
+
* - device_id?: string Filter by device ID
|
|
192
|
+
* - session_id?: string Filter by session ID
|
|
193
|
+
* - short_link_click_id?: string Filter by short link click ID
|
|
194
|
+
* - user_install_id?: string Filter by game install user_install_id
|
|
195
|
+
* - browser_fingerprint?: string Filter by browser fingerprint hash
|
|
196
|
+
* - hardware_fingerprint?: string Filter by hardware fingerprint hash
|
|
197
|
+
* - start_date?: string Optional. Start date (YYYY-MM-DD) if your API supports time limiting
|
|
198
|
+
* - end_date?: string Optional. End date (YYYY-MM-DD) if your API supports time limiting
|
|
199
|
+
*
|
|
200
|
+
* @returns Promise with a unified timeline of the user’s journey, in chronological order.
|
|
201
|
+
*/
|
|
202
|
+
static userJourney<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
|
|
186
203
|
}
|
|
187
204
|
export default WebsiteAnalytics;
|
package/dist/esm/api/index.d.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";
|
|
@@ -37,6 +38,7 @@ import ShortLinks from "./ShortLinks";
|
|
|
37
38
|
import AIUsage from "./AIUsage";
|
|
38
39
|
import MarketingAgencies from "./MarketingAgencies";
|
|
39
40
|
export { Ads };
|
|
41
|
+
export { AccessKeys };
|
|
40
42
|
export { Auth };
|
|
41
43
|
export { Competitions };
|
|
42
44
|
export { Communities };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Config } from "./config";
|
|
2
2
|
import Auth from "./api/Auth";
|
|
3
|
+
import AccessKeys from "./api/AccessKeys";
|
|
3
4
|
import Competitions from "./api/Competitions";
|
|
4
5
|
import { Communities, Social } from "./api";
|
|
5
6
|
import { Ads } from "./api";
|
|
@@ -56,6 +57,7 @@ declare class Glitch {
|
|
|
56
57
|
};
|
|
57
58
|
static api: {
|
|
58
59
|
Ads: typeof Ads;
|
|
60
|
+
AccessKeys: typeof AccessKeys;
|
|
59
61
|
Auth: typeof Auth;
|
|
60
62
|
Campaigns: typeof Campaigns;
|
|
61
63
|
Competitions: typeof Competitions;
|
package/dist/esm/index.js
CHANGED
|
@@ -5895,6 +5895,60 @@ var Auth = /** @class */ (function () {
|
|
|
5895
5895
|
return Auth;
|
|
5896
5896
|
}());
|
|
5897
5897
|
|
|
5898
|
+
var AccessKeysRoute = /** @class */ (function () {
|
|
5899
|
+
function AccessKeysRoute() {
|
|
5900
|
+
}
|
|
5901
|
+
AccessKeysRoute.routes = {
|
|
5902
|
+
list: { url: '/titles/{title_id}/keys', method: HTTP_METHODS.GET },
|
|
5903
|
+
store: { url: '/titles/{title_id}/keys', method: HTTP_METHODS.POST },
|
|
5904
|
+
delete: { url: '/keys/{key_id}', method: HTTP_METHODS.DELETE },
|
|
5905
|
+
};
|
|
5906
|
+
return AccessKeysRoute;
|
|
5907
|
+
}());
|
|
5908
|
+
|
|
5909
|
+
var AccessKeys = /** @class */ (function () {
|
|
5910
|
+
function AccessKeys() {
|
|
5911
|
+
}
|
|
5912
|
+
/**
|
|
5913
|
+
* List all access keys for a given title.
|
|
5914
|
+
*
|
|
5915
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/get_titles__title_id__keys
|
|
5916
|
+
*
|
|
5917
|
+
* @param title_id The UUID of the title.
|
|
5918
|
+
* @param params Optional query parameters for pagination.
|
|
5919
|
+
* @returns promise
|
|
5920
|
+
*/
|
|
5921
|
+
AccessKeys.list = function (title_id, params) {
|
|
5922
|
+
return Requests.processRoute(AccessKeysRoute.routes.list, undefined, { title_id: title_id }, params);
|
|
5923
|
+
};
|
|
5924
|
+
/**
|
|
5925
|
+
* Bulk create access keys from a string of codes.
|
|
5926
|
+
*
|
|
5927
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/post_titles__title_id__keys
|
|
5928
|
+
*
|
|
5929
|
+
* @param title_id The UUID of the title.
|
|
5930
|
+
* @param data The platform and codes to upload.
|
|
5931
|
+
* @param data.platform The platform for the keys (e.g., 'steam').
|
|
5932
|
+
* @param data.codes A string of codes separated by newlines, commas, or spaces.
|
|
5933
|
+
* @returns Promise
|
|
5934
|
+
*/
|
|
5935
|
+
AccessKeys.store = function (title_id, data, params) {
|
|
5936
|
+
return Requests.processRoute(AccessKeysRoute.routes.store, data, { title_id: title_id }, params);
|
|
5937
|
+
};
|
|
5938
|
+
/**
|
|
5939
|
+
* Deletes an unassigned access key.
|
|
5940
|
+
*
|
|
5941
|
+
* @see https://api.glitch.fun/api/documentation#/Access%20Keys/delete_keys__key_id_
|
|
5942
|
+
*
|
|
5943
|
+
* @param key_id The UUID of the access key to delete.
|
|
5944
|
+
* @returns promise
|
|
5945
|
+
*/
|
|
5946
|
+
AccessKeys.delete = function (key_id, params) {
|
|
5947
|
+
return Requests.processRoute(AccessKeysRoute.routes.delete, {}, { key_id: key_id }, params);
|
|
5948
|
+
};
|
|
5949
|
+
return AccessKeys;
|
|
5950
|
+
}());
|
|
5951
|
+
|
|
5898
5952
|
var CompetitionRoutes = /** @class */ (function () {
|
|
5899
5953
|
function CompetitionRoutes() {
|
|
5900
5954
|
}
|
|
@@ -11091,6 +11145,7 @@ var TitlesRoute = /** @class */ (function () {
|
|
|
11091
11145
|
url: '/titles/{title_id}/chat/messages/{message_id}',
|
|
11092
11146
|
method: HTTP_METHODS.PUT
|
|
11093
11147
|
},
|
|
11148
|
+
importKeys: { url: '/titles/{title_id}/import-keys', method: HTTP_METHODS.POST },
|
|
11094
11149
|
// ─────────────────────────────────────────────────────────────────
|
|
11095
11150
|
// Purchase/Revenue Endpoints
|
|
11096
11151
|
// ─────────────────────────────────────────────────────────────────
|
|
@@ -11573,6 +11628,22 @@ var Titles = /** @class */ (function () {
|
|
|
11573
11628
|
Titles.itemAndPurchaseTypeStats = function (title_id, params) {
|
|
11574
11629
|
return Requests.processRoute(TitlesRoute.routes.purchasesItemTypeStats, {}, { title_id: title_id }, params);
|
|
11575
11630
|
};
|
|
11631
|
+
/**
|
|
11632
|
+
* Bulk import access keys for a title from a CSV or Excel file.
|
|
11633
|
+
* The file must contain 'platform' and 'code' columns.
|
|
11634
|
+
*
|
|
11635
|
+
* @see https://api.glitch.fun/api/documentation#/Titles/importTitleKeys
|
|
11636
|
+
*
|
|
11637
|
+
* @param title_id The UUID of the title.
|
|
11638
|
+
* @param file The CSV or Excel file to upload.
|
|
11639
|
+
* @param data Optional additional form data.
|
|
11640
|
+
* @param params Optional query parameters.
|
|
11641
|
+
* @returns AxiosPromise
|
|
11642
|
+
*/
|
|
11643
|
+
Titles.importKeys = function (title_id, file, data, params) {
|
|
11644
|
+
var url = TitlesRoute.routes.importKeys.url.replace("{title_id}", title_id);
|
|
11645
|
+
return Requests.uploadFile(url, "file", file, data, params);
|
|
11646
|
+
};
|
|
11576
11647
|
return Titles;
|
|
11577
11648
|
}());
|
|
11578
11649
|
|
|
@@ -11645,6 +11716,7 @@ var CampaignsRoute = /** @class */ (function () {
|
|
|
11645
11716
|
getSourcedCreators: { url: '/campaigns/{campaign_id}/sourcing/creators', method: HTTP_METHODS.GET },
|
|
11646
11717
|
getSourcedCreator: { url: '/campaigns/{campaign_id}/sourcing/creators/{sourced_creator_id}', method: HTTP_METHODS.GET },
|
|
11647
11718
|
updateSourcedCreator: { url: '/campaigns/{campaign_id}/sourcing/creators/{sourced_creator_id}', method: HTTP_METHODS.PUT },
|
|
11719
|
+
assignKeyToInfluencer: { url: '/campaigns/{campaign_id}/influencers/{user_id}/assign-key', method: HTTP_METHODS.POST },
|
|
11648
11720
|
};
|
|
11649
11721
|
return CampaignsRoute;
|
|
11650
11722
|
}());
|
|
@@ -12376,6 +12448,21 @@ var Campaigns = /** @class */ (function () {
|
|
|
12376
12448
|
Campaigns.updateSourcedCreator = function (campaign_id, sourced_creator_id, data) {
|
|
12377
12449
|
return Requests.processRoute(CampaignsRoute.routes.updateSourcedCreator, data, { campaign_id: campaign_id, sourced_creator_id: sourced_creator_id });
|
|
12378
12450
|
};
|
|
12451
|
+
/**
|
|
12452
|
+
* Assigns an available access key to an influencer for a specific campaign.
|
|
12453
|
+
* This will find the next available key for the given platform and assign it.
|
|
12454
|
+
*
|
|
12455
|
+
* @see https://api.glitch.fun/api/documentation#/Campaigns/assignKey
|
|
12456
|
+
*
|
|
12457
|
+
* @param campaign_id The ID of the campaign.
|
|
12458
|
+
* @param user_id The ID of the user (influencer).
|
|
12459
|
+
* @param data The platform for which to assign a key.
|
|
12460
|
+
* @param data.platform The platform of the key to assign (e.g., 'steam').
|
|
12461
|
+
* @returns promise
|
|
12462
|
+
*/
|
|
12463
|
+
Campaigns.assignKeyToInfluencer = function (campaign_id, user_id, data, params) {
|
|
12464
|
+
return Requests.processRoute(CampaignsRoute.routes.assignKeyToInfluencer, data, { campaign_id: campaign_id, user_id: user_id }, params);
|
|
12465
|
+
};
|
|
12379
12466
|
return Campaigns;
|
|
12380
12467
|
}());
|
|
12381
12468
|
|
|
@@ -14332,6 +14419,10 @@ var WebsiteAnalyticsRoute = /** @class */ (function () {
|
|
|
14332
14419
|
utmPerformance: {
|
|
14333
14420
|
url: '/analytics/utm-performance',
|
|
14334
14421
|
method: HTTP_METHODS.GET
|
|
14422
|
+
},
|
|
14423
|
+
journey: {
|
|
14424
|
+
url: '/analytics/journey',
|
|
14425
|
+
method: HTTP_METHODS.GET
|
|
14335
14426
|
}
|
|
14336
14427
|
};
|
|
14337
14428
|
return WebsiteAnalyticsRoute;
|
|
@@ -14552,6 +14643,27 @@ var WebsiteAnalytics = /** @class */ (function () {
|
|
|
14552
14643
|
WebsiteAnalytics.utmPerformance = function (params) {
|
|
14553
14644
|
return Requests.processRoute(WebsiteAnalyticsRoute.routes.utmPerformance, {}, undefined, params);
|
|
14554
14645
|
};
|
|
14646
|
+
/**
|
|
14647
|
+
* Get a combined user journey across short link clicks, web sessions, game installations, etc.
|
|
14648
|
+
*
|
|
14649
|
+
* @param params Filtering options. All are optional except `title_id`.
|
|
14650
|
+
* - title_id: string Required. The UUID of the title to unify user events.
|
|
14651
|
+
* - device_id?: string Filter by device ID
|
|
14652
|
+
* - session_id?: string Filter by session ID
|
|
14653
|
+
* - short_link_click_id?: string Filter by short link click ID
|
|
14654
|
+
* - user_install_id?: string Filter by game install user_install_id
|
|
14655
|
+
* - browser_fingerprint?: string Filter by browser fingerprint hash
|
|
14656
|
+
* - hardware_fingerprint?: string Filter by hardware fingerprint hash
|
|
14657
|
+
* - start_date?: string Optional. Start date (YYYY-MM-DD) if your API supports time limiting
|
|
14658
|
+
* - end_date?: string Optional. End date (YYYY-MM-DD) if your API supports time limiting
|
|
14659
|
+
*
|
|
14660
|
+
* @returns Promise with a unified timeline of the user’s journey, in chronological order.
|
|
14661
|
+
*/
|
|
14662
|
+
WebsiteAnalytics.userJourney = function (params) {
|
|
14663
|
+
return Requests.processRoute(WebsiteAnalyticsRoute.routes.journey, // references our new route definition
|
|
14664
|
+
{}, // no body data (GET request)
|
|
14665
|
+
undefined, params);
|
|
14666
|
+
};
|
|
14555
14667
|
return WebsiteAnalytics;
|
|
14556
14668
|
}());
|
|
14557
14669
|
|
|
@@ -15382,6 +15494,7 @@ var Glitch = /** @class */ (function () {
|
|
|
15382
15494
|
};
|
|
15383
15495
|
Glitch.api = {
|
|
15384
15496
|
Ads: Ads,
|
|
15497
|
+
AccessKeys: AccessKeys,
|
|
15385
15498
|
Auth: Auth,
|
|
15386
15499
|
Campaigns: Campaigns,
|
|
15387
15500
|
Competitions: Competitions,
|