glitch-javascript-sdk 3.2.27 → 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.
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class MarketResearchRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default MarketResearchRoute;
@@ -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
  *
@@ -10309,6 +10321,15 @@ declare class AdminReports {
10309
10321
  static steam<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
10310
10322
  }
10311
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>;
10331
+ }
10332
+
10312
10333
  interface Route {
10313
10334
  url: string;
10314
10335
  method: string;
@@ -10332,6 +10353,7 @@ declare class Requests {
10332
10353
  static buildUrl(url: string, params?: Record<string, any>): string;
10333
10354
  private static request;
10334
10355
  static get<T>(url: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
10356
+ static download(url: string, params?: Record<string, any>): AxiosPromise<Blob>;
10335
10357
  static post<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
10336
10358
  static put<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
10337
10359
  static patch<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
@@ -10675,6 +10697,7 @@ declare class Glitch {
10675
10697
  Mcp: typeof Mcp;
10676
10698
  PrDirectory: typeof PrDirectory;
10677
10699
  AdminReports: typeof AdminReports;
10700
+ MarketResearch: typeof MarketResearch;
10678
10701
  };
10679
10702
  static util: {
10680
10703
  Requests: typeof Requests;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "3.2.27",
3
+ "version": "3.2.28",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -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;
@@ -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)