@gymspace/sdk 1.4.5 → 1.5.1
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/.tsbuildinfo +1 -0
- package/dist/index.d.mts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/index.ts +5 -0
- package/src/models/organizations.ts +28 -1
- package/src/resources/auth.ts +5 -2
- package/src/resources/organizations.ts +38 -7
package/package.json
CHANGED
package/src/models/index.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// DTOs
|
|
2
2
|
export * from './auth';
|
|
3
3
|
export * from './organizations';
|
|
4
|
+
export type {
|
|
5
|
+
MyOrganization,
|
|
6
|
+
SwitchOrganizationDto,
|
|
7
|
+
SwitchOrganizationResponse,
|
|
8
|
+
} from './organizations';
|
|
4
9
|
export * from './gyms';
|
|
5
10
|
// collaborators types are in @gymspace/shared
|
|
6
11
|
export * from './clients';
|
|
@@ -81,4 +81,31 @@ export interface OrganizationAdminDetails {
|
|
|
81
81
|
};
|
|
82
82
|
createdAt: Date;
|
|
83
83
|
updatedAt: Date;
|
|
84
|
-
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface MyOrganization {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
organizationCode: string;
|
|
90
|
+
country: string;
|
|
91
|
+
currency: string;
|
|
92
|
+
timezone: string;
|
|
93
|
+
isOwner: boolean;
|
|
94
|
+
gyms: Array<{
|
|
95
|
+
id: string;
|
|
96
|
+
name: string;
|
|
97
|
+
}>;
|
|
98
|
+
createdAt: Date;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface SwitchOrganizationDto {
|
|
102
|
+
organizationId: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface SwitchOrganizationResponse {
|
|
106
|
+
success: boolean;
|
|
107
|
+
message: string;
|
|
108
|
+
organizationId: string;
|
|
109
|
+
defaultGymId: string;
|
|
110
|
+
defaultGymName: string;
|
|
111
|
+
}
|
package/src/resources/auth.ts
CHANGED
|
@@ -34,7 +34,11 @@ export class AuthResource extends BaseResource {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
async refreshToken(refreshToken: string, options?: RequestOptions): Promise<LoginResponseDto> {
|
|
37
|
-
return this.client.post<LoginResponseDto>(
|
|
37
|
+
return this.client.post<LoginResponseDto>(
|
|
38
|
+
`${this.basePath}/refresh`,
|
|
39
|
+
{ refresh_token: refreshToken },
|
|
40
|
+
options,
|
|
41
|
+
);
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
async verifyEmail(
|
|
@@ -53,7 +57,6 @@ export class AuthResource extends BaseResource {
|
|
|
53
57
|
return this.client.post(`${this.basePath}/resend-verification`, data, options);
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
|
|
57
60
|
async getSubscriptionPlans(options?: RequestOptions): Promise<{ data: SubscriptionPlan[] }> {
|
|
58
61
|
return this.client.get(`${this.basePath}/subscription-plans`, options);
|
|
59
62
|
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { BaseResource } from './base';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Organization,
|
|
4
|
+
UpdateOrganizationDto,
|
|
5
|
+
OrganizationStats,
|
|
6
|
+
OrganizationWithDetails,
|
|
7
|
+
OrganizationAdminDetails,
|
|
8
|
+
MyOrganization,
|
|
9
|
+
SwitchOrganizationDto,
|
|
10
|
+
SwitchOrganizationResponse,
|
|
11
|
+
} from '../models/organizations';
|
|
3
12
|
import { RequestOptions } from '../types';
|
|
4
13
|
|
|
5
14
|
export class OrganizationsResource extends BaseResource {
|
|
@@ -10,9 +19,9 @@ export class OrganizationsResource extends BaseResource {
|
|
|
10
19
|
}
|
|
11
20
|
|
|
12
21
|
async updateOrganization(
|
|
13
|
-
id: string,
|
|
14
|
-
data: UpdateOrganizationDto,
|
|
15
|
-
options?: RequestOptions
|
|
22
|
+
id: string,
|
|
23
|
+
data: UpdateOrganizationDto,
|
|
24
|
+
options?: RequestOptions,
|
|
16
25
|
): Promise<Organization> {
|
|
17
26
|
return this.client.put<Organization>(`${this.basePath}/${id}`, data, options);
|
|
18
27
|
}
|
|
@@ -25,7 +34,29 @@ export class OrganizationsResource extends BaseResource {
|
|
|
25
34
|
return this.client.get<OrganizationWithDetails[]>(`${this.basePath}/list`, undefined, options);
|
|
26
35
|
}
|
|
27
36
|
|
|
28
|
-
async getOrganizationForAdmin(
|
|
29
|
-
|
|
37
|
+
async getOrganizationForAdmin(
|
|
38
|
+
id: string,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): Promise<OrganizationAdminDetails> {
|
|
41
|
+
return this.client.get<OrganizationAdminDetails>(
|
|
42
|
+
`${this.basePath}/admin/${id}`,
|
|
43
|
+
undefined,
|
|
44
|
+
options,
|
|
45
|
+
);
|
|
30
46
|
}
|
|
31
|
-
|
|
47
|
+
|
|
48
|
+
async getMyOrganizations(options?: RequestOptions): Promise<MyOrganization[]> {
|
|
49
|
+
return this.client.get<MyOrganization[]>(
|
|
50
|
+
`${this.basePath}/my-organizations`,
|
|
51
|
+
undefined,
|
|
52
|
+
options,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async switchOrganization(
|
|
57
|
+
data: SwitchOrganizationDto,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<SwitchOrganizationResponse> {
|
|
60
|
+
return this.client.post<SwitchOrganizationResponse>(`${this.basePath}/switch`, data, options);
|
|
61
|
+
}
|
|
62
|
+
}
|