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