glitch-javascript-sdk 3.0.5 → 3.0.6

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
@@ -5488,6 +5488,15 @@ declare class Subscriptions {
5488
5488
  * @returns promise
5489
5489
  */
5490
5490
  static cancelGift<T>(gift_id: string): AxiosPromise<Response<T>>;
5491
+ /**
5492
+ * Validates a coupon code and returns the calculated discount.
5493
+ * @param data { code: string, price: number, currency?: string }
5494
+ */
5495
+ static validateCoupon<T>(data: {
5496
+ code: string;
5497
+ price: number;
5498
+ currency?: string;
5499
+ }): AxiosPromise<Response<T>>;
5491
5500
  }
5492
5501
 
5493
5502
  declare class Messages {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -175,6 +175,14 @@ class Subscriptions {
175
175
  return Requests.processRoute(SubscriptionsRoute.routes.cancelGift, {}, { gift_id });
176
176
  }
177
177
 
178
+ /**
179
+ * Validates a coupon code and returns the calculated discount.
180
+ * @param data { code: string, price: number, currency?: string }
181
+ */
182
+ public static validateCoupon<T>(data: { code: string, price: number, currency?: string }): AxiosPromise<Response<T>> {
183
+ return Requests.processRoute(SubscriptionsRoute.routes.validateCoupon, data);
184
+ }
185
+
178
186
  }
179
187
 
180
188
  export default Subscriptions;
@@ -28,6 +28,8 @@ class SubscriptionsRoute {
28
28
  redeemGift: { url: '/subscriptions/gifts/redeem', method: HTTP_METHODS.POST },
29
29
  cancelGift: { url: '/subscriptions/gifts/{gift_id}', method: HTTP_METHODS.DELETE },
30
30
 
31
+ validateCoupon: { url: '/subscriptions/coupons/validate', method: HTTP_METHODS.POST },
32
+
31
33
  };
32
34
 
33
35
  }