@in.pulse-crm/sdk 2.2.6 → 2.2.8
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.
- package/dist/types/socket-events.types.d.ts +1 -1
- package/dist/users.client.d.ts +3 -1
- package/dist/users.client.js +7 -1
- package/dist/whatsapp.client.d.ts +1 -1
- package/dist/whatsapp.client.js +7 -2
- package/package.json +4 -3
- package/src/types/socket-events.types.ts +1 -1
- package/src/users.client.ts +9 -1
- package/src/whatsapp.client.ts +12 -4
package/dist/users.client.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { DataResponse, PaginatedResponse } from "./types/response.types";
|
|
2
2
|
import { CreateUserDTO, UpdateUserDTO, User } from "./types/user.types";
|
|
3
3
|
import ApiClient from "./api-client";
|
|
4
|
+
import { RequestFilters } from "./types";
|
|
4
5
|
/**
|
|
5
6
|
* SDK para operações de usuários.
|
|
6
7
|
*/
|
|
7
8
|
export default class UsersClient extends ApiClient {
|
|
8
9
|
/**
|
|
9
10
|
* Obtém a lista de usuários.
|
|
11
|
+
* @param filters - Filtros opcionais para a query.
|
|
10
12
|
* @returns Uma resposta paginada contendo os usuários.
|
|
11
13
|
*/
|
|
12
|
-
getUsers(): Promise<PaginatedResponse<User>>;
|
|
14
|
+
getUsers(filters?: RequestFilters<User>): Promise<PaginatedResponse<User>>;
|
|
13
15
|
/**
|
|
14
16
|
* Obtém um usuário pelo ID.
|
|
15
17
|
* @param userId - O ID do usuário.
|
package/dist/users.client.js
CHANGED
|
@@ -10,9 +10,15 @@ const api_client_1 = __importDefault(require("./api-client"));
|
|
|
10
10
|
class UsersClient extends api_client_1.default {
|
|
11
11
|
/**
|
|
12
12
|
* Obtém a lista de usuários.
|
|
13
|
+
* @param filters - Filtros opcionais para a query.
|
|
13
14
|
* @returns Uma resposta paginada contendo os usuários.
|
|
14
15
|
*/
|
|
15
|
-
async getUsers() {
|
|
16
|
+
async getUsers(filters) {
|
|
17
|
+
let baseUrl = `/api/users`;
|
|
18
|
+
const params = new URLSearchParams(filters);
|
|
19
|
+
if (params.toString()) {
|
|
20
|
+
baseUrl += `?${params.toString()}`;
|
|
21
|
+
}
|
|
16
22
|
const response = await this.httpClient.get(`/api/users`);
|
|
17
23
|
return response.data;
|
|
18
24
|
}
|
|
@@ -5,7 +5,7 @@ type GetChatsResponse = DataResponse<WppChatsAndMessages>;
|
|
|
5
5
|
type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
|
|
6
6
|
type GetMessageResponse = DataResponse<WppMessage>;
|
|
7
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
11
|
setAuth(token: string): void;
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -5,8 +5,13 @@ 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 WhatsappClient extends api_client_1.default {
|
|
8
|
-
async
|
|
9
|
-
const
|
|
8
|
+
async getChatsBySession(token, messages = false, contact = false) {
|
|
9
|
+
const url = `/api/whatsapp/session/chats?messages=${messages}&contact=${contact}`;
|
|
10
|
+
const { data } = await this.httpClient.get(url, {
|
|
11
|
+
headers: {
|
|
12
|
+
Authorization: `Bearer ${token}`,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
10
15
|
return data;
|
|
11
16
|
}
|
|
12
17
|
async getChatById(id) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@in.pulse-crm/sdk",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
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",
|
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@in.pulse-crm/utils": "^1.3.0",
|
|
27
27
|
"axios": "^1.8.3",
|
|
28
|
-
"socket.io-client": "^4.8.1"
|
|
28
|
+
"socket.io-client": "^4.8.1",
|
|
29
|
+
"tsc": "^2.0.4"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/node": "^22.13.10",
|
|
32
33
|
"prettier": "^3.5.3",
|
|
33
|
-
"typescript": "^5.8.
|
|
34
|
+
"typescript": "^5.8.3"
|
|
34
35
|
}
|
|
35
36
|
}
|
package/src/users.client.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DataResponse, PaginatedResponse } from "./types/response.types";
|
|
2
2
|
import { CreateUserDTO, UpdateUserDTO, User } from "./types/user.types";
|
|
3
3
|
import ApiClient from "./api-client";
|
|
4
|
+
import { RequestFilters } from "./types";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* SDK para operações de usuários.
|
|
@@ -8,9 +9,16 @@ import ApiClient from "./api-client";
|
|
|
8
9
|
export default class UsersClient extends ApiClient {
|
|
9
10
|
/**
|
|
10
11
|
* Obtém a lista de usuários.
|
|
12
|
+
* @param filters - Filtros opcionais para a query.
|
|
11
13
|
* @returns Uma resposta paginada contendo os usuários.
|
|
12
14
|
*/
|
|
13
|
-
public async getUsers() {
|
|
15
|
+
public async getUsers(filters?: RequestFilters<User>) {
|
|
16
|
+
let baseUrl = `/api/users`;
|
|
17
|
+
const params = new URLSearchParams(filters);
|
|
18
|
+
if (params.toString()) {
|
|
19
|
+
baseUrl += `?${params.toString()}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
const response =
|
|
15
23
|
await this.httpClient.get<PaginatedResponse<User>>(`/api/users`);
|
|
16
24
|
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -11,10 +11,18 @@ type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
|
|
|
11
11
|
type GetMessageResponse = DataResponse<WppMessage>;
|
|
12
12
|
|
|
13
13
|
export default class WhatsappClient extends ApiClient {
|
|
14
|
-
public async
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
public async getChatsBySession(
|
|
15
|
+
token: string,
|
|
16
|
+
messages = false,
|
|
17
|
+
contact = false,
|
|
18
|
+
) {
|
|
19
|
+
const url = `/api/whatsapp/session/chats?messages=${messages}&contact=${contact}`;
|
|
20
|
+
|
|
21
|
+
const { data } = await this.httpClient.get<GetChatsResponse>(url, {
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: `Bearer ${token}`,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
18
26
|
|
|
19
27
|
return data;
|
|
20
28
|
}
|