@in.pulse-crm/sdk 2.7.8 → 2.8.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.
|
@@ -16,7 +16,8 @@ export default class WhatsappClient extends ApiClient {
|
|
|
16
16
|
}[]>;
|
|
17
17
|
getCustomerContacts(customerId: number): Promise<WppContact[]>;
|
|
18
18
|
getContactsWithCustomer(): Promise<WppContactWithCustomer[]>;
|
|
19
|
-
|
|
19
|
+
getContacts(): Promise<WppContact[]>;
|
|
20
|
+
createContact(name: string, phone: string, customerId?: number): Promise<WppContact>;
|
|
20
21
|
updateContact(contactId: number, name: string): Promise<WppContact>;
|
|
21
22
|
deleteContact(contactId: number): Promise<void>;
|
|
22
23
|
getSectors(): Promise<{
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -76,12 +76,20 @@ class WhatsappClient extends api_client_1.default {
|
|
|
76
76
|
return res.data;
|
|
77
77
|
}
|
|
78
78
|
async getContactsWithCustomer() {
|
|
79
|
+
const url = `/api/whatsapp/contacts/customer`;
|
|
80
|
+
const { data: res } = await this.httpClient.get(url);
|
|
81
|
+
return res.data;
|
|
82
|
+
}
|
|
83
|
+
async getContacts() {
|
|
79
84
|
const url = `/api/whatsapp/contacts`;
|
|
80
85
|
const { data: res } = await this.httpClient.get(url);
|
|
81
86
|
return res.data;
|
|
82
87
|
}
|
|
83
88
|
async createContact(name, phone, customerId) {
|
|
84
|
-
const
|
|
89
|
+
const baseUrl = `/api/whatsapp`;
|
|
90
|
+
const url = customerId
|
|
91
|
+
? `${baseUrl}/customers/${customerId}/contacts`
|
|
92
|
+
: `${baseUrl}/contacts`;
|
|
85
93
|
const body = { name, phone };
|
|
86
94
|
const { data: res } = await this.httpClient.post(url, body);
|
|
87
95
|
return res.data;
|
package/package.json
CHANGED
package/src/whatsapp.client.ts
CHANGED
|
@@ -133,7 +133,7 @@ export default class WhatsappClient extends ApiClient {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
public async getContactsWithCustomer() {
|
|
136
|
-
const url = `/api/whatsapp/contacts`;
|
|
136
|
+
const url = `/api/whatsapp/contacts/customer`;
|
|
137
137
|
const { data: res } =
|
|
138
138
|
await this.httpClient.get<DataResponse<WppContactWithCustomer[]>>(
|
|
139
139
|
url,
|
|
@@ -141,13 +141,25 @@ export default class WhatsappClient extends ApiClient {
|
|
|
141
141
|
|
|
142
142
|
return res.data;
|
|
143
143
|
}
|
|
144
|
+
public async getContacts() {
|
|
145
|
+
const url = `/api/whatsapp/contacts`;
|
|
146
|
+
const { data: res } =
|
|
147
|
+
await this.httpClient.get<DataResponse<WppContact[]>>(
|
|
148
|
+
url,
|
|
149
|
+
);
|
|
144
150
|
|
|
151
|
+
return res.data;
|
|
152
|
+
}
|
|
145
153
|
public async createContact(
|
|
146
154
|
name: string,
|
|
147
155
|
phone: string,
|
|
148
|
-
customerId
|
|
156
|
+
customerId?: number,
|
|
149
157
|
) {
|
|
150
|
-
const
|
|
158
|
+
const baseUrl = `/api/whatsapp`;
|
|
159
|
+
const url = customerId
|
|
160
|
+
? `${baseUrl}/customers/${customerId}/contacts`
|
|
161
|
+
: `${baseUrl}/contacts`;
|
|
162
|
+
|
|
151
163
|
const body = { name, phone };
|
|
152
164
|
|
|
153
165
|
const { data: res } = await this.httpClient.post<
|