@in.pulse-crm/sdk 2.4.11 → 2.4.12
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,7 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
|
-
import { InternalChat } from "./types/internal.types";
|
|
2
|
+
import { InternalChat, InternalChatsAndMessages } from "./types/internal.types";
|
|
3
3
|
export default class InternalChatClient extends ApiClient {
|
|
4
|
+
getChatsBySession(messages?: boolean, contact?: boolean): Promise<InternalChatsAndMessages>;
|
|
4
5
|
getChatsForUser(userId: number, instance: string): Promise<InternalChat[]>;
|
|
5
6
|
getChatById(id: number): Promise<InternalChat>;
|
|
6
7
|
sendMessageToChat(chatId: number, userId: number, content: string): Promise<any>;
|
package/dist/internal.client.js
CHANGED
|
@@ -5,6 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const api_client_1 = __importDefault(require("./api-client"));
|
|
7
7
|
class InternalChatClient extends api_client_1.default {
|
|
8
|
+
async getChatsBySession(messages = false, contact = false) {
|
|
9
|
+
const url = `/api/internal/session/chats?messages=${messages}&contact=${contact}`;
|
|
10
|
+
console.log(this.httpClient.defaults.headers.common["Authorization"]);
|
|
11
|
+
const { data: res } = await this.httpClient.get(url);
|
|
12
|
+
return res.data;
|
|
13
|
+
}
|
|
8
14
|
async getChatsForUser(userId, instance) {
|
|
9
15
|
const url = `/api/internal/chats?userId=${userId}&instance=${instance}`;
|
|
10
16
|
const { data: res } = await this.httpClient.get(url);
|
package/package.json
CHANGED
package/src/internal.client.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
2
|
import { DataResponse } from "./types/response.types";
|
|
3
|
-
import { InternalChat } from "./types/internal.types";
|
|
3
|
+
import { InternalChat, InternalChatsAndMessages } from "./types/internal.types";
|
|
4
|
+
|
|
5
|
+
type GetChatsResponse = DataResponse<InternalChatsAndMessages>;
|
|
4
6
|
|
|
5
7
|
export default class InternalChatClient extends ApiClient {
|
|
8
|
+
public async getChatsBySession(
|
|
9
|
+
messages = false,
|
|
10
|
+
contact = false,
|
|
11
|
+
) {
|
|
12
|
+
const url = `/api/internal/session/chats?messages=${messages}&contact=${contact}`;
|
|
13
|
+
|
|
14
|
+
console.log(this.httpClient.defaults.headers.common["Authorization"]);
|
|
15
|
+
const { data: res } = await this.httpClient.get<GetChatsResponse>(url);
|
|
16
|
+
|
|
17
|
+
return res.data;
|
|
18
|
+
}
|
|
6
19
|
public async getChatsForUser(userId: number, instance: string) {
|
|
7
20
|
const url = `/api/internal/chats?userId=${userId}&instance=${instance}`;
|
|
8
21
|
const { data: res } = await this.httpClient.get<DataResponse<InternalChat[]>>(url);
|