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
|
@@ -20,6 +20,7 @@ declare class Requests {
|
|
|
20
20
|
static buildUrl(url: string, params?: Record<string, any>): string;
|
|
21
21
|
private static request;
|
|
22
22
|
static get<T>(url: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
23
|
+
static download(url: string, params?: Record<string, any>): AxiosPromise<Blob>;
|
|
23
24
|
static post<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
24
25
|
static put<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
25
26
|
static patch<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1250,6 +1250,18 @@ declare class Communities {
|
|
|
1250
1250
|
* @returns promise
|
|
1251
1251
|
*/
|
|
1252
1252
|
static delete<T>(community_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
1253
|
+
/**
|
|
1254
|
+
* Retrieve the site-admin grant state for the customer-facing game market
|
|
1255
|
+
* research product.
|
|
1256
|
+
*/
|
|
1257
|
+
static getMarketResearchAccess<T>(community_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
1258
|
+
/**
|
|
1259
|
+
* Enable or disable game market research access for a business account.
|
|
1260
|
+
*/
|
|
1261
|
+
static updateMarketResearchAccess<T>(community_id: string, data: {
|
|
1262
|
+
enabled: boolean;
|
|
1263
|
+
notes?: string;
|
|
1264
|
+
}, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
1253
1265
|
/**
|
|
1254
1266
|
* Updates the main image for the community using a File object.
|
|
1255
1267
|
*
|
|
@@ -8089,6 +8101,17 @@ declare class TwitchReporting {
|
|
|
8089
8101
|
* @returns promise
|
|
8090
8102
|
*/
|
|
8091
8103
|
static getMostActiveGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
8104
|
+
/**
|
|
8105
|
+
* Discover the most active Twitch games with Steam/IGDB genre, category,
|
|
8106
|
+
* theme, live snapshot, and trend metrics.
|
|
8107
|
+
*
|
|
8108
|
+
* @see https://api.glitch.fun/api/documentation#/Twitch%20Reporting/discoverActiveTwitchGames
|
|
8109
|
+
*
|
|
8110
|
+
* @param params Optional query parameters (e.g., genres, categories, match_mode, trend_days, sort_by, limit).
|
|
8111
|
+
*
|
|
8112
|
+
* @returns promise
|
|
8113
|
+
*/
|
|
8114
|
+
static discoverActiveGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
8092
8115
|
/**
|
|
8093
8116
|
* Get top streamers by performance (average or peak CCV).
|
|
8094
8117
|
*
|
|
@@ -10309,6 +10332,15 @@ declare class AdminReports {
|
|
|
10309
10332
|
static steam<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10310
10333
|
}
|
|
10311
10334
|
|
|
10335
|
+
declare class MarketResearch {
|
|
10336
|
+
static access<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10337
|
+
static filterOptions<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10338
|
+
static listGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10339
|
+
static viewGame<T>(game_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10340
|
+
static exportGames(params?: Record<string, any>): AxiosPromise<Blob>;
|
|
10341
|
+
static exportGame(game_id: string, params?: Record<string, any>): AxiosPromise<Blob>;
|
|
10342
|
+
}
|
|
10343
|
+
|
|
10312
10344
|
interface Route {
|
|
10313
10345
|
url: string;
|
|
10314
10346
|
method: string;
|
|
@@ -10332,6 +10364,7 @@ declare class Requests {
|
|
|
10332
10364
|
static buildUrl(url: string, params?: Record<string, any>): string;
|
|
10333
10365
|
private static request;
|
|
10334
10366
|
static get<T>(url: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10367
|
+
static download(url: string, params?: Record<string, any>): AxiosPromise<Blob>;
|
|
10335
10368
|
static post<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10336
10369
|
static put<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10337
10370
|
static patch<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
@@ -10675,6 +10708,7 @@ declare class Glitch {
|
|
|
10675
10708
|
Mcp: typeof Mcp;
|
|
10676
10709
|
PrDirectory: typeof PrDirectory;
|
|
10677
10710
|
AdminReports: typeof AdminReports;
|
|
10711
|
+
MarketResearch: typeof MarketResearch;
|
|
10678
10712
|
};
|
|
10679
10713
|
static util: {
|
|
10680
10714
|
Requests: typeof Requests;
|
package/package.json
CHANGED
package/src/api/Communities.ts
CHANGED
|
@@ -72,6 +72,21 @@ class Communities {
|
|
|
72
72
|
return Requests.processRoute(CommunitiesRoute.routes.delete, {}, { community_id: community_id });
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Retrieve the site-admin grant state for the customer-facing game market
|
|
77
|
+
* research product.
|
|
78
|
+
*/
|
|
79
|
+
public static getMarketResearchAccess<T>(community_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
80
|
+
return Requests.processRoute(CommunitiesRoute.routes.getMarketResearchAccess, undefined, { community_id }, params);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Enable or disable game market research access for a business account.
|
|
85
|
+
*/
|
|
86
|
+
public static updateMarketResearchAccess<T>(community_id: string, data: { enabled: boolean, notes?: string }, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
87
|
+
return Requests.processRoute(CommunitiesRoute.routes.updateMarketResearchAccess, data, { community_id }, params);
|
|
88
|
+
}
|
|
89
|
+
|
|
75
90
|
/**
|
|
76
91
|
* Updates the main image for the community using a File object.
|
|
77
92
|
*
|
|
@@ -1007,4 +1022,4 @@ class Communities {
|
|
|
1007
1022
|
|
|
1008
1023
|
}
|
|
1009
1024
|
|
|
1010
|
-
export default Communities;
|
|
1025
|
+
export default Communities;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AxiosPromise } from "axios";
|
|
2
|
+
import MarketResearchRoute from "../routes/MarketResearchRoute";
|
|
3
|
+
import Requests from "../util/Requests";
|
|
4
|
+
import Response from "../util/Response";
|
|
5
|
+
|
|
6
|
+
class MarketResearch {
|
|
7
|
+
public static access<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
8
|
+
return Requests.processRoute(MarketResearchRoute.routes.access, undefined, undefined, params);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public static filterOptions<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
12
|
+
return Requests.processRoute(MarketResearchRoute.routes.filterOptions, undefined, undefined, params);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public static listGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
16
|
+
return Requests.processRoute(MarketResearchRoute.routes.listGames, undefined, undefined, params);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public static viewGame<T>(game_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
20
|
+
return Requests.processRoute(MarketResearchRoute.routes.viewGame, undefined, { game_id }, params);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static exportGames(params?: Record<string, any>): AxiosPromise<Blob> {
|
|
24
|
+
return Requests.download(MarketResearchRoute.routes.exportGames.url, params);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public static exportGame(game_id: string, params?: Record<string, any>): AxiosPromise<Blob> {
|
|
28
|
+
const url = MarketResearchRoute.routes.exportGame.url.replace('{game_id}', game_id);
|
|
29
|
+
return Requests.download(url, params);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default MarketResearch;
|
|
@@ -58,6 +58,20 @@ class TwitchReporting {
|
|
|
58
58
|
return Requests.processRoute(TwitchReportingRoute.routes.getMostActiveGames, undefined, undefined, params);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Discover the most active Twitch games with Steam/IGDB genre, category,
|
|
63
|
+
* theme, live snapshot, and trend metrics.
|
|
64
|
+
*
|
|
65
|
+
* @see https://api.glitch.fun/api/documentation#/Twitch%20Reporting/discoverActiveTwitchGames
|
|
66
|
+
*
|
|
67
|
+
* @param params Optional query parameters (e.g., genres, categories, match_mode, trend_days, sort_by, limit).
|
|
68
|
+
*
|
|
69
|
+
* @returns promise
|
|
70
|
+
*/
|
|
71
|
+
public static discoverActiveGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
72
|
+
return Requests.processRoute(TwitchReportingRoute.routes.discoverActiveGames, undefined, undefined, params);
|
|
73
|
+
}
|
|
74
|
+
|
|
61
75
|
/**
|
|
62
76
|
* Get top streamers by performance (average or peak CCV).
|
|
63
77
|
*
|
|
@@ -107,4 +121,4 @@ class TwitchReporting {
|
|
|
107
121
|
|
|
108
122
|
}
|
|
109
123
|
|
|
110
|
-
export default TwitchReporting;
|
|
124
|
+
export default TwitchReporting;
|
package/src/api/index.ts
CHANGED
|
@@ -49,6 +49,7 @@ import Agents from "./Agents";
|
|
|
49
49
|
import Mcp from "./Mcp";
|
|
50
50
|
import PrDirectory from "./PrDirectory";
|
|
51
51
|
import AdminReports from "./AdminReports";
|
|
52
|
+
import MarketResearch from "./MarketResearch";
|
|
52
53
|
|
|
53
54
|
export {Ads};
|
|
54
55
|
export {AccessKeys};
|
|
@@ -101,3 +102,4 @@ export {Agents};
|
|
|
101
102
|
export {Mcp};
|
|
102
103
|
export {PrDirectory};
|
|
103
104
|
export {AdminReports};
|
|
105
|
+
export {MarketResearch};
|
package/src/index.ts
CHANGED
|
@@ -53,6 +53,7 @@ import {Agents} from './api';
|
|
|
53
53
|
import {Mcp} from './api';
|
|
54
54
|
import {PrDirectory} from './api';
|
|
55
55
|
import {AdminReports} from './api';
|
|
56
|
+
import {MarketResearch} from './api';
|
|
56
57
|
|
|
57
58
|
import Requests from "./util/Requests";
|
|
58
59
|
import Parser from "./util/Parser";
|
|
@@ -135,6 +136,7 @@ class Glitch {
|
|
|
135
136
|
Mcp : Mcp,
|
|
136
137
|
PrDirectory : PrDirectory,
|
|
137
138
|
AdminReports : AdminReports,
|
|
139
|
+
MarketResearch : MarketResearch,
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
public static util = {
|
|
@@ -26,6 +26,8 @@ class CommunitiesRoute {
|
|
|
26
26
|
removeUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.DELETE },
|
|
27
27
|
join: { url: '/communities/{community_id}/join', method: HTTP_METHODS.POST },
|
|
28
28
|
findByDomain: { url: '/communities/findByDomain/{domain}', method: HTTP_METHODS.GET },
|
|
29
|
+
getMarketResearchAccess: { url: '/communities/{community_id}/market-research-access', method: HTTP_METHODS.GET },
|
|
30
|
+
updateMarketResearchAccess: { url: '/communities/{community_id}/market-research-access', method: HTTP_METHODS.PUT },
|
|
29
31
|
addPaymentMethod: { url: '/communities/{community_id}/payment/methods', method: HTTP_METHODS.POST },
|
|
30
32
|
getPaymentMethods: { url: '/communities/{community_id}/payment/methods', method: HTTP_METHODS.GET },
|
|
31
33
|
setDefaultPaymentMethod: { url: '/communities/{community_id}/payment/methods/default', method: HTTP_METHODS.POST },
|
|
@@ -121,4 +123,4 @@ class CommunitiesRoute {
|
|
|
121
123
|
|
|
122
124
|
}
|
|
123
125
|
|
|
124
|
-
export default CommunitiesRoute;
|
|
126
|
+
export default CommunitiesRoute;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
3
|
+
|
|
4
|
+
class MarketResearchRoute {
|
|
5
|
+
public static routes: { [key: string]: Route } = {
|
|
6
|
+
access: { url: '/market-research/access', method: HTTP_METHODS.GET },
|
|
7
|
+
filterOptions: { url: '/market-research/filter-options', method: HTTP_METHODS.GET },
|
|
8
|
+
listGames: { url: '/market-research/games', method: HTTP_METHODS.GET },
|
|
9
|
+
viewGame: { url: '/market-research/games/{game_id}', method: HTTP_METHODS.GET },
|
|
10
|
+
exportGames: { url: '/market-research/games/export', method: HTTP_METHODS.GET },
|
|
11
|
+
exportGame: { url: '/market-research/games/{game_id}/export', method: HTTP_METHODS.GET },
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default MarketResearchRoute;
|
|
@@ -20,6 +20,10 @@ class TwitchReportingRoute {
|
|
|
20
20
|
url: '/reporting/twitch/games/most-active',
|
|
21
21
|
method: HTTP_METHODS.GET
|
|
22
22
|
},
|
|
23
|
+
discoverActiveGames: {
|
|
24
|
+
url: '/reporting/twitch/games/discovery',
|
|
25
|
+
method: HTTP_METHODS.GET
|
|
26
|
+
},
|
|
23
27
|
getTopStreamers: {
|
|
24
28
|
url: '/reporting/twitch/streamers/top',
|
|
25
29
|
method: HTTP_METHODS.GET
|
|
@@ -40,4 +44,4 @@ class TwitchReportingRoute {
|
|
|
40
44
|
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
export default TwitchReportingRoute;
|
|
47
|
+
export default TwitchReportingRoute;
|
package/src/util/Requests.ts
CHANGED
|
@@ -112,6 +112,44 @@ class Requests {
|
|
|
112
112
|
return Requests.request<T>('GET', url);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
public static download(url: string, params?: Record<string, any>): AxiosPromise<Blob> {
|
|
116
|
+
if (params && Object.keys(params).length > 0) {
|
|
117
|
+
const queryString = Object.entries(params)
|
|
118
|
+
.filter(([, value]) => value !== undefined && value !== null && value !== '')
|
|
119
|
+
.map(([key, value]) => {
|
|
120
|
+
if (Array.isArray(value)) {
|
|
121
|
+
return value.map((item) => `${key}[]=${encodeURIComponent(item)}`).join('&');
|
|
122
|
+
}
|
|
123
|
+
return `${key}=${encodeURIComponent(value)}`;
|
|
124
|
+
})
|
|
125
|
+
.filter(Boolean)
|
|
126
|
+
.join('&');
|
|
127
|
+
|
|
128
|
+
if (queryString) {
|
|
129
|
+
url = `${url}?${queryString}`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (Requests.community_id) {
|
|
134
|
+
const separator = url.includes('?') ? '&' : '?';
|
|
135
|
+
url = `${url}${separator}community_id=${Requests.community_id}`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const headers: { [key: string]: string } = {};
|
|
139
|
+
if (Requests.authToken) {
|
|
140
|
+
headers['Authorization'] = `Bearer ${Requests.authToken}`;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const uri = Requests.baseUrl.replace(/\/+$/, '') + '/' + url.replace(/^\/+/, '');
|
|
144
|
+
|
|
145
|
+
return axios({
|
|
146
|
+
method: 'GET',
|
|
147
|
+
url: uri,
|
|
148
|
+
headers,
|
|
149
|
+
responseType: 'blob',
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
115
153
|
public static post<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
116
154
|
if (params && Object.keys(params).length > 0) {
|
|
117
155
|
const queryString = Object.entries(params)
|