@in.pulse-crm/sdk 2.12.4 → 2.12.5

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.
@@ -14,14 +14,29 @@ export interface WppContactWithCustomer {
14
14
  id: number;
15
15
  name: string;
16
16
  phone: string;
17
- customerId?: number;
18
- avatarUrl?: string;
17
+ customerId: number | null;
18
+ avatarUrl: string | null;
19
19
  instance: string;
20
20
  isBlocked: boolean;
21
21
  isOnlyAdmin: boolean;
22
+ isDeleted: boolean;
23
+ createdAt: Date;
24
+ updatedAt: Date | null;
25
+ conversationExpiration: string | null;
22
26
  customer: Customer | null;
23
27
  chatingWith: string | null;
24
- lastOutOfHoursReplySentAt?: Date | null;
28
+ lastOutOfHoursReplySentAt: Date | null;
29
+ }
30
+ export interface PaginatedContactsResponse {
31
+ data: WppContactWithCustomer[];
32
+ pagination: {
33
+ page: number;
34
+ perPage: number;
35
+ total: number;
36
+ totalPages: number;
37
+ hasNext: boolean;
38
+ hasPrev: boolean;
39
+ };
25
40
  }
26
41
  export interface WppMessage {
27
42
  id: number;
@@ -1,7 +1,7 @@
1
1
  import ApiClient from "./api-client";
2
2
  import { RequestFilters } from "./types";
3
3
  import { DataResponse, MessageResponse } from "./types/response.types";
4
- import { AppNotification, AutomaticResponseRule, AutomaticResponseRuleDTO, CreateScheduleDTO, ForwardMessagesData, PaginatedNotificationsResponse, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
4
+ import { AppNotification, AutomaticResponseRule, AutomaticResponseRuleDTO, CreateScheduleDTO, ForwardMessagesData, PaginatedContactsResponse, PaginatedNotificationsResponse, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
5
5
  interface FetchMessagesFilters {
6
6
  minDate: string;
7
7
  maxDate: string;
@@ -32,7 +32,7 @@ export default class WhatsappClient extends ApiClient {
32
32
  hasCustomer?: boolean;
33
33
  page?: number;
34
34
  perPage?: number;
35
- }): Promise<WppContactWithCustomer[]>;
35
+ }): Promise<PaginatedContactsResponse>;
36
36
  getContacts(): Promise<WppContact[]>;
37
37
  createContact(name: string, phone: string, customerId?: number): Promise<WppContact>;
38
38
  forwardMessages(data: ForwardMessagesData): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.12.4",
3
+ "version": "2.12.5",
4
4
  "description": "SDKs for abstraction of api consumption of in.pulse-crm application",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,14 +16,30 @@ export interface WppContactWithCustomer {
16
16
  id: number;
17
17
  name: string;
18
18
  phone: string;
19
- customerId?: number;
20
- avatarUrl?: string;
19
+ customerId: number | null;
20
+ avatarUrl: string | null;
21
21
  instance: string;
22
22
  isBlocked: boolean;
23
23
  isOnlyAdmin: boolean;
24
+ isDeleted: boolean;
25
+ createdAt: Date;
26
+ updatedAt: Date | null;
27
+ conversationExpiration: string | null;
24
28
  customer: Customer | null;
25
29
  chatingWith: string | null;
26
- lastOutOfHoursReplySentAt?: Date | null;
30
+ lastOutOfHoursReplySentAt: Date | null;
31
+ }
32
+
33
+ export interface PaginatedContactsResponse {
34
+ data: WppContactWithCustomer[];
35
+ pagination: {
36
+ page: number;
37
+ perPage: number;
38
+ total: number;
39
+ totalPages: number;
40
+ hasNext: boolean;
41
+ hasPrev: boolean;
42
+ };
27
43
  }
28
44
 
29
45
  export interface WppMessage {
@@ -7,6 +7,7 @@ import {
7
7
  AutomaticResponseRuleDTO,
8
8
  CreateScheduleDTO,
9
9
  ForwardMessagesData,
10
+ PaginatedContactsResponse,
10
11
  PaginatedNotificationsResponse,
11
12
  SendMessageData,
12
13
  WppChatsAndMessages,
@@ -178,7 +179,7 @@ export default class WhatsappClient extends ApiClient {
178
179
  if (queryString) url += `?${queryString}`;
179
180
  }
180
181
  const { data: res } =
181
- await this.ax.get<DataResponse<WppContactWithCustomer[]>>(url);
182
+ await this.ax.get<DataResponse<PaginatedContactsResponse>>(url);
182
183
  return res.data;
183
184
  }
184
185