@in.pulse-crm/sdk 2.7.4 → 2.7.6

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/.prettierrc CHANGED
@@ -1,4 +1,4 @@
1
- {
2
- "tabWidth": 4,
3
- "useTabs": true
4
- }
1
+ {
2
+ "tabWidth": 4,
3
+ "useTabs": true
4
+ }
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import ApiClient from "./api-client";
4
2
  import { File, UploadFileOptions } from "./types/files.types";
5
3
  declare class FilesClient extends ApiClient {
@@ -1,7 +1,7 @@
1
1
  import ApiClient from "./api-client";
2
2
  import { ReadyMessage } from "./types/ready-messages.types";
3
3
  export default class ReadyMessageClient extends ApiClient {
4
- createReadyMessage(File?: File | null, TITULO?: string | null, TEXTO_MENSAGEM?: string | null): Promise<ReadyMessage>;
4
+ createReadyMessage(File?: File | null, TITULO?: string | null, TEXTO_MENSAGEM?: string | null, SETOR?: number | null): Promise<ReadyMessage>;
5
5
  deleteReadyMessage(chatId: number): Promise<void>;
6
6
  getReadyMessages(): Promise<ReadyMessage[]>;
7
7
  updateReadyMessage(id: number, ReadyMessage: ReadyMessage, file: File): Promise<ReadyMessage>;
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const api_client_1 = __importDefault(require("./api-client"));
7
7
  const form_data_1 = __importDefault(require("form-data"));
8
8
  class ReadyMessageClient extends api_client_1.default {
9
- async createReadyMessage(File = null, TITULO = null, TEXTO_MENSAGEM = null) {
9
+ async createReadyMessage(File = null, TITULO = null, TEXTO_MENSAGEM = null, SETOR = null) {
10
10
  const form = new form_data_1.default();
11
11
  if (File) {
12
12
  form.append("file", File);
13
13
  }
14
- form.append("data", JSON.stringify({ TITULO, TEXTO_MENSAGEM }));
14
+ form.append("data", JSON.stringify({ TITULO, TEXTO_MENSAGEM, SETOR }));
15
15
  const { data: res } = await this.httpClient.post(`/api/ready-messages`, form, {
16
16
  headers: {
17
17
  "Content-Type": "multipart/form-data",
@@ -1,5 +1,5 @@
1
1
  import ApiClient from "./api-client";
2
- import { ChatsReport, GenerateChatsReportOptions } from "./types/reports.types";
2
+ import { ChatsReport, ExecuteSqlReportOptions, ExportSqlReportOptions, GenerateChatsReportOptions, SQLReportRow } from "./types/reports.types";
3
3
  /**
4
4
  * ReportsClient class to handle reports related API calls.
5
5
  *
@@ -26,6 +26,32 @@ export default class ReportsClient extends ApiClient {
26
26
  * @param chatsReportId - The unique identifier of the chat report to be deleted.
27
27
  */
28
28
  deleteChatsReport(chatsReportId: number): Promise<void>;
29
+ /**
30
+ * Desative a report sql by its unique identifier.
31
+ *
32
+ * @param reportId - The unique identifier of the chat report to be deleted.
33
+ */
34
+ deleteHistoryReport(reportId: number): Promise<void>;
35
+ /**
36
+ * Execute a report sql interactions based on the provided options.
37
+ *
38
+ * @param body - The options for execute the report sql.
39
+ * @returns A promise that resolves to the data of the generated chats report.
40
+ */
41
+ executeSqlReport(body: ExecuteSqlReportOptions): Promise<SQLReportRow[]>;
42
+ /**
43
+ * Retrieves chat reports from the server.
44
+ *
45
+ * @returns A promise that resolves to an array of chat reports wrapped in a `DataResponse` object.
46
+ */
47
+ getSqlReportsHistory(): Promise<any[]>;
48
+ /**
49
+ * Export a report sql interactions based on the provided options.
50
+ *
51
+ * @param body - The options for export the report sql.
52
+ * @returns A promise that resolves to the data of the generated chats report.
53
+ */
54
+ exportReportSql(body: ExportSqlReportOptions): Promise<Blob>;
29
55
  /**
30
56
  * Sets the authorization token for the HTTP client.
31
57
  *
@@ -41,6 +41,49 @@ class ReportsClient extends api_client_1.default {
41
41
  const url = `/api/reports/chats/${chatsReportId}`;
42
42
  await this.httpClient.delete(url);
43
43
  }
44
+ /**
45
+ * Desative a report sql by its unique identifier.
46
+ *
47
+ * @param reportId - The unique identifier of the chat report to be deleted.
48
+ */
49
+ async deleteHistoryReport(reportId) {
50
+ const url = `/api/reports-history/${reportId}`;
51
+ await this.httpClient.delete(url);
52
+ }
53
+ /**
54
+ * Execute a report sql interactions based on the provided options.
55
+ *
56
+ * @param body - The options for execute the report sql.
57
+ * @returns A promise that resolves to the data of the generated chats report.
58
+ */
59
+ async executeSqlReport(body) {
60
+ const url = `/api/execute-report-sql`;
61
+ const { data: res } = await this.httpClient.post(url, body);
62
+ return res.data;
63
+ }
64
+ /**
65
+ * Retrieves chat reports from the server.
66
+ *
67
+ * @returns A promise that resolves to an array of chat reports wrapped in a `DataResponse` object.
68
+ */
69
+ async getSqlReportsHistory() {
70
+ const url = `/api/reports-history`;
71
+ const { data: res } = await this.httpClient.get(url);
72
+ return res.data;
73
+ }
74
+ /**
75
+ * Export a report sql interactions based on the provided options.
76
+ *
77
+ * @param body - The options for export the report sql.
78
+ * @returns A promise that resolves to the data of the generated chats report.
79
+ */
80
+ async exportReportSql(body) {
81
+ const url = `/api/export-report-sql`;
82
+ const response = await this.httpClient.post(url, body, {
83
+ responseType: 'blob',
84
+ });
85
+ return response.data;
86
+ }
44
87
  /**
45
88
  * Sets the authorization token for the HTTP client.
46
89
  *
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  export interface UploadFileOptions {
4
2
  /**
5
3
  * Nome da instância onde o arquivo está armazenado.
@@ -20,3 +20,23 @@ export interface GenerateChatsReportOptions {
20
20
  startDate: string;
21
21
  endDate: string;
22
22
  }
23
+ export interface SQLReportColumn {
24
+ name: string;
25
+ type: string;
26
+ }
27
+ export type SQLReportRow = Record<string, any>;
28
+ export interface SqlReport {
29
+ id: string;
30
+ description: string;
31
+ sql: string;
32
+ createdAt: string;
33
+ status: "pending" | "completed" | "failed";
34
+ resultUrl?: string;
35
+ }
36
+ export interface ExecuteSqlReportOptions {
37
+ sql: string;
38
+ description?: string;
39
+ }
40
+ export interface ExportSqlReportOptions extends ExecuteSqlReportOptions {
41
+ format: ChatsReportFormat;
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.7.4",
3
+ "version": "2.7.6",
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",
@@ -10,6 +10,7 @@ export default class ReadyMessageClient extends ApiClient {
10
10
  File: File | null = null,
11
11
  TITULO: string| null = null,
12
12
  TEXTO_MENSAGEM: string| null = null,
13
+ SETOR: number | null = null,
13
14
  ) {
14
15
  const form = new FormData();
15
16
 
@@ -19,7 +20,7 @@ export default class ReadyMessageClient extends ApiClient {
19
20
 
20
21
  form.append(
21
22
  "data",
22
- JSON.stringify({ TITULO, TEXTO_MENSAGEM }),
23
+ JSON.stringify({ TITULO, TEXTO_MENSAGEM,SETOR }),
23
24
  );
24
25
 
25
26
  const { data: res } = await this.httpClient.post<
@@ -1,5 +1,5 @@
1
1
  import ApiClient from "./api-client";
2
- import { ChatsReport, GenerateChatsReportOptions } from "./types/reports.types";
2
+ import { ChatsReport, ExecuteSqlReportOptions, ExportSqlReportOptions, GenerateChatsReportOptions, SQLReportRow } from "./types/reports.types";
3
3
  import { DataResponse, MessageResponse } from "./types/response.types";
4
4
 
5
5
  /**
@@ -46,6 +46,56 @@ export default class ReportsClient extends ApiClient {
46
46
  const url = `/api/reports/chats/${chatsReportId}`;
47
47
  await this.httpClient.delete<MessageResponse>(url);
48
48
  }
49
+ /**
50
+ * Desative a report sql by its unique identifier.
51
+ *
52
+ * @param reportId - The unique identifier of the chat report to be deleted.
53
+ */
54
+
55
+ public async deleteHistoryReport(reportId: number) {
56
+ const url = `/api/reports-history/${reportId}`;
57
+ await this.httpClient.delete<MessageResponse>(url);
58
+ }
59
+ /**
60
+ * Execute a report sql interactions based on the provided options.
61
+ *
62
+ * @param body - The options for execute the report sql.
63
+ * @returns A promise that resolves to the data of the generated chats report.
64
+ */
65
+
66
+ public async executeSqlReport(body: ExecuteSqlReportOptions) {
67
+ const url = `/api/execute-report-sql`;
68
+ const { data: res } = await this.httpClient.post<DataResponse<SQLReportRow[]>>(url, body);
69
+ return res.data;
70
+ }
71
+
72
+ /**
73
+ * Retrieves chat reports from the server.
74
+ *
75
+ * @returns A promise that resolves to an array of chat reports wrapped in a `DataResponse` object.
76
+ */
77
+ public async getSqlReportsHistory() {
78
+ const url = `/api/reports-history`;
79
+ const { data: res } =
80
+ await this.httpClient.get<DataResponse<Array<any>>>(url);
81
+
82
+ return res.data;
83
+ }
84
+ /**
85
+ * Export a report sql interactions based on the provided options.
86
+ *
87
+ * @param body - The options for export the report sql.
88
+ * @returns A promise that resolves to the data of the generated chats report.
89
+ */
90
+
91
+ public async exportReportSql(body: ExportSqlReportOptions) {
92
+ const url = `/api/export-report-sql`;
93
+ const response = await this.httpClient.post(url, body, {
94
+ responseType: 'blob',
95
+ });
96
+ return response.data as Blob;
97
+ }
98
+
49
99
 
50
100
  /**
51
101
  * Sets the authorization token for the HTTP client.
@@ -21,4 +21,29 @@ export interface GenerateChatsReportOptions {
21
21
  format: ChatsReportFormat;
22
22
  startDate: string;
23
23
  endDate: string;
24
- }
24
+ }
25
+
26
+ export interface SQLReportColumn {
27
+ name: string;
28
+ type: string;
29
+ }
30
+
31
+ export type SQLReportRow = Record<string, any>;
32
+
33
+ export interface SqlReport {
34
+ id: string;
35
+ description: string;
36
+ sql: string;
37
+ createdAt: string;
38
+ status: "pending" | "completed" | "failed";
39
+ resultUrl?: string;
40
+ }
41
+
42
+ export interface ExecuteSqlReportOptions {
43
+ sql: string;
44
+ description?: string;
45
+ }
46
+
47
+ export interface ExportSqlReportOptions extends ExecuteSqlReportOptions {
48
+ format: ChatsReportFormat;
49
+ }
package/tsconfig.json CHANGED
@@ -1,17 +1,17 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
4
- "module": "commonjs" /* Specify what module code is generated. */,
5
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
6
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
7
- "strict": true /* Enable all strict type-checking options. */,
8
- "skipLibCheck": true /* Skip type checking all .d.ts files. */,
9
- "noUnusedLocals": false,
10
- "outDir": "./dist", /* Redirect output structure to the directory. */
11
- "declaration": true
12
- },
13
- "include": [
14
- "src/index.ts",
15
- "src/**/*.{ts}"
16
- ]
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
4
+ "module": "commonjs" /* Specify what module code is generated. */,
5
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
6
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
7
+ "strict": true /* Enable all strict type-checking options. */,
8
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */,
9
+ "noUnusedLocals": false,
10
+ "outDir": "./dist", /* Redirect output structure to the directory. */
11
+ "declaration": true
12
+ },
13
+ "include": [
14
+ "src/index.ts",
15
+ "src/**/*.{ts}"
16
+ ]
17
17
  }