glitch-javascript-sdk 2.8.5 → 2.8.7

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/index.d.ts CHANGED
@@ -26,12 +26,20 @@ declare class Config {
26
26
  * @param lock If set to true, will lock the baseUrl so it cannot be changed
27
27
  */
28
28
  static setBaseUrl(baseUrl: string, lock?: boolean): void;
29
+ /**
30
+ * Gets the base URL
31
+ */
32
+ static getBaseUrl(): string;
29
33
  /**
30
34
  * Set the JSON Web Token (JWT) that will be passed to the API
31
35
  *
32
36
  * @param authToken The JWT
33
37
  */
34
38
  static setAuthToken(authToken: string): void;
39
+ /**
40
+ * Gets the auth token
41
+ */
42
+ static getAuthToken(): string;
35
43
  /**
36
44
  * Set the community to be associated with this config through
37
45
  *
@@ -45,6 +53,9 @@ declare class Config {
45
53
  * @param domain The domain ie: example.com
46
54
  */
47
55
  static setRootDomain(domain: string): void;
56
+ /**
57
+ * Gets the root domain
58
+ */
48
59
  static getRootDomain(): string;
49
60
  /**
50
61
  * Gets base url
@@ -58,6 +69,10 @@ declare class Config {
58
69
  * Gets the community currently associated
59
70
  */
60
71
  static get getCommunity(): object;
72
+ /**
73
+ * Checks if the base URL is locked
74
+ */
75
+ static isBaseUrlLocked(): boolean;
61
76
  }
62
77
 
63
78
  interface Response<T> {
@@ -4326,6 +4341,37 @@ declare class Titles {
4326
4341
  * Resolve a conflict.
4327
4342
  */
4328
4343
  static resolveSaveConflict<T>(title_id: string, install_id: string, save_id: string, conflict_id: string, choice: 'keep_server' | 'use_client'): AxiosPromise<Response<T>>;
4344
+ /**
4345
+ * Toggle a game on the current user's wishlist.
4346
+ * If the game is not wishlisted, it will be added. If it is, it will be removed.
4347
+ *
4348
+ * @param title_id The UUID of the title.
4349
+ * @param data Optional context: { fingerprint_id?: string, short_link_click_id?: string }
4350
+ */
4351
+ static wishlistToggle<T>(title_id: string, data?: object): AxiosPromise<Response<T>>;
4352
+ /**
4353
+ * Record a self-assigned excitement score (1-5) for a wishlisted game.
4354
+ *
4355
+ * @param title_id The UUID of the title.
4356
+ * @param data { score: number } - Must be between 1 and 5.
4357
+ */
4358
+ static wishlistUpdateScore<T>(title_id: string, data: {
4359
+ score: number;
4360
+ }): AxiosPromise<Response<T>>;
4361
+ /**
4362
+ * Retrieve the current user's personal wishlist collection.
4363
+ *
4364
+ * @param params Optional pagination parameters (?page=1&per_page=25)
4365
+ */
4366
+ static myWishlists<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
4367
+ /**
4368
+ * Get Wishlist Intelligence statistics for a title.
4369
+ * Includes funnel data and predictive revenue forecasting.
4370
+ * Note: Requires Title Administrator permissions.
4371
+ *
4372
+ * @param title_id The UUID of the title.
4373
+ */
4374
+ static wishlistStats<T>(title_id: string): AxiosPromise<Response<T>>;
4329
4375
  }
4330
4376
 
4331
4377
  declare class Campaigns {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.8.5",
3
+ "version": "2.8.7",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/api/Titles.ts CHANGED
@@ -1025,6 +1025,47 @@ class Titles {
1025
1025
  public static resolveSaveConflict<T>(title_id: string, install_id: string, save_id: string, conflict_id: string, choice: 'keep_server' | 'use_client'): AxiosPromise<Response<T>> {
1026
1026
  return Requests.processRoute(TitlesRoute.routes.resolveSaveConflict, { conflict_id, choice }, { title_id, install_id, save_id });
1027
1027
  }
1028
+
1029
+ /**
1030
+ * Toggle a game on the current user's wishlist.
1031
+ * If the game is not wishlisted, it will be added. If it is, it will be removed.
1032
+ *
1033
+ * @param title_id The UUID of the title.
1034
+ * @param data Optional context: { fingerprint_id?: string, short_link_click_id?: string }
1035
+ */
1036
+ public static wishlistToggle<T>(title_id: string, data?: object): AxiosPromise<Response<T>> {
1037
+ return Requests.processRoute(TitlesRoute.routes.wishlistToggle, data, { title_id });
1038
+ }
1039
+
1040
+ /**
1041
+ * Record a self-assigned excitement score (1-5) for a wishlisted game.
1042
+ *
1043
+ * @param title_id The UUID of the title.
1044
+ * @param data { score: number } - Must be between 1 and 5.
1045
+ */
1046
+ public static wishlistUpdateScore<T>(title_id: string, data: { score: number }): AxiosPromise<Response<T>> {
1047
+ return Requests.processRoute(TitlesRoute.routes.wishlistUpdateScore, data, { title_id });
1048
+ }
1049
+
1050
+ /**
1051
+ * Retrieve the current user's personal wishlist collection.
1052
+ *
1053
+ * @param params Optional pagination parameters (?page=1&per_page=25)
1054
+ */
1055
+ public static myWishlists<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
1056
+ return Requests.processRoute(TitlesRoute.routes.myWishlists, undefined, undefined, params);
1057
+ }
1058
+
1059
+ /**
1060
+ * Get Wishlist Intelligence statistics for a title.
1061
+ * Includes funnel data and predictive revenue forecasting.
1062
+ * Note: Requires Title Administrator permissions.
1063
+ *
1064
+ * @param title_id The UUID of the title.
1065
+ */
1066
+ public static wishlistStats<T>(title_id: string): AxiosPromise<Response<T>> {
1067
+ return Requests.processRoute(TitlesRoute.routes.wishlistStats, undefined, { title_id });
1068
+ }
1028
1069
  }
1029
1070
 
1030
1071
  export default Titles;
@@ -53,6 +53,13 @@ class Config {
53
53
  }
54
54
  }
