glitch-javascript-sdk 3.0.0 → 3.0.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/cjs/index.js +92 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Media.d.ts +2 -3
- package/dist/esm/api/Posts.d.ts +20 -0
- package/dist/esm/api/Subscriptions.d.ts +18 -0
- package/dist/esm/api/Users.d.ts +18 -0
- package/dist/esm/index.js +92 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +58 -3
- package/package.json +1 -1
- package/src/api/Media.ts +11 -4
- package/src/api/Posts.ts +35 -0
- package/src/api/Subscriptions.ts +24 -0
- package/src/api/Users.ts +24 -0
- package/src/routes/PostsRoute.ts +16 -11
- package/src/routes/SubscriptionsRoute.ts +3 -0
- package/src/routes/UserRoutes.ts +3 -0
package/dist/esm/api/Media.d.ts
CHANGED
|
@@ -265,13 +265,12 @@ declare class Media {
|
|
|
265
265
|
static uploadTikTokMusic<T>(file: File, scheduler_id: string): AxiosPromise<Response<T>>;
|
|
266
266
|
/**
|
|
267
267
|
* Generate an S3 Presigned URL for direct upload.
|
|
268
|
-
* Use this for large files (up to 2GB) to bypass the Laravel server.
|
|
269
268
|
*
|
|
270
269
|
* @param filename The original name of the file.
|
|
271
270
|
* @param extension The file extension (e.g., 'mp4').
|
|
272
|
-
* @
|
|
271
|
+
* @param is_public Set to true if the file should be publicly accessible via URL.
|
|
273
272
|
*/
|
|
274
|
-
static getPresignedUrl<T = PresignedUrlResponse>(filename: string, extension: string): AxiosPromise<Response<T>>;
|
|
273
|
+
static getPresignedUrl<T = PresignedUrlResponse>(filename: string, extension: string, is_public?: boolean): AxiosPromise<Response<T>>;
|
|
275
274
|
/**
|
|
276
275
|
* Confirm a successful S3 upload and create the database record.
|
|
277
276
|
* Call this after the direct S3 upload is complete.
|
package/dist/esm/api/Posts.d.ts
CHANGED
|
@@ -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,23 @@ 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>>;
|
|
98
116
|
}
|
|
99
117
|
export default Subscriptions;
|
package/dist/esm/api/Users.d.ts
CHANGED
|
@@ -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,8 @@ 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 },
|
|
13835
13896
|
};
|
|
13836
13897
|
return SubscriptionsRoute;
|
|
13837
13898
|
}());
|
|
@@ -13959,6 +14020,28 @@ var Subscriptions = /** @class */ (function () {
|
|
|
13959
14020
|
Subscriptions.refundLicense = function (license_id) {
|
|
13960
14021
|
return Requests.processRoute(SubscriptionsRoute.routes.refundLicense, {}, { license_id: license_id });
|
|
13961
14022
|
};
|
|
14023
|
+
/**
|
|
14024
|
+
* Purchase a game or subscription as a gift for another user.
|
|
14025
|
+
*
|
|
14026
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/purchaseGift
|
|
14027
|
+
*
|
|
14028
|
+
* @param data { gift_type: 'premium'|'rental'|'subscription', payment_method_id: string, title_id?: string, recipient_id?: string, recipient_email?: string, recipient_name?: string }
|
|
14029
|
+
* @returns promise
|
|
14030
|
+
*/
|
|
14031
|
+
Subscriptions.purchaseGift = function (data) {
|
|
14032
|
+
return Requests.processRoute(SubscriptionsRoute.routes.purchaseGift, data);
|
|
14033
|
+
};
|
|
14034
|
+
/**
|
|
14035
|
+
* Redeem a gift code to grant access to a game or subscription.
|
|
14036
|
+
*
|
|
14037
|
+
* @see https://api.glitch.fun/api/documentation#/Subscriptions/redeemGift
|
|
14038
|
+
*
|
|
14039
|
+
* @param redemption_code The unique GLITCH-XXXX-XXXX code.
|
|
14040
|
+
* @returns promise
|
|
14041
|
+
*/
|
|
14042
|
+
Subscriptions.redeemGift = function (redemption_code) {
|
|
14043
|
+
return Requests.processRoute(SubscriptionsRoute.routes.redeemGift, { redemption_code: redemption_code });
|
|
14044
|
+
};
|
|
13962
14045
|
return Subscriptions;
|
|
13963
14046
|
}());
|
|
13964
14047
|
|
|
@@ -15146,14 +15229,19 @@ var Media = /** @class */ (function () {
|
|
|
15146
15229
|
};
|
|
15147
15230
|
/**
|
|
15148
15231
|
* Generate an S3 Presigned URL for direct upload.
|
|
15149
|
-
* Use this for large files (up to 2GB) to bypass the Laravel server.
|
|
15150
15232
|
*
|
|
15151
15233
|
* @param filename The original name of the file.
|
|
15152
15234
|
* @param extension The file extension (e.g., 'mp4').
|
|
15153
|
-
* @
|
|
15235
|
+
* @param is_public Set to true if the file should be publicly accessible via URL.
|
|
15154
15236
|
*/
|
|
15155
|
-
Media.getPresignedUrl = function (filename, extension
|
|
15156
|
-
|
|
15237
|
+
Media.getPresignedUrl = function (filename, extension, is_public // Added parameter
|
|
15238
|
+
) {
|
|
15239
|
+
if (is_public === void 0) { is_public = false; }
|
|
15240
|
+
return Requests.processRoute(MediaRoute.routes.getPresignedUrl, {
|
|
15241
|
+
filename: filename,
|
|
15242
|
+
extension: extension,
|
|
15243
|
+
is_public: is_public // Pass to backend
|
|
15244
|
+
});
|
|
15157
15245
|
};
|
|
15158
15246
|
/**
|
|
15159
15247
|
* Confirm a successful S3 upload and create the database record.
|