@authenty/authapi-types 1.0.25 → 1.0.26
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 +12 -2
- package/package.json +1 -1
- package/src/index.ts +62 -52
package/dist/index.d.ts
CHANGED
|
@@ -485,8 +485,18 @@ export declare namespace AuthApi {
|
|
|
485
485
|
type GET = objects.Purchase[];
|
|
486
486
|
namespace getByProduct {
|
|
487
487
|
type GET = {
|
|
488
|
-
ownPurchases: objects.Purchase
|
|
489
|
-
|
|
488
|
+
ownPurchases: (objects.Purchase & {
|
|
489
|
+
Wallet: objects.Wallet;
|
|
490
|
+
PaymentMethod: objects.PaymentMethod & {
|
|
491
|
+
Bundle: objects.Bundle;
|
|
492
|
+
};
|
|
493
|
+
})[];
|
|
494
|
+
sharedPurchases: (objects.Purchase & {
|
|
495
|
+
Wallet: objects.Wallet;
|
|
496
|
+
PaymentMethod: objects.PaymentMethod & {
|
|
497
|
+
Bundle: objects.Bundle;
|
|
498
|
+
};
|
|
499
|
+
})[];
|
|
490
500
|
};
|
|
491
501
|
}
|
|
492
502
|
}
|
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,
|
|
@@ -465,8 +465,8 @@ export namespace AuthApi {
|
|
|
465
465
|
|
|
466
466
|
export type GET = objects.LocalUser & { Wallets?: objects.Wallet[]; PurchasesShares?: objects.PurchaseShare[] };
|
|
467
467
|
export type PUT = objects.LocalUser;
|
|
468
|
-
export type DELETE = {msg?:string};
|
|
469
|
-
|
|
468
|
+
export type DELETE = { msg?: string };
|
|
469
|
+
|
|
470
470
|
export namespace updateConfig {
|
|
471
471
|
export type PUT = { msg?: string };
|
|
472
472
|
}
|
|
@@ -475,26 +475,26 @@ export namespace AuthApi {
|
|
|
475
475
|
}
|
|
476
476
|
export namespace license {
|
|
477
477
|
// export type PUT = { availableLicenses: number; heldLicenses: number; usedLicenses: number; msg?: string };
|
|
478
|
-
export type GET = { msg?: string, license: objects.License}
|
|
478
|
+
export type GET = { msg?: string, license: objects.License }
|
|
479
479
|
|
|
480
480
|
export namespace release {
|
|
481
|
-
export type POST = {msg?:string}
|
|
481
|
+
export type POST = { msg?: string }
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
export namespace licenses {
|
|
485
485
|
export type GET = objects.License[]
|
|
486
486
|
export namespace revokeAll {
|
|
487
|
-
export type POST = {msg: string}
|
|
487
|
+
export type POST = { msg: string }
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
-
|
|
490
|
+
|
|
491
491
|
export namespace availableProducts {
|
|
492
492
|
export type GET = auxiliarTypes.availableSoftware[]
|
|
493
493
|
}
|
|
494
|
-
|
|
494
|
+
|
|
495
495
|
export namespace purchase {
|
|
496
496
|
|
|
497
|
-
export type POST = {
|
|
497
|
+
export type POST = {
|
|
498
498
|
msg?: string;
|
|
499
499
|
code: number,
|
|
500
500
|
purchase?: objects.Purchase;
|
|
@@ -508,7 +508,7 @@ export namespace AuthApi {
|
|
|
508
508
|
|
|
509
509
|
export namespace sync {
|
|
510
510
|
export type POST = {
|
|
511
|
-
msg:string,
|
|
511
|
+
msg: string,
|
|
512
512
|
Purchase: objects.Purchase
|
|
513
513
|
};
|
|
514
514
|
}
|
|
@@ -516,20 +516,30 @@ export namespace AuthApi {
|
|
|
516
516
|
export type GET = objects.PaymentSystem.PG_Purchase;
|
|
517
517
|
}
|
|
518
518
|
export namespace cancel {
|
|
519
|
-
export type POST = {msg?:string, Purchase: objects.Purchase};
|
|
519
|
+
export type POST = { msg?: string, Purchase: objects.Purchase };
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
}
|
|
525
525
|
export namespace purchases {
|
|
526
|
-
|
|
526
|
+
|
|
527
527
|
export type GET = objects.Purchase[];
|
|
528
528
|
|
|
529
529
|
export namespace getByProduct {
|
|
530
530
|
export type GET = {
|
|
531
|
-
ownPurchases: objects.Purchase
|
|
532
|
-
|
|
531
|
+
ownPurchases: (objects.Purchase & {
|
|
532
|
+
Wallet: objects.Wallet;
|
|
533
|
+
PaymentMethod: objects.PaymentMethod & {
|
|
534
|
+
Bundle: objects.Bundle;
|
|
535
|
+
};
|
|
536
|
+
})[],
|
|
537
|
+
sharedPurchases: (objects.Purchase & {
|
|
538
|
+
Wallet: objects.Wallet;
|
|
539
|
+
PaymentMethod: objects.PaymentMethod & {
|
|
540
|
+
Bundle: objects.Bundle;
|
|
541
|
+
};
|
|
542
|
+
})[]
|
|
533
543
|
}
|
|
534
544
|
}
|
|
535
545
|
}
|
|
@@ -539,28 +549,28 @@ export namespace AuthApi {
|
|
|
539
549
|
Licenses: objects.License[]
|
|
540
550
|
})[]
|
|
541
551
|
export namespace renew {
|
|
542
|
-
export type GET = {msg:string}
|
|
552
|
+
export type GET = { msg: string }
|
|
543
553
|
}
|
|
544
554
|
export namespace revokeAllLicenses {
|
|
545
|
-
export type GET = {msg:string}
|
|
555
|
+
export type GET = { msg: string }
|
|
546
556
|
}
|
|
547
557
|
}
|
|
548
558
|
}
|
|
549
559
|
}
|
|
550
|
-
|
|
560
|
+
|
|
551
561
|
export namespace bundle {
|
|
552
|
-
export type POST = {msg:string, Bundle?: objects.Bundle};
|
|
562
|
+
export type POST = { msg: string, Bundle?: objects.Bundle };
|
|
553
563
|
export namespace $bundleId {
|
|
554
564
|
export type GET = objects.Bundle;
|
|
555
565
|
export type PUT = objects.Bundle;
|
|
556
|
-
export type DELETE = {msg:string};
|
|
566
|
+
export type DELETE = { msg: string };
|
|
557
567
|
|
|
558
568
|
export namespace paymentMethod {
|
|
559
|
-
export type POST = {msg:string, PaymentMethod: objects.PaymentMethod};
|
|
569
|
+
export type POST = { msg: string, PaymentMethod: objects.PaymentMethod };
|
|
560
570
|
export namespace $paymentMethodId {
|
|
561
571
|
export type GET = objects.PaymentMethod;
|
|
562
572
|
export type PUT = objects.PaymentMethod;
|
|
563
|
-
export type DELETE = {msg:string};
|
|
573
|
+
export type DELETE = { msg: string };
|
|
564
574
|
}
|
|
565
575
|
}
|
|
566
576
|
}
|
|
@@ -569,11 +579,11 @@ export namespace AuthApi {
|
|
|
569
579
|
export type GET = objects.Bundle[]
|
|
570
580
|
}
|
|
571
581
|
export namespace product {
|
|
572
|
-
export type POST = {msg:string, product?:objects.Product};
|
|
582
|
+
export type POST = { msg: string, product?: objects.Product };
|
|
573
583
|
export namespace $productId {
|
|
574
584
|
export type GET = objects.Product;
|
|
575
585
|
export type PUT = objects.Product;
|
|
576
|
-
export type DELETE = {msg:string};
|
|
586
|
+
export type DELETE = { msg: string };
|
|
577
587
|
}
|
|
578
588
|
}
|
|
579
589
|
export namespace products {
|
|
@@ -584,17 +594,17 @@ export namespace AuthApi {
|
|
|
584
594
|
}
|
|
585
595
|
|
|
586
596
|
export namespace course {
|
|
587
|
-
export type POST = {msg:string, course?:objects.Course};
|
|
597
|
+
export type POST = { msg: string, course?: objects.Course };
|
|
588
598
|
export namespace $courseId {
|
|
589
599
|
export type GET = objects.Course;
|
|
590
600
|
export type PUT = objects.Course;
|
|
591
|
-
export type DELETE = {msg:string};
|
|
601
|
+
export type DELETE = { msg: string };
|
|
592
602
|
|
|
593
603
|
export namespace teachers {
|
|
594
604
|
export type GET = objects.Teacher[]
|
|
595
605
|
}
|
|
596
606
|
export namespace enroll {
|
|
597
|
-
export type POST = {msg?:string, url?: string}
|
|
607
|
+
export type POST = { msg?: string, url?: string }
|
|
598
608
|
}
|
|
599
609
|
}
|
|
600
610
|
}
|
|
@@ -675,7 +685,7 @@ export namespace AuthApi {
|
|
|
675
685
|
export type GET = Array<{ id: number; nome: string; uf: number; ibge: number }>;
|
|
676
686
|
}
|
|
677
687
|
}
|
|
678
|
-
|
|
688
|
+
|
|
679
689
|
export namespace report {
|
|
680
690
|
export type POST = { msg?: string };
|
|
681
691
|
}
|
|
@@ -683,7 +693,7 @@ export namespace AuthApi {
|
|
|
683
693
|
export namespace admin {
|
|
684
694
|
export namespace purchases {
|
|
685
695
|
export namespace search {
|
|
686
|
-
export type POST = {purchases: objects.Purchase[], pagination: auxiliarTypes.PaginationInfo}
|
|
696
|
+
export type POST = { purchases: objects.Purchase[], pagination: auxiliarTypes.PaginationInfo }
|
|
687
697
|
}
|
|
688
698
|
}
|
|
689
699
|
}
|
|
@@ -918,7 +928,7 @@ export namespace AuthApi {
|
|
|
918
928
|
// ==================== MÉTODOS DE AUTENTICAÇÃO ====================
|
|
919
929
|
|
|
920
930
|
public auth = {
|
|
921
|
-
|
|
931
|
+
|
|
922
932
|
/**
|
|
923
933
|
* Faz login na API
|
|
924
934
|
*/
|
|
@@ -954,10 +964,10 @@ export namespace AuthApi {
|
|
|
954
964
|
}
|
|
955
965
|
|
|
956
966
|
public async checkHealth() {
|
|
957
|
-
if(
|
|
967
|
+
if (!this.isHealth) {
|
|
958
968
|
try {
|
|
959
|
-
const r = await this.request('GET', '',{});
|
|
960
|
-
if(
|
|
969
|
+
const r = await this.request('GET', '', {});
|
|
970
|
+
if (r.success) {
|
|
961
971
|
this.isHealth = true;
|
|
962
972
|
return true;
|
|
963
973
|
}
|
|
@@ -978,23 +988,23 @@ export namespace AuthApi {
|
|
|
978
988
|
update: async (userId: number, userData: Partial<objects.LocalUser>) => {
|
|
979
989
|
return await this.request<responses.user.$userId.PUT>('PUT', `user/${userId}`, userData);
|
|
980
990
|
},
|
|
981
|
-
updateConfig: async (
|
|
991
|
+
updateConfig: async (obj: { id: number, config_ihm_showRates?: boolean }) => {
|
|
982
992
|
return await this.request<responses.user.$userId.updateConfig.PUT>('PUT', `user/${obj.id}/config`, obj);
|
|
983
993
|
},
|
|
984
994
|
updateAdmin: async (userId: number, isAdmin: boolean) => {
|
|
985
995
|
return await this.request<responses.user.$userId.updateAdmin.PUT>('PUT', `user/${userId}/admin`, { isAdmin });
|
|
986
996
|
},
|
|
987
997
|
license: {
|
|
988
|
-
list: async (userId:number) => {
|
|
998
|
+
list: async (userId: number) => {
|
|
989
999
|
return await this.request<responses.user.$userId.licenses.GET>('GET', `user/${userId}/licenses`, {});
|
|
990
1000
|
},
|
|
991
|
-
get: async (userId:number) => {
|
|
1001
|
+
get: async (userId: number) => {
|
|
992
1002
|
return await this.request<responses.user.$userId.license.GET>('GET', `user/${userId}/license`, {});
|
|
993
1003
|
},
|
|
994
|
-
release: async (userId:number) => {
|
|
1004
|
+
release: async (userId: number) => {
|
|
995
1005
|
return await this.request<responses.user.$userId.license.release.POST>('POST', `user/${userId}/license/release`, {});
|
|
996
1006
|
},
|
|
997
|
-
revokeAll: async (userId:number) => {
|
|
1007
|
+
revokeAll: async (userId: number) => {
|
|
998
1008
|
return await this.request<responses.user.$userId.licenses.revokeAll.POST>('GET', `user/${userId}/licenses/revokeAll`, {});
|
|
999
1009
|
}
|
|
1000
1010
|
}
|
|
@@ -1002,25 +1012,25 @@ export namespace AuthApi {
|
|
|
1002
1012
|
|
|
1003
1013
|
public purchases = {
|
|
1004
1014
|
new: async (paymentMethodId: number, userId: number) => {
|
|
1005
|
-
return await this.request<responses.user.$userId.purchase.POST>('POST', `user/${userId}/purchase`, {paymentMethodId});
|
|
1015
|
+
return await this.request<responses.user.$userId.purchase.POST>('POST', `user/${userId}/purchase`, { paymentMethodId });
|
|
1006
1016
|
},
|
|
1007
1017
|
sync: async (purchaseId: number, userId: number, async: boolean = false) => {
|
|
1008
1018
|
return await this.request<responses.user.$userId.purchase.$purchaseId.sync.POST>('POST', `user/${userId}/purchase/${purchaseId}/sync`, { async });
|
|
1009
1019
|
},
|
|
1010
1020
|
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
|
|
1021
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.PUT>('PUT', `user/${userId}/purchase/${purchase.id}`, purchase);
|
|
1012
1022
|
},
|
|
1013
1023
|
cancel: async (purchaseId: number, userId: number) => {
|
|
1014
|
-
return await this.request<responses.user.$userId.purchase.$purchaseId.cancel.POST>('POST', `user/${userId}/purchase/${purchaseId}/cancel`, {}
|
|
1024
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.cancel.POST>('POST', `user/${userId}/purchase/${purchaseId}/cancel`, {});
|
|
1015
1025
|
},
|
|
1016
1026
|
delete: async (purchaseId: number, userId: number) => {
|
|
1017
|
-
return await this.request<responses.user.$userId.purchase.$purchaseId.DELETE>('DELETE', `user/${userId}/purchase/${purchaseId}`, {
|
|
1027
|
+
return await this.request<responses.user.$userId.purchase.$purchaseId.DELETE>('DELETE', `user/${userId}/purchase/${purchaseId}`, {});
|
|
1018
1028
|
},
|
|
1019
1029
|
listForUser: async (userId: number) => {
|
|
1020
|
-
return await this.request<responses.user.$userId.purchases.GET>('GET', `user/${userId}/purchases`, {
|
|
1030
|
+
return await this.request<responses.user.$userId.purchases.GET>('GET', `user/${userId}/purchases`, {});
|
|
1021
1031
|
},
|
|
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});
|
|
1032
|
+
list: async (page: number = 1, pageSize: number = 10) => {
|
|
1033
|
+
return await this.request<responses.admin.purchases.search.POST>('GET', `admin/purchases/search`, { page, pageSize });
|
|
1024
1034
|
},
|
|
1025
1035
|
getFromGateway: async (purchaseId: number, userId: number, async: boolean = false) => {
|
|
1026
1036
|
return await this.request<responses.user.$userId.purchase.$purchaseId.getFromGateway.GET>('GET', `user/${userId}/purchase/${purchaseId}/getFromGateway`, {});
|
|
@@ -1057,11 +1067,11 @@ export namespace AuthApi {
|
|
|
1057
1067
|
countries: async () => {
|
|
1058
1068
|
return await this.request<responses.aux.countries.GET>('GET', 'aux/countries', {});
|
|
1059
1069
|
},
|
|
1060
|
-
|
|
1070
|
+
|
|
1061
1071
|
states: async (countryId: number) => {
|
|
1062
1072
|
return await this.request<responses.aux.states.GET>('GET', `aux/country/${countryId}/states`, {});
|
|
1063
1073
|
},
|
|
1064
|
-
|
|
1074
|
+
|
|
1065
1075
|
cities: async (countryId: number, stateId: number) => {
|
|
1066
1076
|
return await this.request<responses.aux.cities.GET>('GET', `aux/country/${countryId}/state/${stateId}/cities`, {});
|
|
1067
1077
|
}
|
|
@@ -1083,12 +1093,12 @@ export namespace AuthApi {
|
|
|
1083
1093
|
};
|
|
1084
1094
|
return await this.request<responses.logs.POST_SEARCH>('POST', 'logs', defaultFilters);
|
|
1085
1095
|
},
|
|
1086
|
-
|
|
1096
|
+
|
|
1087
1097
|
status: async () => {
|
|
1088
1098
|
return await this.request<responses.logs.status.GET>('GET', 'logs/status', {});
|
|
1089
1099
|
}
|
|
1090
1100
|
},
|
|
1091
|
-
|
|
1101
|
+
|
|
1092
1102
|
cronJobs: {
|
|
1093
1103
|
status: async () => {
|
|
1094
1104
|
return await this.request<responses.cronJobs.status.GET>('GET', 'admin/cronjobs/status', {});
|
|
@@ -1098,7 +1108,7 @@ export namespace AuthApi {
|
|
|
1098
1108
|
}
|
|
1099
1109
|
}
|
|
1100
1110
|
}
|
|
1101
|
-
|
|
1111
|
+
|
|
1102
1112
|
public report = {
|
|
1103
1113
|
new: async (id: string, data: any) => {
|
|
1104
1114
|
|
|
@@ -1109,7 +1119,7 @@ export namespace AuthApi {
|
|
|
1109
1119
|
});
|
|
1110
1120
|
}
|
|
1111
1121
|
}
|
|
1112
|
-
|
|
1122
|
+
|
|
1113
1123
|
}
|
|
1114
1124
|
|
|
1115
1125
|
}
|