@palmetto/users-sdk 0.2.1 → 1.1.0
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/__generated__/schema.d.ts +83 -81
- package/dist/client.d.ts +469 -102
- package/dist/client.js +37 -91
- package/package.json +5 -4
|
@@ -164,10 +164,10 @@ export interface paths {
|
|
|
164
164
|
path?: never;
|
|
165
165
|
cookie?: never;
|
|
166
166
|
};
|
|
167
|
-
/** Get pending sign
|
|
167
|
+
/** Get pending sign-ups */
|
|
168
168
|
get: operations["SignUpsController_findAll"];
|
|
169
169
|
put?: never;
|
|
170
|
-
/** Create
|
|
170
|
+
/** Create sign-up */
|
|
171
171
|
post: operations["SignUpsController_create"];
|
|
172
172
|
delete?: never;
|
|
173
173
|
options?: never;
|
|
@@ -182,15 +182,14 @@ export interface paths {
|
|
|
182
182
|
path?: never;
|
|
183
183
|
cookie?: never;
|
|
184
184
|
};
|
|
185
|
-
/** Find
|
|
185
|
+
/** Find sign-up */
|
|
186
186
|
get: operations["SignUpsController_findOne"];
|
|
187
187
|
put?: never;
|
|
188
188
|
post?: never;
|
|
189
189
|
delete?: never;
|
|
190
190
|
options?: never;
|
|
191
191
|
head?: never;
|
|
192
|
-
|
|
193
|
-
patch: operations["SignUpsController_update"];
|
|
192
|
+
patch?: never;
|
|
194
193
|
trace?: never;
|
|
195
194
|
};
|
|
196
195
|
"/api/sign-ups/{token}/user": {
|
|
@@ -202,7 +201,7 @@ export interface paths {
|
|
|
202
201
|
};
|
|
203
202
|
get?: never;
|
|
204
203
|
put?: never;
|
|
205
|
-
/** Create
|
|
204
|
+
/** Create user with sign-up token */
|
|
206
205
|
post: operations["SignUpsController_createUser"];
|
|
207
206
|
delete?: never;
|
|
208
207
|
options?: never;
|
|
@@ -220,7 +219,7 @@ export interface paths {
|
|
|
220
219
|
get?: never;
|
|
221
220
|
put?: never;
|
|
222
221
|
post?: never;
|
|
223
|
-
/** Delete
|
|
222
|
+
/** Delete sign-up */
|
|
224
223
|
delete: operations["SignUpsController_delete"];
|
|
225
224
|
options?: never;
|
|
226
225
|
head?: never;
|
|
@@ -370,16 +369,16 @@ export interface components {
|
|
|
370
369
|
/** BadRequestError */
|
|
371
370
|
BadRequestErrorDto: {
|
|
372
371
|
/**
|
|
373
|
-
* @example
|
|
372
|
+
* @example BadRequest
|
|
374
373
|
* @enum {string}
|
|
375
374
|
*/
|
|
376
|
-
error: "
|
|
375
|
+
error: "BadRequest";
|
|
377
376
|
/**
|
|
378
|
-
* @example
|
|
377
|
+
* @example 400
|
|
379
378
|
* @enum {number}
|
|
380
379
|
*/
|
|
381
|
-
statusCode:
|
|
382
|
-
/** @example
|
|
380
|
+
statusCode: 400;
|
|
381
|
+
/** @example Request is invalid */
|
|
383
382
|
message: string;
|
|
384
383
|
/** @example Technical error description */
|
|
385
384
|
reason: string;
|
|
@@ -413,6 +412,61 @@ export interface components {
|
|
|
413
412
|
totalPages: number;
|
|
414
413
|
};
|
|
415
414
|
};
|
|
415
|
+
/** ListUser */
|
|
416
|
+
ListUserDto: {
|
|
417
|
+
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
418
|
+
id: string;
|
|
419
|
+
meta: {
|
|
420
|
+
/**
|
|
421
|
+
* Format: date-time
|
|
422
|
+
* @description Created at timestamp
|
|
423
|
+
* @example 2024-09-11T00:09:06.276+0000
|
|
424
|
+
*/
|
|
425
|
+
createdAt: string;
|
|
426
|
+
/**
|
|
427
|
+
* Format: date-time
|
|
428
|
+
* @description Updated at timestamp
|
|
429
|
+
* @example 2024-09-11T00:09:06.276+0000
|
|
430
|
+
*/
|
|
431
|
+
updatedAt?: string;
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* @description Auth0 ID
|
|
435
|
+
* @example auth0|1234567890
|
|
436
|
+
*/
|
|
437
|
+
auth0Id: string | null;
|
|
438
|
+
/**
|
|
439
|
+
* Format: email
|
|
440
|
+
* @description Email
|
|
441
|
+
* @example test@test.com
|
|
442
|
+
*/
|
|
443
|
+
email: string;
|
|
444
|
+
/**
|
|
445
|
+
* @description First name
|
|
446
|
+
* @example John
|
|
447
|
+
*/
|
|
448
|
+
firstName: string;
|
|
449
|
+
/**
|
|
450
|
+
* @description Last name
|
|
451
|
+
* @example Doe
|
|
452
|
+
*/
|
|
453
|
+
lastName: string;
|
|
454
|
+
/**
|
|
455
|
+
* @description Phone number
|
|
456
|
+
* @example +18048675309
|
|
457
|
+
*/
|
|
458
|
+
phoneNumber: string;
|
|
459
|
+
/**
|
|
460
|
+
* @description Organization ID
|
|
461
|
+
* @example 66e3367b141b81fb54ec4e1f
|
|
462
|
+
*/
|
|
463
|
+
organizationId: string;
|
|
464
|
+
/**
|
|
465
|
+
* @description Has Personal Access Token
|
|
466
|
+
* @example false
|
|
467
|
+
*/
|
|
468
|
+
hasPAT: boolean;
|
|
469
|
+
};
|
|
416
470
|
/** CreateUser */
|
|
417
471
|
CreateUserDto: {
|
|
418
472
|
/**
|
|
@@ -443,7 +497,8 @@ export interface components {
|
|
|
443
497
|
phoneNumber: string;
|
|
444
498
|
/** @example 66e25e72d10dfef2f9f6cc60 */
|
|
445
499
|
organizationId: string;
|
|
446
|
-
|
|
500
|
+
/** @default [] */
|
|
501
|
+
grants: {
|
|
447
502
|
/**
|
|
448
503
|
* @description Grant Entity
|
|
449
504
|
* @example photon:blueprint
|
|
@@ -561,8 +616,11 @@ export interface components {
|
|
|
561
616
|
* @example Organization Name
|
|
562
617
|
*/
|
|
563
618
|
name: string;
|
|
564
|
-
/**
|
|
565
|
-
|
|
619
|
+
/**
|
|
620
|
+
* @description Grants
|
|
621
|
+
* @default []
|
|
622
|
+
*/
|
|
623
|
+
grants: {
|
|
566
624
|
/**
|
|
567
625
|
* @description Grant Entity
|
|
568
626
|
* @example photon:blueprint
|
|
@@ -629,6 +687,8 @@ export interface components {
|
|
|
629
687
|
firstName?: string;
|
|
630
688
|
lastName?: string;
|
|
631
689
|
email?: string;
|
|
690
|
+
/** Format: date-time */
|
|
691
|
+
expiresAt: string;
|
|
632
692
|
};
|
|
633
693
|
/** SignUp */
|
|
634
694
|
SignUpDto: {
|
|
@@ -640,11 +700,8 @@ export interface components {
|
|
|
640
700
|
firstName?: string;
|
|
641
701
|
lastName?: string;
|
|
642
702
|
email?: string;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
UpdateSignUpDto: {
|
|
646
|
-
/** @example auth0|6fexxxxxxxxxxxxxxxx */
|
|
647
|
-
auth0Id: string;
|
|
703
|
+
/** Format: date-time */
|
|
704
|
+
expiresAt: string;
|
|
648
705
|
};
|
|
649
706
|
/** CreateSignUp */
|
|
650
707
|
CreateSignUpUserDto: {
|
|
@@ -698,18 +755,6 @@ export interface components {
|
|
|
698
755
|
* @example Doe
|
|
699
756
|
*/
|
|
700
757
|
lastName: string;
|
|
701
|
-
/**
|
|
702
|
-
* @description User permissions
|
|
703
|
-
* @example {
|
|
704
|
-
* "photon:blueprint": [
|
|
705
|
-
* "read",
|
|
706
|
-
* "write"
|
|
707
|
-
* ]
|
|
708
|
-
* }
|
|
709
|
-
*/
|
|
710
|
-
permissions: {
|
|
711
|
-
[key: string]: string[];
|
|
712
|
-
};
|
|
713
758
|
/**
|
|
714
759
|
* @description Phone number
|
|
715
760
|
* @example +18048675309
|
|
@@ -916,7 +961,7 @@ export interface operations {
|
|
|
916
961
|
};
|
|
917
962
|
content: {
|
|
918
963
|
"application/json": {
|
|
919
|
-
data: components["schemas"]["
|
|
964
|
+
data: components["schemas"]["ListUserDto"][];
|
|
920
965
|
} & components["schemas"]["PaginatedListDto"];
|
|
921
966
|
};
|
|
922
967
|
};
|
|
@@ -1702,7 +1747,7 @@ export interface operations {
|
|
|
1702
1747
|
};
|
|
1703
1748
|
};
|
|
1704
1749
|
};
|
|
1705
|
-
|
|
1750
|
+
SignUpsController_createUser: {
|
|
1706
1751
|
parameters: {
|
|
1707
1752
|
query?: never;
|
|
1708
1753
|
header?: never;
|
|
@@ -1713,7 +1758,7 @@ export interface operations {
|
|
|
1713
1758
|
};
|
|
1714
1759
|
requestBody: {
|
|
1715
1760
|
content: {
|
|
1716
|
-
"application/json": components["schemas"]["
|
|
1761
|
+
"application/json": components["schemas"]["CreateSignUpUserDto"];
|
|
1717
1762
|
};
|
|
1718
1763
|
};
|
|
1719
1764
|
responses: {
|
|
@@ -1734,56 +1779,13 @@ export interface operations {
|
|
|
1734
1779
|
"application/json": components["schemas"]["BadRequestErrorDto"];
|
|
1735
1780
|
};
|
|
1736
1781
|
};
|
|
1737
|
-
/** @description When
|
|
1738
|
-
|
|
1739
|
-
headers: {
|
|
1740
|
-
[name: string]: unknown;
|
|
1741
|
-
};
|
|
1742
|
-
content: {
|
|
1743
|
-
"application/json": components["schemas"]["NotFoundErrorDto"];
|
|
1744
|
-
};
|
|
1745
|
-
};
|
|
1746
|
-
/** @description When the sign up token already has an auth0Id */
|
|
1747
|
-
409: {
|
|
1748
|
-
headers: {
|
|
1749
|
-
[name: string]: unknown;
|
|
1750
|
-
};
|
|
1751
|
-
content: {
|
|
1752
|
-
"application/json": components["schemas"]["ConflictErrorDto"];
|
|
1753
|
-
};
|
|
1754
|
-
};
|
|
1755
|
-
};
|
|
1756
|
-
};
|
|
1757
|
-
SignUpsController_createUser: {
|
|
1758
|
-
parameters: {
|
|
1759
|
-
query?: never;
|
|
1760
|
-
header?: never;
|
|
1761
|
-
path: {
|
|
1762
|
-
token: string;
|
|
1763
|
-
};
|
|
1764
|
-
cookie?: never;
|
|
1765
|
-
};
|
|
1766
|
-
requestBody: {
|
|
1767
|
-
content: {
|
|
1768
|
-
"application/json": components["schemas"]["CreateSignUpUserDto"];
|
|
1769
|
-
};
|
|
1770
|
-
};
|
|
1771
|
-
responses: {
|
|
1772
|
-
200: {
|
|
1773
|
-
headers: {
|
|
1774
|
-
[name: string]: unknown;
|
|
1775
|
-
};
|
|
1776
|
-
content: {
|
|
1777
|
-
"application/json": components["schemas"]["SignUpDto"];
|
|
1778
|
-
};
|
|
1779
|
-
};
|
|
1780
|
-
/** @description When the sign up token or body is invalid */
|
|
1781
|
-
400: {
|
|
1782
|
+
/** @description When authentication fails */
|
|
1783
|
+
401: {
|
|
1782
1784
|
headers: {
|
|
1783
1785
|
[name: string]: unknown;
|
|
1784
1786
|
};
|
|
1785
1787
|
content: {
|
|
1786
|
-
"application/json": components["schemas"]["
|
|
1788
|
+
"application/json": components["schemas"]["UnauthorizedErrorDto"];
|
|
1787
1789
|
};
|
|
1788
1790
|
};
|
|
1789
1791
|
/** @description When the sign up is not found */
|
package/dist/client.d.ts
CHANGED
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
import { BaseSdkClient, CreateSdkClientInput, RequestOptions } from "@palmetto/base-sdk-client";
|
|
1
|
+
import { ApiInput, ApiResponse, BaseSdkClient, CreateSdkClientInput, RequestOptions } from "@palmetto/base-sdk-client";
|
|
2
2
|
import { paths } from "./__generated__/schema";
|
|
3
|
-
export type MeResponse = paths["/api/users/me"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
4
|
-
export type UpdateMeInput = paths["/api/users/me"]["patch"]["requestBody"]["content"]["application/json"];
|
|
5
|
-
export type UpdateMeResponse = paths["/api/users/me"]["patch"]["responses"]["200"]["content"]["application/json"];
|
|
6
|
-
export type UpdateUserByIdInput = paths["/api/users/{id}"]["patch"]["parameters"]["path"] & paths["/api/users/{id}"]["patch"]["requestBody"]["content"]["application/json"];
|
|
7
|
-
export type UpdateUserByIdResponse = paths["/api/users/{id}"]["patch"]["responses"]["200"]["content"]["application/json"];
|
|
8
|
-
export type GetUsersInput = NonNullable<paths["/api/users"]["get"]["parameters"]["query"]>;
|
|
9
|
-
export type GetUsersResponse = paths["/api/users"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
10
|
-
export type GetUserByIdInput = paths["/api/users/{id}"]["get"]["parameters"]["path"];
|
|
11
|
-
export type GetUserByIdResponse = paths["/api/users/{id}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
12
|
-
export type GetOrganizationInput = paths["/api/organizations/{id}"]["get"]["parameters"]["path"];
|
|
13
|
-
export type GetOrganizationResponse = paths["/api/organizations/{id}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
14
|
-
export type UpdateOrganizationInput = paths["/api/organizations/{id}"]["patch"]["parameters"]["path"] & paths["/api/organizations/{id}"]["patch"]["requestBody"]["content"]["application/json"];
|
|
15
|
-
export type UpdateOrganizationResponse = paths["/api/organizations/{id}"]["patch"]["responses"]["200"]["content"]["application/json"];
|
|
16
|
-
export type CreateSignUpInput = paths["/api/sign-ups"]["post"]["requestBody"]["content"]["application/json"];
|
|
17
|
-
export type CreateSignUpResponse = paths["/api/sign-ups"]["post"]["responses"]["200"]["content"]["application/json"];
|
|
18
|
-
export type GetSignUpInput = paths["/api/sign-ups/{token}"]["get"]["parameters"]["path"];
|
|
19
|
-
export type GetSignUpResponse = paths["/api/sign-ups/{token}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
20
|
-
export type CreateSignUpUserInput = paths["/api/sign-ups/{token}/user"]["post"]["parameters"]["path"] & paths["/api/sign-ups/{token}/user"]["post"]["requestBody"]["content"]["application/json"];
|
|
21
|
-
export interface GetAuthTokenInput {
|
|
22
|
-
code: string;
|
|
23
|
-
}
|
|
24
|
-
export interface RefreshTokenInput {
|
|
25
|
-
refreshToken: string;
|
|
26
|
-
}
|
|
27
3
|
export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
28
4
|
constructor(input: CreateSdkClientInput);
|
|
29
5
|
me(opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
@@ -42,11 +18,32 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
42
18
|
phoneNumber: string;
|
|
43
19
|
organizationId: string;
|
|
44
20
|
hasPAT: boolean;
|
|
45
|
-
}> | import("@palmetto/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
21
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
22
|
+
200: {
|
|
23
|
+
headers: {
|
|
24
|
+
[name: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
content: {
|
|
27
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UserDto"];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
401: {
|
|
31
|
+
headers: {
|
|
32
|
+
[name: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
content: {
|
|
35
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
403: {
|
|
39
|
+
headers: {
|
|
40
|
+
[name: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
content: {
|
|
43
|
+
"application/json": import("./__generated__/schema").components["schemas"]["ForbiddenErrorDto"];
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}, `${string}/${string}`>>>;
|
|
50
47
|
updateMe(input: UpdateMeInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
51
48
|
id: string;
|
|
52
49
|
meta: {
|
|
@@ -63,14 +60,41 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
63
60
|
phoneNumber: string;
|
|
64
61
|
organizationId: string;
|
|
65
62
|
hasPAT: boolean;
|
|
66
|
-
}> | import("@palmetto/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
64
|
+
200: {
|
|
65
|
+
headers: {
|
|
66
|
+
[name: string]: unknown;
|
|
67
|
+
};
|
|
68
|
+
content: {
|
|
69
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UserDto"];
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
400: {
|
|
73
|
+
headers: {
|
|
74
|
+
[name: string]: unknown;
|
|
75
|
+
};
|
|
76
|
+
content: {
|
|
77
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
401: {
|
|
81
|
+
headers: {
|
|
82
|
+
[name: string]: unknown;
|
|
83
|
+
};
|
|
84
|
+
content: {
|
|
85
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
403: {
|
|
89
|
+
headers: {
|
|
90
|
+
[name: string]: unknown;
|
|
91
|
+
};
|
|
92
|
+
content: {
|
|
93
|
+
"application/json": import("./__generated__/schema").components["schemas"]["ForbiddenErrorDto"];
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
}, `${string}/${string}`>>>;
|
|
97
|
+
updateUser({ id, ...input }: UpdateUserInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
74
98
|
id: string;
|
|
75
99
|
meta: {
|
|
76
100
|
createdAt: string;
|
|
@@ -86,19 +110,50 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
86
110
|
phoneNumber: string;
|
|
87
111
|
organizationId: string;
|
|
88
112
|
hasPAT: boolean;
|
|
89
|
-
}> | import("@palmetto/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
113
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
114
|
+
200: {
|
|
115
|
+
headers: {
|
|
116
|
+
[name: string]: unknown;
|
|
117
|
+
};
|
|
118
|
+
content: {
|
|
119
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UserDto"];
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
400: {
|
|
123
|
+
headers: {
|
|
124
|
+
[name: string]: unknown;
|
|
125
|
+
};
|
|
126
|
+
content: {
|
|
127
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
401: {
|
|
131
|
+
headers: {
|
|
132
|
+
[name: string]: unknown;
|
|
133
|
+
};
|
|
134
|
+
content: {
|
|
135
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
403: {
|
|
139
|
+
headers: {
|
|
140
|
+
[name: string]: unknown;
|
|
141
|
+
};
|
|
142
|
+
content: {
|
|
143
|
+
"application/json": import("./__generated__/schema").components["schemas"]["ForbiddenErrorDto"];
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
404: {
|
|
147
|
+
headers: {
|
|
148
|
+
[name: string]: unknown;
|
|
149
|
+
};
|
|
150
|
+
content: {
|
|
151
|
+
"application/json": import("./__generated__/schema").components["schemas"]["NotFoundErrorDto"];
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}, `${string}/${string}`>>>;
|
|
155
|
+
getUsers(input: GetUsersInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
156
|
+
data: import("./__generated__/schema").components["schemas"]["ListUserDto"][];
|
|
102
157
|
} & {
|
|
103
158
|
data: unknown[];
|
|
104
159
|
paging: {
|
|
@@ -109,8 +164,43 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
109
164
|
totalRecords: number;
|
|
110
165
|
totalPages: number;
|
|
111
166
|
};
|
|
112
|
-
}
|
|
113
|
-
|
|
167
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
168
|
+
200: {
|
|
169
|
+
headers: {
|
|
170
|
+
[name: string]: unknown;
|
|
171
|
+
};
|
|
172
|
+
content: {
|
|
173
|
+
"application/json": {
|
|
174
|
+
data: import("./__generated__/schema").components["schemas"]["ListUserDto"][];
|
|
175
|
+
} & import("./__generated__/schema").components["schemas"]["PaginatedListDto"];
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
400: {
|
|
179
|
+
headers: {
|
|
180
|
+
[name: string]: unknown;
|
|
181
|
+
};
|
|
182
|
+
content: {
|
|
183
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
401: {
|
|
187
|
+
headers: {
|
|
188
|
+
[name: string]: unknown;
|
|
189
|
+
};
|
|
190
|
+
content: {
|
|
191
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
403: {
|
|
195
|
+
headers: {
|
|
196
|
+
[name: string]: unknown;
|
|
197
|
+
};
|
|
198
|
+
content: {
|
|
199
|
+
"application/json": import("./__generated__/schema").components["schemas"]["ForbiddenErrorDto"];
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
}, `${string}/${string}`>>>;
|
|
203
|
+
getUser({ id }: GetUserInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
114
204
|
id: string;
|
|
115
205
|
meta: {
|
|
116
206
|
createdAt: string;
|
|
@@ -126,20 +216,49 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
126
216
|
phoneNumber: string;
|
|
127
217
|
organizationId: string;
|
|
128
218
|
hasPAT: boolean;
|
|
129
|
-
}> | import("@palmetto/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
219
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
220
|
+
200: {
|
|
221
|
+
headers: {
|
|
222
|
+
[name: string]: unknown;
|
|
223
|
+
};
|
|
224
|
+
content: {
|
|
225
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UserDto"];
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
400: {
|
|
229
|
+
headers: {
|
|
230
|
+
[name: string]: unknown;
|
|
231
|
+
};
|
|
232
|
+
content: {
|
|
233
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
401: {
|
|
237
|
+
headers: {
|
|
238
|
+
[name: string]: unknown;
|
|
239
|
+
};
|
|
240
|
+
content: {
|
|
241
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
403: {
|
|
245
|
+
headers: {
|
|
246
|
+
[name: string]: unknown;
|
|
247
|
+
};
|
|
248
|
+
content: {
|
|
249
|
+
"application/json": import("./__generated__/schema").components["schemas"]["ForbiddenErrorDto"];
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
404: {
|
|
253
|
+
headers: {
|
|
254
|
+
[name: string]: unknown;
|
|
255
|
+
};
|
|
256
|
+
content: {
|
|
257
|
+
"application/json": import("./__generated__/schema").components["schemas"]["NotFoundErrorDto"];
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
}, `${string}/${string}`>>>;
|
|
261
|
+
getOrganization({ id }: GetOrganizationInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
143
262
|
id: string;
|
|
144
263
|
meta: {
|
|
145
264
|
createdAt: string;
|
|
@@ -149,14 +268,49 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
149
268
|
permissions: {
|
|
150
269
|
[key: string]: string[];
|
|
151
270
|
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
271
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
272
|
+
200: {
|
|
273
|
+
headers: {
|
|
274
|
+
[name: string]: unknown;
|
|
275
|
+
};
|
|
276
|
+
content: {
|
|
277
|
+
"application/json": import("./__generated__/schema").components["schemas"]["OrganizationDto"];
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
400: {
|
|
281
|
+
headers: {
|
|
282
|
+
[name: string]: unknown;
|
|
283
|
+
};
|
|
284
|
+
content: {
|
|
285
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
401: {
|
|
289
|
+
headers: {
|
|
290
|
+
[name: string]: unknown;
|
|
291
|
+
};
|
|
292
|
+
content: {
|
|
293
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
403: {
|
|
297
|
+
headers: {
|
|
298
|
+
[name: string]: unknown;
|
|
299
|
+
};
|
|
300
|
+
content: {
|
|
301
|
+
"application/json": import("./__generated__/schema").components["schemas"]["ForbiddenErrorDto"];
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
404: {
|
|
305
|
+
headers: {
|
|
306
|
+
[name: string]: unknown;
|
|
307
|
+
};
|
|
308
|
+
content: {
|
|
309
|
+
"application/json": import("./__generated__/schema").components["schemas"]["NotFoundErrorDto"];
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
}, `${string}/${string}`>>>;
|
|
313
|
+
updateOrganization({ id, ...input }: UpdateOrganizationInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
160
314
|
id: string;
|
|
161
315
|
meta: {
|
|
162
316
|
createdAt: string;
|
|
@@ -166,19 +320,77 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
166
320
|
permissions: {
|
|
167
321
|
[key: string]: string[];
|
|
168
322
|
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
323
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
324
|
+
200: {
|
|
325
|
+
headers: {
|
|
326
|
+
[name: string]: unknown;
|
|
327
|
+
};
|
|
328
|
+
content: {
|
|
329
|
+
"application/json": import("./__generated__/schema").components["schemas"]["OrganizationDto"];
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
400: {
|
|
333
|
+
headers: {
|
|
334
|
+
[name: string]: unknown;
|
|
335
|
+
};
|
|
336
|
+
content: {
|
|
337
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
401: {
|
|
341
|
+
headers: {
|
|
342
|
+
[name: string]: unknown;
|
|
343
|
+
};
|
|
344
|
+
content: {
|
|
345
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
403: {
|
|
349
|
+
headers: {
|
|
350
|
+
[name: string]: unknown;
|
|
351
|
+
};
|
|
352
|
+
content: {
|
|
353
|
+
"application/json": import("./__generated__/schema").components["schemas"]["ForbiddenErrorDto"];
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
404: {
|
|
357
|
+
headers: {
|
|
358
|
+
[name: string]: unknown;
|
|
359
|
+
};
|
|
360
|
+
content: {
|
|
361
|
+
"application/json": import("./__generated__/schema").components["schemas"]["NotFoundErrorDto"];
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
}, `${string}/${string}`>>>;
|
|
365
|
+
createSignUp(input: CreateSignUpInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
175
366
|
token: string;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
367
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
368
|
+
200: {
|
|
369
|
+
headers: {
|
|
370
|
+
[name: string]: unknown;
|
|
371
|
+
};
|
|
372
|
+
content: {
|
|
373
|
+
"application/json": import("./__generated__/schema").components["schemas"]["SignUpTokenDto"];
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
400: {
|
|
377
|
+
headers: {
|
|
378
|
+
[name: string]: unknown;
|
|
379
|
+
};
|
|
380
|
+
content: {
|
|
381
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
401: {
|
|
385
|
+
headers: {
|
|
386
|
+
[name: string]: unknown;
|
|
387
|
+
};
|
|
388
|
+
content: {
|
|
389
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
}, `${string}/${string}`>>>;
|
|
393
|
+
getSignUp({ token }: GetSignUpInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
182
394
|
redirectUrl: string;
|
|
183
395
|
auth0Id?: string;
|
|
184
396
|
userId?: string;
|
|
@@ -186,12 +398,82 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
186
398
|
firstName?: string;
|
|
187
399
|
lastName?: string;
|
|
188
400
|
email?: string;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
401
|
+
expiresAt: string;
|
|
402
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
403
|
+
200: {
|
|
404
|
+
headers: {
|
|
405
|
+
[name: string]: unknown;
|
|
406
|
+
};
|
|
407
|
+
content: {
|
|
408
|
+
"application/json": import("./__generated__/schema").components["schemas"]["SignUpDto"];
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
400: {
|
|
412
|
+
headers: {
|
|
413
|
+
[name: string]: unknown;
|
|
414
|
+
};
|
|
415
|
+
content: {
|
|
416
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
404: {
|
|
420
|
+
headers: {
|
|
421
|
+
[name: string]: unknown;
|
|
422
|
+
};
|
|
423
|
+
content: {
|
|
424
|
+
"application/json": import("./__generated__/schema").components["schemas"]["NotFoundErrorDto"];
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
}, `${string}/${string}`>>>;
|
|
428
|
+
getSignUps(input: GetSignUpsInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
429
|
+
data: import("./__generated__/schema").components["schemas"]["SignUpAdminDto"][];
|
|
430
|
+
} & {
|
|
431
|
+
data: unknown[];
|
|
432
|
+
paging: {
|
|
433
|
+
limit: number;
|
|
434
|
+
page: number;
|
|
435
|
+
pageStart: number;
|
|
436
|
+
pageEnd: number;
|
|
437
|
+
totalRecords: number;
|
|
438
|
+
totalPages: number;
|
|
439
|
+
};
|
|
440
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
441
|
+
200: {
|
|
442
|
+
headers: {
|
|
443
|
+
[name: string]: unknown;
|
|
444
|
+
};
|
|
445
|
+
content: {
|
|
446
|
+
"application/json": {
|
|
447
|
+
data: import("./__generated__/schema").components["schemas"]["SignUpAdminDto"][];
|
|
448
|
+
} & import("./__generated__/schema").components["schemas"]["PaginatedListDto"];
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
400: {
|
|
452
|
+
headers: {
|
|
453
|
+
[name: string]: unknown;
|
|
454
|
+
};
|
|
455
|
+
content: {
|
|
456
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
401: {
|
|
460
|
+
headers: {
|
|
461
|
+
[name: string]: unknown;
|
|
462
|
+
};
|
|
463
|
+
content: {
|
|
464
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
403: {
|
|
468
|
+
headers: {
|
|
469
|
+
[name: string]: unknown;
|
|
470
|
+
};
|
|
471
|
+
content: {
|
|
472
|
+
"application/json": import("./__generated__/schema").components["schemas"]["ForbiddenErrorDto"];
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
}, `${string}/${string}`>>>;
|
|
476
|
+
createSignUpUser({ token, ...body }: CreateSignUpUserInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
195
477
|
redirectUrl: string;
|
|
196
478
|
auth0Id?: string;
|
|
197
479
|
userId?: string;
|
|
@@ -199,24 +481,109 @@ export declare class UsersApiClient extends BaseSdkClient<paths> {
|
|
|
199
481
|
firstName?: string;
|
|
200
482
|
lastName?: string;
|
|
201
483
|
email?: string;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
484
|
+
expiresAt: string;
|
|
485
|
+
}> | import("@palmetto/base-sdk-client").SdkError<import("openapi-typescript-helpers").ErrorResponse<{
|
|
486
|
+
200: {
|
|
487
|
+
headers: {
|
|
488
|
+
[name: string]: unknown;
|
|
489
|
+
};
|
|
490
|
+
content: {
|
|
491
|
+
"application/json": import("./__generated__/schema").components["schemas"]["SignUpDto"];
|
|
492
|
+
};
|
|
493
|
+
};
|
|
494
|
+
400: {
|
|
495
|
+
headers: {
|
|
496
|
+
[name: string]: unknown;
|
|
497
|
+
};
|
|
498
|
+
content: {
|
|
499
|
+
"application/json": import("./__generated__/schema").components["schemas"]["BadRequestErrorDto"];
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
401: {
|
|
503
|
+
headers: {
|
|
504
|
+
[name: string]: unknown;
|
|
505
|
+
};
|
|
506
|
+
content: {
|
|
507
|
+
"application/json": import("./__generated__/schema").components["schemas"]["UnauthorizedErrorDto"];
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
404: {
|
|
511
|
+
headers: {
|
|
512
|
+
[name: string]: unknown;
|
|
513
|
+
};
|
|
514
|
+
content: {
|
|
515
|
+
"application/json": import("./__generated__/schema").components["schemas"]["NotFoundErrorDto"];
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
409: {
|
|
519
|
+
headers: {
|
|
520
|
+
[name: string]: unknown;
|
|
521
|
+
};
|
|
522
|
+
content: {
|
|
523
|
+
"application/json": import("./__generated__/schema").components["schemas"]["ConflictErrorDto"];
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
}, `${string}/${string}`>>>;
|
|
527
|
+
getAuthToken({ code }: GetAuthTokenInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
208
528
|
accessToken: string;
|
|
209
529
|
idToken: string;
|
|
210
530
|
refreshToken: string;
|
|
211
531
|
expiresIn: number;
|
|
532
|
+
}> | import("@palmetto/base-sdk-client").SdkError<{
|
|
533
|
+
error: "BadRequest";
|
|
534
|
+
statusCode: 400;
|
|
535
|
+
message: string;
|
|
536
|
+
reason: string;
|
|
537
|
+
validations: {
|
|
538
|
+
[key: string]: string[];
|
|
539
|
+
};
|
|
212
540
|
}>>;
|
|
213
|
-
refreshToken({ refreshToken }: RefreshTokenInput, opts?: RequestOptions): Promise<import("@palmetto/result").
|
|
214
|
-
code: "UNKNOWN_ERROR";
|
|
215
|
-
}> | import("@palmetto/result").ResultOk<{
|
|
541
|
+
refreshToken({ refreshToken }: RefreshTokenInput, opts?: RequestOptions): Promise<import("@palmetto/result").ResultOk<{
|
|
216
542
|
accessToken: string;
|
|
217
543
|
idToken: string;
|
|
218
544
|
refreshToken: string;
|
|
219
545
|
expiresIn: number;
|
|
546
|
+
}> | import("@palmetto/base-sdk-client").SdkError<{
|
|
547
|
+
error: "BadRequest";
|
|
548
|
+
statusCode: 400;
|
|
549
|
+
message: string;
|
|
550
|
+
reason: string;
|
|
551
|
+
validations: {
|
|
552
|
+
[key: string]: string[];
|
|
553
|
+
};
|
|
220
554
|
}>>;
|
|
221
555
|
private getToken;
|
|
222
556
|
}
|
|
557
|
+
export type MeResponse = ApiResponse<paths["/api/users/me"]["get"]>;
|
|
558
|
+
export type UpdateMeInput = ApiInput<paths["/api/users/me"]["patch"]>;
|
|
559
|
+
export type UpdateMeResponse = ApiResponse<paths["/api/users/me"]["patch"]>;
|
|
560
|
+
export type UpdateUserInput = ApiInput<paths["/api/users/{id}"]["patch"]>;
|
|
561
|
+
export type UpdateUserResponse = ApiResponse<paths["/api/users/{id}"]["patch"]>;
|
|
562
|
+
export type GetUsersInput = NonNullable<ApiInput<paths["/api/users"]["get"]>>;
|
|
563
|
+
export type GetUsersResponse = ApiResponse<paths["/api/users"]["get"]>;
|
|
564
|
+
export type GetSignUpsInput = ApiInput<paths["/api/sign-ups"]["get"]>;
|
|
565
|
+
export type GetSignUpsResponse = ApiResponse<paths["/api/sign-ups"]["get"]>;
|
|
566
|
+
export type GetUserInput = ApiInput<paths["/api/users/{id}"]["get"]>;
|
|
567
|
+
export type GetUserResponse = ApiResponse<paths["/api/users/{id}"]["get"]>;
|
|
568
|
+
export type GetOrganizationInput = ApiInput<paths["/api/organizations/{id}"]["get"]>;
|
|
569
|
+
export type GetOrganizationResponse = ApiResponse<paths["/api/organizations/{id}"]["get"]>;
|
|
570
|
+
export type UpdateOrganizationInput = ApiInput<paths["/api/organizations/{id}"]["patch"]>;
|
|
571
|
+
export type UpdateOrganizationResponse = ApiResponse<paths["/api/organizations/{id}"]["patch"]>;
|
|
572
|
+
export type CreateSignUpInput = ApiInput<paths["/api/sign-ups"]["post"]>;
|
|
573
|
+
export type CreateSignUpResponse = ApiResponse<paths["/api/sign-ups"]["post"]>;
|
|
574
|
+
export type GetSignUpInput = ApiInput<paths["/api/sign-ups/{token}"]["get"]>;
|
|
575
|
+
export type GetSignUpResponse = ApiResponse<paths["/api/sign-ups/{token}"]["get"]>;
|
|
576
|
+
export type CreateSignUpUserInput = ApiInput<paths["/api/sign-ups/{token}/user"]["post"]>;
|
|
577
|
+
export type CreateSignUpUserResponse = ApiResponse<paths["/api/sign-ups/{token}/user"]["post"]>;
|
|
578
|
+
export interface GetAuthTokenInput {
|
|
579
|
+
code: string;
|
|
580
|
+
}
|
|
581
|
+
export interface RefreshTokenInput {
|
|
582
|
+
refreshToken: string;
|
|
583
|
+
}
|
|
584
|
+
export interface GetTokenResponse {
|
|
585
|
+
accessToken: string;
|
|
586
|
+
idToken: string;
|
|
587
|
+
refreshToken: string;
|
|
588
|
+
expiresIn: number;
|
|
589
|
+
}
|
package/dist/client.js
CHANGED
|
@@ -23,51 +23,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.UsersApiClient = void 0;
|
|
24
24
|
const base_sdk_client_1 = require("@palmetto/base-sdk-client");
|
|
25
25
|
const result_1 = require("@palmetto/result");
|
|
26
|
-
const SDK_VERSION_SLUG = "palmetto-users-sdk/0.
|
|
26
|
+
const SDK_VERSION_SLUG = "palmetto-users-sdk/1.0.0";
|
|
27
27
|
class UsersApiClient extends base_sdk_client_1.BaseSdkClient {
|
|
28
28
|
constructor(input) {
|
|
29
29
|
super(Object.assign(Object.assign({}, input), { sdkVersion: SDK_VERSION_SLUG }));
|
|
30
30
|
}
|
|
31
31
|
me(opts) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const { data, response } = yield this.client.GET("/api/users/me", {
|
|
33
|
+
const { data, error, response } = yield this.client.GET("/api/users/me", {
|
|
34
34
|
headers: this.generateHeaders(opts),
|
|
35
35
|
});
|
|
36
36
|
if (data) {
|
|
37
37
|
return (0, result_1.Ok)(data);
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
case 401:
|
|
41
|
-
case 404:
|
|
42
|
-
return (0, result_1.Err)("NOT_AUTHENTICATED");
|
|
43
|
-
default:
|
|
44
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
45
|
-
}
|
|
39
|
+
return this.handleErrorResponse(error, response);
|
|
46
40
|
});
|
|
47
41
|
}
|
|
48
42
|
updateMe(input, opts) {
|
|
49
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
const { data, response } = yield this.client.PATCH("/api/users/me", {
|
|
44
|
+
const { data, error, response } = yield this.client.PATCH("/api/users/me", {
|
|
51
45
|
body: input,
|
|
52
46
|
headers: this.generateHeaders(opts),
|
|
53
47
|
});
|
|
54
48
|
if (data) {
|
|
55
49
|
return (0, result_1.Ok)(data);
|
|
56
50
|
}
|
|
57
|
-
|
|
58
|
-
case 400:
|
|
59
|
-
return (0, result_1.Err)("BAD_REQUEST");
|
|
60
|
-
case 404:
|
|
61
|
-
return (0, result_1.Err)("NOT_FOUND");
|
|
62
|
-
default:
|
|
63
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
64
|
-
}
|
|
51
|
+
return this.handleErrorResponse(error, response);
|
|
65
52
|
});
|
|
66
53
|
}
|
|
67
|
-
|
|
54
|
+
updateUser(_a, opts) {
|
|
68
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
56
|
var { id } = _a, input = __rest(_a, ["id"]);
|
|
70
|
-
const { data, response } = yield this.client.PATCH("/api/users/{id}", {
|
|
57
|
+
const { data, error, response } = yield this.client.PATCH("/api/users/{id}", {
|
|
71
58
|
params: { path: { id } },
|
|
72
59
|
body: input,
|
|
73
60
|
headers: this.generateHeaders(opts),
|
|
@@ -75,75 +62,49 @@ class UsersApiClient extends base_sdk_client_1.BaseSdkClient {
|
|
|
75
62
|
if (data) {
|
|
76
63
|
return (0, result_1.Ok)(data);
|
|
77
64
|
}
|
|
78
|
-
|
|
79
|
-
case 400:
|
|
80
|
-
return (0, result_1.Err)("BAD_REQUEST");
|
|
81
|
-
case 404:
|
|
82
|
-
return (0, result_1.Err)("NOT_FOUND");
|
|
83
|
-
default:
|
|
84
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
85
|
-
}
|
|
65
|
+
return this.handleErrorResponse(error, response);
|
|
86
66
|
});
|
|
87
67
|
}
|
|
88
68
|
getUsers(input, opts) {
|
|
89
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const { data, response } = yield this.client.GET("/api/users", {
|
|
70
|
+
const { data, error, response } = yield this.client.GET("/api/users", {
|
|
91
71
|
params: { query: input },
|
|
92
72
|
headers: this.generateHeaders(opts),
|
|
93
73
|
});
|
|
94
74
|
if (data) {
|
|
95
75
|
return (0, result_1.Ok)(data);
|
|
96
76
|
}
|
|
97
|
-
|
|
98
|
-
case 400:
|
|
99
|
-
return (0, result_1.Err)("BAD_REQUEST");
|
|
100
|
-
default:
|
|
101
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
102
|
-
}
|
|
77
|
+
return this.handleErrorResponse(error, response);
|
|
103
78
|
});
|
|
104
79
|
}
|
|
105
|
-
|
|
80
|
+
getUser(_a, opts_1) {
|
|
106
81
|
return __awaiter(this, arguments, void 0, function* ({ id }, opts) {
|
|
107
|
-
const { data, response } = yield this.client.GET("/api/users/{id}", {
|
|
82
|
+
const { data, error, response } = yield this.client.GET("/api/users/{id}", {
|
|
108
83
|
params: { path: { id } },
|
|
109
84
|
headers: this.generateHeaders(opts),
|
|
110
85
|
});
|
|
111
86
|
if (data) {
|
|
112
87
|
return (0, result_1.Ok)(data);
|
|
113
88
|
}
|
|
114
|
-
|
|
115
|
-
case 400:
|
|
116
|
-
return (0, result_1.Err)("BAD_REQUEST");
|
|
117
|
-
case 404:
|
|
118
|
-
return (0, result_1.Err)("NOT_FOUND");
|
|
119
|
-
default:
|
|
120
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
121
|
-
}
|
|
89
|
+
return this.handleErrorResponse(error, response);
|
|
122
90
|
});
|
|
123
91
|
}
|
|
124
|
-
|
|
92
|
+
getOrganization(_a, opts_1) {
|
|
125
93
|
return __awaiter(this, arguments, void 0, function* ({ id }, opts) {
|
|
126
|
-
const { data, response } = yield this.client.GET("/api/organizations/{id}", {
|
|
94
|
+
const { data, error, response } = yield this.client.GET("/api/organizations/{id}", {
|
|
127
95
|
params: { path: { id } },
|
|
128
96
|
headers: this.generateHeaders(opts),
|
|
129
97
|
});
|
|
130
98
|
if (data) {
|
|
131
99
|
return (0, result_1.Ok)(data);
|
|
132
100
|
}
|
|
133
|
-
|
|
134
|
-
case 400:
|
|
135
|
-
return (0, result_1.Err)("BAD_REQUEST");
|
|
136
|
-
case 404:
|
|
137
|
-
return (0, result_1.Err)("NOT_FOUND");
|
|
138
|
-
default:
|
|
139
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
140
|
-
}
|
|
101
|
+
return this.handleErrorResponse(error, response);
|
|
141
102
|
});
|
|
142
103
|
}
|
|
143
104
|
updateOrganization(_a, opts) {
|
|
144
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
106
|
var { id } = _a, input = __rest(_a, ["id"]);
|
|
146
|
-
const { data, response } = yield this.client.PATCH("/api/organizations/{id}", {
|
|
107
|
+
const { data, error, response } = yield this.client.PATCH("/api/organizations/{id}", {
|
|
147
108
|
params: {
|
|
148
109
|
path: { id },
|
|
149
110
|
},
|
|
@@ -153,54 +114,49 @@ class UsersApiClient extends base_sdk_client_1.BaseSdkClient {
|
|
|
153
114
|
if (data) {
|
|
154
115
|
return (0, result_1.Ok)(data);
|
|
155
116
|
}
|
|
156
|
-
|
|
157
|
-
case 400:
|
|
158
|
-
return (0, result_1.Err)("BAD_REQUEST");
|
|
159
|
-
case 404:
|
|
160
|
-
return (0, result_1.Err)("NOT_FOUND");
|
|
161
|
-
default:
|
|
162
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
163
|
-
}
|
|
117
|
+
return this.handleErrorResponse(error, response);
|
|
164
118
|
});
|
|
165
119
|
}
|
|
166
120
|
createSignUp(input, opts) {
|
|
167
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
const { data, response } = yield this.client.POST("/api/sign-ups", {
|
|
122
|
+
const { data, error, response } = yield this.client.POST("/api/sign-ups", {
|
|
169
123
|
body: input,
|
|
170
124
|
headers: this.generateHeaders(opts),
|
|
171
125
|
});
|
|
172
126
|
if (data) {
|
|
173
127
|
return (0, result_1.Ok)(data);
|
|
174
128
|
}
|
|
175
|
-
|
|
176
|
-
case 400:
|
|
177
|
-
return (0, result_1.Err)("BAD_REQUEST");
|
|
178
|
-
default:
|
|
179
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
180
|
-
}
|
|
129
|
+
return this.handleErrorResponse(error, response);
|
|
181
130
|
});
|
|
182
131
|
}
|
|
183
132
|
getSignUp(_a, opts_1) {
|
|
184
133
|
return __awaiter(this, arguments, void 0, function* ({ token }, opts) {
|
|
185
|
-
const { data, response } = yield this.client.GET("/api/sign-ups/{token}", {
|
|
134
|
+
const { data, error, response } = yield this.client.GET("/api/sign-ups/{token}", {
|
|
186
135
|
params: { path: { token } },
|
|
187
136
|
headers: this.generateHeaders(opts),
|
|
188
137
|
});
|
|
189
138
|
if (data) {
|
|
190
139
|
return (0, result_1.Ok)(data);
|
|
191
140
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
141
|
+
return this.handleErrorResponse(error, response);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
getSignUps(input, opts) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const { data, error, response } = yield this.client.GET("/api/sign-ups", {
|
|
147
|
+
params: { query: input },
|
|
148
|
+
headers: this.generateHeaders(opts),
|
|
149
|
+
});
|
|
150
|
+
if (data) {
|
|
151
|
+
return (0, result_1.Ok)(data);
|
|
197
152
|
}
|
|
153
|
+
return this.handleErrorResponse(error, response);
|
|
198
154
|
});
|
|
199
155
|
}
|
|
200
156
|
createSignUpUser(_a, opts) {
|
|
201
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
202
158
|
var { token } = _a, body = __rest(_a, ["token"]);
|
|
203
|
-
const { data, response } = yield this.client.POST("/api/sign-ups/{token}/user", {
|
|
159
|
+
const { data, error, response } = yield this.client.POST("/api/sign-ups/{token}/user", {
|
|
204
160
|
headers: this.generateHeaders(opts),
|
|
205
161
|
params: { path: { token } },
|
|
206
162
|
body,
|
|
@@ -208,14 +164,7 @@ class UsersApiClient extends base_sdk_client_1.BaseSdkClient {
|
|
|
208
164
|
if (data) {
|
|
209
165
|
return (0, result_1.Ok)(data);
|
|
210
166
|
}
|
|
211
|
-
|
|
212
|
-
case 401:
|
|
213
|
-
return (0, result_1.Err)("NOT_AUTHENTICATED");
|
|
214
|
-
case 409:
|
|
215
|
-
return (0, result_1.Err)("INVALID_STATE");
|
|
216
|
-
default:
|
|
217
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
218
|
-
}
|
|
167
|
+
return this.handleErrorResponse(error, response);
|
|
219
168
|
});
|
|
220
169
|
}
|
|
221
170
|
getAuthToken(_a, opts_1) {
|
|
@@ -233,7 +182,7 @@ class UsersApiClient extends base_sdk_client_1.BaseSdkClient {
|
|
|
233
182
|
}
|
|
234
183
|
getToken(input, opts) {
|
|
235
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
236
|
-
const { data, response } = yield this.client.POST("/api/auth/token", {
|
|
185
|
+
const { data, error, response } = yield this.client.POST("/api/auth/token", {
|
|
237
186
|
headers: this.generateHeaders(opts),
|
|
238
187
|
body: input,
|
|
239
188
|
});
|
|
@@ -245,10 +194,7 @@ class UsersApiClient extends base_sdk_client_1.BaseSdkClient {
|
|
|
245
194
|
expiresIn: data.expires_in,
|
|
246
195
|
});
|
|
247
196
|
}
|
|
248
|
-
|
|
249
|
-
default:
|
|
250
|
-
return (0, result_1.Err)("UNKNOWN_ERROR");
|
|
251
|
-
}
|
|
197
|
+
return this.handleErrorResponse(error, response);
|
|
252
198
|
});
|
|
253
199
|
}
|
|
254
200
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@palmetto/users-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"main": "./dist/main.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*",
|
|
@@ -34,9 +34,10 @@
|
|
|
34
34
|
"typescript": "5.5.4"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@palmetto/base-sdk-client": "1.1.0",
|
|
38
|
-
"@palmetto/result": "1.2.0",
|
|
39
|
-
"openapi-fetch": "^0.12.2"
|
|
37
|
+
"@palmetto/base-sdk-client": "^1.1.0",
|
|
38
|
+
"@palmetto/result": "^1.2.0",
|
|
39
|
+
"openapi-fetch": "^0.12.2",
|
|
40
|
+
"openapi-typescript-helpers": "^0.0.15"
|
|
40
41
|
},
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public"
|