@learnpress/api 0.5.0 → 0.6.1
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/endpoints/lp/index.cjs +3 -1
- package/dist/endpoints/lp/index.d.cts +2 -2
- package/dist/endpoints/lp/index.d.ts +2 -2
- package/dist/endpoints/lp/index.js +2 -2
- package/dist/endpoints/wp/index.cjs +1 -1
- package/dist/endpoints/wp/index.d.cts +1 -1
- package/dist/endpoints/wp/index.d.ts +1 -1
- package/dist/endpoints/wp/index.js +1 -1
- package/dist/{index-CTJ8v4pA.d.cts → index-BUuPlRZk.d.cts} +607 -19
- package/dist/index-BUuPlRZk.d.cts.map +1 -0
- package/dist/{index-CWyrNDh3.d.ts → index-BUuPlRZk.d.ts} +607 -19
- package/dist/index-BUuPlRZk.d.ts.map +1 -0
- package/dist/index.cjs +29 -11
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +28 -12
- package/dist/index.js.map +1 -1
- package/dist/lp-CuwMSqff.js +353 -0
- package/dist/lp-CuwMSqff.js.map +1 -0
- package/dist/lp-DjHGTC0c.cjs +368 -0
- package/dist/{wp-4qPZPs4-.js → wp-DjqcCWa9.js} +1 -1
- package/dist/{wp-4qPZPs4-.js.map → wp-DjqcCWa9.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CTJ8v4pA.d.cts.map +0 -1
- package/dist/index-CWyrNDh3.d.ts.map +0 -1
- package/dist/lp-8FkYA4yx.js +0 -159
- package/dist/lp-8FkYA4yx.js.map +0 -1
- package/dist/lp-Bw4yL0Wh.cjs +0 -162
- /package/dist/{wp-Cj52Y1an.cjs → wp-BbczTv61.cjs} +0 -0
|
@@ -10,7 +10,8 @@ interface LpValidateResponse {
|
|
|
10
10
|
code: string;
|
|
11
11
|
message: string;
|
|
12
12
|
data: {
|
|
13
|
-
status: number;
|
|
13
|
+
status: number;
|
|
14
|
+
/** Remaining seconds until expiry */
|
|
14
15
|
exp: number;
|
|
15
16
|
};
|
|
16
17
|
}
|
|
@@ -43,15 +44,18 @@ interface LpInstructor {
|
|
|
43
44
|
description: string;
|
|
44
45
|
social?: Record<string, unknown>;
|
|
45
46
|
}
|
|
47
|
+
type LpItemType = "lp_lesson" | "lp_quiz" | "lp_assignment";
|
|
48
|
+
type LpItemStatus = "completed" | "in-progress" | "";
|
|
49
|
+
type LpItemGraduation = "passed" | "failed" | "in-progress" | "";
|
|
46
50
|
interface LpSectionItem {
|
|
47
51
|
id: number;
|
|
48
|
-
type: string;
|
|
52
|
+
type: LpItemType | string;
|
|
49
53
|
slug?: string;
|
|
50
54
|
title: string;
|
|
51
55
|
preview: boolean;
|
|
52
56
|
duration: string;
|
|
53
|
-
graduation: string;
|
|
54
|
-
status: string;
|
|
57
|
+
graduation: LpItemGraduation | string;
|
|
58
|
+
status: LpItemStatus | string;
|
|
55
59
|
locked: boolean;
|
|
56
60
|
}
|
|
57
61
|
interface LpSection {
|
|
@@ -103,17 +107,20 @@ interface LpCourse {
|
|
|
103
107
|
content?: string;
|
|
104
108
|
excerpt?: string;
|
|
105
109
|
count_students?: number;
|
|
110
|
+
/** Total lesson/item count. Not returned by listing API; computed from sections on single-course fetch. */
|
|
111
|
+
lesson_count?: number;
|
|
106
112
|
can_finish?: boolean;
|
|
107
113
|
can_retake?: number | boolean;
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
retake_count?: number;
|
|
115
|
+
retaken?: number;
|
|
110
116
|
duration?: string;
|
|
111
117
|
categories?: LpTerm[];
|
|
112
118
|
tags?: LpTerm[];
|
|
113
119
|
instructor?: LpInstructor;
|
|
114
120
|
sections?: LpSection[];
|
|
115
121
|
course_data?: LpCourseUserData;
|
|
116
|
-
rating
|
|
122
|
+
/** LearnPress returns false when the course does not have a rating yet. */
|
|
123
|
+
rating?: number | false;
|
|
117
124
|
price?: number;
|
|
118
125
|
price_rendered?: string;
|
|
119
126
|
origin_price?: number;
|
|
@@ -147,7 +154,15 @@ interface LpCoursesQuery {
|
|
|
147
154
|
slug?: string | string[];
|
|
148
155
|
/** Applies only when `learned` is enabled. */
|
|
149
156
|
course_filter?: "in-progress" | "passed" | "failed" | string;
|
|
157
|
+
/** Filter by post status (e.g. instructor's own courses): "all", "publish", "pending". */
|
|
158
|
+
c_status?: "all" | "publish" | "pending" | string;
|
|
159
|
+
/** LearnPress course filters: free, paid, sale, feature. */
|
|
160
|
+
sort_by?: "on_free" | "on_paid" | "on_sale" | "on_feature" | string;
|
|
150
161
|
on_sale?: boolean;
|
|
162
|
+
/** Filter by featured courses (`meta_key = '_lp_featured'`). Pass `1` or `true`. */
|
|
163
|
+
on_feature?: boolean | 1;
|
|
164
|
+
/** @deprecated LearnPress REST courses do not support `free`; use `sort_by: "on_free"`. */
|
|
165
|
+
free?: boolean;
|
|
151
166
|
popular?: boolean;
|
|
152
167
|
/** Skip heavy fields (sections, course_data, instructor, meta_data, ...). */
|
|
153
168
|
optimize?: boolean | string;
|
|
@@ -171,6 +186,60 @@ interface LpCourseIdInput {
|
|
|
171
186
|
interface LpLessonResults {
|
|
172
187
|
status?: string;
|
|
173
188
|
}
|
|
189
|
+
interface LpAssignmentDuration {
|
|
190
|
+
format: string;
|
|
191
|
+
time: number;
|
|
192
|
+
time_remaining: number;
|
|
193
|
+
}
|
|
194
|
+
interface LpAssignmentResults {
|
|
195
|
+
/** "" = not started, "started", "completed" = submitted (pending review), "evaluated" = graded */
|
|
196
|
+
status: "started" | "completed" | "evaluated" | "";
|
|
197
|
+
start_time: string;
|
|
198
|
+
expiration_time: string;
|
|
199
|
+
end_time: string;
|
|
200
|
+
}
|
|
201
|
+
interface LpAssignmentAnswer {
|
|
202
|
+
note: string;
|
|
203
|
+
file: string[];
|
|
204
|
+
}
|
|
205
|
+
interface LpAssignmentEvaluationFile {
|
|
206
|
+
id: string;
|
|
207
|
+
url: string;
|
|
208
|
+
name: string;
|
|
209
|
+
}
|
|
210
|
+
interface LpAssignmentEvaluation {
|
|
211
|
+
mark: number;
|
|
212
|
+
user_mark: number;
|
|
213
|
+
/** "passed" | "failed" */
|
|
214
|
+
graduation: string;
|
|
215
|
+
/** Percentage 0–100 */
|
|
216
|
+
result: number;
|
|
217
|
+
instructor_note?: string;
|
|
218
|
+
reference_files?: LpAssignmentEvaluationFile[];
|
|
219
|
+
}
|
|
220
|
+
interface LpAssignment {
|
|
221
|
+
id: number;
|
|
222
|
+
name: string;
|
|
223
|
+
slug: string;
|
|
224
|
+
permalink: string;
|
|
225
|
+
status?: string;
|
|
226
|
+
content?: string;
|
|
227
|
+
excerpt?: string;
|
|
228
|
+
introdution?: string;
|
|
229
|
+
passing_grade?: string;
|
|
230
|
+
retake_count?: number;
|
|
231
|
+
retaken?: number;
|
|
232
|
+
allow_file_type?: string;
|
|
233
|
+
files_amount?: number;
|
|
234
|
+
attachment?: unknown[];
|
|
235
|
+
duration?: LpAssignmentDuration;
|
|
236
|
+
results?: LpAssignmentResults;
|
|
237
|
+
assignment_answer?: LpAssignmentAnswer;
|
|
238
|
+
/** Present as an object when instructor has graded; empty array when not yet graded. */
|
|
239
|
+
evaluation?: LpAssignmentEvaluation | [];
|
|
240
|
+
can_finish_course?: boolean;
|
|
241
|
+
assigned?: LpAssigned;
|
|
242
|
+
}
|
|
174
243
|
interface LpAssignedCourse {
|
|
175
244
|
id: number;
|
|
176
245
|
title: string;
|
|
@@ -197,12 +266,83 @@ interface LpLesson {
|
|
|
197
266
|
assigned?: LpAssigned;
|
|
198
267
|
meta_data?: Record<string, unknown>;
|
|
199
268
|
}
|
|
269
|
+
interface LpQuizQuestionOption {
|
|
270
|
+
/** API returns a numeric DB id; coerce with String() when used as a Radio/Checkbox value. */
|
|
271
|
+
uid: string | number;
|
|
272
|
+
title: string;
|
|
273
|
+
value?: string;
|
|
274
|
+
/** Present (as "yes"/"no") only when answer is revealed (instant_check or completed). */
|
|
275
|
+
is_true?: string;
|
|
276
|
+
}
|
|
277
|
+
interface LpQuizFibAnswerEntry {
|
|
278
|
+
is_correct: boolean;
|
|
279
|
+
/** User's answer. */
|
|
280
|
+
answer: string;
|
|
281
|
+
/** Correct fill value. */
|
|
282
|
+
correct: string;
|
|
283
|
+
}
|
|
200
284
|
interface LpQuizQuestion {
|
|
201
285
|
id: number;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
point
|
|
286
|
+
title: string;
|
|
287
|
+
type: string;
|
|
288
|
+
point: number;
|
|
289
|
+
/** For FIB questions, this contains `{{FIB_<id>}}` placeholders instead of raw shortcodes. */
|
|
290
|
+
content?: string;
|
|
291
|
+
hint?: string;
|
|
292
|
+
explanation?: string;
|
|
293
|
+
has_explanation?: boolean;
|
|
294
|
+
options: LpQuizQuestionOption[];
|
|
295
|
+
/** For FIB on revealed state: per-blank correctness + correct answer. */
|
|
296
|
+
fib_answers?: Record<string, LpQuizFibAnswerEntry>;
|
|
297
|
+
}
|
|
298
|
+
interface LpQuizCheckAnswerResponse {
|
|
299
|
+
status?: string;
|
|
300
|
+
message?: string;
|
|
301
|
+
explanation?: string;
|
|
302
|
+
/** Options with `is_true` revealed. */
|
|
303
|
+
options?: LpQuizQuestionOption[];
|
|
304
|
+
/** Plugin's internal correctness check object. Shape varies by question type. */
|
|
305
|
+
result?: {
|
|
306
|
+
correct?: boolean;
|
|
307
|
+
[key: string]: unknown;
|
|
308
|
+
};
|
|
309
|
+
[key: string]: unknown;
|
|
310
|
+
}
|
|
311
|
+
interface LpQuizResultScore {
|
|
312
|
+
mark?: number;
|
|
313
|
+
user_mark?: number;
|
|
314
|
+
question_count?: number;
|
|
315
|
+
question_correct?: number;
|
|
316
|
+
question_wrong?: number;
|
|
317
|
+
question_empty?: number;
|
|
318
|
+
result?: number;
|
|
319
|
+
pass?: number;
|
|
320
|
+
}
|
|
321
|
+
interface LpQuizUserResults {
|
|
322
|
+
status?: string;
|
|
323
|
+
passing_grade?: number | string;
|
|
324
|
+
retake_count?: number;
|
|
325
|
+
retaken?: number;
|
|
326
|
+
total_time?: number;
|
|
327
|
+
/** Number of questions per page; 0 or undefined = show all on one page. */
|
|
328
|
+
questions_per_page?: number;
|
|
329
|
+
page_numbers?: boolean;
|
|
330
|
+
attempts?: unknown[];
|
|
331
|
+
checked_questions?: number[];
|
|
332
|
+
start_time?: string;
|
|
333
|
+
question_ids?: number[];
|
|
334
|
+
answered?: Record<string, {
|
|
335
|
+
answered?: string | string[] | Record<string, string>;
|
|
336
|
+
correct?: boolean;
|
|
337
|
+
}>;
|
|
338
|
+
results?: LpQuizResultScore;
|
|
339
|
+
instant_check?: boolean;
|
|
340
|
+
negative_marking?: boolean;
|
|
341
|
+
/** "Allow students to review this quiz after they finish the quiz." */
|
|
342
|
+
review_questions?: boolean;
|
|
343
|
+
show_correct_review?: boolean;
|
|
205
344
|
}
|
|
345
|
+
type LpQuizAnswerInput = Record<string | number, string | string[] | Record<string, string>>;
|
|
206
346
|
interface LpQuiz {
|
|
207
347
|
id: number;
|
|
208
348
|
name: string;
|
|
@@ -214,7 +354,7 @@ interface LpQuiz {
|
|
|
214
354
|
duration?: string;
|
|
215
355
|
can_finish_course?: boolean;
|
|
216
356
|
questions?: LpQuizQuestion[];
|
|
217
|
-
results?:
|
|
357
|
+
results?: LpQuizUserResults;
|
|
218
358
|
assigned?: LpAssigned;
|
|
219
359
|
meta_data?: Record<string, unknown>;
|
|
220
360
|
}
|
|
@@ -234,6 +374,180 @@ interface LpCourseActionResponse {
|
|
|
234
374
|
message?: string;
|
|
235
375
|
[key: string]: unknown;
|
|
236
376
|
}
|
|
377
|
+
interface LpWishlistData {
|
|
378
|
+
/** Present on toggle responses: which action was performed. */
|
|
379
|
+
type?: "add" | "remove";
|
|
380
|
+
/** Present on single-course responses: whether the course is in the wishlist. */
|
|
381
|
+
in_wishlist?: "yes" | "no";
|
|
382
|
+
/** Localized add/remove button labels. */
|
|
383
|
+
text?: {
|
|
384
|
+
add: string;
|
|
385
|
+
remove: string;
|
|
386
|
+
};
|
|
387
|
+
/** Wishlisted courses, resolved from `/learnpress/v1/courses`. */
|
|
388
|
+
items?: LpCourse[];
|
|
389
|
+
}
|
|
390
|
+
interface LpWishlistResponse extends LpCourseActionResponse {
|
|
391
|
+
data?: LpWishlistData;
|
|
392
|
+
}
|
|
393
|
+
interface LpPaymentMethodConfig {
|
|
394
|
+
client_id?: string;
|
|
395
|
+
sandbox?: boolean;
|
|
396
|
+
currency?: string;
|
|
397
|
+
}
|
|
398
|
+
interface LpPaymentMethod {
|
|
399
|
+
id: string;
|
|
400
|
+
title: string;
|
|
401
|
+
description: string;
|
|
402
|
+
icon: string;
|
|
403
|
+
is_default: boolean;
|
|
404
|
+
config?: LpPaymentMethodConfig;
|
|
405
|
+
}
|
|
406
|
+
interface LpPaypalCreateOrderInput {
|
|
407
|
+
course_id: number;
|
|
408
|
+
notes?: string;
|
|
409
|
+
}
|
|
410
|
+
interface LpPaypalCreateOrderResponse extends LpCourseActionResponse {
|
|
411
|
+
data?: {
|
|
412
|
+
lp_order_id?: number;
|
|
413
|
+
paypal_order_id?: string;
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
interface LpPaypalCaptureInput {
|
|
417
|
+
paypal_order_id: string;
|
|
418
|
+
}
|
|
419
|
+
interface LpPaypalCaptureResponse extends LpCourseActionResponse {
|
|
420
|
+
data?: {
|
|
421
|
+
order?: LpOrderSummary;
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
interface LpCheckoutInput {
|
|
425
|
+
course_id: number;
|
|
426
|
+
payment_method?: string;
|
|
427
|
+
notes?: string;
|
|
428
|
+
}
|
|
429
|
+
interface LpOrderItem {
|
|
430
|
+
name: string;
|
|
431
|
+
course_id: number;
|
|
432
|
+
total: number;
|
|
433
|
+
}
|
|
434
|
+
interface LpOrderSummary {
|
|
435
|
+
id: number;
|
|
436
|
+
number: string;
|
|
437
|
+
status: string;
|
|
438
|
+
status_label: string;
|
|
439
|
+
total: number;
|
|
440
|
+
total_formatted: string;
|
|
441
|
+
subtotal: number;
|
|
442
|
+
created_at: string;
|
|
443
|
+
payment_method: string;
|
|
444
|
+
items: LpOrderItem[];
|
|
445
|
+
}
|
|
446
|
+
interface LpCheckoutResponse extends LpCourseActionResponse {
|
|
447
|
+
data?: {
|
|
448
|
+
order_id?: number;
|
|
449
|
+
redirect?: string;
|
|
450
|
+
/** True when the gateway requires the user to be redirected externally (e.g. PayPal). */
|
|
451
|
+
requires_redirect?: boolean;
|
|
452
|
+
order?: LpOrderSummary;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
interface LpUserSocial {
|
|
456
|
+
facebook?: string;
|
|
457
|
+
twitter?: string;
|
|
458
|
+
youtube?: string;
|
|
459
|
+
linkedin?: string;
|
|
460
|
+
instagram?: string;
|
|
461
|
+
github?: string;
|
|
462
|
+
}
|
|
463
|
+
interface LpUserOrderEntry {
|
|
464
|
+
order_key: string;
|
|
465
|
+
total: number | string;
|
|
466
|
+
currency: string;
|
|
467
|
+
status: string;
|
|
468
|
+
date: string;
|
|
469
|
+
}
|
|
470
|
+
interface LpUserProfile {
|
|
471
|
+
id: number;
|
|
472
|
+
name?: string;
|
|
473
|
+
first_name?: string;
|
|
474
|
+
last_name?: string;
|
|
475
|
+
email?: string;
|
|
476
|
+
description?: string;
|
|
477
|
+
url?: string;
|
|
478
|
+
nickname?: string;
|
|
479
|
+
registered_date?: string;
|
|
480
|
+
/** Only returned with `context: "edit"`. */
|
|
481
|
+
roles?: string[];
|
|
482
|
+
avatar_url?: string;
|
|
483
|
+
avatar_size?: {
|
|
484
|
+
width: number;
|
|
485
|
+
height: number;
|
|
486
|
+
};
|
|
487
|
+
cover_image_url?: string;
|
|
488
|
+
social?: LpUserSocial;
|
|
489
|
+
tabs?: {
|
|
490
|
+
orders?: {
|
|
491
|
+
content?: Record<string, LpUserOrderEntry>;
|
|
492
|
+
};
|
|
493
|
+
[key: string]: unknown;
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
interface LpUserUpdateInput {
|
|
497
|
+
first_name?: string;
|
|
498
|
+
last_name?: string;
|
|
499
|
+
email?: string;
|
|
500
|
+
description?: string;
|
|
501
|
+
url?: string;
|
|
502
|
+
nickname?: string;
|
|
503
|
+
social?: Record<string, string>;
|
|
504
|
+
}
|
|
505
|
+
interface LpChangePasswordInput {
|
|
506
|
+
current_password: string;
|
|
507
|
+
password: string;
|
|
508
|
+
confirm_password: string;
|
|
509
|
+
}
|
|
510
|
+
interface LpThumbnailDimensions {
|
|
511
|
+
width: number;
|
|
512
|
+
height: number;
|
|
513
|
+
crop: boolean;
|
|
514
|
+
}
|
|
515
|
+
interface LpCourseSettings {
|
|
516
|
+
archive_layout: "grid" | "list" | string;
|
|
517
|
+
archive_layouts: string[];
|
|
518
|
+
archive_limit: number;
|
|
519
|
+
pagination_type: "standard" | "load_more" | "infinite" | string;
|
|
520
|
+
layout_single_course: string;
|
|
521
|
+
curriculum_display: string;
|
|
522
|
+
section_per_page: number;
|
|
523
|
+
course_item_per_page: number;
|
|
524
|
+
auto_enroll: boolean;
|
|
525
|
+
popup_confirm_finish: boolean;
|
|
526
|
+
courses_of_subcategory: boolean;
|
|
527
|
+
thumbnail_dimensions: LpThumbnailDimensions;
|
|
528
|
+
}
|
|
529
|
+
interface LpCurrencySettings {
|
|
530
|
+
currency: string;
|
|
531
|
+
symbol: string;
|
|
532
|
+
position: "left" | "right" | "left_space" | "right_space" | string;
|
|
533
|
+
thousands_separator: string;
|
|
534
|
+
decimals_separator: string;
|
|
535
|
+
number_of_decimals: number;
|
|
536
|
+
}
|
|
537
|
+
interface LpSettings {
|
|
538
|
+
course: LpCourseSettings;
|
|
539
|
+
currency: LpCurrencySettings;
|
|
540
|
+
[key: string]: unknown;
|
|
541
|
+
}
|
|
542
|
+
/** Instructor dashboard counters from GET /lp/v1/profile/instructor/statistic. */
|
|
543
|
+
interface LpInstructorStatistic {
|
|
544
|
+
total_course: number;
|
|
545
|
+
published_course: number;
|
|
546
|
+
pending_course: number;
|
|
547
|
+
total_student: number;
|
|
548
|
+
student_completed: number;
|
|
549
|
+
student_in_progress: number;
|
|
550
|
+
}
|
|
237
551
|
//#endregion
|
|
238
552
|
//#region src/client.d.ts
|
|
239
553
|
interface ApiClientOptions {
|
|
@@ -251,6 +565,10 @@ interface ApiClientOptions {
|
|
|
251
565
|
headers?: Record<string, string>;
|
|
252
566
|
/** fetch credentials mode. Default: "same-origin" */
|
|
253
567
|
credentials?: RequestCredentials;
|
|
568
|
+
/** HTTP cache policy, independent of the query cache used by the UI. */
|
|
569
|
+
cache?: RequestCache;
|
|
570
|
+
/** Bypass intermediary GET caches. Defaults to true; disable for cacheable public data. */
|
|
571
|
+
cacheBust?: boolean;
|
|
254
572
|
/** Custom fetch implementation */
|
|
255
573
|
fetch?: typeof fetch;
|
|
256
574
|
}
|
|
@@ -275,9 +593,9 @@ interface ResponseMeta<T> {
|
|
|
275
593
|
declare class ApiError extends Error {
|
|
276
594
|
readonly status: number;
|
|
277
595
|
readonly code?: string | undefined;
|
|
278
|
-
readonly data?: unknown
|
|
596
|
+
readonly data?: unknown;
|
|
279
597
|
readonly response?: Response | undefined;
|
|
280
|
-
constructor(message: string, status: number, code?: string | undefined, data?: unknown
|
|
598
|
+
constructor(message: string, status: number, code?: string | undefined, data?: unknown, response?: Response | undefined);
|
|
281
599
|
}
|
|
282
600
|
type AuthInput = Pick<ApiClientOptions, "bearerToken" | "authorization"> | null;
|
|
283
601
|
declare class ApiClient {
|
|
@@ -305,6 +623,47 @@ declare class ApiClient {
|
|
|
305
623
|
};
|
|
306
624
|
}
|
|
307
625
|
//#endregion
|
|
626
|
+
//#region src/endpoints/lp/certificates.d.ts
|
|
627
|
+
interface LpCertificateItem {
|
|
628
|
+
cert_id: number;
|
|
629
|
+
user_id: number;
|
|
630
|
+
course_id: number;
|
|
631
|
+
}
|
|
632
|
+
interface LpCertificateProfileResponse {
|
|
633
|
+
status: string;
|
|
634
|
+
message?: string;
|
|
635
|
+
data?: {
|
|
636
|
+
certKey: string[];
|
|
637
|
+
template?: string;
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
interface LpCertificatePurchaseResponse {
|
|
641
|
+
status: string;
|
|
642
|
+
message?: string;
|
|
643
|
+
data?: {
|
|
644
|
+
redirect: string;
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
interface LpCertificateProfileQuery {
|
|
648
|
+
userID?: number;
|
|
649
|
+
page?: number;
|
|
650
|
+
}
|
|
651
|
+
interface LpCertificateInfo {
|
|
652
|
+
enable: number;
|
|
653
|
+
image?: string;
|
|
654
|
+
title?: string;
|
|
655
|
+
description?: string;
|
|
656
|
+
}
|
|
657
|
+
declare const createCertificates: (client: ApiClient) => {
|
|
658
|
+
/** GET /lp/v1/certificate/items-profile */
|
|
659
|
+
getProfileItems(query?: LpCertificateProfileQuery): Promise<LpCertificateProfileResponse>;
|
|
660
|
+
/** POST /lp/v1/certificate/purchase */
|
|
661
|
+
purchase(input: {
|
|
662
|
+
lp_cert_id: number;
|
|
663
|
+
lp_course_id_of_cert: number;
|
|
664
|
+
}): Promise<LpCertificatePurchaseResponse>;
|
|
665
|
+
};
|
|
666
|
+
//#endregion
|
|
308
667
|
//#region src/types/common.d.ts
|
|
309
668
|
interface Rendered {
|
|
310
669
|
rendered: string;
|
|
@@ -369,6 +728,7 @@ interface WpUser {
|
|
|
369
728
|
slug: string;
|
|
370
729
|
avatar_urls: Record<string, string>;
|
|
371
730
|
meta?: Record<string, unknown>;
|
|
731
|
+
cover_image_url?: string;
|
|
372
732
|
}
|
|
373
733
|
interface WpMedia extends WpPost {
|
|
374
734
|
alt_text: string;
|
|
@@ -468,6 +828,8 @@ interface WpPagesQuery extends PaginatedQuery {
|
|
|
468
828
|
//#region src/endpoints/wp/users.d.ts
|
|
469
829
|
interface WpUsersQuery extends PaginatedQuery {
|
|
470
830
|
slug?: string | string[];
|
|
831
|
+
roles?: string | string[];
|
|
832
|
+
who?: string;
|
|
471
833
|
}
|
|
472
834
|
//#endregion
|
|
473
835
|
//#region src/endpoints/wp/media.d.ts
|
|
@@ -654,12 +1016,52 @@ declare const createApi: (options: CreateApiOptions) => {
|
|
|
654
1016
|
};
|
|
655
1017
|
};
|
|
656
1018
|
lp: {
|
|
1019
|
+
assignments: {
|
|
1020
|
+
list(query?: LpItemQuery): Promise<LpAssignment[]>;
|
|
1021
|
+
get(id: number): Promise<LpAssignment>;
|
|
1022
|
+
getBySlug(slug: string): Promise<LpAssignment | undefined>;
|
|
1023
|
+
start(input: {
|
|
1024
|
+
id: number;
|
|
1025
|
+
}): Promise<{
|
|
1026
|
+
message: string;
|
|
1027
|
+
}>;
|
|
1028
|
+
submit(input: {
|
|
1029
|
+
id: number;
|
|
1030
|
+
note?: string;
|
|
1031
|
+
}): Promise<{
|
|
1032
|
+
message: string;
|
|
1033
|
+
}>;
|
|
1034
|
+
retake(input: {
|
|
1035
|
+
id: number;
|
|
1036
|
+
}): Promise<{
|
|
1037
|
+
message: string;
|
|
1038
|
+
}>;
|
|
1039
|
+
deleteFile(input: {
|
|
1040
|
+
id: number;
|
|
1041
|
+
file: string;
|
|
1042
|
+
}): Promise<{
|
|
1043
|
+
message: string;
|
|
1044
|
+
}>;
|
|
1045
|
+
};
|
|
657
1046
|
auth: {
|
|
658
1047
|
login(input: LpLoginInput): Promise<LpTokenResponse>;
|
|
659
1048
|
validate(): Promise<LpValidateResponse>;
|
|
660
1049
|
register(input: LpRegisterInput): Promise<LpTokenResponse>;
|
|
661
1050
|
logout(): void;
|
|
662
1051
|
};
|
|
1052
|
+
certificates: {
|
|
1053
|
+
getProfileItems(query?: LpCertificateProfileQuery): Promise<LpCertificateProfileResponse>;
|
|
1054
|
+
purchase(input: {
|
|
1055
|
+
lp_cert_id: number;
|
|
1056
|
+
lp_course_id_of_cert: number;
|
|
1057
|
+
}): Promise<LpCertificatePurchaseResponse>;
|
|
1058
|
+
};
|
|
1059
|
+
checkout: {
|
|
1060
|
+
listPaymentMethods(): Promise<LpPaymentMethod[]>;
|
|
1061
|
+
create(input: LpCheckoutInput): Promise<LpCheckoutResponse>;
|
|
1062
|
+
paypalCreateOrder(input: LpPaypalCreateOrderInput): Promise<LpPaypalCreateOrderResponse>;
|
|
1063
|
+
paypalCapture(input: LpPaypalCaptureInput): Promise<LpPaypalCaptureResponse>;
|
|
1064
|
+
};
|
|
663
1065
|
courseCategories: {
|
|
664
1066
|
list(query?: LpTermsQuery): Promise<LpCourseCategory[]>;
|
|
665
1067
|
listWithMeta(query?: LpTermsQuery): Promise<ResponseMeta<LpCourseCategory[]>>;
|
|
@@ -699,24 +1101,159 @@ declare const createApi: (options: CreateApiOptions) => {
|
|
|
699
1101
|
checkAnswer(input: {
|
|
700
1102
|
id: number;
|
|
701
1103
|
question_id: number;
|
|
702
|
-
answered:
|
|
703
|
-
}): Promise<
|
|
1104
|
+
answered: string | string[] | Record<string, string>;
|
|
1105
|
+
}): Promise<LpQuizCheckAnswerResponse>;
|
|
704
1106
|
finish(input: {
|
|
705
1107
|
id: number;
|
|
1108
|
+
answered?: LpQuizAnswerInput;
|
|
1109
|
+
time_spend?: number;
|
|
706
1110
|
}): Promise<LpCourseActionResponse>;
|
|
707
1111
|
};
|
|
1112
|
+
reviews: {
|
|
1113
|
+
getCourseReviews(courseId: number): Promise<LpCourseReviewData>;
|
|
1114
|
+
submit(params: LpReviewSubmitParams): Promise<{
|
|
1115
|
+
status: string;
|
|
1116
|
+
message: string;
|
|
1117
|
+
}>;
|
|
1118
|
+
};
|
|
1119
|
+
settings: {
|
|
1120
|
+
get(): Promise<LpSettings>;
|
|
1121
|
+
};
|
|
1122
|
+
users: {
|
|
1123
|
+
get(id: number, query?: {
|
|
1124
|
+
context?: "view" | "edit";
|
|
1125
|
+
}): Promise<LpUserProfile>;
|
|
1126
|
+
update(id: number, data: LpUserUpdateInput): Promise<{
|
|
1127
|
+
status: string;
|
|
1128
|
+
message: string;
|
|
1129
|
+
data?: LpUserProfile;
|
|
1130
|
+
}>;
|
|
1131
|
+
changePassword(data: LpChangePasswordInput): Promise<{
|
|
1132
|
+
code?: string;
|
|
1133
|
+
message: string;
|
|
1134
|
+
}>;
|
|
1135
|
+
uploadAvatar(dataUrl: string): Promise<{
|
|
1136
|
+
status: string;
|
|
1137
|
+
message: string;
|
|
1138
|
+
}>;
|
|
1139
|
+
removeAvatar(): Promise<{
|
|
1140
|
+
status: string;
|
|
1141
|
+
message: string;
|
|
1142
|
+
}>;
|
|
1143
|
+
uploadCoverImage(file: File): Promise<{
|
|
1144
|
+
status: string;
|
|
1145
|
+
message: string;
|
|
1146
|
+
data?: {
|
|
1147
|
+
url?: string;
|
|
1148
|
+
};
|
|
1149
|
+
}>;
|
|
1150
|
+
removeCoverImage(): Promise<{
|
|
1151
|
+
status: string;
|
|
1152
|
+
message: string;
|
|
1153
|
+
}>;
|
|
1154
|
+
instructorStatistic(userId: number): Promise<LpInstructorStatistic>;
|
|
1155
|
+
};
|
|
1156
|
+
wishlist: {
|
|
1157
|
+
list(): Promise<LpWishlistResponse>;
|
|
1158
|
+
getCourseStatus(id: number): Promise<LpWishlistResponse>;
|
|
1159
|
+
toggle(input: LpCourseIdInput): Promise<LpWishlistResponse>;
|
|
1160
|
+
};
|
|
708
1161
|
};
|
|
709
1162
|
};
|
|
710
1163
|
type Api = ReturnType<typeof createApi>;
|
|
711
1164
|
//#endregion
|
|
1165
|
+
//#region src/endpoints/lp/reviews.d.ts
|
|
1166
|
+
interface LpReviewItem {
|
|
1167
|
+
comment_id: string;
|
|
1168
|
+
display_name: string;
|
|
1169
|
+
user_email?: string;
|
|
1170
|
+
rate: string;
|
|
1171
|
+
title: string;
|
|
1172
|
+
content: string;
|
|
1173
|
+
comment_date_gmt: string;
|
|
1174
|
+
}
|
|
1175
|
+
interface LpRatingStar {
|
|
1176
|
+
rated: number;
|
|
1177
|
+
total: number;
|
|
1178
|
+
percent: number;
|
|
1179
|
+
percent_float: number;
|
|
1180
|
+
}
|
|
1181
|
+
interface LpCourseReviewData {
|
|
1182
|
+
rated: number;
|
|
1183
|
+
total: number;
|
|
1184
|
+
items: Record<string, LpRatingStar>;
|
|
1185
|
+
reviews: {
|
|
1186
|
+
reviews: LpReviewItem[];
|
|
1187
|
+
paged: number;
|
|
1188
|
+
total: number;
|
|
1189
|
+
per_page: number;
|
|
1190
|
+
};
|
|
1191
|
+
can_review: boolean;
|
|
1192
|
+
}
|
|
1193
|
+
interface LpReviewSubmitParams {
|
|
1194
|
+
id: number;
|
|
1195
|
+
rate: number;
|
|
1196
|
+
title: string;
|
|
1197
|
+
content: string;
|
|
1198
|
+
}
|
|
1199
|
+
declare const createReviews: (client: ApiClient) => {
|
|
1200
|
+
/** GET /learnpress/v1/review/course/{courseId} */
|
|
1201
|
+
getCourseReviews(courseId: number): Promise<LpCourseReviewData>;
|
|
1202
|
+
/** POST /learnpress/v1/review/submit */
|
|
1203
|
+
submit(params: LpReviewSubmitParams): Promise<{
|
|
1204
|
+
status: string;
|
|
1205
|
+
message: string;
|
|
1206
|
+
}>;
|
|
1207
|
+
};
|
|
1208
|
+
//#endregion
|
|
712
1209
|
//#region src/endpoints/lp/index.d.ts
|
|
713
1210
|
declare const createLpApi: (client: ApiClient) => {
|
|
1211
|
+
assignments: {
|
|
1212
|
+
list(query?: LpItemQuery): Promise<LpAssignment[]>;
|
|
1213
|
+
get(id: number): Promise<LpAssignment>;
|
|
1214
|
+
getBySlug(slug: string): Promise<LpAssignment | undefined>;
|
|
1215
|
+
start(input: {
|
|
1216
|
+
id: number;
|
|
1217
|
+
}): Promise<{
|
|
1218
|
+
message: string;
|
|
1219
|
+
}>;
|
|
1220
|
+
submit(input: {
|
|
1221
|
+
id: number;
|
|
1222
|
+
note?: string;
|
|
1223
|
+
}): Promise<{
|
|
1224
|
+
message: string;
|
|
1225
|
+
}>;
|
|
1226
|
+
retake(input: {
|
|
1227
|
+
id: number;
|
|
1228
|
+
}): Promise<{
|
|
1229
|
+
message: string;
|
|
1230
|
+
}>;
|
|
1231
|
+
deleteFile(input: {
|
|
1232
|
+
id: number;
|
|
1233
|
+
file: string;
|
|
1234
|
+
}): Promise<{
|
|
1235
|
+
message: string;
|
|
1236
|
+
}>;
|
|
1237
|
+
};
|
|
714
1238
|
auth: {
|
|
715
1239
|
login(input: LpLoginInput): Promise<LpTokenResponse>;
|
|
716
1240
|
validate(): Promise<LpValidateResponse>;
|
|
717
1241
|
register(input: LpRegisterInput): Promise<LpTokenResponse>;
|
|
718
1242
|
logout(): void;
|
|
719
1243
|
};
|
|
1244
|
+
certificates: {
|
|
1245
|
+
getProfileItems(query?: LpCertificateProfileQuery): Promise<LpCertificateProfileResponse>;
|
|
1246
|
+
purchase(input: {
|
|
1247
|
+
lp_cert_id: number;
|
|
1248
|
+
lp_course_id_of_cert: number;
|
|
1249
|
+
}): Promise<LpCertificatePurchaseResponse>;
|
|
1250
|
+
};
|
|
1251
|
+
checkout: {
|
|
1252
|
+
listPaymentMethods(): Promise<LpPaymentMethod[]>;
|
|
1253
|
+
create(input: LpCheckoutInput): Promise<LpCheckoutResponse>;
|
|
1254
|
+
paypalCreateOrder(input: LpPaypalCreateOrderInput): Promise<LpPaypalCreateOrderResponse>;
|
|
1255
|
+
paypalCapture(input: LpPaypalCaptureInput): Promise<LpPaypalCaptureResponse>;
|
|
1256
|
+
};
|
|
720
1257
|
courseCategories: {
|
|
721
1258
|
list(query?: LpTermsQuery): Promise<LpCourseCategory[]>;
|
|
722
1259
|
listWithMeta(query?: LpTermsQuery): Promise<ResponseMeta<LpCourseCategory[]>>;
|
|
@@ -756,14 +1293,65 @@ declare const createLpApi: (client: ApiClient) => {
|
|
|
756
1293
|
checkAnswer(input: {
|
|
757
1294
|
id: number;
|
|
758
1295
|
question_id: number;
|
|
759
|
-
answered:
|
|
760
|
-
}): Promise<
|
|
1296
|
+
answered: string | string[] | Record<string, string>;
|
|
1297
|
+
}): Promise<LpQuizCheckAnswerResponse>;
|
|
761
1298
|
finish(input: {
|
|
762
1299
|
id: number;
|
|
1300
|
+
answered?: LpQuizAnswerInput;
|
|
1301
|
+
time_spend?: number;
|
|
763
1302
|
}): Promise<LpCourseActionResponse>;
|
|
764
1303
|
};
|
|
1304
|
+
reviews: {
|
|
1305
|
+
getCourseReviews(courseId: number): Promise<LpCourseReviewData>;
|
|
1306
|
+
submit(params: LpReviewSubmitParams): Promise<{
|
|
1307
|
+
status: string;
|
|
1308
|
+
message: string;
|
|
1309
|
+
}>;
|
|
1310
|
+
};
|
|
1311
|
+
settings: {
|
|
1312
|
+
get(): Promise<LpSettings>;
|
|
1313
|
+
};
|
|
1314
|
+
users: {
|
|
1315
|
+
get(id: number, query?: {
|
|
1316
|
+
context?: "view" | "edit";
|
|
1317
|
+
}): Promise<LpUserProfile>;
|
|
1318
|
+
update(id: number, data: LpUserUpdateInput): Promise<{
|
|
1319
|
+
status: string;
|
|
1320
|
+
message: string;
|
|
1321
|
+
data?: LpUserProfile;
|
|
1322
|
+
}>;
|
|
1323
|
+
changePassword(data: LpChangePasswordInput): Promise<{
|
|
1324
|
+
code?: string;
|
|
1325
|
+
message: string;
|
|
1326
|
+
}>;
|
|
1327
|
+
uploadAvatar(dataUrl: string): Promise<{
|
|
1328
|
+
status: string;
|
|
1329
|
+
message: string;
|
|
1330
|
+
}>;
|
|
1331
|
+
removeAvatar(): Promise<{
|
|
1332
|
+
status: string;
|
|
1333
|
+
message: string;
|
|
1334
|
+
}>;
|
|
1335
|
+
uploadCoverImage(file: File): Promise<{
|
|
1336
|
+
status: string;
|
|
1337
|
+
message: string;
|
|
1338
|
+
data?: {
|
|
1339
|
+
url?: string;
|
|
1340
|
+
};
|
|
1341
|
+
}>;
|
|
1342
|
+
removeCoverImage(): Promise<{
|
|
1343
|
+
status: string;
|
|
1344
|
+
message: string;
|
|
1345
|
+
}>;
|
|
1346
|
+
instructorStatistic(userId: number): Promise<LpInstructorStatistic>;
|
|
1347
|
+
};
|
|
1348
|
+
wishlist: {
|
|
1349
|
+
list(): Promise<LpWishlistResponse>;
|
|
1350
|
+
getCourseStatus(id: number): Promise<LpWishlistResponse>;
|
|
1351
|
+
toggle(input: LpCourseIdInput): Promise<LpWishlistResponse>;
|
|
1352
|
+
};
|
|
765
1353
|
};
|
|
766
1354
|
type LpApi = ReturnType<typeof createLpApi>;
|
|
767
1355
|
//#endregion
|
|
768
|
-
export {
|
|
769
|
-
//# sourceMappingURL=index-
|
|
1356
|
+
export { LpCourseIdInput as $, LpCertificatePurchaseResponse as A, LpQuizUserResults as At, LpAssignedCourse as B, LpUserProfile as Bt, ID as C, LpQuiz as Ct, LpCertificateItem as D, LpQuizQuestion as Dt, LpCertificateInfo as E, LpQuizFibAnswerEntry as Et, AuthInput as F, LpTerm as Ft, LpAssignmentEvaluationFile as G, LpWishlistResponse as Gt, LpAssignmentAnswer as H, LpUserUpdateInput as Ht, QueryParams as I, LpTermsQuery as It, LpCheckoutInput as J, LpAssignmentResults as K, RequestOptions as L, LpThumbnailDimensions as Lt, ApiClient as M, LpSection as Mt, ApiClientOptions as N, LpSectionItem as Nt, LpCertificateProfileQuery as O, LpQuizQuestionOption as Ot, ApiError as P, LpSettings as Pt, LpCourseCategory as Q, ResponseMeta as R, LpTokenResponse as Rt, WpUser as S, LpPaypalCreateOrderResponse as St, Rendered as T, LpQuizCheckAnswerResponse as Tt, LpAssignmentDuration as U, LpValidateResponse as Ut, LpAssignment as V, LpUserSocial as Vt, LpAssignmentEvaluation as W, LpWishlistData as Wt, LpCourse as X, LpCheckoutResponse as Y, LpCourseActionResponse as Z, WpMenuItem as _, LpPaymentMethod as _t, LpReviewItem as a, LpCurrencySettings as at, WpSearchResult as b, LpPaypalCaptureResponse as bt, Api as c, LpItemGraduation as ct, WpApi as d, LpItemType as dt, LpCourseResult as et, createWpApi as f, LpLesson as ft, WpMenu as g, LpOrderSummary as gt, WpMedia as h, LpOrderItem as ht, LpRatingStar as i, LpCoursesQuery as it, createCertificates as j, LpRegisterInput as jt, LpCertificateProfileResponse as k, LpQuizResultScore as kt, CreateApiOptions as l, LpItemQuery as lt, WpEmbeddedTerm as m, LpLoginInput as mt, createLpApi as n, LpCourseSettings as nt, LpReviewSubmitParams as o, LpInstructor as ot, WpComment as p, LpLessonResults as pt, LpChangePasswordInput as q, LpCourseReviewData as r, LpCourseUserData as rt, createReviews as s, LpInstructorStatistic as st, LpApi as t, LpCourseResultItem as tt, createApi as u, LpItemStatus as ut, WpPage as v, LpPaymentMethodConfig as vt, PaginatedQuery as w, LpQuizAnswerInput as wt, WpTerm as x, LpPaypalCreateOrderInput as xt, WpPost as y, LpPaypalCaptureInput as yt, LpAssigned as z, LpUserOrderEntry as zt };
|
|
1357
|
+
//# sourceMappingURL=index-BUuPlRZk.d.ts.map
|