55
55
 
56
+ /**
57
+ * Gets the base URL
58
+ */
59
+ public static getBaseUrl(): string {
60
+ return Config._baseUrl;
61
+ }
62
+
56
63
  /**
57
64
  * Set the JSON Web Token (JWT) that will be passed to the API
58
65
  *
@@ -64,6 +71,16 @@ class Config {
64
71
  Requests.setAuthToken(authToken);
65
72
  }
66
73
 
74
+
75
+ /**
76
+ * Gets the auth token
77
+ */
78
+ public static getAuthToken(): string {
79
+ return Config._authToken;
80
+ }
81
+
82
+
83
+
67
84
  /**
68
85
  * Set the community to be associated with this config through
69
86
  *
@@ -77,6 +94,7 @@ class Config {
77
94
  LabelManager.initialize(community);
78
95
  }
79
96
 
97
+
80
98
  /**
81
99
  * Sets the root level domain so data can be accessed across
82
100
  * multiple subdomains
@@ -95,13 +113,16 @@ class Config {
95
113
 
96
114
  // REMOVE THIS LINE: formattedDomain = formattedDomain.replace(/^\./, '');
97
115
  // We WANT the dot.
98
-
116
+
99
117
  this._rootDomain = formattedDomain;
100
118
 
101
119
  Storage.setRootDomain(formattedDomain);
102
120
  }
103
121
 
104
- public static getRootDomain() {
122
+ /**
123
+ * Gets the root domain
124
+ */
125
+ public static getRootDomain(): string {
105
126
  return this._rootDomain;
106
127
  }
107
128
 
@@ -125,6 +146,13 @@ class Config {
125
146
  public static get getCommunity(): object {
126
147
  return Config._community;
127
148
  }
149
+
150
+ /**
151
+ * Checks if the base URL is locked
152
+ */
153
+ public static isBaseUrlLocked(): boolean {
154
+ return this._baseUrlLocked;
155
+ }
128
156
  }
129
157
 
130
158
  export default Config;
@@ -190,13 +190,13 @@ class TitlesRoute {
190
190
  viewDeveloperPayout: { url: '/titles/{title_id}/payouts/{payout_id}', method: HTTP_METHODS.GET },
191
191
  developerPayoutSummary: { url: '/titles/{title_id}/payouts/summary', method: HTTP_METHODS.GET },
192
192
 
193
- /**
194
- * The Aegis Handshake: Validates if a specific install/session is authorized to play.
195
- * POST /titles/{title_id}/installs/{install_id}/validate
196
- */
197
- validateInstall: {
198
- url: '/titles/{title_id}/installs/{install_id}/validate',
199
- method: HTTP_METHODS.POST
193
+ /**
194
+ * The Aegis Handshake: Validates if a specific install/session is authorized to play.
195
+ * POST /titles/{title_id}/installs/{install_id}/validate
196
+ */
197
+ validateInstall: {
198
+ url: '/titles/{title_id}/installs/{install_id}/validate',
199
+ method: HTTP_METHODS.POST
200
200
  },
201
201
 
202
202
  listBuilds: { url: '/titles/{title_id}/deployments', method: HTTP_METHODS.GET },
@@ -205,6 +205,23 @@ class TitlesRoute {
205
205
  storeSave: { url: '/titles/{title_id}/installs/{install_id}/saves', method: HTTP_METHODS.POST },
206
206
  resolveSaveConflict: { url: '/titles/{title_id}/installs/{install_id}/saves/{save_id}/resolve', method: HTTP_METHODS.POST },
207
207
 
208
+ wishlistToggle: {
209
+ url: '/titles/{title_id}/wishlist',
210
+ method: HTTP_METHODS.POST
211
+ },
212
+ wishlistUpdateScore: {
213
+ url: '/titles/{title_id}/wishlist/score',
214
+ method: HTTP_METHODS.POST
215
+ },
216
+ wishlistStats: {
217
+ url: '/titles/{title_id}/wishlist/stats',
218
+ method: HTTP_METHODS.GET
219
+ },
220
+ myWishlists: {
221
+ url: '/users/me/wishlists',
222
+ method: HTTP_METHODS.GET
223
+ },
224
+
208
225
 
209
226
  };
210
227