@gymspace/sdk 1.2.5 → 1.2.9
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 +269 -157
- package/dist/index.d.ts +269 -157
- package/dist/index.js +311 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +302 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/check-ins.ts +6 -4
- package/src/models/clients.ts +1 -13
- package/src/models/collaborators.ts +2 -84
- package/src/models/dashboard.ts +26 -1
- package/src/models/index.ts +4 -3
- package/src/models/invitations.ts +2 -46
- package/src/models/payment-methods.ts +15 -2
- package/src/models/roles.ts +1 -23
- package/src/models/whatsapp.ts +142 -0
- package/src/resources/admin-subscription-management.ts +1 -1
- package/src/resources/clients.ts +27 -28
- package/src/resources/collaborators.ts +14 -14
- package/src/resources/contracts.ts +27 -19
- package/src/resources/dashboard.ts +11 -1
- package/src/resources/index.ts +3 -1
- package/src/resources/invitations.ts +11 -14
- package/src/resources/roles.ts +2 -1
- package/src/resources/sales.ts +28 -25
- package/src/resources/whatsapp-templates.ts +80 -0
- package/src/resources/whatsapp.ts +97 -0
- package/src/sdk.ts +28 -3
- package/src/types.ts +2 -2
- package/src/utils/agent-fetch.ts +25 -0
package/package.json
CHANGED
package/src/models/check-ins.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { PaginationQueryDto } from '../types';
|
|
2
|
-
|
|
3
1
|
export interface CreateCheckInDto {
|
|
4
2
|
gymClientId: string;
|
|
5
3
|
notes?: string;
|
|
@@ -27,10 +25,12 @@ export interface CheckIn {
|
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
export interface SearchCheckInsParams
|
|
28
|
+
export interface SearchCheckInsParams {
|
|
31
29
|
clientId?: string;
|
|
32
30
|
startDate?: string;
|
|
33
31
|
endDate?: string;
|
|
32
|
+
limit?: number;
|
|
33
|
+
offset?: number;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface GetCheckInStatsParams {
|
|
@@ -46,7 +46,9 @@ export interface CheckInStats {
|
|
|
46
46
|
dayDistribution: Record<string, number>;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export interface GetClientCheckInHistoryParams
|
|
49
|
+
export interface GetClientCheckInHistoryParams {
|
|
50
|
+
limit?: number;
|
|
51
|
+
offset?: number;
|
|
50
52
|
// Additional check-in history specific parameters can be added here
|
|
51
53
|
}
|
|
52
54
|
|
package/src/models/clients.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { PaginationQueryDto } from '../types';
|
|
2
|
-
|
|
3
1
|
export interface CreateClientDto {
|
|
4
2
|
name: string;
|
|
5
3
|
email?: string;
|
|
@@ -124,7 +122,7 @@ export interface ClientStats {
|
|
|
124
122
|
}>;
|
|
125
123
|
}
|
|
126
124
|
|
|
127
|
-
export interface SearchClientsParams
|
|
125
|
+
export interface SearchClientsParams {
|
|
128
126
|
search?: string;
|
|
129
127
|
activeOnly?: boolean;
|
|
130
128
|
clientNumber?: string;
|
|
@@ -133,13 +131,3 @@ export interface SearchClientsParams extends PaginationQueryDto {
|
|
|
133
131
|
notCheckedInToday?: boolean;
|
|
134
132
|
checkedInToday?: boolean;
|
|
135
133
|
}
|
|
136
|
-
|
|
137
|
-
export interface ClientSearchForCheckInResponse {
|
|
138
|
-
data: Client[];
|
|
139
|
-
pagination: {
|
|
140
|
-
total: number;
|
|
141
|
-
page: number;
|
|
142
|
-
limit: number;
|
|
143
|
-
totalPages: number;
|
|
144
|
-
};
|
|
145
|
-
}
|
|
@@ -1,84 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
userId: string;
|
|
4
|
-
gymId: string;
|
|
5
|
-
roleId: string;
|
|
6
|
-
status: 'pending' | 'active' | 'inactive';
|
|
7
|
-
hiredDate?: string;
|
|
8
|
-
profilePhotoId?: string;
|
|
9
|
-
coverPhotoId?: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
specialties?: any;
|
|
12
|
-
user?: {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
email: string;
|
|
16
|
-
phone?: string;
|
|
17
|
-
};
|
|
18
|
-
role?: {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
permissions: string[];
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface ListCollaboratorsParams {
|
|
26
|
-
page: number;
|
|
27
|
-
limit: number;
|
|
28
|
-
status?: 'pending' | 'active' | 'inactive';
|
|
29
|
-
roleId?: string;
|
|
30
|
-
search?: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface UpdateCollaboratorDto {
|
|
34
|
-
hiredDate?: string;
|
|
35
|
-
profilePhotoId?: string;
|
|
36
|
-
coverPhotoId?: string;
|
|
37
|
-
description?: string;
|
|
38
|
-
specialties?: any;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface UpdateStatusDto {
|
|
42
|
-
status: 'active' | 'inactive';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface UpdateRoleDto {
|
|
46
|
-
roleId: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface ActivityQueryParams {
|
|
50
|
-
startDate?: string;
|
|
51
|
-
endDate?: string;
|
|
52
|
-
limit?: number;
|
|
53
|
-
type?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface StatsQueryParams {
|
|
57
|
-
startDate?: string;
|
|
58
|
-
endDate?: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface CollaboratorStats {
|
|
62
|
-
contracts: {
|
|
63
|
-
total: number;
|
|
64
|
-
totalAmount: number;
|
|
65
|
-
averageAmount: number;
|
|
66
|
-
};
|
|
67
|
-
checkIns: {
|
|
68
|
-
total: number;
|
|
69
|
-
};
|
|
70
|
-
sales: {
|
|
71
|
-
total: number;
|
|
72
|
-
totalAmount: number;
|
|
73
|
-
};
|
|
74
|
-
clients: {
|
|
75
|
-
created: number;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface ActivityItem {
|
|
80
|
-
type: string;
|
|
81
|
-
timestamp: string;
|
|
82
|
-
description: string;
|
|
83
|
-
metadata: any;
|
|
84
|
-
}
|
|
1
|
+
// All types are exported from @gymspace/shared via types.ts
|
|
2
|
+
// No need to duplicate them here
|
package/src/models/dashboard.ts
CHANGED
|
@@ -62,4 +62,29 @@ export interface ExpiringContract {
|
|
|
62
62
|
export interface DateRangeParams {
|
|
63
63
|
startDate?: string;
|
|
64
64
|
endDate?: string;
|
|
65
|
-
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface CheckInDetail {
|
|
68
|
+
id: string;
|
|
69
|
+
timestamp: string;
|
|
70
|
+
gymClientId: string;
|
|
71
|
+
client: {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
clientNumber: string;
|
|
75
|
+
status: string;
|
|
76
|
+
profilePhotoId: string | null;
|
|
77
|
+
};
|
|
78
|
+
notes: string | null;
|
|
79
|
+
registeredBy: {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface CheckInsList {
|
|
86
|
+
checkIns: CheckInDetail[];
|
|
87
|
+
total: number;
|
|
88
|
+
startDate: string;
|
|
89
|
+
endDate: string;
|
|
90
|
+
}
|
package/src/models/index.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
export * from './auth';
|
|
3
3
|
export * from './organizations';
|
|
4
4
|
export * from './gyms';
|
|
5
|
-
|
|
5
|
+
// collaborators types are in @gymspace/shared
|
|
6
6
|
export * from './clients';
|
|
7
7
|
export * from './membership-plans';
|
|
8
8
|
export * from './contracts';
|
|
9
9
|
export * from './dashboard';
|
|
10
10
|
export * from './evaluations';
|
|
11
11
|
export * from './check-ins';
|
|
12
|
-
|
|
12
|
+
// invitations types are in @gymspace/shared
|
|
13
13
|
export * from './leads';
|
|
14
14
|
export * from './assets';
|
|
15
15
|
export * from './files';
|
|
@@ -23,8 +23,9 @@ export * from './subscription-plans';
|
|
|
23
23
|
export * from './admin-subscription-management';
|
|
24
24
|
export * from './payment-methods';
|
|
25
25
|
export * from './roles';
|
|
26
|
+
export * from './whatsapp';
|
|
26
27
|
|
|
27
28
|
export interface ApiResponse<T> {
|
|
28
29
|
data: T;
|
|
29
30
|
meta?: any;
|
|
30
|
-
}
|
|
31
|
+
}
|
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface CreateInvitationDto {
|
|
4
|
-
email: string;
|
|
5
|
-
roleId: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface AcceptInvitationDto {
|
|
9
|
-
token?: string;
|
|
10
|
-
code?: string;
|
|
11
|
-
name: string;
|
|
12
|
-
phone: string;
|
|
13
|
-
password: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface ValidateByCodeDto {
|
|
17
|
-
code: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface Invitation {
|
|
21
|
-
id: string;
|
|
22
|
-
email: string;
|
|
23
|
-
gymId: string;
|
|
24
|
-
roleId: string;
|
|
25
|
-
token: string;
|
|
26
|
-
code: string;
|
|
27
|
-
status: InvitationStatus;
|
|
28
|
-
invitedByUserId: string;
|
|
29
|
-
acceptedAt?: string;
|
|
30
|
-
expiresAt: string;
|
|
31
|
-
createdAt: string;
|
|
32
|
-
updatedAt: string;
|
|
33
|
-
role?: {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
};
|
|
37
|
-
invitedBy?: {
|
|
38
|
-
id: string;
|
|
39
|
-
name: string | null;
|
|
40
|
-
email: string;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface GetGymInvitationsParams {
|
|
45
|
-
gymId: string;
|
|
46
|
-
}
|
|
1
|
+
// All types are exported from @gymspace/shared via types.ts
|
|
2
|
+
// No need to duplicate them here
|
|
@@ -18,14 +18,27 @@ export interface UpdatePaymentMethodDto {
|
|
|
18
18
|
|
|
19
19
|
export interface PaymentMethod {
|
|
20
20
|
id: string;
|
|
21
|
-
|
|
21
|
+
organizationId: string;
|
|
22
22
|
name: string;
|
|
23
23
|
description?: string;
|
|
24
24
|
code: string;
|
|
25
25
|
enabled: boolean;
|
|
26
26
|
metadata?: Record<string, any>;
|
|
27
|
+
createdByUserId: string;
|
|
28
|
+
updatedByUserId?: string | null;
|
|
27
29
|
createdAt: string;
|
|
28
30
|
updatedAt: string;
|
|
31
|
+
deletedAt?: string | null;
|
|
32
|
+
createdBy?: {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
email: string;
|
|
36
|
+
};
|
|
37
|
+
updatedBy?: {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
email: string;
|
|
41
|
+
} | null;
|
|
29
42
|
}
|
|
30
43
|
|
|
31
44
|
export interface SearchPaymentMethodsParams extends PaginationQueryDto {
|
|
@@ -38,4 +51,4 @@ export interface PaymentMethodStats {
|
|
|
38
51
|
totalPaymentMethods: number;
|
|
39
52
|
enabledPaymentMethods: number;
|
|
40
53
|
disabledPaymentMethods: number;
|
|
41
|
-
}
|
|
54
|
+
}
|
package/src/models/roles.ts
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
description: string | null;
|
|
5
|
-
permissions: string[];
|
|
6
|
-
canManageEvaluations: boolean;
|
|
7
|
-
organizationId: string;
|
|
8
|
-
createdByUserId: string | null;
|
|
9
|
-
updatedByUserId: string | null;
|
|
10
|
-
createdAt: string;
|
|
11
|
-
updatedAt: string;
|
|
12
|
-
deletedAt: string | null;
|
|
13
|
-
createdBy?: {
|
|
14
|
-
id: string;
|
|
15
|
-
name: string;
|
|
16
|
-
email: string;
|
|
17
|
-
};
|
|
18
|
-
updatedBy?: {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
email: string;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
1
|
+
// Role type is exported from @gymspace/shared via types.ts
|
|
24
2
|
|
|
25
3
|
export interface PermissionsGroup {
|
|
26
4
|
[category: string]: string[];
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { PaginationQueryDto } from '../types';
|
|
2
|
+
|
|
3
|
+
// Import types for WhatsApp templates
|
|
4
|
+
// Note: TemplateCode and TemplateType are re-exported from @gymspace/shared via ../types
|
|
5
|
+
// They should be imported directly from the SDK index when needed
|
|
6
|
+
type TemplateCode = string;
|
|
7
|
+
type TemplateType = string;
|
|
8
|
+
|
|
9
|
+
// WhatsApp Config interfaces
|
|
10
|
+
export interface WhatsAppConfig {
|
|
11
|
+
id: string;
|
|
12
|
+
gymId: string;
|
|
13
|
+
instanceName: string;
|
|
14
|
+
phoneNumber?: string;
|
|
15
|
+
isActive: boolean;
|
|
16
|
+
connectionStatus: string;
|
|
17
|
+
lastConnectedAt?: string;
|
|
18
|
+
settings?: Record<string, any>;
|
|
19
|
+
createdByUserId: string;
|
|
20
|
+
updatedByUserId?: string;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CreateWhatsAppConfigDto {
|
|
26
|
+
settings?: Record<string, any>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface UpdateWhatsAppConfigDto {
|
|
30
|
+
settings?: Record<string, any>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ConnectionStatusResponse {
|
|
34
|
+
status: 'connected' | 'waiting_qr_scan' | 'connecting' | 'not_initialized' | 'disconnected';
|
|
35
|
+
qrCode?: string;
|
|
36
|
+
isActive?: boolean;
|
|
37
|
+
connectionStatus?: string;
|
|
38
|
+
lastConnectedAt?: string;
|
|
39
|
+
message?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface InitializeConnectionResponse {
|
|
43
|
+
status: 'connected' | 'waiting_qr_scan' | 'connecting' | 'not_initialized' | 'disconnected';
|
|
44
|
+
qrCode?: string;
|
|
45
|
+
isActive?: boolean;
|
|
46
|
+
connectionStatus?: string;
|
|
47
|
+
lastConnectedAt?: string;
|
|
48
|
+
message?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// WhatsApp Template interfaces
|
|
52
|
+
export interface WhatsAppTemplate {
|
|
53
|
+
id: string;
|
|
54
|
+
gymId: string;
|
|
55
|
+
code: TemplateCode;
|
|
56
|
+
name: string;
|
|
57
|
+
type: TemplateType;
|
|
58
|
+
message: string;
|
|
59
|
+
variables: string[];
|
|
60
|
+
isActive: boolean;
|
|
61
|
+
metadata?: Record<string, any>;
|
|
62
|
+
createdByUserId: string;
|
|
63
|
+
updatedByUserId?: string;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
updatedAt: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CreateTemplateDto {
|
|
69
|
+
code: TemplateCode;
|
|
70
|
+
name: string;
|
|
71
|
+
type: TemplateType;
|
|
72
|
+
message: string;
|
|
73
|
+
variables?: string[];
|
|
74
|
+
isActive?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface UpdateTemplateDto {
|
|
78
|
+
name?: string;
|
|
79
|
+
type?: TemplateType;
|
|
80
|
+
message?: string;
|
|
81
|
+
variables?: string[];
|
|
82
|
+
isActive?: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface SearchTemplatesDto extends PaginationQueryDto {
|
|
86
|
+
code?: TemplateCode;
|
|
87
|
+
type?: TemplateType;
|
|
88
|
+
isActive?: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface PreviewTemplateResponse {
|
|
92
|
+
content: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// WhatsApp Message interfaces
|
|
96
|
+
export interface WhatsAppMessage {
|
|
97
|
+
id: string;
|
|
98
|
+
gymId: string;
|
|
99
|
+
clientId?: string;
|
|
100
|
+
templateId?: string;
|
|
101
|
+
phoneNumber: string;
|
|
102
|
+
content: string;
|
|
103
|
+
direction: 'incoming' | 'outgoing';
|
|
104
|
+
status: 'pending' | 'sent' | 'delivered' | 'read' | 'failed';
|
|
105
|
+
externalMessageId?: string;
|
|
106
|
+
metadata?: Record<string, any>;
|
|
107
|
+
sentAt?: string;
|
|
108
|
+
deliveredAt?: string;
|
|
109
|
+
readAt?: string;
|
|
110
|
+
failedAt?: string;
|
|
111
|
+
failureReason?: string;
|
|
112
|
+
createdAt: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface SendWhatsAppMessageDto {
|
|
116
|
+
clientId?: string;
|
|
117
|
+
phoneNumber: string;
|
|
118
|
+
content?: string;
|
|
119
|
+
templateId?: string;
|
|
120
|
+
variables?: Record<string, any>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface SearchWhatsAppMessagesDto extends PaginationQueryDto {
|
|
124
|
+
clientId?: string;
|
|
125
|
+
status?: string;
|
|
126
|
+
direction?: string;
|
|
127
|
+
phoneNumber?: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface Contact {
|
|
131
|
+
id: string;
|
|
132
|
+
name: string;
|
|
133
|
+
pushname: string;
|
|
134
|
+
phoneNumber?: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export type ListContactsResponse = Contact[];
|
|
138
|
+
|
|
139
|
+
export interface DisconnectResponse {
|
|
140
|
+
success: boolean;
|
|
141
|
+
message: string;
|
|
142
|
+
}
|
package/src/resources/clients.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { BaseResource } from './base';
|
|
2
|
-
import {
|
|
3
|
-
Client,
|
|
4
|
-
CreateClientDto,
|
|
5
|
-
UpdateClientDto,
|
|
2
|
+
import {
|
|
3
|
+
Client,
|
|
4
|
+
CreateClientDto,
|
|
5
|
+
UpdateClientDto,
|
|
6
6
|
ClientStats,
|
|
7
7
|
ClientStat,
|
|
8
8
|
SearchClientsParams,
|
|
9
|
-
ClientSearchForCheckInResponse
|
|
10
9
|
} from '../models/clients';
|
|
11
|
-
import { RequestOptions
|
|
10
|
+
import { RequestOptions } from '../types';
|
|
12
11
|
|
|
13
12
|
export class ClientsResource extends BaseResource {
|
|
14
13
|
private basePath = 'clients';
|
|
@@ -17,23 +16,15 @@ export class ClientsResource extends BaseResource {
|
|
|
17
16
|
return this.client.post<Client>(this.basePath, data, options);
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
async searchClients(
|
|
21
|
-
params
|
|
22
|
-
options?: RequestOptions
|
|
23
|
-
): Promise<PaginatedResponseDto<Client>> {
|
|
24
|
-
|
|
25
|
-
return this.paginate<Client>(this.basePath, params, options);
|
|
19
|
+
async searchClients(params?: SearchClientsParams, options?: RequestOptions): Promise<Client[]> {
|
|
20
|
+
return this.client.get<Client[]>(this.basePath, params, options);
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
async getClient(id: string, options?: RequestOptions): Promise<Client> {
|
|
29
24
|
return this.client.get<Client>(`${this.basePath}/${id}`, undefined, options);
|
|
30
25
|
}
|
|
31
26
|
|
|
32
|
-
async updateClient(
|
|
33
|
-
id: string,
|
|
34
|
-
data: UpdateClientDto,
|
|
35
|
-
options?: RequestOptions
|
|
36
|
-
): Promise<Client> {
|
|
27
|
+
async updateClient(id: string, data: UpdateClientDto, options?: RequestOptions): Promise<Client> {
|
|
37
28
|
return this.client.put<Client>(`${this.basePath}/${id}`, data, options);
|
|
38
29
|
}
|
|
39
30
|
|
|
@@ -46,11 +37,23 @@ export class ClientsResource extends BaseResource {
|
|
|
46
37
|
}
|
|
47
38
|
|
|
48
39
|
async getClientStat(id: string, statKey: string, options?: RequestOptions): Promise<ClientStat> {
|
|
49
|
-
return this.client.get<ClientStat>(
|
|
40
|
+
return this.client.get<ClientStat>(
|
|
41
|
+
`${this.basePath}/${id}/stats/${statKey}`,
|
|
42
|
+
undefined,
|
|
43
|
+
options,
|
|
44
|
+
);
|
|
50
45
|
}
|
|
51
46
|
|
|
52
|
-
async getClientStatsByCategory(
|
|
53
|
-
|
|
47
|
+
async getClientStatsByCategory(
|
|
48
|
+
id: string,
|
|
49
|
+
category: string,
|
|
50
|
+
options?: RequestOptions,
|
|
51
|
+
): Promise<ClientStat[]> {
|
|
52
|
+
return this.client.get<ClientStat[]>(
|
|
53
|
+
`${this.basePath}/${id}/stats/category/${category}`,
|
|
54
|
+
undefined,
|
|
55
|
+
options,
|
|
56
|
+
);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
async getAvailableStats(options?: RequestOptions): Promise<ClientStat[]> {
|
|
@@ -59,13 +62,9 @@ export class ClientsResource extends BaseResource {
|
|
|
59
62
|
|
|
60
63
|
async searchClientsForCheckIn(
|
|
61
64
|
params?: SearchClientsParams,
|
|
62
|
-
options?: RequestOptions
|
|
63
|
-
): Promise<
|
|
65
|
+
options?: RequestOptions,
|
|
66
|
+
): Promise<Client[]> {
|
|
64
67
|
// This endpoint automatically includes contract status and only active clients
|
|
65
|
-
return this.client.get<
|
|
66
|
-
`${this.basePath}/search/check-in`,
|
|
67
|
-
params,
|
|
68
|
-
options
|
|
69
|
-
);
|
|
68
|
+
return this.client.get<Client[]>(`${this.basePath}/search/check-in`, params, options);
|
|
70
69
|
}
|
|
71
|
-
}
|
|
70
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { BaseResource } from './base';
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
3
|
Collaborator,
|
|
4
4
|
ListCollaboratorsParams,
|
|
5
5
|
UpdateCollaboratorDto,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
UpdateCollaboratorStatusDto,
|
|
7
|
+
UpdateCollaboratorRoleDto,
|
|
8
8
|
ActivityQueryParams,
|
|
9
9
|
StatsQueryParams,
|
|
10
10
|
CollaboratorStats,
|
|
11
11
|
ActivityItem,
|
|
12
|
-
} from '
|
|
12
|
+
} from '@gymspace/shared';
|
|
13
13
|
import { RequestOptions, PaginatedResponseDto } from '../types';
|
|
14
14
|
|
|
15
15
|
export class CollaboratorsResource extends BaseResource {
|
|
@@ -17,7 +17,7 @@ export class CollaboratorsResource extends BaseResource {
|
|
|
17
17
|
|
|
18
18
|
async list(
|
|
19
19
|
params?: ListCollaboratorsParams,
|
|
20
|
-
options?: RequestOptions
|
|
20
|
+
options?: RequestOptions,
|
|
21
21
|
): Promise<PaginatedResponseDto<Collaborator>> {
|
|
22
22
|
return this.paginate<Collaborator>(this.basePath, params, options);
|
|
23
23
|
}
|
|
@@ -29,31 +29,31 @@ export class CollaboratorsResource extends BaseResource {
|
|
|
29
29
|
async update(
|
|
30
30
|
id: string,
|
|
31
31
|
data: UpdateCollaboratorDto,
|
|
32
|
-
options?: RequestOptions
|
|
32
|
+
options?: RequestOptions,
|
|
33
33
|
): Promise<Collaborator> {
|
|
34
34
|
return this.client.patch<Collaborator>(`${this.basePath}/${id}`, data, options);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
async updateRole(
|
|
38
38
|
id: string,
|
|
39
|
-
|
|
40
|
-
options?: RequestOptions
|
|
39
|
+
data: UpdateCollaboratorRoleDto,
|
|
40
|
+
options?: RequestOptions,
|
|
41
41
|
): Promise<Collaborator> {
|
|
42
|
-
return this.client.patch<Collaborator>(`${this.basePath}/${id}/role`,
|
|
42
|
+
return this.client.patch<Collaborator>(`${this.basePath}/${id}/role`, data, options);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
async updateStatus(
|
|
46
46
|
id: string,
|
|
47
|
-
|
|
48
|
-
options?: RequestOptions
|
|
47
|
+
data: UpdateCollaboratorStatusDto,
|
|
48
|
+
options?: RequestOptions,
|
|
49
49
|
): Promise<Collaborator> {
|
|
50
|
-
return this.client.patch<Collaborator>(`${this.basePath}/${id}/status`,
|
|
50
|
+
return this.client.patch<Collaborator>(`${this.basePath}/${id}/status`, data, options);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
async getActivity(
|
|
54
54
|
id: string,
|
|
55
55
|
params?: ActivityQueryParams,
|
|
56
|
-
options?: RequestOptions
|
|
56
|
+
options?: RequestOptions,
|
|
57
57
|
): Promise<ActivityItem[]> {
|
|
58
58
|
return this.client.get<ActivityItem[]>(`${this.basePath}/${id}/activity`, params, options);
|
|
59
59
|
}
|
|
@@ -61,7 +61,7 @@ export class CollaboratorsResource extends BaseResource {
|
|
|
61
61
|
async getStats(
|
|
62
62
|
id: string,
|
|
63
63
|
params?: StatsQueryParams,
|
|
64
|
-
options?: RequestOptions
|
|
64
|
+
options?: RequestOptions,
|
|
65
65
|
): Promise<CollaboratorStats> {
|
|
66
66
|
return this.client.get<CollaboratorStats>(`${this.basePath}/${id}/stats`, params, options);
|
|
67
67
|
}
|