glitch-javascript-sdk 2.5.7 → 2.5.9
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 +51 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Education.d.ts +9 -0
- package/dist/esm/api/Media.d.ts +28 -0
- package/dist/esm/index.js +51 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +37 -0
- package/package.json +1 -1
- package/src/api/Education.ts +30 -0
- package/src/api/Media.ts +36 -0
- package/src/routes/EducationRoute.ts +1 -0
- package/src/routes/MediaRoute.ts +2 -0
|
@@ -30,11 +30,20 @@ declare class Education {
|
|
|
30
30
|
static submitQuiz<T>(uuid: string, answers: object): AxiosPromise<Response<T>>;
|
|
31
31
|
static myQuizAttempts<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
32
32
|
static viewQuizAttempt<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
33
|
+
static createQuiz<T>(data: object): AxiosPromise<Response<T>>;
|
|
34
|
+
static updateQuiz<T>(uuid: string, data: object): AxiosPromise<Response<T>>;
|
|
35
|
+
static deleteQuiz<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
33
36
|
static listQuizQuestions<T>(quiz_id: string): AxiosPromise<Response<T>>;
|
|
34
37
|
static createQuizQuestion<T>(quiz_id: string, data: object): AxiosPromise<Response<T>>;
|
|
35
38
|
static reorderQuizQuestions<T>(quiz_id: string, question_ids: string[]): AxiosPromise<Response<T>>;
|
|
36
39
|
static listQuizOptions<T>(question_id: string): AxiosPromise<Response<T>>;
|
|
37
40
|
static createQuizOption<T>(question_id: string, data: object): AxiosPromise<Response<T>>;
|
|
41
|
+
static viewQuizQuestion<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
42
|
+
static updateQuizQuestion<T>(uuid: string, data: object): AxiosPromise<Response<T>>;
|
|
43
|
+
static deleteQuizQuestion<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
44
|
+
static viewQuizOption<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
45
|
+
static updateQuizOption<T>(uuid: string, data: object): AxiosPromise<Response<T>>;
|
|
46
|
+
static deleteQuizOption<T>(uuid: string): AxiosPromise<Response<T>>;
|
|
38
47
|
static syncProgress<T>(data: object): AxiosPromise<Response<T>>;
|
|
39
48
|
static getMyProgressByContent<T>(content_id: string): AxiosPromise<Response<T>>;
|
|
40
49
|
static listRegistrations<T>(params?: object): AxiosPromise<Response<T>>;
|
package/dist/esm/api/Media.d.ts
CHANGED
|
@@ -86,6 +86,17 @@ export interface ScreenshotValidationResponse {
|
|
|
86
86
|
issues: string[];
|
|
87
87
|
recommendations: string[];
|
|
88
88
|
}
|
|
89
|
+
export interface PresignedUrlResponse {
|
|
90
|
+
upload_url: string;
|
|
91
|
+
file_path: string;
|
|
92
|
+
}
|
|
93
|
+
export interface S3ConfirmRequest {
|
|
94
|
+
file_path: string;
|
|
95
|
+
size: number;
|
|
96
|
+
mime_type: string;
|
|
97
|
+
title?: string;
|
|
98
|
+
filename?: string;
|
|
99
|
+
}
|
|
89
100
|
declare class Media {
|
|
90
101
|
/**
|
|
91
102
|
* Upload media content using a File object.
|
|
@@ -221,5 +232,22 @@ declare class Media {
|
|
|
221
232
|
* @param scheduler_id The ID of the scheduler to provide OAuth context.
|
|
222
233
|
*/
|
|
223
234
|
static uploadTikTokMusic<T>(file: File, scheduler_id: string): AxiosPromise<Response<T>>;
|
|
235
|
+
/**
|
|
236
|
+
* Generate an S3 Presigned URL for direct upload.
|
|
237
|
+
* Use this for large files (up to 2GB) to bypass the Laravel server.
|
|
238
|
+
*
|
|
239
|
+
* @param filename The original name of the file.
|
|
240
|
+
* @param extension The file extension (e.g., 'mp4').
|
|
241
|
+
* @returns AxiosPromise containing upload_url and file_path.
|
|
242
|
+
*/
|
|
243
|
+
static getPresignedUrl<T = PresignedUrlResponse>(filename: string, extension: string): AxiosPromise<Response<T>>;
|
|
244
|
+
/**
|
|
245
|
+
* Confirm a successful S3 upload and create the database record.
|
|
246
|
+
* Call this after the direct S3 upload is complete.
|
|
247
|
+
*
|
|
248
|
+
* @param data The file metadata (path, size, mime_type).
|
|
249
|
+
* @returns AxiosPromise containing the created Media resource.
|
|
250
|
+
*/
|
|
251
|
+
static confirmS3Upload<T>(data: S3ConfirmRequest): AxiosPromise<Response<T>>;
|
|
224
252
|
}
|
|
225
253
|
export default Media;
|
package/dist/esm/index.js
CHANGED
|
@@ -14038,6 +14038,8 @@ var MediaRoute = /** @class */ (function () {
|
|
|
14038
14038
|
createLibraryLogo: { url: '/media/create-library-logo', method: HTTP_METHODS.POST },
|
|
14039
14039
|
validateScreenshot: { url: '/media/validate-screenshot', method: HTTP_METHODS.POST },
|
|
14040
14040
|
uploadTikTokMusic: { url: '/media/tiktok/music', method: HTTP_METHODS.POST },
|
|
14041
|
+
getPresignedUrl: { url: '/media/presigned-url', method: HTTP_METHODS.POST },
|
|
14042
|
+
confirmS3Upload: { url: '/media/s3-confirm', method: HTTP_METHODS.POST },
|
|
14041
14043
|
};
|
|
14042
14044
|
return MediaRoute;
|
|
14043
14045
|
}());
|
|
@@ -14268,6 +14270,27 @@ var Media = /** @class */ (function () {
|
|
|
14268
14270
|
// We use the raw URL here as it's a specialized upload path
|
|
14269
14271
|
return Requests.uploadFile('/media/tiktok/music', 'audio', file, { scheduler_id: scheduler_id });
|
|
14270
14272
|
};
|
|
14273
|
+
/**
|
|
14274
|
+
* Generate an S3 Presigned URL for direct upload.
|
|
14275
|
+
* Use this for large files (up to 2GB) to bypass the Laravel server.
|
|
14276
|
+
*
|
|
14277
|
+
* @param filename The original name of the file.
|
|
14278
|
+
* @param extension The file extension (e.g., 'mp4').
|
|
14279
|
+
* @returns AxiosPromise containing upload_url and file_path.
|
|
14280
|
+
*/
|
|
14281
|
+
Media.getPresignedUrl = function (filename, extension) {
|
|
14282
|
+
return Requests.processRoute(MediaRoute.routes.getPresignedUrl, { filename: filename, extension: extension });
|
|
14283
|
+
};
|
|
14284
|
+
/**
|
|
14285
|
+
* Confirm a successful S3 upload and create the database record.
|
|
14286
|
+
* Call this after the direct S3 upload is complete.
|
|
14287
|
+
*
|
|
14288
|
+
* @param data The file metadata (path, size, mime_type).
|
|
14289
|
+
* @returns AxiosPromise containing the created Media resource.
|
|
14290
|
+
*/
|
|
14291
|
+
Media.confirmS3Upload = function (data) {
|
|
14292
|
+
return Requests.processRoute(MediaRoute.routes.confirmS3Upload, data);
|
|
14293
|
+
};
|
|
14271
14294
|
return Media;
|
|
14272
14295
|
}());
|
|
14273
14296
|
|
|
@@ -16685,6 +16708,15 @@ var Education = /** @class */ (function () {
|
|
|
16685
16708
|
Education.viewQuizAttempt = function (uuid) {
|
|
16686
16709
|
return Requests.processRoute(EducationRoute.routes.viewQuizAttempt, undefined, { uuid: uuid });
|
|
16687
16710
|
};
|
|
16711
|
+
Education.createQuiz = function (data) {
|
|
16712
|
+
return Requests.processRoute(EducationRoute.routes.createQuiz, data);
|
|
16713
|
+
};
|
|
16714
|
+
Education.updateQuiz = function (uuid, data) {
|
|
16715
|
+
return Requests.processRoute(EducationRoute.routes.updateQuiz, data, { uuid: uuid });
|
|
16716
|
+
};
|
|
16717
|
+
Education.deleteQuiz = function (uuid) {
|
|
16718
|
+
return Requests.processRoute(EducationRoute.routes.deleteQuiz, undefined, { uuid: uuid });
|
|
16719
|
+
};
|
|
16688
16720
|
// --- 6. QUIZ QUESTIONS & OPTIONS ---
|
|
16689
16721
|
Education.listQuizQuestions = function (quiz_id) {
|
|
16690
16722
|
return Requests.processRoute(EducationRoute.routes.listQuizQuestions, undefined, { quiz_id: quiz_id });
|
|
@@ -16701,6 +16733,25 @@ var Education = /** @class */ (function () {
|
|
|
16701
16733
|
Education.createQuizOption = function (question_id, data) {
|
|
16702
16734
|
return Requests.processRoute(EducationRoute.routes.createQuizOption, data, { question_id: question_id });
|
|
16703
16735
|
};
|
|
16736
|
+
Education.viewQuizQuestion = function (uuid) {
|
|
16737
|
+
return Requests.processRoute(EducationRoute.routes.viewQuizQuestion, undefined, { uuid: uuid });
|
|
16738
|
+
};
|
|
16739
|
+
Education.updateQuizQuestion = function (uuid, data) {
|
|
16740
|
+
return Requests.processRoute(EducationRoute.routes.updateQuizQuestion, data, { uuid: uuid });
|
|
16741
|
+
};
|
|
16742
|
+
Education.deleteQuizQuestion = function (uuid) {
|
|
16743
|
+
return Requests.processRoute(EducationRoute.routes.deleteQuizQuestion, undefined, { uuid: uuid });
|
|
16744
|
+
};
|
|
16745
|
+
// --- QUIZ OPTIONS (CRUD) ---
|
|
16746
|
+
Education.viewQuizOption = function (uuid) {
|
|
16747
|
+
return Requests.processRoute(EducationRoute.routes.viewQuizOption, undefined, { uuid: uuid });
|
|
16748
|
+
};
|
|
16749
|
+
Education.updateQuizOption = function (uuid, data) {
|
|
16750
|
+
return Requests.processRoute(EducationRoute.routes.updateQuizOption, data, { uuid: uuid });
|
|
16751
|
+
};
|
|
16752
|
+
Education.deleteQuizOption = function (uuid) {
|
|
16753
|
+
return Requests.processRoute(EducationRoute.routes.deleteQuizOption, undefined, { uuid: uuid });
|
|
16754
|
+
};
|
|
16704
16755
|
// --- 7. PROGRESS & REGISTRATIONS ---
|
|
16705
16756
|
Education.syncProgress = function (data) {
|
|
16706
16757
|
return Requests.processRoute(EducationRoute.routes.syncProgress, data);
|