glitch-javascript-sdk 3.0.1 → 3.0.3

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.
@@ -102,5 +102,25 @@ declare class Posts {
102
102
  * @returns Promise
103
103
  */
104
104
  static toggleInteraction<T>(post_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
105
+ /**
106
+ * Join a Play Together session.
107
+ */
108
+ static joinSession<T>(post_id: string, data?: object): AxiosPromise<Response<T>>;
109
+ /**
110
+ * Follow a bug report for updates.
111
+ */
112
+ static followBug<T>(post_id: string, data?: object): AxiosPromise<Response<T>>;
113
+ /**
114
+ * Update notification preferences for a post.
115
+ */
116
+ static updatePreferences<T>(post_id: string, data: object): AxiosPromise<Response<T>>;
117
+ /**
118
+ * Leave a session or unfollow a bug.
119
+ */
120
+ static leave<T>(post_id: string): AxiosPromise<Response<T>>;
121
+ /**
122
+ * Mark a bug as resolved (Admin only).
123
+ */
124
+ static resolveBug<T>(post_id: string): AxiosPromise<Response<T>>;
105
125
  }
106
126
  export default Posts;
@@ -95,5 +95,33 @@ declare class Subscriptions {
95
95
  * Request a refund for a premium purchase.
96
96
  */
97
97
  static refundLicense<T>(license_id: string): AxiosPromise<Response<T>>;
98
+ /**
99
+ * Purchase a game or subscription as a gift for another user.
100
+ *
101
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/purchaseGift
102
+ *
103
+ * @param data { gift_type: 'premium'|'rental'|'subscription', payment_method_id: string, title_id?: string, recipient_id?: string, recipient_email?: string, recipient_name?: string }
104
+ * @returns promise
105
+ */
106
+ static purchaseGift<T>(data: object): AxiosPromise<Response<T>>;
107
+ /**
108
+ * Redeem a gift code to grant access to a game or subscription.
109
+ *
110
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/redeemGift
111
+ *
112
+ * @param redemption_code The unique GLITCH-XXXX-XXXX code.
113
+ * @returns promise
114
+ */
115
+ static redeemGift<T>(redemption_code: string): AxiosPromise<Response<T>>;
116
+ /**
117
+ * Cancel an unredeemed gift and trigger a refund.
118
+ * Only the user who purchased the gift (the giver) can perform this action.
119
+ *
120
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelGift
121
+ *
122
+ * @param gift_id The UUID of the gift to cancel.
123
+ * @returns promise
124
+ */
125
+ static cancelGift<T>(gift_id: string): AxiosPromise<Response<T>>;
98
126
  }
99
127
  export default Subscriptions;
@@ -465,5 +465,23 @@ declare class Users {
465
465
  title?: string;
466
466
  content: string;
467
467
  }): AxiosPromise<Response<T>>;
468
+ /**
469
+ * List all gifts purchased by the current user.
470
+ *
471
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userSentGifts
472
+ *
473
+ * @param params Optional filters: title_id, status, gift_type, min_amount, max_amount, start_date, end_date, sort_by, sort_order.
474
+ * @returns promise
475
+ */
476
+ static sentGifts<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
477
+ /**
478
+ * List all gifts received by the current user.
479
+ *
480
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userReceivedGifts
481
+ *
482
+ * @param params Optional filters: title_id, status, start_date, sort_by.
483
+ * @returns promise
484
+ */
485
+ static receivedGifts<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
468
486
  }
469
487
  export default Users;
package/dist/esm/index.js CHANGED
@@ -8815,6 +8815,8 @@ var UserRoutes = /** @class */ (function () {
8815
8815
  modifyMedia: { url: '/users/me/media/{id}/modify', method: HTTP_METHODS.POST },
8816
8816
  suggestSmartTrim: { url: '/users/me/media/{id}/smart-trim', method: HTTP_METHODS.GET },
8817
8817
  shareMedia: { url: '/users/me/media/{id}/share', method: HTTP_METHODS.POST },
8818
+ sentGifts: { url: '/users/me/gifts/sent', method: HTTP_METHODS.GET },
8819
+ receivedGifts: { url: '/users/me/gifts/received', method: HTTP_METHODS.GET },
8818
8820
  };
8819
8821
  return UserRoutes;
8820
8822
  }());
@@ -9381,6 +9383,28 @@ var Users = /** @class */ (function () {
9381
9383
  Users.shareMedia = function (id, data) {
9382
9384
  return Requests.processRoute(UserRoutes.routes.shareMedia, data, { id: id });
9383
9385
  };
9386
+ /**
9387
+ * List all gifts purchased by the current user.
9388
+ *
9389
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userSentGifts
9390
+ *
9391
+ * @param params Optional filters: title_id, status, gift_type, min_amount, max_amount, start_date, end_date, sort_by, sort_order.
9392
+ * @returns promise
9393
+ */
9394
+ Users.sentGifts = function (params) {
9395
+ return Requests.processRoute(UserRoutes.routes.sentGifts, undefined, undefined, params);
9396
+ };
9397
+ /**
9398
+ * List all gifts received by the current user.
9399
+ *
9400
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userReceivedGifts
9401
+ *
9402
+ * @param params Optional filters: title_id, status, start_date, sort_by.
9403
+ * @returns promise
9404
+ */
9405
+ Users.receivedGifts = function (params) {
9406
+ return Requests.processRoute(UserRoutes.routes.receivedGifts, undefined, undefined, params);
9407
+ };
9384
9408
  return Users;
9385
9409
  }());
9386
9410
 
