@gymspace/sdk 1.3.0 → 1.3.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/index.d.mts +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/whatsapp.ts +20 -0
- package/src/resources/admin-catalog.ts +25 -11
- package/src/resources/whatsapp.ts +16 -0
package/package.json
CHANGED
package/src/models/whatsapp.ts
CHANGED
|
@@ -140,3 +140,23 @@ export interface DisconnectResponse {
|
|
|
140
140
|
success: boolean;
|
|
141
141
|
message: string;
|
|
142
142
|
}
|
|
143
|
+
|
|
144
|
+
// Catalog Message interfaces
|
|
145
|
+
export interface SendCatalogMessageDto {
|
|
146
|
+
clientIds: string[];
|
|
147
|
+
urlCatalog: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface SendCatalogMessageResponse {
|
|
151
|
+
queued: boolean;
|
|
152
|
+
message: string;
|
|
153
|
+
total: number;
|
|
154
|
+
successful: number;
|
|
155
|
+
failed: number;
|
|
156
|
+
details: Array<{
|
|
157
|
+
clientId: string;
|
|
158
|
+
clientName: string;
|
|
159
|
+
status: 'fulfilled' | 'rejected';
|
|
160
|
+
error?: string;
|
|
161
|
+
}>;
|
|
162
|
+
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { BaseResource } from './base';
|
|
2
|
-
import { RequestOptions } from '../types';
|
|
3
|
-
import {
|
|
4
|
-
GymCatalog,
|
|
5
|
-
UpdateCatalogConfigDto,
|
|
6
|
-
CatalogLead,
|
|
7
|
-
LeadFiltersDto,
|
|
8
|
-
} from '../models/catalog';
|
|
2
|
+
import { RequestOptions, PaginatedResponseDto } from '../types';
|
|
3
|
+
import { GymCatalog, UpdateCatalogConfigDto, CatalogLead, LeadFiltersDto } from '../models/catalog';
|
|
9
4
|
|
|
10
5
|
/**
|
|
11
6
|
* Admin Catalog Resource
|
|
@@ -28,7 +23,7 @@ export class AdminCatalogResource extends BaseResource {
|
|
|
28
23
|
*/
|
|
29
24
|
async updateCatalogConfig(
|
|
30
25
|
data: UpdateCatalogConfigDto,
|
|
31
|
-
options?: RequestOptions
|
|
26
|
+
options?: RequestOptions,
|
|
32
27
|
): Promise<GymCatalog> {
|
|
33
28
|
return this.client.put<GymCatalog>(this.basePath, data, options);
|
|
34
29
|
}
|
|
@@ -39,8 +34,27 @@ export class AdminCatalogResource extends BaseResource {
|
|
|
39
34
|
*/
|
|
40
35
|
async getLeads(
|
|
41
36
|
filters?: LeadFiltersDto,
|
|
42
|
-
options?: RequestOptions
|
|
43
|
-
): Promise<CatalogLead
|
|
44
|
-
return this.client.get<CatalogLead
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): Promise<PaginatedResponseDto<CatalogLead>> {
|
|
39
|
+
return this.client.get<PaginatedResponseDto<CatalogLead>>(
|
|
40
|
+
`${this.basePath}/leads`,
|
|
41
|
+
filters,
|
|
42
|
+
options,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Mark a lead as contacted
|
|
48
|
+
* Requires: CATALOG_UPDATE permission
|
|
49
|
+
*/
|
|
50
|
+
async markLeadAsContacted(
|
|
51
|
+
leadId: string,
|
|
52
|
+
options?: RequestOptions,
|
|
53
|
+
): Promise<{ id: string; isContacted: boolean; contactedAt: string }> {
|
|
54
|
+
return this.client.patch<{ id: string; isContacted: boolean; contactedAt: string }>(
|
|
55
|
+
`${this.basePath}/leads/${leadId}/mark-contacted`,
|
|
56
|
+
undefined,
|
|
57
|
+
options,
|
|
58
|
+
);
|
|
45
59
|
}
|
|
46
60
|
}
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
InitializeConnectionResponse,
|
|
11
11
|
Contact,
|
|
12
12
|
DisconnectResponse,
|
|
13
|
+
SendCatalogMessageDto,
|
|
14
|
+
SendCatalogMessageResponse,
|
|
13
15
|
} from '../models/whatsapp';
|
|
14
16
|
import { RequestOptions, PaginatedResponseDto } from '../types';
|
|
15
17
|
|
|
@@ -94,4 +96,18 @@ export class WhatsAppResource extends BaseResource {
|
|
|
94
96
|
async disconnect(options?: RequestOptions): Promise<DisconnectResponse> {
|
|
95
97
|
return this.client.post<DisconnectResponse>(`${this.basePath}/disconnect`, {}, options);
|
|
96
98
|
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Send catalog message to multiple clients
|
|
102
|
+
*/
|
|
103
|
+
async sendCatalogMessage(
|
|
104
|
+
data: SendCatalogMessageDto,
|
|
105
|
+
options?: RequestOptions,
|
|
106
|
+
): Promise<SendCatalogMessageResponse> {
|
|
107
|
+
return this.client.post<SendCatalogMessageResponse>(
|
|
108
|
+
`${this.basePath}/send-catalog`,
|
|
109
|
+
data,
|
|
110
|
+
options,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
97
113
|
}
|