@selfcommunity/api-services 0.6.7-alpha.3 → 0.6.7-payments.144
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/lib/cjs/client/index.d.ts +3 -3
- package/lib/cjs/client/index.js +3 -3
- package/lib/cjs/constants/Endpoints.js +198 -0
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +8 -1
- package/lib/cjs/services/course/index.d.ts +449 -0
- package/lib/cjs/services/course/index.js +643 -0
- package/lib/cjs/services/payment/index.d.ts +117 -0
- package/lib/cjs/services/payment/index.js +120 -0
- package/lib/cjs/services/suggestion/index.d.ts +9 -1
- package/lib/cjs/services/suggestion/index.js +13 -0
- package/lib/cjs/services/user/index.d.ts +19 -0
- package/lib/cjs/services/user/index.js +29 -0
- package/lib/cjs/types/course.d.ts +123 -0
- package/lib/cjs/types/course.js +12 -0
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.js +3 -1
- package/lib/cjs/types/payment.d.ts +39 -0
- package/lib/cjs/types/payment.js +2 -0
- package/lib/esm/client/index.d.ts +3 -3
- package/lib/esm/client/index.js +3 -3
- package/lib/esm/constants/Endpoints.js +198 -0
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +4 -2
- package/lib/esm/services/course/index.d.ts +449 -0
- package/lib/esm/services/course/index.js +638 -0
- package/lib/esm/services/payment/index.d.ts +117 -0
- package/lib/esm/services/payment/index.js +115 -0
- package/lib/esm/services/suggestion/index.d.ts +9 -1
- package/lib/esm/services/suggestion/index.js +13 -0
- package/lib/esm/services/user/index.d.ts +19 -0
- package/lib/esm/services/user/index.js +29 -0
- package/lib/esm/types/course.d.ts +123 -0
- package/lib/esm/types/course.js +9 -0
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/esm/types/index.js +2 -1
- package/lib/esm/types/payment.d.ts +39 -0
- package/lib/esm/types/payment.js +1 -0
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CourseApiClient = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Endpoints_1 = tslib_1.__importDefault(require("../../constants/Endpoints"));
|
|
6
|
+
const apiRequest_1 = require("../../utils/apiRequest");
|
|
7
|
+
const url_1 = require("../../utils/url");
|
|
8
|
+
/**
|
|
9
|
+
* Contains all the endpoints needed to manage events.
|
|
10
|
+
*/
|
|
11
|
+
class CourseApiClient {
|
|
12
|
+
/**
|
|
13
|
+
* This endpoint allows user managers to change the role of some users in the specified course.
|
|
14
|
+
* @param _id
|
|
15
|
+
* @param data
|
|
16
|
+
* @param config
|
|
17
|
+
*/
|
|
18
|
+
static changeCourseUserRole(id, data, config) {
|
|
19
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.ChangeCourseUserRole.url({ id }), method: Endpoints_1.default.ChangeCourseUserRole.method, data }));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* This endpoint retrieves all the events of the logged-in user.
|
|
23
|
+
* @param params
|
|
24
|
+
* @param config
|
|
25
|
+
*/
|
|
26
|
+
static getJoinedCourses(params, config) {
|
|
27
|
+
const p = (0, url_1.urlParams)(params);
|
|
28
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetJoinedCourses.url({})}?${p.toString()}`, method: Endpoints_1.default.GetJoinedCourses.method }));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* This endpoint retrieves a specific course.
|
|
32
|
+
* @param id
|
|
33
|
+
* @param config
|
|
34
|
+
*/
|
|
35
|
+
static getUserJoinedCourses(id, config) {
|
|
36
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetUserJoinedCourses.url({ id }), method: Endpoints_1.default.GetUserJoinedCourses.method }));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* This endpoint performs events search
|
|
40
|
+
* @param params
|
|
41
|
+
* @param config
|
|
42
|
+
*/
|
|
43
|
+
static searchCourses(params, config) {
|
|
44
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: Endpoints_1.default.SearchCourses.url({}), method: Endpoints_1.default.SearchCourses.method }));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* This endpoint retrieves a specific course.
|
|
48
|
+
* @param id
|
|
49
|
+
* @param params
|
|
50
|
+
* @param config
|
|
51
|
+
*/
|
|
52
|
+
static getSpecificCourseInfo(id, params, config) {
|
|
53
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: Endpoints_1.default.GetCourseInfo.url({ id }), method: Endpoints_1.default.GetCourseInfo.method }));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* This endpoint retrieves the list of all users that joined the course identified by Id
|
|
57
|
+
* it will also return some useful stats that can be used to make a course dashboard.
|
|
58
|
+
* @param id
|
|
59
|
+
* @param params
|
|
60
|
+
* @param config
|
|
61
|
+
*/
|
|
62
|
+
static getCourseDashboardUsers(id, params, config) {
|
|
63
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: Endpoints_1.default.GetCourseDashboardUsers.url({ id }), method: Endpoints_1.default.GetCourseDashboardUsers.method }));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* This endpoint creates a course.
|
|
67
|
+
* @param data
|
|
68
|
+
* @param config
|
|
69
|
+
*/
|
|
70
|
+
static createCourse(data, config) {
|
|
71
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CreateCourse.url({}), method: Endpoints_1.default.CreateCourse.method, data }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* This endpoint updates a course.
|
|
75
|
+
* @param id
|
|
76
|
+
* @param data
|
|
77
|
+
* @param config
|
|
78
|
+
*/
|
|
79
|
+
static updateCourse(id, data, config) {
|
|
80
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.UpdateCourse.url({ id }), method: Endpoints_1.default.UpdateCourse.method, data }));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* This endpoint patches a course.
|
|
84
|
+
* @param id
|
|
85
|
+
* @param data
|
|
86
|
+
* @param config
|
|
87
|
+
*/
|
|
88
|
+
static patchCourse(id, data, config) {
|
|
89
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.PatchCourse.url({ id }), method: Endpoints_1.default.PatchCourse.method, data }));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* This endpoint deletes a course.
|
|
93
|
+
* @param id
|
|
94
|
+
* @param config
|
|
95
|
+
*/
|
|
96
|
+
static deleteCourse(id, config) {
|
|
97
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.DeleteCourse.url({ id }), method: Endpoints_1.default.DeleteCourse.method }));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* This endpoint retrieves a specific course comment.
|
|
101
|
+
* @param id
|
|
102
|
+
* @param section_id
|
|
103
|
+
* @param lesson_id
|
|
104
|
+
* @param comment_id
|
|
105
|
+
* @param config
|
|
106
|
+
*/
|
|
107
|
+
static getCourseLessonComment(id, section_id, lesson_id, comment_id, config) {
|
|
108
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCourseLessonComment.url({ id, section_id, lesson_id, comment_id }), method: Endpoints_1.default.GetCourseLessonComment.method }));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* This endpoint retrieves the course comments.
|
|
112
|
+
* @param id
|
|
113
|
+
* @param params
|
|
114
|
+
* @param config
|
|
115
|
+
*/
|
|
116
|
+
static getCourseComments(id, params, config) {
|
|
117
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCourseComments.url({ id }), method: Endpoints_1.default.GetCourseComments.method, params }));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* This endpoint creates a course comment.
|
|
121
|
+
* @param id
|
|
122
|
+
* @param section_id
|
|
123
|
+
* @param lesson_id
|
|
124
|
+
* @param data
|
|
125
|
+
* @param config
|
|
126
|
+
*/
|
|
127
|
+
static createCourseComment(id, section_id, lesson_id, data, config) {
|
|
128
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CreateCourseComment.url({ id, section_id, lesson_id }), method: Endpoints_1.default.CreateCourseComment.method, data }));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* This endpoint updates a course comment.
|
|
132
|
+
* @param id
|
|
133
|
+
* @param section_id
|
|
134
|
+
* @param lesson_id
|
|
135
|
+
* @param comment_id
|
|
136
|
+
* @param data
|
|
137
|
+
* @param config
|
|
138
|
+
*/
|
|
139
|
+
static updateCourseComment(id, section_id, lesson_id, comment_id, data, config) {
|
|
140
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.UpdateCourseComment.url({ id, section_id, lesson_id, comment_id }), method: Endpoints_1.default.UpdateCourseComment.method, data }));
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* This endpoint patches a course comment.
|
|
144
|
+
* @param id
|
|
145
|
+
* @param section_id
|
|
146
|
+
* @param lesson_id
|
|
147
|
+
* @param comment_id
|
|
148
|
+
* @param data
|
|
149
|
+
* @param config
|
|
150
|
+
*/
|
|
151
|
+
static patchCourseComment(id, section_id, lesson_id, comment_id, data, config) {
|
|
152
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.PatchCourseComment.url({ id, section_id, lesson_id, comment_id }), method: Endpoints_1.default.PatchCourseComment.method, data }));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* This endpoint deletes a course comment.
|
|
156
|
+
* @param id
|
|
157
|
+
* @param section_id
|
|
158
|
+
* @param lesson_id
|
|
159
|
+
* @param comment_id
|
|
160
|
+
* @param config
|
|
161
|
+
*/
|
|
162
|
+
static deleteCourseComment(id, section_id, lesson_id, comment_id, config) {
|
|
163
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.DeleteCourseComment.url({ id, section_id, lesson_id, comment_id }), method: Endpoints_1.default.DeleteCourseComment.method }));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* This endpoint retrieves a specific course section.
|
|
167
|
+
* @param id
|
|
168
|
+
* @param section_id
|
|
169
|
+
* @param config
|
|
170
|
+
*/
|
|
171
|
+
static getCourseSection(id, section_id, config) {
|
|
172
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCourseSection.url({ id, section_id }), method: Endpoints_1.default.GetCourseSection.method }));
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* This endpoint retrieves the course sections.
|
|
176
|
+
* @param id
|
|
177
|
+
* @param config
|
|
178
|
+
*/
|
|
179
|
+
static getCourseSections(id, config) {
|
|
180
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCourseSections.url({ id }), method: Endpoints_1.default.GetCourseSections.method }));
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* This endpoint creates a course section.
|
|
184
|
+
* @param data
|
|
185
|
+
* @param config
|
|
186
|
+
*/
|
|
187
|
+
static createCourseSection(id, data, config) {
|
|
188
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CreateCourseSection.url({ id }), method: Endpoints_1.default.CreateCourseSection.method, data }));
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* This endpoint updates a course section.
|
|
192
|
+
* @param id
|
|
193
|
+
* @param section_id
|
|
194
|
+
* @param data
|
|
195
|
+
* @param config
|
|
196
|
+
*/
|
|
197
|
+
static updateCourseSection(id, section_id, data, config) {
|
|
198
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.UpdateCourseSection.url({ id, section_id }), method: Endpoints_1.default.UpdateCourseSection.method, data }));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* This endpoint patches a course section.
|
|
202
|
+
* @param id
|
|
203
|
+
* @param section_id
|
|
204
|
+
* @param data
|
|
205
|
+
* @param config
|
|
206
|
+
*/
|
|
207
|
+
static patchCourseSection(id, section_id, data, config) {
|
|
208
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.PatchCourseSection.url({ id, section_id }), method: Endpoints_1.default.PatchCourseSection.method, data }));
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* This endpoint deletes a course section.
|
|
212
|
+
* @param id
|
|
213
|
+
* @param section_id
|
|
214
|
+
* @param config
|
|
215
|
+
*/
|
|
216
|
+
static deleteCourseSection(id, section_id, config) {
|
|
217
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.DeleteCourseSection.url({ id, section_id }), method: Endpoints_1.default.DeleteCourseSection.method }));
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* This endpoint retrieves a specific course lesson.
|
|
221
|
+
* @param id
|
|
222
|
+
* @param section_id
|
|
223
|
+
* @param lesson_id
|
|
224
|
+
* @param config
|
|
225
|
+
*/
|
|
226
|
+
static getCourseLesson(id, section_id, lesson_id, config) {
|
|
227
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCourseLesson.url({ id, section_id, lesson_id }), method: Endpoints_1.default.GetCourseLesson.method }));
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* This endpoint retrieves the comments for a specific course lesson.
|
|
231
|
+
* @param id
|
|
232
|
+
* @param section_id
|
|
233
|
+
* @param lesson_id
|
|
234
|
+
* @param params
|
|
235
|
+
* @param config
|
|
236
|
+
*/
|
|
237
|
+
static getCourseLessonComments(id, section_id, lesson_id, params, config) {
|
|
238
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCourseLessonComments.url({ id, section_id, lesson_id }), method: Endpoints_1.default.GetCourseLessonComments.method, params }));
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* This endpoint retrieves the course lessons.
|
|
242
|
+
* @param id
|
|
243
|
+
* @param section_id
|
|
244
|
+
* @param config
|
|
245
|
+
*/
|
|
246
|
+
static getCourseLessons(id, section_id, config) {
|
|
247
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCourseLessons.url({ id, section_id }), method: Endpoints_1.default.GetCourseLessons.method }));
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* This endpoint creates a course lesson.
|
|
251
|
+
* @param data
|
|
252
|
+
* @param config
|
|
253
|
+
*/
|
|
254
|
+
static createCourseLesson(data, config) {
|
|
255
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CreateCourseLesson.url({}), method: Endpoints_1.default.CreateCourseLesson.method, data }));
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* This endpoint updates a course lesson.
|
|
259
|
+
* @param id
|
|
260
|
+
* @param section_id
|
|
261
|
+
* @param lesson_id
|
|
262
|
+
* @param data
|
|
263
|
+
* @param config
|
|
264
|
+
*/
|
|
265
|
+
static updateCourseLesson(id, section_id, lesson_id, data, config) {
|
|
266
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.UpdateCourseLesson.url({ id, section_id, lesson_id }), method: Endpoints_1.default.UpdateCourseLesson.method, data }));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* This endpoint patches a course lesson.
|
|
270
|
+
* @param id
|
|
271
|
+
* @param section_id
|
|
272
|
+
* @param lesson_id
|
|
273
|
+
* @param data
|
|
274
|
+
* @param config
|
|
275
|
+
*/
|
|
276
|
+
static patchCourseLesson(id, section_id, lesson_id, data, config) {
|
|
277
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.PatchCourseLesson.url({ id, section_id, lesson_id }), method: Endpoints_1.default.PatchCourseLesson.method, data }));
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* This endpoint deletes a course lesson.
|
|
281
|
+
* @param id
|
|
282
|
+
* @param section_id
|
|
283
|
+
* @param lesson_id
|
|
284
|
+
* @param config
|
|
285
|
+
*/
|
|
286
|
+
static deleteCourseLesson(id, section_id, lesson_id, config) {
|
|
287
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.DeleteCourseLesson.url({ id, section_id, lesson_id }), method: Endpoints_1.default.DeleteCourseLesson.method }));
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* This endpoint marks a course lesson as complete.
|
|
291
|
+
* @param id
|
|
292
|
+
* @param section_id
|
|
293
|
+
* @param lesson_id
|
|
294
|
+
* @param config
|
|
295
|
+
*/
|
|
296
|
+
static markLessonComplete(id, section_id, lesson_id, config) {
|
|
297
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.MarkLessonComplete.url({ id, section_id, lesson_id }), method: Endpoints_1.default.MarkLessonComplete.method }));
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* This endpoint marks a course lesson as incomplete.
|
|
301
|
+
* @param id
|
|
302
|
+
* @param section_id
|
|
303
|
+
* @param lesson_id
|
|
304
|
+
* @param config
|
|
305
|
+
*/
|
|
306
|
+
static markLessonIncomplete(id, section_id, lesson_id, config) {
|
|
307
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.MarkLessonIncomplete.url({ id, section_id, lesson_id }), method: Endpoints_1.default.MarkLessonIncomplete.method }));
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* This endpoint changes the course avatar
|
|
311
|
+
* @param id
|
|
312
|
+
* @param data
|
|
313
|
+
* @param config
|
|
314
|
+
*/
|
|
315
|
+
static changeCourseCover(id, data, config) {
|
|
316
|
+
return (0, apiRequest_1.apiRequest)(Object.assign({ url: Endpoints_1.default.PatchCourse.url({ id }), method: Endpoints_1.default.PatchCourse.method, data }, config));
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* This endpoint returns all waiting approval subscribers
|
|
320
|
+
* @param id
|
|
321
|
+
* @param params
|
|
322
|
+
* @param config
|
|
323
|
+
*/
|
|
324
|
+
static getCourseWaitingApproval(id, params, config) {
|
|
325
|
+
const p = (0, url_1.urlParams)(params);
|
|
326
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetCourseWaitingApproval.url({ id })}?${p.toString()}`, method: Endpoints_1.default.GetCourseWaitingApproval.method }));
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* This endpoint returns a list of suggested users to invite to the course.
|
|
330
|
+
* @param id
|
|
331
|
+
* @param search
|
|
332
|
+
* @param config
|
|
333
|
+
*/
|
|
334
|
+
static getCourseSuggestedUsers(id, search, config) {
|
|
335
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCourseSuggestedUsers.url({ id, search }), method: Endpoints_1.default.GetCourseSuggestedUsers.method }));
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* This endpoint returns a list of invited users.
|
|
339
|
+
* @param id
|
|
340
|
+
* @param params
|
|
341
|
+
* @param config
|
|
342
|
+
*/
|
|
343
|
+
static getCourseInvitedUsers(id, params, config) {
|
|
344
|
+
const p = (0, url_1.urlParams)(params);
|
|
345
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetCourseInvitedUsers.url({ id })}?${p.toString()}`, method: Endpoints_1.default.GetCourseInvitedUsers.method }));
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* This endpoint returns a list of joined users.
|
|
349
|
+
* @param id
|
|
350
|
+
* @param params
|
|
351
|
+
* @param config
|
|
352
|
+
*/
|
|
353
|
+
static getCourseJoinedUsers(id, params, config) {
|
|
354
|
+
const p = (0, url_1.urlParams)(params);
|
|
355
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetCourseJoinedUsers.url({ id })}?${p.toString()}`, method: Endpoints_1.default.GetCourseJoinedUsers.method }));
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* This endpoint subscribes to a course.
|
|
359
|
+
* @param id
|
|
360
|
+
* @param config
|
|
361
|
+
*/
|
|
362
|
+
static joinOrAcceptInviteToCourse(id, config) {
|
|
363
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.JoinOrAcceptInviteToCourse.url({ id }), method: Endpoints_1.default.JoinOrAcceptInviteToCourse.method }));
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* This endpoint unsubscribes from a course.
|
|
367
|
+
* @param id
|
|
368
|
+
* @param config
|
|
369
|
+
*/
|
|
370
|
+
static leaveOrRemoveCourseRequest(id, params, config) {
|
|
371
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.LeaveOrRemoveCourseRequest.url({ id }), method: Endpoints_1.default.LeaveOrRemoveCourseRequest.method, params }));
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* This endpoint allows to invite or accept a course invite.
|
|
375
|
+
* @param id
|
|
376
|
+
* @param data
|
|
377
|
+
* @param config
|
|
378
|
+
*/
|
|
379
|
+
static inviteOrAcceptUsersToCourse(id, data, config) {
|
|
380
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.InviteOrAcceptUsersToCourse.url({ id }), method: Endpoints_1.default.InviteOrAcceptUsersToCourse.method, data }));
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* This endpoint allows to remove invites.
|
|
384
|
+
* @param id
|
|
385
|
+
* @param data
|
|
386
|
+
* @param config
|
|
387
|
+
*/
|
|
388
|
+
static removeInvitationToCourse(id, data, config) {
|
|
389
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.RemoveInvitationToCourse.url({ id }), method: Endpoints_1.default.RemoveInvitationToCourse.method, data }));
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* This endpoint retrieves the course subscription status.
|
|
393
|
+
* @param id
|
|
394
|
+
* @param config
|
|
395
|
+
*/
|
|
396
|
+
static getCourseStatus(id, config) {
|
|
397
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCourseStatus.url({ id }), method: Endpoints_1.default.GetCourseStatus.method }));
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
exports.CourseApiClient = CourseApiClient;
|
|
401
|
+
/**
|
|
402
|
+
*
|
|
403
|
+
:::tip Incubator service can be used in the following way:
|
|
404
|
+
|
|
405
|
+
```jsx
|
|
406
|
+
1. Import the service from our library:
|
|
407
|
+
|
|
408
|
+
import {CourseService} from "@selfcommunity/api-services";
|
|
409
|
+
```
|
|
410
|
+
```jsx
|
|
411
|
+
2. Create a function and put the service inside it!
|
|
412
|
+
The async function `searchCourses` will return the events matching the search query.
|
|
413
|
+
|
|
414
|
+
async searchCourses() {
|
|
415
|
+
return await CourseService.searchCourses();
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
```jsx
|
|
419
|
+
In case of required `params`, just add them inside the brackets.
|
|
420
|
+
|
|
421
|
+
async getSpecificCourseInfo(eventId) {
|
|
422
|
+
return await CourseService.getSpecificCourseInfo(eventId);
|
|
423
|
+
}
|
|
424
|
+
```
|
|
425
|
+
```jsx
|
|
426
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
427
|
+
|
|
428
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
429
|
+
|
|
430
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
431
|
+
|
|
432
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
433
|
+
```
|
|
434
|
+
:::
|
|
435
|
+
*/
|
|
436
|
+
class CourseService {
|
|
437
|
+
static changeCourseUserRole(id, data, config) {
|
|
438
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
439
|
+
return CourseApiClient.changeCourseUserRole(id, data, config);
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
static getJoinedCourses(params, config) {
|
|
443
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
444
|
+
return CourseApiClient.getJoinedCourses(params, config);
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
static getUserJoinedCourses(id, config) {
|
|
448
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
449
|
+
return CourseApiClient.getUserJoinedCourses(id, config);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
static searchCourses(params, config) {
|
|
453
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
454
|
+
return CourseApiClient.searchCourses(params, config);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
static getSpecificCourseInfo(id, params, config) {
|
|
458
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
459
|
+
return CourseApiClient.getSpecificCourseInfo(id, params, config);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
static getCourseDashboardUsers(id, params, config) {
|
|
463
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
464
|
+
return CourseApiClient.getCourseDashboardUsers(id, params, config);
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
static createCourse(data, config) {
|
|
468
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
469
|
+
return CourseApiClient.createCourse(data, config);
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
static updateCourse(id, data, config) {
|
|
473
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
474
|
+
return CourseApiClient.updateCourse(id, data, config);
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
static patchCourse(id, data, config) {
|
|
478
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
479
|
+
return CourseApiClient.patchCourse(id, data, config);
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
static deleteCourse(id, config) {
|
|
483
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
484
|
+
return CourseApiClient.deleteCourse(id, config);
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
static getCourseLessonComment(id, section_id, lesson_id, comment_id, config) {
|
|
488
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
489
|
+
return CourseApiClient.getCourseLessonComment(id, section_id, lesson_id, comment_id, config);
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
static getCourseComments(id, params, config) {
|
|
493
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
494
|
+
return CourseApiClient.getCourseComments(id, params, config);
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
static createCourseComment(id, section_id, lesson_id, data, config) {
|
|
498
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
499
|
+
return CourseApiClient.createCourseComment(id, section_id, lesson_id, data, config);
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
static updateCourseComment(id, section_id, lesson_id, comment_id, data, config) {
|
|
503
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
504
|
+
return CourseApiClient.updateCourseComment(id, section_id, lesson_id, comment_id, data, config);
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
static patchCourseComment(id, section_id, lesson_id, comment_id, data, config) {
|
|
508
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
509
|
+
return CourseApiClient.patchCourseComment(id, section_id, lesson_id, comment_id, data, config);
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
static deleteCourseComment(id, section_id, lesson_id, comment_id, config) {
|
|
513
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
514
|
+
return CourseApiClient.deleteCourseComment(id, section_id, lesson_id, comment_id, config);
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
static getCourseSection(id, section_id, config) {
|
|
518
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
519
|
+
return CourseApiClient.getCourseSection(id, section_id, config);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
static getCourseSections(id, config) {
|
|
523
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
524
|
+
return CourseApiClient.getCourseSections(id, config);
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
static createCourseSection(id, data, config) {
|
|
528
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
529
|
+
return CourseApiClient.createCourseSection(id, data, config);
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
static updateCourseSection(id, section_id, data, config) {
|
|
533
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
534
|
+
return CourseApiClient.updateCourseSection(id, section_id, data, config);
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
static patchCourseSection(id, section_id, data, config) {
|
|
538
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
539
|
+
return CourseApiClient.patchCourseSection(id, section_id, data, config);
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
static deleteCourseSection(id, section_id, config) {
|
|
543
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
544
|
+
return CourseApiClient.deleteCourseSection(id, section_id, config);
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
static getCourseLesson(id, section_id, lesson_id, config) {
|
|
548
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
549
|
+
return CourseApiClient.getCourseLesson(id, section_id, lesson_id, config);
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
static getCourseLessonComments(id, section_id, lesson_id, params, config) {
|
|
553
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
554
|
+
return CourseApiClient.getCourseLessonComments(id, section_id, lesson_id, params, config);
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
static getCourseLessons(id, section_id, config) {
|
|
558
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
559
|
+
return CourseApiClient.getCourseLessons(id, section_id, config);
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
static createCourseLesson(data, config) {
|
|
563
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
564
|
+
return CourseApiClient.createCourseLesson(data, config);
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
static updateCourseLesson(id, section_id, lesson_id, data, config) {
|
|
568
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
569
|
+
return CourseApiClient.updateCourseLesson(id, section_id, lesson_id, data, config);
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
static patchCourseLesson(id, section_id, lesson_id, data, config) {
|
|
573
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
574
|
+
return CourseApiClient.patchCourseLesson(id, section_id, lesson_id, data, config);
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
static deleteCourseLesson(id, section_id, lesson_id, config) {
|
|
578
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
579
|
+
return CourseApiClient.deleteCourseLesson(id, section_id, lesson_id, config);
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
static markLessonComplete(id, section_id, lesson_id, config) {
|
|
583
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
584
|
+
return CourseApiClient.markLessonComplete(id, section_id, lesson_id, config);
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
static markLessonIncomplete(id, section_id, lesson_id, config) {
|
|
588
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
589
|
+
return CourseApiClient.markLessonIncomplete(id, section_id, lesson_id, config);
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
static changeCourseCover(id, data, config) {
|
|
593
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
594
|
+
return CourseApiClient.changeCourseCover(id, data, config);
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
static getCourseWaitingApproval(id, params, config) {
|
|
598
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
599
|
+
return CourseApiClient.getCourseWaitingApproval(id, params, config);
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
static getCourseSuggestedUsers(id, search, config) {
|
|
603
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
604
|
+
return CourseApiClient.getCourseSuggestedUsers(id, search, config);
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
static getCourseInvitedUsers(id, params, config) {
|
|
608
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
609
|
+
return CourseApiClient.getCourseInvitedUsers(id, params, config);
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
static getCourseJoinedUsers(id, params, config) {
|
|
613
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
614
|
+
return CourseApiClient.getCourseJoinedUsers(id, params, config);
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
static joinOrAcceptInviteToCourse(id, config) {
|
|
618
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
619
|
+
return CourseApiClient.joinOrAcceptInviteToCourse(id, config);
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
static leaveOrRemoveCourseRequest(id, params, config) {
|
|
623
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
624
|
+
return CourseApiClient.leaveOrRemoveCourseRequest(id, params, config);
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
static inviteOrAcceptUsersToCourse(id, data, config) {
|
|
628
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
629
|
+
return CourseApiClient.inviteOrAcceptUsersToCourse(id, data, config);
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
static removeInvitationToCourse(id, data, config) {
|
|
633
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
634
|
+
return CourseApiClient.removeInvitationToCourse(id, data, config);
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
static getCourseStatus(id, config) {
|
|
638
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
639
|
+
return CourseApiClient.getCourseStatus(id, config);
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
exports.default = CourseService;
|