glitch-javascript-sdk 3.2.26 → 3.2.28
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 +103 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/AdminReports.d.ts +6 -0
- package/dist/esm/api/Communities.d.ts +12 -0
- package/dist/esm/api/MarketResearch.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 +103 -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 +29 -0
- package/package.json +1 -1
- package/src/api/AdminReports.ts +9 -0
- package/src/api/Communities.ts +16 -1
- package/src/api/MarketResearch.ts +33 -0
- package/src/api/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/routes/AdminReportsRoute.ts +4 -0
- package/src/routes/CommunitiesRoute.ts +3 -1
- package/src/routes/MarketResearchRoute.ts +15 -0
- 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
|
*
|
|
@@ -10301,6 +10313,21 @@ declare class AdminReports {
|
|
|
10301
10313
|
* engagement, and user-generated revenue.
|
|
10302
10314
|
*/
|
|
10303
10315
|
static usersRevenue<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10316
|
+
/**
|
|
10317
|
+
* Returns site-admin Steam market reports, including social profile coverage,
|
|
10318
|
+
* platform usage, follower benchmarks, review/player relationships, and
|
|
10319
|
+
* optional target-app game reports.
|
|
10320
|
+
*/
|
|
10321
|
+
static steam<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10322
|
+
}
|
|
10323
|
+
|
|
10324
|
+
declare class MarketResearch {
|
|
10325
|
+
static access<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10326
|
+
static filterOptions<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10327
|
+
static listGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10328
|
+
static viewGame<T>(game_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10329
|
+
static exportGames(params?: Record<string, any>): AxiosPromise<Blob>;
|
|
10330
|
+
static exportGame(game_id: string, params?: Record<string, any>): AxiosPromise<Blob>;
|
|
10304
10331
|
}
|
|
10305
10332
|
|
|
10306
10333
|
interface Route {
|
|
@@ -10326,6 +10353,7 @@ declare class Requests {
|
|
|
10326
10353
|
static buildUrl(url: string, params?: Record<string, any>): string;
|
|
10327
10354
|
private static request;
|
|
10328
10355
|
static get<T>(url: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10356
|
+
static download(url: string, params?: Record<string, any>): AxiosPromise<Blob>;
|
|
10329
10357
|
static post<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10330
10358
|
static put<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
10331
10359
|
static patch<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
@@ -10669,6 +10697,7 @@ declare class Glitch {
|
|
|
10669
10697
|
Mcp: typeof Mcp;
|
|
10670
10698
|
PrDirectory: typeof PrDirectory;
|
|
10671
10699
|
AdminReports: typeof AdminReports;
|
|
10700
|
+
MarketResearch: typeof MarketResearch;
|
|
10672
10701
|
};
|
|
10673
10702
|
static util: {
|
|
10674
10703
|
Requests: typeof Requests;
|
package/package.json
CHANGED
package/src/api/AdminReports.ts
CHANGED
|
@@ -11,6 +11,15 @@ class AdminReports {
|
|
|
11
11
|
public static usersRevenue<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
12
12
|
return Requests.processRoute(AdminReportsRoute.routes.usersRevenue, undefined, undefined, params);
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Returns site-admin Steam market reports, including social profile coverage,
|
|
17
|
+
* platform usage, follower benchmarks, review/player relationships, and
|
|
18
|
+
* optional target-app game reports.
|
|
19
|
+
*/
|
|
20
|
+
public static steam<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
21
|
+
return Requests.processRoute(AdminReportsRoute.routes.steam, undefined, undefined, params);
|
|
22
|
+
}
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
export default AdminReports;
|
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;
|
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;
|
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)
|