@in.pulse-crm/sdk 2.4.13 → 2.4.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
|
-
import { InternalChat, InternalChatsAndMessages, InternalContactWithUser } from "./types/internal.types";
|
|
2
|
+
import { InternalChat, InternalChatsAndMessages, InternalChatWithDetailsAndMessages, InternalContactWithUser } from "./types/internal.types";
|
|
3
3
|
export default class InternalChatClient extends ApiClient {
|
|
4
4
|
getChatsBySession(messages?: boolean, contact?: boolean): Promise<InternalChatsAndMessages>;
|
|
5
5
|
getChatsForUser(userId: number, instance: string): Promise<InternalChat[]>;
|
|
@@ -8,5 +8,6 @@ export default class InternalChatClient extends ApiClient {
|
|
|
8
8
|
createGroup(name: string, participantIds: number[], userId: number): Promise<InternalChat>;
|
|
9
9
|
updateGroupMembers(groupId: number, add: number[], remove: number[]): Promise<any>;
|
|
10
10
|
getContactsWithUser(): Promise<InternalContactWithUser[]>;
|
|
11
|
+
startChatByContactId(contactId: number): Promise<InternalChatWithDetailsAndMessages>;
|
|
11
12
|
setAuth(token: string): void;
|
|
12
13
|
}
|
package/dist/internal.client.js
CHANGED
|
@@ -39,6 +39,12 @@ class InternalChatClient extends api_client_1.default {
|
|
|
39
39
|
const { data: res } = await this.httpClient.get(url);
|
|
40
40
|
return res.data;
|
|
41
41
|
}
|
|
42
|
+
async startChatByContactId(contactId) {
|
|
43
|
+
const url = `/api/internal/chats`;
|
|
44
|
+
const body = { contactId };
|
|
45
|
+
const { data: res } = await this.httpClient.post(url, body);
|
|
46
|
+
return res.data;
|
|
47
|
+
}
|
|
42
48
|
setAuth(token) {
|
|
43
49
|
this.httpClient.defaults.headers.common["Authorization"] =
|
|
44
50
|
`Bearer ${token}`;
|
package/package.json
CHANGED
package/src/internal.client.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
2
|
import { DataResponse } from "./types/response.types";
|
|
3
|
-
import { InternalChat, InternalChatsAndMessages, InternalContactWithUser } from "./types/internal.types";
|
|
3
|
+
import { InternalChat, InternalChatsAndMessages, InternalChatWithDetailsAndMessages, InternalContactWithUser } from "./types/internal.types";
|
|
4
4
|
|
|
5
5
|
type GetChatsResponse = DataResponse<InternalChatsAndMessages>;
|
|
6
6
|
|
|
@@ -59,6 +59,16 @@ type GetChatsResponse = DataResponse<InternalChatsAndMessages>;
|
|
|
59
59
|
|
|
60
60
|
return res.data;
|
|
61
61
|
}
|
|
62
|
+
public async startChatByContactId(contactId: number) {
|
|
63
|
+
const url = `/api/internal/chats`;
|
|
64
|
+
const body = { contactId };
|
|
65
|
+
|
|
66
|
+
const { data: res } = await this.httpClient.post<
|
|
67
|
+
DataResponse<InternalChatWithDetailsAndMessages>
|
|
68
|
+
>(url, body);
|
|
69
|
+
|
|
70
|
+
return res.data;
|
|
71
|
+
}
|
|
62
72
|
|
|
63
73
|
public setAuth(token: string) {
|
|
64
74
|
this.httpClient.defaults.headers.common["Authorization"] =
|