glitch-javascript-sdk 2.9.0 → 2.9.2

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
@@ -2250,6 +2250,11 @@ declare class Users {
2250
2250
  * @returns Promise resolving to the list of rules
2251
2251
  */
2252
2252
  static getSubredditRules<T>(subreddit: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
2253
+ /**
2254
+ * Get a list of games the current user has played.
2255
+ * Includes playtime and last played timestamps.
2256
+ */
2257
+ static playedGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
2253
2258
  }
2254
2259
 
2255
2260
  declare class Events {
@@ -4389,6 +4394,14 @@ declare class Titles {
4389
4394
  * @param status The new status ('ready', 'inactive', or 'failed').
4390
4395
  */
4391
4396
  static updateBuildStatus<T>(title_id: string, build_id: string, status: string): AxiosPromise<Response<T>>;
4397
+ /**
4398
+ * Proxies a request through the backend to the matchmaker.
4399
+ * This avoids HTTPS -> HTTP mixed content blocks.
4400
+ *
4401
+ * @param title_id The UUID of the game title.
4402
+ * @returns AxiosPromise containing { signallingServer: string }
4403
+ */
4404
+ static getMatchmakerServer<T>(title_id: string): AxiosPromise<Response<T>>;
4392
4405
  }
4393
4406
 
4394
4407
  declare class Campaigns {
@@ -5249,6 +5262,14 @@ declare class Subscriptions {
5249
5262
  * @param data { purchase_type: 'premium' | 'rental', payment_method_id: string }
5250
5263
  */
5251
5264
  static purchaseLicense<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
5265
+ /**
5266
+ * List all game licenses (Premium/Rental) owned by the current user.
5267
+ */
5268
+ static listMyLicenses<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
5269
+ /**
5270
+ * Request a refund for a premium purchase.
5271
+ */
5272
+ static refundLicense<T>(license_id: string): AxiosPromise<Response<T>>;
5252
5273
  }
5253
5274
 
5254
5275
  declare class Messages {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -124,6 +124,20 @@ class Subscriptions {
124
124
  return Requests.processRoute(SubscriptionsRoute.routes.purchaseLicense, data, { title_id });
125
125
  }
126
126
 
127
+ /**
128
+ * List all game licenses (Premium/Rental) owned by the current user.
129
+ */
130
+ public static listMyLicenses<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
131
+ return Requests.processRoute(SubscriptionsRoute.routes.listMyLicenses, undefined, undefined, params);
132
+ }
133
+
134
+ /**
135
+ * Request a refund for a premium purchase.
136
+ */
137
+ public static refundLicense<T>(license_id: string): AxiosPromise<Response<T>> {
138
+ return Requests.processRoute(SubscriptionsRoute.routes.refundLicense, {}, { license_id });
139
+ }
140
+
127
141
 
128
142
  }
129
143
 
package/src/api/Titles.ts CHANGED
@@ -1092,6 +1092,21 @@ class Titles {
1092
1092
  public static updateBuildStatus<T>(title_id: string, build_id: string, status: string): AxiosPromise<Response<T>> {
1093
1093
  return Requests.processRoute(TitlesRoute.routes.updateBuildStatus, { status }, { title_id, build_id });
1094
1094
  }
1095
+
1096
+ /**
1097
+ * Proxies a request through the backend to the matchmaker.
1098
+ * This avoids HTTPS -> HTTP mixed content blocks.
1099
+ *
1100
+ * @param title_id The UUID of the game title.
1101
+ * @returns AxiosPromise containing { signallingServer: string }
1102
+ */
1103
+ public static getMatchmakerServer<T>(title_id: string): AxiosPromise<Response<T>> {
1104
+ return Requests.processRoute(
1105
+ TitlesRoute.routes.getMatchmakerServer,
1106
+ {},
1107
+ { title_id }
1108
+ );
1109
+ }
1095
1110
  }
1096
1111
 
1097
1112
  export default Titles;
package/src/api/Users.ts CHANGED
@@ -564,6 +564,13 @@ class Users {
564
564
  }
565
565
 
566
566
 
567
+ /**
568
+ * Get a list of games the current user has played.
569
+ * Includes playtime and last played timestamps.
570
+ */
571
+ public static playedGames<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
572
+ return Requests.processRoute(UserRoutes.routes.playedGames, undefined, undefined, params);
573
+ }
567
574
 
568
575
 
569
576
  }
@@ -2,7 +2,7 @@ import Route from "./interface";
2
2
  import HTTP_METHODS from "../constants/HttpMethods";
3
3
 
4
4
  class SubscriptionsRoute {
5
-
5
+
6
6
  public static routes: { [key: string]: Route } = {
7
7
  createCreatorSubscription: { url: '/subscriptions/creators/subscribe', method: HTTP_METHODS.POST },
8
8
  getCreatorSubscription: { url: '/subscriptions/creators/{stripe_subscription_id}', method: HTTP_METHODS.GET },
@@ -15,15 +15,17 @@ class SubscriptionsRoute {
15
15
  listCommunityInfluencerSubscriptions: { url: '/subscriptions/communities/influencers/{community_id}', method: HTTP_METHODS.GET },
16
16
  changeCommunityInfluencerSubscription: { url: '/subscriptions/communities/influencers/change/{community_id}', method: HTTP_METHODS.POST },
17
17
 
18
- createCustomCommunitySubscription: {
19
- url: '/subscriptions/communities/custom/{community_id}',
20
- method: HTTP_METHODS.POST
18
+ createCustomCommunitySubscription: {
19
+ url: '/subscriptions/communities/custom/{community_id}',
20
+ method: HTTP_METHODS.POST
21
21
  },
22
22
 
23
23
  purchaseLicense: { url: '/titles/{title_id}/purchase', method: HTTP_METHODS.POST },
24
+ listMyLicenses: { url: '/subscriptions/my-licenses', method: HTTP_METHODS.GET },
25
+ refundLicense: { url: '/subscriptions/licenses/{license_id}/refund', method: HTTP_METHODS.POST },
24
26
 
25
27
  };
26
28
 
27
- }
29
+ }
28
30
 
29
- export default SubscriptionsRoute;
31
+ export default SubscriptionsRoute;
@@ -233,6 +233,11 @@ class TitlesRoute {
233
233
 
234
234
  updateBuildStatus: { url: '/titles/{title_id}/deployments/{build_id}/status', method: HTTP_METHODS.PUT },
235
235
 
236
+ // Inside the routes object in TitlesRoute.ts
237
+ getMatchmakerServer: {
238
+ url: '/titles/{title_id}/matchmaker/server',
239
+ method: HTTP_METHODS.GET
240
+ },
236
241
 
237
242
  };
238
243
 
@@ -50,6 +50,8 @@ class UserRoutes {
50
50
  clearInstagramAuth: { url: '/users/clearInstagramAuth', method: HTTP_METHODS.DELETE },
51
51
  getSubredditRules: { url: "/users/reddit/redditrules/{subreddit}", method: HTTP_METHODS.GET },
52
52
 
53
+ playedGames: { url: '/users/me/played-games', method: HTTP_METHODS.GET },
54
+
53
55
 
54
56
  };
55
57