@authenty/authapi-types 1.0.20 → 1.0.21
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/index.d.ts +243 -66
- package/dist/index.js +26 -9
- package/package.json +1 -1
- package/src/index.ts +246 -62
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,22 @@ export declare namespace AuthApi {
|
|
|
45
45
|
Bundle?: Bundle;
|
|
46
46
|
}[];
|
|
47
47
|
};
|
|
48
|
+
type Teacher = {
|
|
49
|
+
id: number;
|
|
50
|
+
fullname: string;
|
|
51
|
+
resume: string;
|
|
52
|
+
email: string;
|
|
53
|
+
avatar_l: string;
|
|
54
|
+
date_c: string;
|
|
55
|
+
date_r: string | null;
|
|
56
|
+
active: boolean;
|
|
57
|
+
notif_newPupil: boolean;
|
|
58
|
+
};
|
|
59
|
+
enum TeacherType {
|
|
60
|
+
DEFAULT_TEACHER = 0,
|
|
61
|
+
AUXILIAR_TEACHER = 1,
|
|
62
|
+
PARTICIPATION = 2
|
|
63
|
+
}
|
|
48
64
|
type Course = {
|
|
49
65
|
id: number;
|
|
50
66
|
type: number;
|
|
@@ -69,6 +85,14 @@ export declare namespace AuthApi {
|
|
|
69
85
|
email_after?: string;
|
|
70
86
|
date_c: string;
|
|
71
87
|
date_r?: string | null;
|
|
88
|
+
scholar_courses_teacher?: {
|
|
89
|
+
id: number;
|
|
90
|
+
courseID: number;
|
|
91
|
+
teacherID: number;
|
|
92
|
+
type: TeacherType;
|
|
93
|
+
Course?: Course;
|
|
94
|
+
Teacher?: Teacher;
|
|
95
|
+
};
|
|
72
96
|
};
|
|
73
97
|
type Consultancy = {
|
|
74
98
|
id: number;
|
|
@@ -210,6 +234,36 @@ export declare namespace AuthApi {
|
|
|
210
234
|
deletedAt: Date | null;
|
|
211
235
|
userID: number;
|
|
212
236
|
};
|
|
237
|
+
type Session = {
|
|
238
|
+
id: string;
|
|
239
|
+
hash?: string;
|
|
240
|
+
pin1?: string;
|
|
241
|
+
pin2?: string;
|
|
242
|
+
trust: boolean;
|
|
243
|
+
userID: number;
|
|
244
|
+
User?: LocalUser;
|
|
245
|
+
ip: string;
|
|
246
|
+
os: string;
|
|
247
|
+
browser: string;
|
|
248
|
+
creation_ts: number;
|
|
249
|
+
update_ts: number;
|
|
250
|
+
last_ts: number;
|
|
251
|
+
active: boolean;
|
|
252
|
+
data: string;
|
|
253
|
+
Licenses?: License[];
|
|
254
|
+
};
|
|
255
|
+
type License = {
|
|
256
|
+
id: number;
|
|
257
|
+
purchaseID: number;
|
|
258
|
+
Purchase?: Purchase;
|
|
259
|
+
levelID: number | null;
|
|
260
|
+
ProductLevel?: ProductLevel;
|
|
261
|
+
sessionID: number | null;
|
|
262
|
+
Session?: MediaSession;
|
|
263
|
+
got_at: number;
|
|
264
|
+
renew_at: number;
|
|
265
|
+
released_at: number | null;
|
|
266
|
+
};
|
|
213
267
|
type LogEntry = {
|
|
214
268
|
appId: string;
|
|
215
269
|
logCode: number;
|
|
@@ -358,79 +412,197 @@ export declare namespace AuthApi {
|
|
|
358
412
|
type GET = objects.LocalUser[];
|
|
359
413
|
}
|
|
360
414
|
namespace user {
|
|
361
|
-
type
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
namespace updateConfig {
|
|
367
|
-
type PUT = {
|
|
368
|
-
msg?: string;
|
|
415
|
+
type POST = objects.LocalUser;
|
|
416
|
+
namespace $userId {
|
|
417
|
+
type GET = objects.LocalUser & {
|
|
418
|
+
Wallets?: objects.Wallet[];
|
|
419
|
+
PurchasesShares?: objects.PurchaseShare[];
|
|
369
420
|
};
|
|
370
|
-
}
|
|
371
|
-
namespace updateAdmin {
|
|
372
421
|
type PUT = objects.LocalUser;
|
|
373
|
-
|
|
374
|
-
namespace license {
|
|
375
|
-
type PUT = {
|
|
376
|
-
availableLicenses: number;
|
|
377
|
-
heldLicenses: number;
|
|
378
|
-
usedLicenses: number;
|
|
379
|
-
msg?: string;
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
namespace purchase {
|
|
384
|
-
namespace create {
|
|
385
|
-
type POST = {
|
|
422
|
+
type DELETE = {
|
|
386
423
|
msg?: string;
|
|
387
|
-
purchase: objects.Purchase;
|
|
388
|
-
url?: string;
|
|
389
424
|
};
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
namespace sync {
|
|
393
|
-
type POST = objects.Purchase & {
|
|
425
|
+
namespace updateConfig {
|
|
426
|
+
type PUT = {
|
|
394
427
|
msg?: string;
|
|
395
428
|
};
|
|
396
429
|
}
|
|
430
|
+
namespace updateAdmin {
|
|
431
|
+
type PUT = objects.LocalUser;
|
|
432
|
+
}
|
|
433
|
+
namespace license {
|
|
434
|
+
type GET = {
|
|
435
|
+
msg?: string;
|
|
436
|
+
license: objects.License;
|
|
437
|
+
};
|
|
438
|
+
namespace release {
|
|
439
|
+
type POST = {
|
|
440
|
+
msg?: string;
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
namespace licenses {
|
|
445
|
+
type GET = objects.License[];
|
|
446
|
+
namespace revokeAll {
|
|
447
|
+
type POST = {
|
|
448
|
+
msg: string;
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
namespace availableProducts {
|
|
453
|
+
type GET = auxiliarTypes.availableSoftware[];
|
|
454
|
+
}
|
|
455
|
+
namespace purchase {
|
|
456
|
+
type POST = {
|
|
457
|
+
msg?: string;
|
|
458
|
+
code: number;
|
|
459
|
+
purchase?: objects.Purchase;
|
|
460
|
+
url?: string;
|
|
461
|
+
};
|
|
462
|
+
namespace $purchaseId {
|
|
463
|
+
type GET = objects.Purchase;
|
|
464
|
+
type PUT = objects.Purchase;
|
|
465
|
+
type DELETE = {
|
|
466
|
+
msg?: string;
|
|
467
|
+
};
|
|
468
|
+
namespace sync {
|
|
469
|
+
type POST = {
|
|
470
|
+
msg: string;
|
|
471
|
+
purchase?: objects.Purchase;
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
namespace getFromGateway {
|
|
475
|
+
type GET = objects.PaymentSystem.PG_Purchase;
|
|
476
|
+
}
|
|
477
|
+
namespace cancel {
|
|
478
|
+
type POST = {
|
|
479
|
+
msg?: string;
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
namespace purchases {
|
|
485
|
+
type GET = objects.Purchase[];
|
|
486
|
+
namespace getByProduct {
|
|
487
|
+
type GET = {
|
|
488
|
+
ownPurchases: objects.Purchase[];
|
|
489
|
+
sharedPurchases: objects.Purchase[];
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
namespace sessions {
|
|
494
|
+
type GET = (objects.Session & {
|
|
495
|
+
Licenses: objects.License[];
|
|
496
|
+
})[];
|
|
497
|
+
namespace renew {
|
|
498
|
+
type GET = {
|
|
499
|
+
msg: string;
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
namespace revokeAllLicenses {
|
|
503
|
+
type GET = {
|
|
504
|
+
msg: string;
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
}
|
|
397
508
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
type DELETE = {
|
|
405
|
-
msg?: string;
|
|
509
|
+
}
|
|
510
|
+
namespace bundle {
|
|
511
|
+
type POST = {
|
|
512
|
+
msg: string;
|
|
513
|
+
Bundle?: objects.Bundle;
|
|
406
514
|
};
|
|
407
|
-
namespace
|
|
408
|
-
type GET = objects.
|
|
515
|
+
namespace $bundleId {
|
|
516
|
+
type GET = objects.Bundle;
|
|
517
|
+
type PUT = objects.Bundle;
|
|
518
|
+
type DELETE = {
|
|
519
|
+
msg: string;
|
|
520
|
+
};
|
|
521
|
+
namespace paymentMethod {
|
|
522
|
+
type POST = {
|
|
523
|
+
msg: string;
|
|
524
|
+
PaymentMethod: objects.PaymentMethod;
|
|
525
|
+
};
|
|
526
|
+
namespace $paymentMethodId {
|
|
527
|
+
type GET = objects.PaymentMethod;
|
|
528
|
+
type PUT = objects.PaymentMethod;
|
|
529
|
+
type DELETE = {
|
|
530
|
+
msg: string;
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
}
|
|
409
534
|
}
|
|
410
535
|
}
|
|
411
|
-
namespace
|
|
412
|
-
type
|
|
413
|
-
purchases: objects.Purchase[];
|
|
414
|
-
pagination: {
|
|
415
|
-
page: number;
|
|
416
|
-
pageSize: number;
|
|
417
|
-
count: number;
|
|
418
|
-
};
|
|
419
|
-
};
|
|
536
|
+
namespace bundles {
|
|
537
|
+
type GET = objects.Bundle[];
|
|
420
538
|
}
|
|
421
539
|
namespace product {
|
|
422
|
-
type
|
|
423
|
-
|
|
540
|
+
type POST = {
|
|
541
|
+
msg: string;
|
|
542
|
+
product?: objects.Product;
|
|
543
|
+
};
|
|
544
|
+
namespace $productId {
|
|
545
|
+
type GET = objects.Product;
|
|
546
|
+
type PUT = objects.Product;
|
|
547
|
+
type DELETE = {
|
|
548
|
+
msg: string;
|
|
549
|
+
};
|
|
550
|
+
}
|
|
424
551
|
}
|
|
425
552
|
namespace products {
|
|
426
553
|
type GET = objects.Product[];
|
|
554
|
+
namespace featured {
|
|
555
|
+
type GET = objects.Product[];
|
|
556
|
+
}
|
|
427
557
|
}
|
|
428
|
-
namespace
|
|
429
|
-
type POST =
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
msg?: string;
|
|
558
|
+
namespace course {
|
|
559
|
+
type POST = {
|
|
560
|
+
msg: string;
|
|
561
|
+
course?: objects.Course;
|
|
433
562
|
};
|
|
563
|
+
namespace $courseId {
|
|
564
|
+
type GET = objects.Course;
|
|
565
|
+
type PUT = objects.Course;
|
|
566
|
+
type DELETE = {
|
|
567
|
+
msg: string;
|
|
568
|
+
};
|
|
569
|
+
namespace teachers {
|
|
570
|
+
type GET = objects.Teacher[];
|
|
571
|
+
}
|
|
572
|
+
namespace enroll {
|
|
573
|
+
type POST = {
|
|
574
|
+
msg?: string;
|
|
575
|
+
url?: string;
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
namespace courses {
|
|
581
|
+
type GET = objects.Course[];
|
|
582
|
+
namespace teachers {
|
|
583
|
+
type GET = objects.Teacher[];
|
|
584
|
+
}
|
|
585
|
+
namespace teacher {
|
|
586
|
+
namespace $teacherId {
|
|
587
|
+
type GET = objects.Teacher;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
namespace consultancy {
|
|
592
|
+
namespace $consultancyId {
|
|
593
|
+
type GET = objects.Consultancy;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
namespace consultancies {
|
|
597
|
+
type GET = objects.Consultancy[];
|
|
598
|
+
namespace consultors {
|
|
599
|
+
type GET = objects.Teacher[];
|
|
600
|
+
}
|
|
601
|
+
namespace consultor {
|
|
602
|
+
namespace $consultorId {
|
|
603
|
+
type GET = objects.Teacher;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
434
606
|
}
|
|
435
607
|
namespace logs {
|
|
436
608
|
type POST_SEARCH = {
|
|
@@ -567,22 +739,27 @@ export declare namespace AuthApi {
|
|
|
567
739
|
checkHealth(): Promise<boolean>;
|
|
568
740
|
users: {
|
|
569
741
|
list: () => Promise<responses.ApiResponse<responses.users.GET>>;
|
|
570
|
-
get: (userId: number, includePurchases?: boolean) => Promise<responses.ApiResponse<responses.user.GET>>;
|
|
742
|
+
get: (userId: number, includePurchases?: boolean) => Promise<responses.ApiResponse<responses.user.$userId.GET>>;
|
|
571
743
|
update: (userId: number, userData: Partial<objects.LocalUser>) => Promise<responses.ApiResponse<objects.LocalUser>>;
|
|
572
744
|
updateConfig: (obj: {
|
|
573
745
|
id: number;
|
|
574
746
|
config_ihm_showRates?: boolean;
|
|
575
|
-
}) => Promise<responses.ApiResponse<responses.user.updateConfig.PUT>>;
|
|
747
|
+
}) => Promise<responses.ApiResponse<responses.user.$userId.updateConfig.PUT>>;
|
|
576
748
|
updateAdmin: (userId: number, isAdmin: boolean) => Promise<responses.ApiResponse<objects.LocalUser>>;
|
|
577
|
-
license:
|
|
749
|
+
license: {
|
|
750
|
+
list: (userId: number) => Promise<responses.ApiResponse<responses.user.$userId.licenses.GET>>;
|
|
751
|
+
get: (userId: number) => Promise<responses.ApiResponse<responses.user.$userId.license.GET>>;
|
|
752
|
+
release: (userId: number) => Promise<responses.ApiResponse<responses.user.$userId.license.release.POST>>;
|
|
753
|
+
revokeAll: (userId: number) => Promise<responses.ApiResponse<responses.user.$userId.licenses.revokeAll.POST>>;
|
|
754
|
+
};
|
|
578
755
|
};
|
|
579
756
|
purchases: {
|
|
580
|
-
new: (paymentMethodId: number, userId: number) => Promise<responses.ApiResponse<responses.purchase.
|
|
581
|
-
sync: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<responses.purchase.
|
|
582
|
-
update: (userId: number, purchase: objects.Purchase) => Promise<responses.ApiResponse<
|
|
583
|
-
cancel: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<
|
|
584
|
-
delete: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<responses.purchase.DELETE>>;
|
|
585
|
-
list: (
|
|
757
|
+
new: (paymentMethodId: number, userId: number) => Promise<responses.ApiResponse<responses.user.$userId.purchase.POST>>;
|
|
758
|
+
sync: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<responses.user.$userId.purchase.$purchaseId.sync.POST>>;
|
|
759
|
+
update: (userId: number, purchase: objects.Purchase) => Promise<responses.ApiResponse<objects.Purchase>>;
|
|
760
|
+
cancel: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<responses.user.$userId.purchase.$purchaseId.cancel.POST>>;
|
|
761
|
+
delete: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<responses.user.$userId.purchase.$purchaseId.DELETE>>;
|
|
762
|
+
list: (userId: number) => Promise<responses.ApiResponse<responses.user.$userId.purchases.GET>>;
|
|
586
763
|
getFromGateway: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<objects.PaymentSystem.PG_Purchase>>;
|
|
587
764
|
};
|
|
588
765
|
products: {
|
|
@@ -591,9 +768,9 @@ export declare namespace AuthApi {
|
|
|
591
768
|
update: (productId: number, productData: any) => Promise<responses.ApiResponse<objects.Product>>;
|
|
592
769
|
};
|
|
593
770
|
paymentMethods: {
|
|
594
|
-
create: (id: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<
|
|
771
|
+
create: (id: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<responses.bundle.$bundleId.paymentMethod.POST>>;
|
|
595
772
|
update: (id: number, paymentMethodId: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<objects.PaymentMethod>>;
|
|
596
|
-
delete: (id: number, paymentMethodId: number) => Promise<responses.ApiResponse<responses.paymentMethod.DELETE>>;
|
|
773
|
+
delete: (id: number, paymentMethodId: number) => Promise<responses.ApiResponse<responses.bundle.$bundleId.paymentMethod.$paymentMethodId.DELETE>>;
|
|
597
774
|
};
|
|
598
775
|
aux: {
|
|
599
776
|
countries: () => Promise<responses.ApiResponse<responses.aux.countries.GET>>;
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,12 @@ var AuthApi;
|
|
|
34
34
|
BundleType[BundleType["SYMBOLIC_COURSE"] = 2] = "SYMBOLIC_COURSE";
|
|
35
35
|
BundleType[BundleType["SYMBOLIC_CONSULTANCY"] = 3] = "SYMBOLIC_CONSULTANCY";
|
|
36
36
|
})(BundleType = objects.BundleType || (objects.BundleType = {}));
|
|
37
|
+
let TeacherType;
|
|
38
|
+
(function (TeacherType) {
|
|
39
|
+
TeacherType[TeacherType["DEFAULT_TEACHER"] = 0] = "DEFAULT_TEACHER";
|
|
40
|
+
TeacherType[TeacherType["AUXILIAR_TEACHER"] = 1] = "AUXILIAR_TEACHER";
|
|
41
|
+
TeacherType[TeacherType["PARTICIPATION"] = 2] = "PARTICIPATION";
|
|
42
|
+
})(TeacherType = objects.TeacherType || (objects.TeacherType = {}));
|
|
37
43
|
let PaymentSystem;
|
|
38
44
|
(function (PaymentSystem) {
|
|
39
45
|
let PG_PurchaseLicenseStatus;
|
|
@@ -147,13 +153,24 @@ var AuthApi;
|
|
|
147
153
|
updateAdmin: async (userId, isAdmin) => {
|
|
148
154
|
return await this.request('PUT', `user/${userId}/admin`, { isAdmin });
|
|
149
155
|
},
|
|
150
|
-
license:
|
|
151
|
-
|
|
156
|
+
license: {
|
|
157
|
+
list: async (userId) => {
|
|
158
|
+
return await this.request('GET', `user/${userId}/licenses`, {});
|
|
159
|
+
},
|
|
160
|
+
get: async (userId) => {
|
|
161
|
+
return await this.request('GET', `user/${userId}/license`, {});
|
|
162
|
+
},
|
|
163
|
+
release: async (userId) => {
|
|
164
|
+
return await this.request('POST', `user/${userId}/license/release`, {});
|
|
165
|
+
},
|
|
166
|
+
revokeAll: async (userId) => {
|
|
167
|
+
return await this.request('GET', `user/${userId}/licenses/revokeAll`, {});
|
|
168
|
+
}
|
|
152
169
|
}
|
|
153
170
|
};
|
|
154
171
|
this.purchases = {
|
|
155
172
|
new: async (paymentMethodId, userId) => {
|
|
156
|
-
return await this.request('POST', `user/${userId}/purchase
|
|
173
|
+
return await this.request('POST', `user/${userId}/purchase`, { paymentMethodId });
|
|
157
174
|
},
|
|
158
175
|
sync: async (purchaseId, userId, async = false) => {
|
|
159
176
|
return await this.request('POST', `user/${userId}/purchase/${purchaseId}/sync`, { async });
|
|
@@ -162,13 +179,13 @@ var AuthApi;
|
|
|
162
179
|
return await this.request('PUT', `user/${userId}/purchase/${purchase.id}`, purchase);
|
|
163
180
|
},
|
|
164
181
|
cancel: async (purchaseId, userId) => {
|
|
165
|
-
return await this.request('
|
|
182
|
+
return await this.request('POST', `user/${userId}/purchase/${purchaseId}/cancel`, {});
|
|
166
183
|
},
|
|
167
184
|
delete: async (purchaseId, userId) => {
|
|
168
185
|
return await this.request('DELETE', `user/${userId}/purchase/${purchaseId}`, {});
|
|
169
186
|
},
|
|
170
|
-
list: async (
|
|
171
|
-
return await this.request('
|
|
187
|
+
list: async (userId) => {
|
|
188
|
+
return await this.request('GET', `user/${userId}/purchases`, {});
|
|
172
189
|
},
|
|
173
190
|
getFromGateway: async (purchaseId, userId, async = false) => {
|
|
174
191
|
return await this.request('GET', `user/${userId}/purchase/${purchaseId}/getFromGateway`, {});
|
|
@@ -187,13 +204,13 @@ var AuthApi;
|
|
|
187
204
|
};
|
|
188
205
|
this.paymentMethods = {
|
|
189
206
|
create: async (id, paymentMethodData) => {
|
|
190
|
-
return await this.request('POST', `bundle/${id}/
|
|
207
|
+
return await this.request('POST', `bundle/${id}/paymentMethod`, paymentMethodData);
|
|
191
208
|
},
|
|
192
209
|
update: async (id, paymentMethodId, paymentMethodData) => {
|
|
193
|
-
return await this.request('PUT', `bundle/${id}/
|
|
210
|
+
return await this.request('PUT', `bundle/${id}/paymentMethod/${paymentMethodId}`, paymentMethodData);
|
|
194
211
|
},
|
|
195
212
|
delete: async (id, paymentMethodId) => {
|
|
196
|
-
return await this.request('DELETE', `bundle/${id}/
|
|
213
|
+
return await this.request('DELETE', `bundle/${id}/paymentMethod/${paymentMethodId}`, {});
|
|
197
214
|
}
|
|
198
215
|
};
|
|
199
216
|
this.aux = {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -52,6 +52,23 @@ export namespace AuthApi {
|
|
|
52
52
|
}[];
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
export type Teacher = {
|
|
56
|
+
id: number,
|
|
57
|
+
fullname: string,
|
|
58
|
+
resume: string,
|
|
59
|
+
email: string,
|
|
60
|
+
avatar_l: string,
|
|
61
|
+
date_c: string,
|
|
62
|
+
date_r: string | null,
|
|
63
|
+
active: boolean,
|
|
64
|
+
notif_newPupil: boolean
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export enum TeacherType {
|
|
68
|
+
DEFAULT_TEACHER = 0,
|
|
69
|
+
AUXILIAR_TEACHER = 1,
|
|
70
|
+
PARTICIPATION = 2
|
|
71
|
+
}
|
|
55
72
|
export type Course = {
|
|
56
73
|
id: number;
|
|
57
74
|
type: number;
|
|
@@ -76,6 +93,14 @@ export namespace AuthApi {
|
|
|
76
93
|
email_after?: string;
|
|
77
94
|
date_c: string;
|
|
78
95
|
date_r?: string | null;
|
|
96
|
+
scholar_courses_teacher?: {
|
|
97
|
+
id: number,
|
|
98
|
+
courseID: number,
|
|
99
|
+
teacherID: number,
|
|
100
|
+
type: TeacherType,
|
|
101
|
+
Course?: Course,
|
|
102
|
+
Teacher?: Teacher
|
|
103
|
+
}
|
|
79
104
|
}
|
|
80
105
|
|
|
81
106
|
export type Consultancy = {
|
|
@@ -228,6 +253,36 @@ export namespace AuthApi {
|
|
|
228
253
|
deletedAt: Date | null,
|
|
229
254
|
userID: number
|
|
230
255
|
}
|
|
256
|
+
export type Session = {
|
|
257
|
+
id: string,
|
|
258
|
+
hash?: string,
|
|
259
|
+
pin1?: string,
|
|
260
|
+
pin2?: string,
|
|
261
|
+
trust: boolean,
|
|
262
|
+
userID: number,
|
|
263
|
+
User?: LocalUser,
|
|
264
|
+
ip: string,
|
|
265
|
+
os: string,
|
|
266
|
+
browser: string,
|
|
267
|
+
creation_ts: number,
|
|
268
|
+
update_ts: number,
|
|
269
|
+
last_ts: number,
|
|
270
|
+
active: boolean,
|
|
271
|
+
data: string,
|
|
272
|
+
Licenses?: License[]
|
|
273
|
+
}
|
|
274
|
+
export type License = {
|
|
275
|
+
id: number,
|
|
276
|
+
purchaseID: number,
|
|
277
|
+
Purchase?: Purchase,
|
|
278
|
+
levelID: number | null,
|
|
279
|
+
ProductLevel?: ProductLevel,
|
|
280
|
+
sessionID: number | null,
|
|
281
|
+
Session?: MediaSession,
|
|
282
|
+
got_at: number,
|
|
283
|
+
renew_at: number,
|
|
284
|
+
released_at: number | null
|
|
285
|
+
}
|
|
231
286
|
|
|
232
287
|
// Tipos para logs do sistema
|
|
233
288
|
export type LogEntry = {
|
|
@@ -404,65 +459,183 @@ export namespace AuthApi {
|
|
|
404
459
|
}
|
|
405
460
|
|
|
406
461
|
export namespace user {
|
|
407
|
-
|
|
408
|
-
export type
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
export type
|
|
412
|
-
}
|
|
413
|
-
export namespace updateAdmin {
|
|
462
|
+
|
|
463
|
+
export type POST = objects.LocalUser;
|
|
464
|
+
export namespace $userId {
|
|
465
|
+
|
|
466
|
+
export type GET = objects.LocalUser & { Wallets?: objects.Wallet[]; PurchasesShares?: objects.PurchaseShare[] };
|
|
414
467
|
export type PUT = objects.LocalUser;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
export
|
|
418
|
-
|
|
419
|
-
|
|
468
|
+
export type DELETE = {msg?:string};
|
|
469
|
+
|
|
470
|
+
export namespace updateConfig {
|
|
471
|
+
export type PUT = { msg?: string };
|
|
472
|
+
}
|
|
473
|
+
export namespace updateAdmin {
|
|
474
|
+
export type PUT = objects.LocalUser;
|
|
475
|
+
}
|
|
476
|
+
export namespace license {
|
|
477
|
+
// export type PUT = { availableLicenses: number; heldLicenses: number; usedLicenses: number; msg?: string };
|
|
478
|
+
export type GET = { msg?: string, license: objects.License}
|
|
479
|
+
|
|
480
|
+
export namespace release {
|
|
481
|
+
export type POST = {msg?:string}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
export namespace licenses {
|
|
485
|
+
export type GET = objects.License[]
|
|
486
|
+
export namespace revokeAll {
|
|
487
|
+
export type POST = {msg: string}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export namespace availableProducts {
|
|
492
|
+
export type GET = auxiliarTypes.availableSoftware[]
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export namespace purchase {
|
|
420
496
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
497
|
+
export type POST = {
|
|
498
|
+
msg?: string;
|
|
499
|
+
code: number,
|
|
500
|
+
purchase?: objects.Purchase;
|
|
501
|
+
url?: string
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
export namespace $purchaseId {
|
|
505
|
+
export type GET = objects.Purchase;
|
|
506
|
+
export type PUT = objects.Purchase;
|
|
507
|
+
export type DELETE = { msg?: string };
|
|
508
|
+
|
|
509
|
+
export namespace sync {
|
|
510
|
+
export type POST = {
|
|
511
|
+
msg:string,
|
|
512
|
+
purchase?: objects.Purchase
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
export namespace getFromGateway {
|
|
516
|
+
export type GET = objects.PaymentSystem.PG_Purchase;
|
|
517
|
+
}
|
|
518
|
+
export namespace cancel {
|
|
519
|
+
export type POST = {msg?:string};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
}
|
|
525
|
+
export namespace purchases {
|
|
526
|
+
|
|
527
|
+
export type GET = objects.Purchase[];
|
|
528
|
+
|
|
529
|
+
export namespace getByProduct {
|
|
530
|
+
export type GET = {
|
|
531
|
+
ownPurchases: objects.Purchase[],
|
|
532
|
+
sharedPurchases: objects.Purchase[]
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export namespace sessions {
|
|
538
|
+
export type GET = (objects.Session & {
|
|
539
|
+
Licenses: objects.License[]
|
|
540
|
+
})[]
|
|
541
|
+
export namespace renew {
|
|
542
|
+
export type GET = {msg:string}
|
|
543
|
+
}
|
|
544
|
+
export namespace revokeAllLicenses {
|
|
545
|
+
export type GET = {msg:string}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
424
548
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export namespace bundle {
|
|
552
|
+
export type POST = {msg:string, Bundle?: objects.Bundle};
|
|
553
|
+
export namespace $bundleId {
|
|
554
|
+
export type GET = objects.Bundle;
|
|
555
|
+
export type PUT = objects.Bundle;
|
|
556
|
+
export type DELETE = {msg:string};
|
|
557
|
+
|
|
558
|
+
export namespace paymentMethod {
|
|
559
|
+
export type POST = {msg:string, PaymentMethod: objects.PaymentMethod};
|
|
560
|
+
export namespace $paymentMethodId {
|
|
561
|
+
export type GET = objects.PaymentMethod;
|
|
562
|
+
export type PUT = objects.PaymentMethod;
|
|
563
|
+
export type DELETE = {msg:string};
|
|
564
|
+
}
|
|
428
565
|
}
|
|
429
566
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
567
|
+
}
|
|
568
|
+
export namespace bundles {
|
|
569
|
+
export type GET = objects.Bundle[]
|
|
570
|
+
}
|
|
571
|
+
export namespace product {
|
|
572
|
+
export type POST = {msg:string, product?:objects.Product};
|
|
573
|
+
export namespace $productId {
|
|
574
|
+
export type GET = objects.Product;
|
|
575
|
+
export type PUT = objects.Product;
|
|
576
|
+
export type DELETE = {msg:string};
|
|
433
577
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
578
|
+
}
|
|
579
|
+
export namespace products {
|
|
580
|
+
export type GET = objects.Product[];
|
|
581
|
+
export namespace featured {
|
|
582
|
+
export type GET = objects.Product[];
|
|
437
583
|
}
|
|
438
584
|
}
|
|
439
585
|
|
|
440
|
-
export namespace
|
|
441
|
-
export type
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
586
|
+
export namespace course {
|
|
587
|
+
export type POST = {msg:string, course?:objects.Course};
|
|
588
|
+
export namespace $courseId {
|
|
589
|
+
export type GET = objects.Course;
|
|
590
|
+
export type PUT = objects.Course;
|
|
591
|
+
export type DELETE = {msg:string};
|
|
592
|
+
|
|
593
|
+
export namespace teachers {
|
|
594
|
+
export type GET = objects.Teacher[]
|
|
595
|
+
}
|
|
596
|
+
export namespace enroll {
|
|
597
|
+
export type POST = {msg?:string, url?: string}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
449
600
|
}
|
|
601
|
+
export namespace courses {
|
|
602
|
+
export type GET = objects.Course[]
|
|
450
603
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
604
|
+
export namespace teachers {
|
|
605
|
+
export type GET = objects.Teacher[]
|
|
606
|
+
}
|
|
607
|
+
export namespace teacher {
|
|
608
|
+
export namespace $teacherId {
|
|
609
|
+
export type GET = objects.Teacher
|
|
610
|
+
}
|
|
611
|
+
}
|
|
454
612
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
export
|
|
613
|
+
|
|
614
|
+
export namespace consultancy {
|
|
615
|
+
export namespace $consultancyId {
|
|
616
|
+
export type GET = objects.Consultancy;
|
|
617
|
+
}
|
|
458
618
|
}
|
|
619
|
+
export namespace consultancies {
|
|
459
620
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
export
|
|
463
|
-
|
|
621
|
+
export type GET = objects.Consultancy[];
|
|
622
|
+
|
|
623
|
+
export namespace consultors {
|
|
624
|
+
export type GET = objects.Teacher[];
|
|
625
|
+
}
|
|
626
|
+
export namespace consultor {
|
|
627
|
+
export namespace $consultorId {
|
|
628
|
+
export type GET = objects.Teacher;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
464
631
|
}
|
|
465
632
|
|
|
633
|
+
// export namespace paymentMethod {
|
|
634
|
+
// export type POST = objects.PaymentMethod;
|
|
635
|
+
// export type PUT = objects.PaymentMethod;
|
|
636
|
+
// export type DELETE = { msg?: string };
|
|
637
|
+
// }
|
|
638
|
+
|
|
466
639
|
export namespace logs {
|
|
467
640
|
|
|
468
641
|
export type POST_SEARCH = {
|
|
@@ -792,43 +965,54 @@ export namespace AuthApi {
|
|
|
792
965
|
return await this.request<responses.users.GET>('GET', 'users', {});
|
|
793
966
|
},
|
|
794
967
|
get: async (userId: number, includePurchases: boolean = true) => {
|
|
795
|
-
return await this.request<responses.user.GET>('GET', `user/${userId}?includePurchases=${includePurchases}`, {});
|
|
968
|
+
return await this.request<responses.user.$userId.GET>('GET', `user/${userId}?includePurchases=${includePurchases}`, {});
|
|
796
969
|
},
|
|
797
970
|
update: async (userId: number, userData: Partial<objects.LocalUser>) => {
|
|
798
|
-
return await this.request<responses.user.PUT>('PUT', `user/${userId}`, userData);
|
|
971
|
+
return await this.request<responses.user.$userId.PUT>('PUT', `user/${userId}`, userData);
|
|
799
972
|
},
|
|
800
973
|
updateConfig: async ( obj:{id: number, config_ihm_showRates?: boolean} ) => {
|
|
801
|
-
return await this.request<responses.user.updateConfig.PUT>('PUT', `user/${obj.id}/config`, obj);
|
|
974
|
+
return await this.request<responses.user.$userId.updateConfig.PUT>('PUT', `user/${obj.id}/config`, obj);
|
|
802
975
|
},
|
|
803
976
|
updateAdmin: async (userId: number, isAdmin: boolean) => {
|
|
804
|
-
return await this.request<responses.user.updateAdmin.PUT>('PUT', `user/${userId}/admin`, { isAdmin });
|
|
977
|
+
return await this.request<responses.user.$userId.updateAdmin.PUT>('PUT', `user/${userId}/admin`, { isAdmin });
|
|
805
978
|
},
|
|
806
|
-
license:
|
|
807
|
-
|
|
979
|
+
license: {
|
|
980
|
+
list: async (userId:number) => {
|
|
981
|
+
return await this.request<responses.user.$userId.licenses.GET>('GET', `user/${userId}/licenses`, {});
|
|
982
|
+
},
|
|
983
|
+
get: async (userId:number) => {
|
|
984
|
+
return await this.request<responses.user.$userId.license.GET>('GET', `user/${userId}/license`, {});
|
|
985
|
+
},
|
|
986
|
+
release: async (userId:number) => {
|
|
987
|
+
return await this.request<responses.user.$userId.license.release.POST>('POST', `user/${userId}/license/release`, {});
|
|
988
|
+
},
|
|
989
|
+
revokeAll: async (userId:number) => {
|
|
990
|
+
return await this.request<responses.user.$userId.licenses.revokeAll.POST>('GET', `user/${userId}/licenses/revokeAll`, {});
|
|
991
|
+
}
|
|
808
992
|
}
|
|
809
993
|
}
|
|
810
994
|
|
|
811
995
|
public purchases = {
|
|
812
996
|
new: async (paymentMethodId: number, userId: number) => {
|
|
813
|
-
return await this.request<responses.purchase.
|
|
997
|
+
return await this.request<responses.user.$userId.purchase.POST>('POST', `user/${userId}/purchase`, {paymentMethodId});
|
|
814
998
|
},
|
|
815
999
|
sync: async (purchaseId: number, userId: number, async: boolean = false) => {
|
|
816
|
-
return await this.request<responses.purchase.
|
|
1000
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.sync.POST>('POST', `user/${userId}/purchase/${purchaseId}/sync`, { async });
|
|
817
1001
|
},
|
|
818
1002
|
update: async (userId: number, purchase: objects.Purchase) => {
|
|
819
|
-
return await this.request<responses.purchase.PUT>('PUT', `user/${userId}/purchase/${purchase.id}`, purchase );
|
|
1003
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.PUT>('PUT', `user/${userId}/purchase/${purchase.id}`, purchase );
|
|
820
1004
|
},
|
|
821
1005
|
cancel: async (purchaseId: number, userId: number) => {
|
|
822
|
-
return await this.request<responses.purchase.cancel.
|
|
1006
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.cancel.POST>('POST', `user/${userId}/purchase/${purchaseId}/cancel`, {} );
|
|
823
1007
|
},
|
|
824
1008
|
delete: async (purchaseId: number, userId: number) => {
|
|
825
|
-
return await this.request<responses.purchase.DELETE>('DELETE', `user/${userId}/purchase/${purchaseId}`, { });
|
|
1009
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.DELETE>('DELETE', `user/${userId}/purchase/${purchaseId}`, { });
|
|
826
1010
|
},
|
|
827
|
-
list: async (
|
|
828
|
-
return await this.request<responses.purchases.
|
|
1011
|
+
list: async (userId: number) => {
|
|
1012
|
+
return await this.request<responses.user.$userId.purchases.GET>('GET', `user/${userId}/purchases`, { });
|
|
829
1013
|
},
|
|
830
1014
|
getFromGateway: async (purchaseId: number, userId: number, async: boolean = false) => {
|
|
831
|
-
return await this.request<responses.purchase.getFromGateway.GET>('GET', `user/${userId}/purchase/${purchaseId}/getFromGateway`, {});
|
|
1015
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.getFromGateway.GET>('GET', `user/${userId}/purchase/${purchaseId}/getFromGateway`, {});
|
|
832
1016
|
},
|
|
833
1017
|
}
|
|
834
1018
|
|
|
@@ -838,23 +1022,23 @@ export namespace AuthApi {
|
|
|
838
1022
|
return await this.request<responses.products.GET>('GET', 'products', {});
|
|
839
1023
|
},
|
|
840
1024
|
get: async (productId: number) => {
|
|
841
|
-
return await this.request<responses.product.GET>('GET', `product/${productId}`, { mode: 'admin' });
|
|
1025
|
+
return await this.request<responses.product.$productId.GET>('GET', `product/${productId}`, { mode: 'admin' });
|
|
842
1026
|
},
|
|
843
1027
|
update: async (productId: number, productData: any) => {
|
|
844
|
-
return await this.request<responses.product.PUT>('PUT', `product/${productId}`, productData);
|
|
1028
|
+
return await this.request<responses.product.$productId.PUT>('PUT', `product/${productId}`, productData);
|
|
845
1029
|
}
|
|
846
1030
|
}
|
|
847
1031
|
|
|
848
1032
|
public paymentMethods = {
|
|
849
1033
|
|
|
850
1034
|
create: async (id: number, paymentMethodData: objects.PaymentMethod) => {
|
|
851
|
-
return await this.request<responses.paymentMethod.POST>('POST', `bundle/${id}/
|
|
1035
|
+
return await this.request<responses.bundle.$bundleId.paymentMethod.POST>('POST', `bundle/${id}/paymentMethod`, paymentMethodData);
|
|
852
1036
|
},
|
|
853
1037
|
update: async (id: number, paymentMethodId: number, paymentMethodData: objects.PaymentMethod) => {
|
|
854
|
-
return await this.request<responses.paymentMethod.PUT>('PUT', `bundle/${id}/
|
|
1038
|
+
return await this.request<responses.bundle.$bundleId.paymentMethod.$paymentMethodId.PUT>('PUT', `bundle/${id}/paymentMethod/${paymentMethodId}`, paymentMethodData);
|
|
855
1039
|
},
|
|
856
1040
|
delete: async (id: number, paymentMethodId: number) => {
|
|
857
|
-
return await this.request<responses.paymentMethod.DELETE>('DELETE', `bundle/${id}/
|
|
1041
|
+
return await this.request<responses.bundle.$bundleId.paymentMethod.$paymentMethodId.DELETE>('DELETE', `bundle/${id}/paymentMethod/${paymentMethodId}`, {});
|
|
858
1042
|
}
|
|
859
1043
|
}
|
|
860
1044
|
|