@in.pulse-crm/sdk 2.1.0 → 2.1.1
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/auth.client.d.ts +2 -1
- package/dist/auth.client.js +8 -0
- package/dist/types/auth.types.d.ts +5 -0
- package/package.json +1 -1
- package/src/auth.client.ts +20 -8
- package/src/types/auth.types.ts +6 -0
package/dist/auth.client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataResponse } from "./types/response.types";
|
|
2
2
|
import ApiClient from "./api-client";
|
|
3
|
-
import { LoginData, SessionData } from "./types/auth.types";
|
|
3
|
+
import { LoginData, SessionData, UserOnlineSession } from "./types/auth.types";
|
|
4
4
|
/**
|
|
5
5
|
* Classe AuthSDK para interagir com a API de autenticação.
|
|
6
6
|
*/
|
|
@@ -34,6 +34,7 @@ export default class AuthClient extends ApiClient {
|
|
|
34
34
|
* @returns {Promise<boolean>} Verdadeiro se o usuário estiver autorizado, falso caso contrário.
|
|
35
35
|
*/
|
|
36
36
|
isAuthorized(instanceName: string, authToken: string, authorizedRoles: string[]): Promise<boolean>;
|
|
37
|
+
getOnlineSessions(instance: string): Promise<UserOnlineSession[]>;
|
|
37
38
|
initOnlineSession(authToken: string): Promise<void>;
|
|
38
39
|
finishOnlineSession(authToken: string): Promise<void>;
|
|
39
40
|
}
|
package/dist/auth.client.js
CHANGED
|
@@ -70,6 +70,14 @@ class AuthClient extends api_client_1.default {
|
|
|
70
70
|
return false;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
async getOnlineSessions(instance) {
|
|
74
|
+
const response = await this.httpClient.get("/api/online-sessions", {
|
|
75
|
+
params: {
|
|
76
|
+
instance,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
return response.data.data;
|
|
80
|
+
}
|
|
73
81
|
async initOnlineSession(authToken) {
|
|
74
82
|
await this.httpClient.post("/api/online-sessions", {}, {
|
|
75
83
|
headers: {
|
package/package.json
CHANGED
package/src/auth.client.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { sanitizeErrorMessage } from "@in.pulse-crm/utils";
|
|
2
2
|
import { DataResponse } from "./types/response.types";
|
|
3
3
|
import ApiClient from "./api-client";
|
|
4
|
-
import { LoginData, SessionData } from "./types/auth.types";
|
|
4
|
+
import { LoginData, SessionData, UserOnlineSession } from "./types/auth.types";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Classe AuthSDK para interagir com a API de autenticação.
|
|
@@ -92,6 +92,18 @@ export default class AuthClient extends ApiClient {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
public async getOnlineSessions(instance: string) {
|
|
96
|
+
const response = await this.httpClient.get<
|
|
97
|
+
DataResponse<UserOnlineSession[]>
|
|
98
|
+
>("/api/online-sessions", {
|
|
99
|
+
params: {
|
|
100
|
+
instance,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return response.data.data;
|
|
105
|
+
}
|
|
106
|
+
|
|
95
107
|
public async initOnlineSession(authToken: string) {
|
|
96
108
|
await this.httpClient.post(
|
|
97
109
|
"/api/online-sessions",
|
|
@@ -104,11 +116,11 @@ export default class AuthClient extends ApiClient {
|
|
|
104
116
|
);
|
|
105
117
|
}
|
|
106
118
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
public async finishOnlineSession(authToken: string) {
|
|
120
|
+
await this.httpClient.delete("/api/online-sessions", {
|
|
121
|
+
headers: {
|
|
122
|
+
Authorization: authToken,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
}
|
|
114
126
|
}
|