@authenty/authapi-types 1.0.25 → 1.0.27
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 +18 -5
- package/package.json +1 -1
- package/src/index.ts +68 -55
package/dist/index.d.ts
CHANGED
|
@@ -373,10 +373,10 @@ export declare namespace AuthApi {
|
|
|
373
373
|
endDate?: string;
|
|
374
374
|
};
|
|
375
375
|
type PaginationInfo = {
|
|
376
|
-
total
|
|
376
|
+
total?: number;
|
|
377
377
|
page: number;
|
|
378
378
|
itemsPerPage: number;
|
|
379
|
-
totalPages
|
|
379
|
+
totalPages?: number;
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
382
|
/**
|
|
@@ -408,7 +408,10 @@ export declare namespace AuthApi {
|
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
namespace users {
|
|
411
|
-
type GET =
|
|
411
|
+
type GET = {
|
|
412
|
+
users: objects.LocalUser[];
|
|
413
|
+
pagination: auxiliarTypes.PaginationInfo;
|
|
414
|
+
};
|
|
412
415
|
}
|
|
413
416
|
namespace user {
|
|
414
417
|
type POST = objects.LocalUser;
|
|
@@ -485,8 +488,18 @@ export declare namespace AuthApi {
|
|
|
485
488
|
type GET = objects.Purchase[];
|
|
486
489
|
namespace getByProduct {
|
|
487
490
|
type GET = {
|
|
488
|
-
ownPurchases: objects.Purchase
|
|
489
|
-
|
|
491
|
+
ownPurchases: (objects.Purchase & {
|
|
492
|
+
Wallet: objects.Wallet;
|
|
493
|
+
PaymentMethod: objects.PaymentMethod & {
|
|
494
|
+
Bundle: objects.Bundle;
|
|
495
|
+
};
|
|
496
|
+
})[];
|
|
497
|
+
sharedPurchases: (objects.Purchase & {
|
|
498
|
+
Wallet: objects.Wallet;
|
|
499
|
+
PaymentMethod: objects.PaymentMethod & {
|
|
500
|
+
Bundle: objects.Bundle;
|
|
501
|
+
};
|
|
502
|
+
})[];
|
|
490
503
|
};
|
|
491
504
|
}
|
|
492
505
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ export namespace AuthApi {
|
|
|
10
10
|
* Objetos de domínio da aplicação
|
|
11
11
|
*/
|
|
12
12
|
export namespace objects {
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
export enum BundleType {
|
|
15
15
|
BUNDLE = 0,
|
|
16
16
|
SYMBOLIC_PRODUCT = 1,
|
|
@@ -55,8 +55,8 @@ export namespace AuthApi {
|
|
|
55
55
|
export type Teacher = {
|
|
56
56
|
id: number,
|
|
57
57
|
fullname: string,
|
|
58
|
-
resume: string,
|
|
59
|
-
email: string,
|
|
58
|
+
resume: string,
|
|
59
|
+
email: string,
|
|
60
60
|
avatar_l: string,
|
|
61
61
|
date_c: string,
|
|
62
62
|
date_r: string | null,
|
|
@@ -421,10 +421,10 @@ export namespace AuthApi {
|
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
export type PaginationInfo = {
|
|
424
|
-
total
|
|
424
|
+
total?: number; //quando undefined, considerar "de muitos"
|
|
425
425
|
page: number;
|
|
426
426
|
itemsPerPage: number;
|
|
427
|
-
totalPages
|
|
427
|
+
totalPages?: number;//quando undefined, considerar "de muitos"
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
|
|
@@ -455,7 +455,10 @@ export namespace AuthApi {
|
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
export namespace users {
|
|
458
|
-
export type GET =
|
|
458
|
+
export type GET = {
|
|
459
|
+
users: objects.LocalUser[],
|
|
460
|
+
pagination: auxiliarTypes.PaginationInfo
|
|
461
|
+
};
|
|
459
462
|
}
|
|
460
463
|
|
|
461
464
|
export namespace user {
|
|
@@ -465,8 +468,8 @@ export namespace AuthApi {
|
|
|
465
468
|
|
|
466
469
|
export type GET = objects.LocalUser & { Wallets?: objects.Wallet[]; PurchasesShares?: objects.PurchaseShare[] };
|
|
467
470
|
export type PUT = objects.LocalUser;
|
|
468
|
-
export type DELETE = {msg?:string};
|
|
469
|
-
|
|
471
|
+
export type DELETE = { msg?: string };
|
|
472
|
+
|
|
470
473
|
export namespace updateConfig {
|
|
471
474
|
export type PUT = { msg?: string };
|
|
472
475
|
}
|
|
@@ -475,26 +478,26 @@ export namespace AuthApi {
|
|
|
475
478
|
}
|
|
476
479
|
export namespace license {
|
|
477
480
|
// export type PUT = { availableLicenses: number; heldLicenses: number; usedLicenses: number; msg?: string };
|
|
478
|
-
export type GET = { msg?: string, license: objects.License}
|
|
481
|
+
export type GET = { msg?: string, license: objects.License }
|
|
479
482
|
|
|
480
483
|
export namespace release {
|
|
481
|
-
export type POST = {msg?:string}
|
|
484
|
+
export type POST = { msg?: string }
|
|
482
485
|
}
|
|
483
486
|
}
|
|
484
487
|
export namespace licenses {
|
|
485
488
|
export type GET = objects.License[]
|
|
486
489
|
export namespace revokeAll {
|
|
487
|
-
export type POST = {msg: string}
|
|
490
|
+
export type POST = { msg: string }
|
|
488
491
|
}
|
|
489
492
|
}
|
|
490
|
-
|
|
493
|
+
|
|
491
494
|
export namespace availableProducts {
|
|
492
495
|
export type GET = auxiliarTypes.availableSoftware[]
|
|
493
496
|
}
|
|
494
|
-
|
|
497
|
+
|
|
495
498
|
export namespace purchase {
|
|
496
499
|
|
|
497
|
-
export type POST = {
|
|
500
|
+
export type POST = {
|
|
498
501
|
msg?: string;
|
|
499
502
|
code: number,
|
|
500
503
|
purchase?: objects.Purchase;
|
|
@@ -508,7 +511,7 @@ export namespace AuthApi {
|
|
|
508
511
|
|
|
509
512
|
export namespace sync {
|
|
510
513
|
export type POST = {
|
|
511
|
-
msg:string,
|
|
514
|
+
msg: string,
|
|
512
515
|
Purchase: objects.Purchase
|
|
513
516
|
};
|
|
514
517
|
}
|
|
@@ -516,20 +519,30 @@ export namespace AuthApi {
|
|
|
516
519
|
export type GET = objects.PaymentSystem.PG_Purchase;
|
|
517
520
|
}
|
|
518
521
|
export namespace cancel {
|
|
519
|
-
export type POST = {msg?:string, Purchase: objects.Purchase};
|
|
522
|
+
export type POST = { msg?: string, Purchase: objects.Purchase };
|
|
520
523
|
}
|
|
521
524
|
|
|
522
525
|
}
|
|
523
526
|
|
|
524
527
|
}
|
|
525
528
|
export namespace purchases {
|
|
526
|
-
|
|
529
|
+
|
|
527
530
|
export type GET = objects.Purchase[];
|
|
528
531
|
|
|
529
532
|
export namespace getByProduct {
|
|
530
533
|
export type GET = {
|
|
531
|
-
ownPurchases: objects.Purchase
|
|
532
|
-
|
|
534
|
+
ownPurchases: (objects.Purchase & {
|
|
535
|
+
Wallet: objects.Wallet;
|
|
536
|
+
PaymentMethod: objects.PaymentMethod & {
|
|
537
|
+
Bundle: objects.Bundle;
|
|
538
|
+
};
|
|
539
|
+
})[],
|
|
540
|
+
sharedPurchases: (objects.Purchase & {
|
|
541
|
+
Wallet: objects.Wallet;
|
|
542
|
+
PaymentMethod: objects.PaymentMethod & {
|
|
543
|
+
Bundle: objects.Bundle;
|
|
544
|
+
};
|
|
545
|
+
})[]
|
|
533
546
|
}
|
|
534
547
|
}
|
|
535
548
|
}
|
|
@@ -539,28 +552,28 @@ export namespace AuthApi {
|
|
|
539
552
|
Licenses: objects.License[]
|
|
540
553
|
})[]
|
|
541
554
|
export namespace renew {
|
|
542
|
-
export type GET = {msg:string}
|
|
555
|
+
export type GET = { msg: string }
|
|
543
556
|
}
|
|
544
557
|
export namespace revokeAllLicenses {
|
|
545
|
-
export type GET = {msg:string}
|
|
558
|
+
export type GET = { msg: string }
|
|
546
559
|
}
|
|
547
560
|
}
|
|
548
561
|
}
|
|
549
562
|
}
|
|
550
|
-
|
|
563
|
+
|
|
551
564
|
export namespace bundle {
|
|
552
|
-
export type POST = {msg:string, Bundle?: objects.Bundle};
|
|
565
|
+
export type POST = { msg: string, Bundle?: objects.Bundle };
|
|
553
566
|
export namespace $bundleId {
|
|
554
567
|
export type GET = objects.Bundle;
|
|
555
568
|
export type PUT = objects.Bundle;
|
|
556
|
-
export type DELETE = {msg:string};
|
|
569
|
+
export type DELETE = { msg: string };
|
|
557
570
|
|
|
558
571
|
export namespace paymentMethod {
|
|
559
|
-
export type POST = {msg:string, PaymentMethod: objects.PaymentMethod};
|
|
572
|
+
export type POST = { msg: string, PaymentMethod: objects.PaymentMethod };
|
|
560
573
|
export namespace $paymentMethodId {
|
|
561
574
|
export type GET = objects.PaymentMethod;
|
|
562
575
|
export type PUT = objects.PaymentMethod;
|
|
563
|
-
export type DELETE = {msg:string};
|
|
576
|
+
export type DELETE = { msg: string };
|
|
564
577
|
}
|
|
565
578
|
}
|
|
566
579
|
}
|
|
@@ -569,11 +582,11 @@ export namespace AuthApi {
|
|
|
569
582
|
export type GET = objects.Bundle[]
|
|
570
583
|
}
|
|
571
584
|
export namespace product {
|
|
572
|
-
export type POST = {msg:string, product?:objects.Product};
|
|
585
|
+
export type POST = { msg: string, product?: objects.Product };
|
|
573
586
|
export namespace $productId {
|
|
574
587
|
export type GET = objects.Product;
|
|
575
588
|
export type PUT = objects.Product;
|
|
576
|
-
export type DELETE = {msg:string};
|
|
589
|
+
export type DELETE = { msg: string };
|
|
577
590
|
}
|
|
578
591
|
}
|
|
579
592
|
export namespace products {
|
|
@@ -584,17 +597,17 @@ export namespace AuthApi {
|
|
|
584
597
|
}
|
|
585
598
|
|
|
586
599
|
export namespace course {
|
|
587
|
-
export type POST = {msg:string, course?:objects.Course};
|
|
600
|
+
export type POST = { msg: string, course?: objects.Course };
|
|
588
601
|
export namespace $courseId {
|
|
589
602
|
export type GET = objects.Course;
|
|
590
603
|
export type PUT = objects.Course;
|
|
591
|
-
export type DELETE = {msg:string};
|
|
604
|
+
export type DELETE = { msg: string };
|
|
592
605
|
|
|
593
606
|
export namespace teachers {
|
|
594
607
|
export type GET = objects.Teacher[]
|
|
595
608
|
}
|
|
596
609
|
export namespace enroll {
|
|
597
|
-
export type POST = {msg?:string, url?: string}
|
|
610
|
+
export type POST = { msg?: string, url?: string }
|
|
598
611
|
}
|
|
599
612
|
}
|
|
600
613
|
}
|
|
@@ -675,7 +688,7 @@ export namespace AuthApi {
|
|
|
675
688
|
export type GET = Array<{ id: number; nome: string; uf: number; ibge: number }>;
|
|
676
689
|
}
|
|
677
690
|
}
|
|
678
|
-
|
|
691
|
+
|
|
679
692
|
export namespace report {
|
|
680
693
|
export type POST = { msg?: string };
|
|
681
694
|
}
|
|
@@ -683,7 +696,7 @@ export namespace AuthApi {
|
|
|
683
696
|
export namespace admin {
|
|
684
697
|
export namespace purchases {
|
|
685
698
|
export namespace search {
|
|
686
|
-
export type POST = {purchases: objects.Purchase[], pagination: auxiliarTypes.PaginationInfo}
|
|
699
|
+
export type POST = { purchases: objects.Purchase[], pagination: auxiliarTypes.PaginationInfo }
|
|
687
700
|
}
|
|
688
701
|
}
|
|
689
702
|
}
|
|
@@ -918,7 +931,7 @@ export namespace AuthApi {
|
|
|
918
931
|
// ==================== MÉTODOS DE AUTENTICAÇÃO ====================
|
|
919
932
|
|
|
920
933
|
public auth = {
|
|
921
|
-
|
|
934
|
+
|
|
922
935
|
/**
|
|
923
936
|
* Faz login na API
|
|
924
937
|
*/
|
|
@@ -954,10 +967,10 @@ export namespace AuthApi {
|
|
|
954
967
|
}
|
|
955
968
|
|
|
956
969
|
public async checkHealth() {
|
|
957
|
-
if(
|
|
970
|
+
if (!this.isHealth) {
|
|
958
971
|
try {
|
|
959
|
-
const r = await this.request('GET', '',{});
|
|
960
|
-
if(
|
|
972
|
+
const r = await this.request('GET', '', {});
|
|
973
|
+
if (r.success) {
|
|
961
974
|
this.isHealth = true;
|
|
962
975
|
return true;
|
|
963
976
|
}
|
|
@@ -978,23 +991,23 @@ export namespace AuthApi {
|
|
|
978
991
|
update: async (userId: number, userData: Partial<objects.LocalUser>) => {
|
|
979
992
|
return await this.request<responses.user.$userId.PUT>('PUT', `user/${userId}`, userData);
|
|
980
993
|
},
|
|
981
|
-
updateConfig: async (
|
|
994
|
+
updateConfig: async (obj: { id: number, config_ihm_showRates?: boolean }) => {
|
|
982
995
|
return await this.request<responses.user.$userId.updateConfig.PUT>('PUT', `user/${obj.id}/config`, obj);
|
|
983
996
|
},
|
|
984
997
|
updateAdmin: async (userId: number, isAdmin: boolean) => {
|
|
985
998
|
return await this.request<responses.user.$userId.updateAdmin.PUT>('PUT', `user/${userId}/admin`, { isAdmin });
|
|
986
999
|
},
|
|
987
1000
|
license: {
|
|
988
|
-
list: async (userId:number) => {
|
|
1001
|
+
list: async (userId: number) => {
|
|
989
1002
|
return await this.request<responses.user.$userId.licenses.GET>('GET', `user/${userId}/licenses`, {});
|
|
990
1003
|
},
|
|
991
|
-
get: async (userId:number) => {
|
|
1004
|
+
get: async (userId: number) => {
|
|
992
1005
|
return await this.request<responses.user.$userId.license.GET>('GET', `user/${userId}/license`, {});
|
|
993
1006
|
},
|
|
994
|
-
release: async (userId:number) => {
|
|
1007
|
+
release: async (userId: number) => {
|
|
995
1008
|
return await this.request<responses.user.$userId.license.release.POST>('POST', `user/${userId}/license/release`, {});
|
|
996
1009
|
},
|
|
997
|
-
revokeAll: async (userId:number) => {
|
|
1010
|
+
revokeAll: async (userId: number) => {
|
|
998
1011
|
return await this.request<responses.user.$userId.licenses.revokeAll.POST>('GET', `user/${userId}/licenses/revokeAll`, {});
|
|
999
1012
|
}
|
|
1000
1013
|
}
|
|
@@ -1002,25 +1015,25 @@ export namespace AuthApi {
|
|
|
1002
1015
|
|
|
1003
1016
|
public purchases = {
|
|
1004
1017
|
new: async (paymentMethodId: number, userId: number) => {
|
|
1005
|
-
return await this.request<responses.user.$userId.purchase.POST>('POST', `user/${userId}/purchase`, {paymentMethodId});
|
|
1018
|
+
return await this.request<responses.user.$userId.purchase.POST>('POST', `user/${userId}/purchase`, { paymentMethodId });
|
|
1006
1019
|
},
|
|
1007
1020
|
sync: async (purchaseId: number, userId: number, async: boolean = false) => {
|
|
1008
1021
|
return await this.request<responses.user.$userId.purchase.$purchaseId.sync.POST>('POST', `user/${userId}/purchase/${purchaseId}/sync`, { async });
|
|
1009
1022
|
},
|
|
1010
1023
|
update: async (userId: number, purchase: objects.Purchase) => {
|
|
1011
|
-
return await this.request<responses.user.$userId.purchase.$purchaseId.PUT>('PUT', `user/${userId}/purchase/${purchase.id}`, purchase
|
|
1024
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.PUT>('PUT', `user/${userId}/purchase/${purchase.id}`, purchase);
|
|
1012
1025
|
},
|
|
1013
1026
|
cancel: async (purchaseId: number, userId: number) => {
|
|
1014
|
-
return await this.request<responses.user.$userId.purchase.$purchaseId.cancel.POST>('POST', `user/${userId}/purchase/${purchaseId}/cancel`, {}
|
|
1027
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.cancel.POST>('POST', `user/${userId}/purchase/${purchaseId}/cancel`, {});
|
|
1015
1028
|
},
|
|
1016
1029
|
delete: async (purchaseId: number, userId: number) => {
|
|
1017
|
-
return await this.request<responses.user.$userId.purchase.$purchaseId.DELETE>('DELETE', `user/${userId}/purchase/${purchaseId}`, {
|
|
1030
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.DELETE>('DELETE', `user/${userId}/purchase/${purchaseId}`, {});
|
|
1018
1031
|
},
|
|
1019
1032
|
listForUser: async (userId: number) => {
|
|
1020
|
-
return await this.request<responses.user.$userId.purchases.GET>('GET', `user/${userId}/purchases`, {
|
|
1033
|
+
return await this.request<responses.user.$userId.purchases.GET>('GET', `user/${userId}/purchases`, {});
|
|
1021
1034
|
},
|
|
1022
|
-
list: async (page: number=1, pageSize: number=10) => {
|
|
1023
|
-
return await this.request<responses.admin.purchases.search.POST>('GET', `admin/purchases/search`, { page, pageSize});
|
|
1035
|
+
list: async (page: number = 1, pageSize: number = 10) => {
|
|
1036
|
+
return await this.request<responses.admin.purchases.search.POST>('GET', `admin/purchases/search`, { page, pageSize });
|
|
1024
1037
|
},
|
|
1025
1038
|
getFromGateway: async (purchaseId: number, userId: number, async: boolean = false) => {
|
|
1026
1039
|
return await this.request<responses.user.$userId.purchase.$purchaseId.getFromGateway.GET>('GET', `user/${userId}/purchase/${purchaseId}/getFromGateway`, {});
|
|
@@ -1057,11 +1070,11 @@ export namespace AuthApi {
|
|
|
1057
1070
|
countries: async () => {
|
|
1058
1071
|
return await this.request<responses.aux.countries.GET>('GET', 'aux/countries', {});
|
|
1059
1072
|
},
|
|
1060
|
-
|
|
1073
|
+
|
|
1061
1074
|
states: async (countryId: number) => {
|
|
1062
1075
|
return await this.request<responses.aux.states.GET>('GET', `aux/country/${countryId}/states`, {});
|
|
1063
1076
|
},
|
|
1064
|
-
|
|
1077
|
+
|
|
1065
1078
|
cities: async (countryId: number, stateId: number) => {
|
|
1066
1079
|
return await this.request<responses.aux.cities.GET>('GET', `aux/country/${countryId}/state/${stateId}/cities`, {});
|
|
1067
1080
|
}
|
|
@@ -1083,12 +1096,12 @@ export namespace AuthApi {
|
|
|
1083
1096
|
};
|
|
1084
1097
|
return await this.request<responses.logs.POST_SEARCH>('POST', 'logs', defaultFilters);
|
|
1085
1098
|
},
|
|
1086
|
-
|
|
1099
|
+
|
|
1087
1100
|
status: async () => {
|
|
1088
1101
|
return await this.request<responses.logs.status.GET>('GET', 'logs/status', {});
|
|
1089
1102
|
}
|
|
1090
1103
|
},
|
|
1091
|
-
|
|
1104
|
+
|
|
1092
1105
|
cronJobs: {
|
|
1093
1106
|
status: async () => {
|
|
1094
1107
|
return await this.request<responses.cronJobs.status.GET>('GET', 'admin/cronjobs/status', {});
|
|
@@ -1098,7 +1111,7 @@ export namespace AuthApi {
|
|
|
1098
1111
|
}
|
|
1099
1112
|
}
|
|
1100
1113
|
}
|
|
1101
|
-
|
|
1114
|
+
|
|
1102
1115
|
public report = {
|
|
1103
1116
|
new: async (id: string, data: any) => {
|
|
1104
1117
|
|
|
@@ -1109,7 +1122,7 @@ export namespace AuthApi {
|
|
|
1109
1122
|
});
|
|
1110
1123
|
}
|
|
1111
1124
|
}
|
|
1112
|
-
|
|
1125
|
+
|
|
1113
1126
|
}
|
|
1114
1127
|
|
|
1115
1128
|
}
|