@gymspace/sdk 1.2.12 → 1.2.14
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 -1
- package/dist/index.d.mts +724 -20
- package/dist/index.d.ts +724 -20
- package/dist/index.js +343 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +339 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/activities.ts +139 -0
- package/src/models/bulk-messaging.ts +119 -0
- package/src/models/clients.ts +6 -1
- package/src/models/contracts.ts +127 -9
- package/src/models/gyms.ts +46 -7
- package/src/models/index.ts +3 -0
- package/src/models/onboarding.ts +4 -3
- package/src/models/products.ts +8 -0
- package/src/models/tags.ts +151 -0
- package/src/resources/activities.ts +113 -0
- package/src/resources/bulk-messaging.ts +83 -0
- package/src/resources/check-ins.ts +42 -10
- package/src/resources/contracts.ts +53 -1
- package/src/resources/gyms.ts +65 -27
- package/src/resources/index.ts +4 -1
- package/src/resources/subscription-plans.ts +9 -1
- package/src/resources/tags.ts +147 -0
- package/src/sdk.ts +9 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { BaseResource } from './base';
|
|
2
|
+
import {
|
|
3
|
+
Tag,
|
|
4
|
+
CreateTagDto,
|
|
5
|
+
UpdateTagDto,
|
|
6
|
+
AssignTagsDto,
|
|
7
|
+
SearchTagsParams,
|
|
8
|
+
GetTagClientsParams,
|
|
9
|
+
AssignTagsResponse,
|
|
10
|
+
RemoveTagsResponse,
|
|
11
|
+
DeleteTagResponse,
|
|
12
|
+
ClientTagsResponse,
|
|
13
|
+
TagClientsResponse,
|
|
14
|
+
TagStatsResponse,
|
|
15
|
+
} from '../models/tags';
|
|
16
|
+
import { RequestOptions, PaginatedResponseDto } from '../types';
|
|
17
|
+
|
|
18
|
+
export class TagsResource extends BaseResource {
|
|
19
|
+
private basePath = 'tags';
|
|
20
|
+
|
|
21
|
+
// ==================== Tag Management ====================
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Create a new tag
|
|
25
|
+
* POST /api/v1/tags
|
|
26
|
+
*/
|
|
27
|
+
async createTag(data: CreateTagDto, options?: RequestOptions): Promise<Tag> {
|
|
28
|
+
return this.client.post<Tag>(this.basePath, data, options);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* List all tags with optional filters and pagination
|
|
33
|
+
* GET /api/v1/tags
|
|
34
|
+
*/
|
|
35
|
+
async searchTags(
|
|
36
|
+
params?: SearchTagsParams,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): Promise<PaginatedResponseDto<Tag>> {
|
|
39
|
+
return this.client.get<PaginatedResponseDto<Tag>>(this.basePath, params, options);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get a specific tag by ID
|
|
44
|
+
* GET /api/v1/tags/:id
|
|
45
|
+
*/
|
|
46
|
+
async getTag(id: string, options?: RequestOptions): Promise<Tag> {
|
|
47
|
+
return this.client.get<Tag>(`${this.basePath}/${id}`, undefined, options);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Update an existing tag
|
|
52
|
+
* PUT /api/v1/tags/:id
|
|
53
|
+
*/
|
|
54
|
+
async updateTag(id: string, data: UpdateTagDto, options?: RequestOptions): Promise<Tag> {
|
|
55
|
+
return this.client.put<Tag>(`${this.basePath}/${id}`, data, options);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Delete a tag (soft delete)
|
|
60
|
+
* DELETE /api/v1/tags/:id
|
|
61
|
+
* @param id - Tag ID
|
|
62
|
+
* @param force - Force deletion even if tag has assigned clients
|
|
63
|
+
*/
|
|
64
|
+
async deleteTag(
|
|
65
|
+
id: string,
|
|
66
|
+
force?: boolean,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<DeleteTagResponse> {
|
|
69
|
+
const path = force ? `${this.basePath}/${id}?force=true` : `${this.basePath}/${id}`;
|
|
70
|
+
return this.client.delete<DeleteTagResponse>(path, options);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get clients with a specific tag
|
|
75
|
+
* GET /api/v1/tags/:id/clients
|
|
76
|
+
*/
|
|
77
|
+
async getTagClients(
|
|
78
|
+
id: string,
|
|
79
|
+
params?: GetTagClientsParams,
|
|
80
|
+
options?: RequestOptions,
|
|
81
|
+
): Promise<TagClientsResponse> {
|
|
82
|
+
return this.client.get<TagClientsResponse>(`${this.basePath}/${id}/clients`, params, options);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get tag statistics
|
|
87
|
+
* GET /api/v1/tags/stats
|
|
88
|
+
*/
|
|
89
|
+
async getTagStats(options?: RequestOptions): Promise<TagStatsResponse> {
|
|
90
|
+
return this.client.get<TagStatsResponse>(`${this.basePath}/stats`, undefined, options);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ==================== Client Tag Assignment ====================
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Assign one or multiple tags to a client
|
|
97
|
+
* POST /api/v1/clients/:clientId/tags
|
|
98
|
+
*/
|
|
99
|
+
async assignTagsToClient(
|
|
100
|
+
clientId: string,
|
|
101
|
+
data: AssignTagsDto,
|
|
102
|
+
options?: RequestOptions,
|
|
103
|
+
): Promise<AssignTagsResponse> {
|
|
104
|
+
return this.client.post<AssignTagsResponse>(`clients/${clientId}/tags`, data, options);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Remove a specific tag from a client
|
|
109
|
+
* DELETE /api/v1/clients/:clientId/tags/:tagId
|
|
110
|
+
*/
|
|
111
|
+
async removeTagFromClient(
|
|
112
|
+
clientId: string,
|
|
113
|
+
tagId: string,
|
|
114
|
+
options?: RequestOptions,
|
|
115
|
+
): Promise<RemoveTagsResponse> {
|
|
116
|
+
return this.client.delete<RemoveTagsResponse>(`clients/${clientId}/tags/${tagId}`, options);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Remove multiple tags from a client
|
|
121
|
+
* DELETE /api/v1/clients/:clientId/tags
|
|
122
|
+
* Note: This endpoint requires sending tagIds in the request body
|
|
123
|
+
*/
|
|
124
|
+
async removeTagsFromClient(
|
|
125
|
+
clientId: string,
|
|
126
|
+
tagIds: string[],
|
|
127
|
+
options?: RequestOptions,
|
|
128
|
+
): Promise<RemoveTagsResponse> {
|
|
129
|
+
// DELETE with body requires special handling
|
|
130
|
+
return this.request<RemoveTagsResponse>(`clients/${clientId}/tags`, {
|
|
131
|
+
method: 'DELETE',
|
|
132
|
+
body: JSON.stringify({ tagIds }),
|
|
133
|
+
headers: {
|
|
134
|
+
'Content-Type': 'application/json',
|
|
135
|
+
...options?.headers,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get all tags assigned to a client
|
|
142
|
+
* GET /api/v1/clients/:clientId/tags
|
|
143
|
+
*/
|
|
144
|
+
async getClientTags(clientId: string, options?: RequestOptions): Promise<ClientTagsResponse> {
|
|
145
|
+
return this.client.get<ClientTagsResponse>(`clients/${clientId}/tags`, undefined, options);
|
|
146
|
+
}
|
|
147
|
+
}
|
package/src/sdk.ts
CHANGED
|
@@ -28,6 +28,9 @@ import {
|
|
|
28
28
|
PaymentMethodsResource,
|
|
29
29
|
WhatsAppResource,
|
|
30
30
|
WhatsAppTemplatesResource,
|
|
31
|
+
BulkMessagingResource,
|
|
32
|
+
ActivitiesResource,
|
|
33
|
+
TagsResource,
|
|
31
34
|
} from './resources';
|
|
32
35
|
|
|
33
36
|
export class GymSpaceSdk {
|
|
@@ -61,6 +64,9 @@ export class GymSpaceSdk {
|
|
|
61
64
|
public paymentMethods: PaymentMethodsResource;
|
|
62
65
|
public whatsapp: WhatsAppResource;
|
|
63
66
|
public whatsappTemplates: WhatsAppTemplatesResource;
|
|
67
|
+
public bulkMessaging: BulkMessagingResource;
|
|
68
|
+
public activities: ActivitiesResource;
|
|
69
|
+
public tags: TagsResource;
|
|
64
70
|
|
|
65
71
|
constructor(config: GymSpaceConfig) {
|
|
66
72
|
this.client = new ApiClient(config);
|
|
@@ -92,6 +98,9 @@ export class GymSpaceSdk {
|
|
|
92
98
|
this.paymentMethods = new PaymentMethodsResource(this.client);
|
|
93
99
|
this.whatsapp = new WhatsAppResource(this.client);
|
|
94
100
|
this.whatsappTemplates = new WhatsAppTemplatesResource(this.client);
|
|
101
|
+
this.bulkMessaging = new BulkMessagingResource(this.client);
|
|
102
|
+
this.activities = new ActivitiesResource(this.client);
|
|
103
|
+
this.tags = new TagsResource(this.client);
|
|
95
104
|
}
|
|
96
105
|
|
|
97
106
|
/**
|