glitch-javascript-sdk 3.2.27 → 3.2.29
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 +108 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Communities.d.ts +12 -0
- package/dist/esm/api/MarketResearch.d.ts +11 -0
- package/dist/esm/api/TwitchReporting.d.ts +11 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +108 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/MarketResearchRoute.d.ts +7 -0
- package/dist/esm/util/Requests.d.ts +1 -0
- package/dist/index.d.ts +34 -0
- package/package.json +1 -1
- package/src/api/Communities.ts +16 -1
- package/src/api/MarketResearch.ts +33 -0
- package/src/api/TwitchReporting.ts +15 -1
- package/src/api/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/routes/CommunitiesRoute.ts +3 -1
- package/src/routes/MarketResearchRoute.ts +15 -0
- package/src/routes/TwitchReportingRoute.ts +5 -1
- package/src/util/Requests.ts +38 -0
package/dist/cjs/index.js
CHANGED
|
@@ -17392,6 +17392,42 @@ var Requests = /** @class */ (function () {
|
|
|
17392
17392
|
}
|
|
17393
17393
|
return Requests.request('GET', url);
|
|
17394
17394
|
};
|
|
17395
|
+
Requests.download = function (url, params) {
|
|
17396
|
+
if (params && Object.keys(params).length > 0) {
|
|
17397
|
+
var queryString = Object.entries(params)
|
|
17398
|
+
.filter(function (_a) {
|
|
17399
|
+
var value = _a[1];
|
|
17400
|
+
return value !== undefined && value !== null && value !== '';
|
|
17401
|
+
})
|
|
17402
|
+
.map(function (_a) {
|
|
17403
|
+
var key = _a[0], value = _a[1];
|
|
17404
|
+
if (Array.isArray(value)) {
|
|
17405
|
+
return value.map(function (item) { return "".concat(key, "[]=").concat(encodeURIComponent(item)); }).join('&');
|
|
17406
|
+
}
|
|
17407
|
+
return "".concat(key, "=").concat(encodeURIComponent(value));
|
|
17408
|
+
})
|
|
17409
|
+
.filter(Boolean)
|
|
17410
|
+
.join('&');
|
|
17411
|
+
if (queryString) {
|
|
17412
|
+
url = "".concat(url, "?").concat(queryString);
|
|
17413
|
+
}
|
|
17414
|
+
}
|
|
17415
|
+
if (Requests.community_id) {
|
|
17416
|
+
var separator = url.includes('?') ? '&' : '?';
|
|
17417
|
+
url = "".concat(url).concat(separator, "community_id=").concat(Requests.community_id);
|
|
17418
|
+
}
|
|
17419
|
+
var headers = {};
|
|
17420
|
+
if (Requests.authToken) {
|
|
17421
|
+
headers['Authorization'] = "Bearer ".concat(Requests.authToken);
|
|
17422
|
+
}
|
|
17423
|
+
var uri = Requests.baseUrl.replace(/\/+$/, '') + '/' + url.replace(/^\/+/, '');
|
|
17424
|
+
return axios$1({
|
|
17425
|
+
method: 'GET',
|
|
17426
|
+
url: uri,
|
|
17427
|
+
headers: headers,
|
|
17428
|
+
responseType: 'blob',
|
|
17429
|
+
});
|
|
17430
|
+
};
|
|
17395
17431
|
Requests.post = function (url, data, params) {
|
|
17396
17432
|
if (params && Object.keys(params).length > 0) {
|
|
17397
17433
|
var queryString = Object.entries(params)
|
|
@@ -19915,6 +19951,8 @@ var CommunitiesRoute = /** @class */ (function () {
|
|
|
19915
19951
|
removeUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.DELETE },
|
|
19916
19952
|
join: { url: '/communities/{community_id}/join', method: HTTP_METHODS.POST },
|
|
19917
19953
|
findByDomain: { url: '/communities/findByDomain/{domain}', method: HTTP_METHODS.GET },
|
|
19954
|
+
getMarketResearchAccess: { url: '/communities/{community_id}/market-research-access', method: HTTP_METHODS.GET },
|
|
19955
|
+
updateMarketResearchAccess: { url: '/communities/{community_id}/market-research-access', method: HTTP_METHODS.PUT },
|
|
19918
19956
|
addPaymentMethod: { url: '/communities/{community_id}/payment/methods', method: HTTP_METHODS.POST },
|
|
19919
19957
|
getPaymentMethods: { url: '/communities/{community_id}/payment/methods', method: HTTP_METHODS.GET },
|
|
19920
19958
|
setDefaultPaymentMethod: { url: '/communities/{community_id}/payment/methods/default', method: HTTP_METHODS.POST },
|
|
@@ -20058,6 +20096,19 @@ var Communities = /** @class */ (function () {
|
|
|
20058
20096
|
Communities.delete = function (community_id, params) {
|
|
20059
20097
|
return Requests.processRoute(CommunitiesRoute.routes.delete, {}, { community_id: community_id });
|
|
20060
20098
|
};
|
|
20099
|
+
/**
|
|
20100
|
+
* Retrieve the site-admin grant state for the customer-facing game market
|
|
20101
|
+
* research product.
|
|
20102
|
+
*/
|
|
20103
|
+
Communities.getMarketResearchAccess = function (community_id, params) {
|
|
20104
|
+
return Requests.processRoute(CommunitiesRoute.routes.getMarketResearchAccess, undefined, { community_id: community_id }, params);
|
|
20105
|
+
};
|
|
20106
|
+
/**
|
|
20107
|
+
* Enable or disable game market research access for a business account.
|
|
20108
|
+
*/
|
|
20109
|
+
Communities.updateMarketResearchAccess = function (community_id, data, params) {
|
|
20110
|
+
return Requests.processRoute(CommunitiesRoute.routes.updateMarketResearchAccess, data, { community_id: community_id }, params);
|
|
20111
|
+
};
|
|
20061
20112
|
/**
|
|
20062
20113
|
* Updates the main image for the community using a File object.
|
|
20063
20114
|
*
|
|
@@ -29823,6 +29874,10 @@ var TwitchReportingRoute = /** @class */ (function () {
|
|
|
29823
29874
|
url: '/reporting/twitch/games/most-active',
|
|
29824
29875
|
method: HTTP_METHODS.GET
|
|
29825
29876
|
},
|
|
29877
|
+
discoverActiveGames: {
|
|
29878
|
+
url: '/reporting/twitch/games/discovery',
|
|
29879
|
+
method: HTTP_METHODS.GET
|
|
29880
|
+
},
|
|
29826
29881
|
getTopStreamers: {
|
|
29827
29882
|
url: '/reporting/twitch/streamers/top',
|
|
29828
29883
|
method: HTTP_METHODS.GET
|
|
@@ -29895,6 +29950,19 @@ var TwitchReporting = /** @class */ (function () {
|
|
|
29895
29950
|
TwitchReporting.getMostActiveGames = function (params) {
|
|
29896
29951
|
return Requests.processRoute(TwitchReportingRoute.routes.getMostActiveGames, undefined, undefined, params);
|
|
29897
29952
|
};
|
|
29953
|
+
/**
|
|
29954
|
+
* Discover the most active Twitch games with Steam/IGDB genre, category,
|
|
29955
|
+
* theme, live snapshot, and trend metrics.
|
|
29956
|
+
*
|
|
29957
|
+
* @see https://api.glitch.fun/api/documentation#/Twitch%20Reporting/discoverActiveTwitchGames
|
|
29958
|
+
*
|
|
29959
|
+
* @param params Optional query parameters (e.g., genres, categories, match_mode, trend_days, sort_by, limit).
|
|
29960
|
+
*
|
|
29961
|
+
* @returns promise
|
|
29962
|
+
*/
|
|
29963
|
+
TwitchReporting.discoverActiveGames = function (params) {
|
|
29964
|
+
return Requests.processRoute(TwitchReportingRoute.routes.discoverActiveGames, undefined, undefined, params);
|
|
29965
|
+
};
|
|
29898
29966
|
/**
|
|
29899
29967
|
* Get top streamers by performance (average or peak CCV).
|
|
29900
29968
|
*
|
|
@@ -32045,6 +32113,45 @@ var AdminReports = /** @class */ (function () {
|
|
|
32045
32113
|
return AdminReports;
|
|
32046
32114
|
}());
|
|
32047
32115
|
|
|
32116
|
+
var MarketResearchRoute = /** @class */ (function () {
|
|
32117
|
+
function MarketResearchRoute() {
|
|
32118
|
+
}
|
|
32119
|
+
MarketResearchRoute.routes = {
|
|
32120
|
+
access: { url: '/market-research/access', method: HTTP_METHODS.GET },
|
|
32121
|
+
filterOptions: { url: '/market-research/filter-options', method: HTTP_METHODS.GET },
|
|
32122
|
+
listGames: { url: '/market-research/games', method: HTTP_METHODS.GET },
|
|
32123
|
+
viewGame: { url: '/market-research/games/{game_id}', method: HTTP_METHODS.GET },
|
|
32124
|
+
exportGames: { url: '/market-research/games/export', method: HTTP_METHODS.GET },
|
|
32125
|
+
exportGame: { url: '/market-research/games/{game_id}/export', method: HTTP_METHODS.GET },
|
|
32126
|
+
};
|
|
32127
|
+
return MarketResearchRoute;
|
|
32128
|
+
}());
|
|
32129
|
+
|
|
32130
|
+
var MarketResearch = /** @class */ (function () {
|
|
32131
|
+
function MarketResearch() {
|
|
32132
|
+
}
|
|
32133
|
+
MarketResearch.access = function (params) {
|
|
32134
|
+
return Requests.processRoute(MarketResearchRoute.routes.access, undefined, undefined, params);
|
|
32135
|
+
};
|
|
32136
|
+
MarketResearch.filterOptions = function (params) {
|
|
32137
|
+
return Requests.processRoute(MarketResearchRoute.routes.filterOptions, undefined, undefined, params);
|
|
32138
|
+
};
|
|
32139
|
+
MarketResearch.listGames = function (params) {
|
|
32140
|
+
return Requests.processRoute(MarketResearchRoute.routes.listGames, undefined, undefined, params);
|
|
32141
|
+
};
|
|
32142
|
+
MarketResearch.viewGame = function (game_id, params) {
|
|
32143
|
+
return Requests.processRoute(MarketResearchRoute.routes.viewGame, undefined, { game_id: game_id }, params);
|
|
32144
|
+
};
|
|
32145
|
+
MarketResearch.exportGames = function (params) {
|
|
32146
|
+
return Requests.download(MarketResearchRoute.routes.exportGames.url, params);
|
|
32147
|
+
};
|
|
32148
|
+
MarketResearch.exportGame = function (game_id, params) {
|
|
32149
|
+
var url = MarketResearchRoute.routes.exportGame.url.replace('{game_id}', game_id);
|
|
32150
|
+
return Requests.download(url, params);
|
|
32151
|
+
};
|
|
32152
|
+
return MarketResearch;
|
|
32153
|
+
}());
|
|
32154
|
+
|
|
32048
32155
|
var Parser = /** @class */ (function () {
|
|
32049
32156
|
function Parser() {
|
|
32050
32157
|
}
|
|
@@ -32592,6 +32699,7 @@ var Glitch = /** @class */ (function () {
|
|
|
32592
32699
|
Mcp: Mcp,
|
|
32593
32700
|
PrDirectory: PrDirectory,
|
|
32594
32701
|
AdminReports: AdminReports,
|
|
32702
|
+
MarketResearch: MarketResearch,
|
|
32595
32703
|
};
|
|
32596
32704
|
Glitch.util = {
|
|
32597
32705
|
Requests: Requests,
|