@fiado/api-invoker 1.0.19 → 1.0.20
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,8 +1,11 @@
|
|
|
1
1
|
import { IIdentityApi } from "./interfaces/IIdentityApi";
|
|
2
2
|
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
|
|
3
4
|
export declare class IdentityApi implements IIdentityApi {
|
|
4
5
|
private httpRequest;
|
|
5
6
|
private readonly baseUrl;
|
|
6
7
|
constructor(httpRequest: IHttpRequest);
|
|
7
8
|
getPeopleByIds(ids: string[]): Promise<any>;
|
|
9
|
+
updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void>;
|
|
10
|
+
getProfilePicture(directoryId: string): Promise<any>;
|
|
8
11
|
}
|
|
@@ -31,6 +31,21 @@ let IdentityApi = class IdentityApi {
|
|
|
31
31
|
const url = `${this.baseUrl}identities/people?${ids.map(id => `id=${encodeURIComponent(id)}`).join('&')}`;
|
|
32
32
|
return await this.httpRequest.get(`${url}`);
|
|
33
33
|
}
|
|
34
|
+
async updatePeopleById(id, data) {
|
|
35
|
+
if (!id) {
|
|
36
|
+
throw new Error("People ID is required.");
|
|
37
|
+
}
|
|
38
|
+
const url = `${this.baseUrl}identities/people/${id}`;
|
|
39
|
+
await this.httpRequest.put(url, data);
|
|
40
|
+
}
|
|
41
|
+
async getProfilePicture(directoryId) {
|
|
42
|
+
if (!directoryId) {
|
|
43
|
+
throw new Error("Directory ID is required.");
|
|
44
|
+
}
|
|
45
|
+
const url = `${this.baseUrl}identities/profile?directoryId=${directoryId}&typeOfDirectoryId=USER`;
|
|
46
|
+
const operationName = "getUserInfoByIds";
|
|
47
|
+
return await this.httpRequest.get(url, { 'operationName': operationName });
|
|
48
|
+
}
|
|
34
49
|
};
|
|
35
50
|
exports.IdentityApi = IdentityApi;
|
|
36
51
|
exports.IdentityApi = IdentityApi = __decorate([
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
|
|
1
2
|
/**
|
|
2
3
|
* Interfaz para el servicio Directory que permite operaciones sobre directorios.
|
|
3
4
|
*/
|
|
@@ -10,4 +11,19 @@ export interface IIdentityApi {
|
|
|
10
11
|
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
11
12
|
*/
|
|
12
13
|
getPeopleByIds(ids: string[]): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Actualiza la información de un people.
|
|
16
|
+
* @param id ID de people a actualizar.
|
|
17
|
+
* @param data Datos de people a actualizar.
|
|
18
|
+
* @returns Una promesa que resuelve a void.
|
|
19
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
20
|
+
*/
|
|
21
|
+
updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Obtiene la URL de la imagen de perfil de un usuario.
|
|
24
|
+
* @param directoryId ID de directorio del usuario.
|
|
25
|
+
* @returns Una promesa que resuelve a un objeto con la URL de la imagen de perfil.
|
|
26
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
27
|
+
*/
|
|
28
|
+
getProfilePicture(directoryId: string): Promise<any>;
|
|
13
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves de invocaciones http",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"types": "bin/index.d.ts",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@aws-sdk/client-sqs": "^3.572.0",
|
|
16
|
-
"@fiado/api-invoker": "^1.0.
|
|
16
|
+
"@fiado/api-invoker": "^1.0.19",
|
|
17
17
|
"@fiado/gateway-adapter": "^1.0.30",
|
|
18
18
|
"@fiado/http-client": "^1.0.1",
|
|
19
|
-
"@fiado/type-kit": "^1.0.
|
|
19
|
+
"@fiado/type-kit": "^1.0.64",
|
|
20
20
|
"dotenv": "^16.4.5",
|
|
21
21
|
"inversify": "^6.0.2",
|
|
22
22
|
"reflect-metadata": "^0.2.1",
|
|
@@ -2,15 +2,16 @@ import { inject, injectable } from "inversify";
|
|
|
2
2
|
import { IIdentityApi } from "./interfaces/IIdentityApi";
|
|
3
3
|
import { IHttpRequest } from "@fiado/http-client";
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
|
-
|
|
5
|
+
import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
|
|
6
|
+
dotenv.config();
|
|
6
7
|
|
|
7
8
|
@injectable()
|
|
8
9
|
export class IdentityApi implements IIdentityApi {
|
|
9
10
|
|
|
10
11
|
private readonly baseUrl = process.env.IDENTITY_LAMBDA_URL || "";
|
|
11
|
-
|
|
12
|
+
|
|
12
13
|
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
13
|
-
|
|
14
|
+
|
|
14
15
|
async getPeopleByIds(ids: string[]): Promise<any> {
|
|
15
16
|
|
|
16
17
|
if (ids.length === 0) {
|
|
@@ -18,8 +19,30 @@ export class IdentityApi implements IIdentityApi {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
const url = `${this.baseUrl}identities/people?${ids.map(id => `id=${encodeURIComponent(id)}`).join('&')}`;
|
|
21
|
-
|
|
22
22
|
return await this.httpRequest.get(`${url}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void> {
|
|
26
|
+
|
|
27
|
+
if (!id) {
|
|
28
|
+
throw new Error("People ID is required.")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const url = `${this.baseUrl}identities/people/${id}`;
|
|
32
|
+
await this.httpRequest.put<void>(url, data);
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async getProfilePicture(directoryId: string): Promise<any> {
|
|
37
|
+
|
|
38
|
+
if (!directoryId) {
|
|
39
|
+
throw new Error("Directory ID is required.")
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const url = `${this.baseUrl}identities/profile?directoryId=${directoryId}&typeOfDirectoryId=USER`;
|
|
43
|
+
const operationName = "getUserInfoByIds";
|
|
44
|
+
|
|
45
|
+
return await this.httpRequest.get<any>(url, { 'operationName': operationName });
|
|
23
46
|
|
|
24
47
|
}
|
|
25
48
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
|
|
1
2
|
|
|
2
3
|
/**
|
|
3
4
|
* Interfaz para el servicio Directory que permite operaciones sobre directorios.
|
|
@@ -11,4 +12,22 @@ export interface IIdentityApi {
|
|
|
11
12
|
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
12
13
|
*/
|
|
13
14
|
getPeopleByIds(ids: string[]): Promise<any>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Actualiza la información de un people.
|
|
18
|
+
* @param id ID de people a actualizar.
|
|
19
|
+
* @param data Datos de people a actualizar.
|
|
20
|
+
* @returns Una promesa que resuelve a void.
|
|
21
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
22
|
+
*/
|
|
23
|
+
updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Obtiene la URL de la imagen de perfil de un usuario.
|
|
27
|
+
* @param directoryId ID de directorio del usuario.
|
|
28
|
+
* @returns Una promesa que resuelve a un objeto con la URL de la imagen de perfil.
|
|
29
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
30
|
+
*/
|
|
31
|
+
getProfilePicture(directoryId: string): Promise<any>;
|
|
32
|
+
|
|
14
33
|
}
|