glitch-javascript-sdk 3.0.5 → 3.0.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/cjs/index.js +30 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Subscriptions.d.ts +9 -0
- package/dist/esm/api/Titles.d.ts +15 -0
- package/dist/esm/index.js +30 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +24 -0
- package/package.json +1 -1
- package/src/api/Subscriptions.ts +8 -0
- package/src/api/Titles.ts +18 -0
- package/src/routes/SubscriptionsRoute.ts +2 -0
- package/src/routes/TitlesRoute.ts +6 -0
package/dist/index.d.ts
CHANGED
|
@@ -4592,6 +4592,21 @@ declare class Titles {
|
|
|
4592
4592
|
limit?: number;
|
|
4593
4593
|
device_id?: string;
|
|
4594
4594
|
}): AxiosPromise<Response<T>>;
|
|
4595
|
+
/**
|
|
4596
|
+
* Get a curated, playable feed for the Swipe interface.
|
|
4597
|
+
* This route ensures games have builds and images, and supports seeded randomization.
|
|
4598
|
+
*
|
|
4599
|
+
* @see https://api.glitch.fun/api/documentation#/Discovery/getSwipeFeed
|
|
4600
|
+
*
|
|
4601
|
+
* @param params Object of query params:
|
|
4602
|
+
* - seed?: number (For consistent randomization)
|
|
4603
|
+
* - genres?: string[] (Filter by genre names)
|
|
4604
|
+
* - models?: string[] (premium, rental, subscription, free)
|
|
4605
|
+
* - excluded_ids?: string[] (UUIDs to skip)
|
|
4606
|
+
* - page?: number
|
|
4607
|
+
* - per_page?: number
|
|
4608
|
+
*/
|
|
4609
|
+
static swipeFeed<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4595
4610
|
}
|
|
4596
4611
|
|
|
4597
4612
|
declare class Campaigns {
|
|
@@ -5488,6 +5503,15 @@ declare class Subscriptions {
|
|
|
5488
5503
|
* @returns promise
|
|
5489
5504
|
*/
|
|
5490
5505
|
static cancelGift<T>(gift_id: string): AxiosPromise<Response<T>>;
|
|
5506
|
+
/**
|
|
5507
|
+
* Validates a coupon code and returns the calculated discount.
|
|
5508
|
+
* @param data { code: string, price: number, currency?: string }
|
|
5509
|
+
*/
|
|
5510
|
+
static validateCoupon<T>(data: {
|
|
5511
|
+
code: string;
|
|
5512
|
+
price: number;
|
|
5513
|
+
currency?: string;
|
|
5514
|
+
}): AxiosPromise<Response<T>>;
|
|
5491
5515
|
}
|
|
5492
5516
|
|
|
5493
5517
|
declare class Messages {
|
package/package.json
CHANGED
package/src/api/Subscriptions.ts
CHANGED
|
@@ -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;
|
package/src/api/Titles.ts
CHANGED
|
@@ -1253,6 +1253,24 @@ class Titles {
|
|
|
1253
1253
|
public static getDiscoveryQueue<T>(params?: { limit?: number, device_id?: string }): AxiosPromise<Response<T>> {
|
|
1254
1254
|
return Requests.processRoute(TitlesRoute.routes.discoveryQueue, {}, {}, params);
|
|
1255
1255
|
}
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Get a curated, playable feed for the Swipe interface.
|
|
1259
|
+
* This route ensures games have builds and images, and supports seeded randomization.
|
|
1260
|
+
*
|
|
1261
|
+
* @see https://api.glitch.fun/api/documentation#/Discovery/getSwipeFeed
|
|
1262
|
+
*
|
|
1263
|
+
* @param params Object of query params:
|
|
1264
|
+
* - seed?: number (For consistent randomization)
|
|
1265
|
+
* - genres?: string[] (Filter by genre names)
|
|
1266
|
+
* - models?: string[] (premium, rental, subscription, free)
|
|
1267
|
+
* - excluded_ids?: string[] (UUIDs to skip)
|
|
1268
|
+
* - page?: number
|
|
1269
|
+
* - per_page?: number
|
|
1270
|
+
*/
|
|
1271
|
+
public static swipeFeed<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
1272
|
+
return Requests.processRoute(TitlesRoute.routes.swipeFeed, {}, undefined, params);
|
|
1273
|
+
}
|
|
1256
1274
|
}
|
|
1257
1275
|
|
|
1258
1276
|
export default Titles;
|
|
@@ -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
|
}
|
|
@@ -282,6 +282,12 @@ class TitlesRoute {
|
|
|
282
282
|
socialTrending: { url: '/titles/activity/social', method: HTTP_METHODS.GET },
|
|
283
283
|
discoveryQueue: { url: '/titles/discovery/queue', method: HTTP_METHODS.GET },
|
|
284
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Curated, playable feed for the Swipe interface.
|
|
287
|
+
* GET /titles/discovery/swipe
|
|
288
|
+
*/
|
|
289
|
+
swipeFeed: { url: '/titles/discovery/swipe', method: HTTP_METHODS.GET },
|
|
290
|
+
|
|
285
291
|
};
|
|
286
292
|
|
|
287
293
|
}
|