@@ -10506,6 +10530,11 @@ var PostsRoute = /** @class */ (function () {
10506
10530
  update: { url: '/posts/{post_id}', method: HTTP_METHODS.PUT },
10507
10531
  delete: { url: '/posts/{post_id}', method: HTTP_METHODS.DELETE },
10508
10532
  toggleInteraction: { url: '/posts/{post_id}/toggleInteraction', method: HTTP_METHODS.POST },
10533
+ join: { url: '/posts/{post_id}/join', method: HTTP_METHODS.POST },
10534
+ follow: { url: '/posts/{post_id}/follow', method: HTTP_METHODS.POST },
10535
+ leave: { url: '/posts/{post_id}/leave', method: HTTP_METHODS.DELETE },
10536
+ resolve: { url: '/posts/{post_id}/resolve', method: HTTP_METHODS.POST },
10537
+ updatePreferences: { url: '/posts/{post_id}/participants/me', method: HTTP_METHODS.PUT },
10509
10538
  };
10510
10539
  return PostsRoute;
10511
10540
  }());
@@ -10671,6 +10700,36 @@ var Posts = /** @class */ (function () {
10671
10700
  Posts.toggleInteraction = function (post_id, data, params) {
10672
10701
  return Requests.processRoute(PostsRoute.routes.toggleInteraction, data, { post_id: post_id }, params);
10673
10702
  };
10703
+ /**
10704
+ * Join a Play Together session.
10705
+ */
10706
+ Posts.joinSession = function (post_id, data) {
10707
+ return Requests.processRoute(PostsRoute.routes.join, data, { post_id: post_id });
10708
+ };
10709
+ /**
10710
+ * Follow a bug report for updates.
10711
+ */
10712
+ Posts.followBug = function (post_id, data) {
10713
+ return Requests.processRoute(PostsRoute.routes.follow, data, { post_id: post_id });
10714
+ };
10715
+ /**
10716
+ * Update notification preferences for a post.
10717
+ */
10718
+ Posts.updatePreferences = function (post_id, data) {
10719
+ return Requests.processRoute(PostsRoute.routes.updatePreferences, data, { post_id: post_id });
10720
+ };
10721
+ /**
10722
+ * Leave a session or unfollow a bug.
10723
+ */
10724
+ Posts.leave = function (post_id) {
10725
+ return Requests.processRoute(PostsRoute.routes.leave, {}, { post_id: post_id });
10726
+ };
10727
+ /**
10728
+ * Mark a bug as resolved (Admin only).
10729
+ */
10730
+ Posts.resolveBug = function (post_id) {
10731
+ return Requests.processRoute(PostsRoute.routes.resolve, {}, { post_id: post_id });
10732
+ };
10674
10733
  return Posts;
10675
10734
  }());
10676
10735
 
@@ -13832,6 +13891,9 @@ var SubscriptionsRoute = /** @class */ (function () {
13832
13891
  purchaseLicense: { url: '/titles/{title_id}/purchase', method: HTTP_METHODS.POST },
13833
13892
  listMyLicenses: { url: '/subscriptions/my-licenses', method: HTTP_METHODS.GET },
13834
13893
  refundLicense: { url: '/subscriptions/licenses/{license_id}/refund', method: HTTP_METHODS.POST },
13894
+ purchaseGift: { url: '/subscriptions/gifts/purchase', method: HTTP_METHODS.POST },
13895
+ redeemGift: { url: '/subscriptions/gifts/redeem', method: HTTP_METHODS.POST },
13896
+ cancelGift: { url: '/subscriptions/gifts/{gift_id}', method: HTTP_METHODS.DELETE },
13835
13897
  };
13836
13898
  return SubscriptionsRoute;
13837
13899
  }());
@@ -13959,6 +14021,40 @@ var Subscriptions = /** @class */ (function () {
13959
14021
  Subscriptions.refundLicense = function (license_id) {
13960
14022
  return Requests.processRoute(SubscriptionsRoute.routes.refundLicense, {}, { license_id: license_id });
13961
14023
  };
14024
+ /**
14025
+ * Purchase a game or subscription as a gift for another user.
14026
+ *
14027
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/purchaseGift
14028
+ *
14029
+ * @param data { gift_type: 'premium'|'rental'|'subscription', payment_method_id: string, title_id?: string, recipient_id?: string, recipient_email?: string, recipient_name?: string }
14030
+ * @returns promise
14031
+ */
14032
+ Subscriptions.purchaseGift = function (data) {
14033
+ return Requests.processRoute(SubscriptionsRoute.routes.purchaseGift, data);
14034
+ };
14035
+ /**
14036
+ * Redeem a gift code to grant access to a game or subscription.
14037
+ *
14038
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/redeemGift
14039
+ *
14040
+ * @param redemption_code The unique GLITCH-XXXX-XXXX code.
14041
+ * @returns promise
14042
+ */
14043
+ Subscriptions.redeemGift = function (redemption_code) {
14044
+ return Requests.processRoute(SubscriptionsRoute.routes.redeemGift, { redemption_code: redemption_code });
14045
+ };
14046
+ /**
14047
+ * Cancel an unredeemed gift and trigger a refund.
14048
+ * Only the user who purchased the gift (the giver) can perform this action.
14049
+ *
14050
+ * @see https://api.glitch.fun/api/documentation#/Subscriptions/cancelGift
14051
+ *
14052
+ * @param gift_id The UUID of the gift to cancel.
14053
+ * @returns promise
14054
+ */
14055
+ Subscriptions.cancelGift = function (gift_id) {
14056
+ return Requests.processRoute(SubscriptionsRoute.routes.cancelGift, {}, { gift_id: gift_id });
14057
+ };
13962
14058
  return Subscriptions;
13963
14059
  }());
13964
14060