@in.pulse-crm/sdk 2.2.12 → 2.2.13
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
2
|
import { DataResponse } from "./types/response.types";
|
|
3
|
-
import { WppChatsAndMessages, WppChatWithDetailsAndMessages, WppMessage } from "./types/whatsapp.types";
|
|
3
|
+
import { WppChatsAndMessages, WppChatWithDetailsAndMessages, WppMessage, WppWallet } from "./types/whatsapp.types";
|
|
4
4
|
type GetChatsResponse = DataResponse<WppChatsAndMessages>;
|
|
5
5
|
type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
|
|
6
6
|
type GetMessageResponse = DataResponse<WppMessage>;
|
|
@@ -8,6 +8,7 @@ export default class WhatsappClient extends ApiClient {
|
|
|
8
8
|
getChatsBySession(token: string, messages?: boolean, contact?: boolean): Promise<GetChatsResponse>;
|
|
9
9
|
getChatById(id: number): Promise<GetChatResponse>;
|
|
10
10
|
getMessageById(id: string): Promise<GetMessageResponse>;
|
|
11
|
+
getUserWallets(instance: string, userId: number): Promise<DataResponse<WppWallet[]>>;
|
|
11
12
|
setAuth(token: string): void;
|
|
12
13
|
}
|
|
13
14
|
export {};
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -22,6 +22,10 @@ class WhatsappClient extends api_client_1.default {
|
|
|
22
22
|
const { data } = await this.httpClient.get(`/api/whatsapp/messages/${id}`);
|
|
23
23
|
return data;
|
|
24
24
|
}
|
|
25
|
+
async getUserWallets(instance, userId) {
|
|
26
|
+
const { data } = await this.httpClient.get(`/api/wallets?instance=${instance}&userId=${userId}`);
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
25
29
|
setAuth(token) {
|
|
26
30
|
this.httpClient.defaults.headers.common["Authorization"] =
|
|
27
31
|
`Bearer ${token}`;
|
package/package.json
CHANGED
package/src/whatsapp.client.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
WppChatsAndMessages,
|
|
5
5
|
WppChatWithDetailsAndMessages,
|
|
6
6
|
WppMessage,
|
|
7
|
+
WppWallet,
|
|
7
8
|
} from "./types/whatsapp.types";
|
|
8
9
|
|
|
9
10
|
type GetChatsResponse = DataResponse<WppChatsAndMessages>;
|
|
@@ -43,6 +44,14 @@ export default class WhatsappClient extends ApiClient {
|
|
|
43
44
|
return data;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
public async getUserWallets(instance: string, userId: number) {
|
|
48
|
+
const { data } = await this.httpClient.get<DataResponse<WppWallet[]>>(
|
|
49
|
+
`/api/wallets?instance=${instance}&userId=${userId}`,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
|
|
46
55
|
public setAuth(token: string) {
|
|
47
56
|
this.httpClient.defaults.headers.common["Authorization"] =
|
|
48
57
|
`Bearer ${token}`;
|