@liquid-state/idm-client
Advanced tools
Comparing version
@@ -13,2 +13,3 @@ import { IIDMClient, Options, CreateUser, CreateInvitation } from './types'; | ||
deleteInvitation: (id: string) => Promise<Response>; | ||
solutions: (page?: number) => Promise<Response>; | ||
updateUser: (id: string, user: { | ||
@@ -15,0 +16,0 @@ [key: string]: any; |
@@ -56,2 +56,3 @@ var __assign = (this && this.__assign) || function () { | ||
invitations: 'invitations/', | ||
solutions: 'solutions/', | ||
updateUser: 'users/{{id}}', | ||
@@ -102,2 +103,6 @@ updateUserProfile: 'users/{{id}}', | ||
}; | ||
this.solutions = function (page) { | ||
if (page === void 0) { page = 1; } | ||
return _this.apiRequest('solutions', 'Failed to fetch solutions list', 'GET', { page: page }); | ||
}; | ||
this.updateUser = function (id, user) { | ||
@@ -104,0 +109,0 @@ return _this.apiRequest('updateUserProfile', 'Failed to update IDM user', 'PATCH', undefined, user, { id: id }); |
@@ -1,2 +0,2 @@ | ||
import { IIDMClient, IIDMService, IDMUser, CreateUser, CreateInvitation } from './types'; | ||
import { IIDMClient, IIDMService, IDMUser, CreateUser, CreateInvitation, IDMSolutionConfigurations } from './types'; | ||
declare class IDMService implements IIDMService { | ||
@@ -11,2 +11,3 @@ private client; | ||
getAllUsers: () => Promise<IDMUser[]>; | ||
solutions: () => Promise<IDMSolutionConfigurations[]>; | ||
updateUser: (id: string, user: { | ||
@@ -13,0 +14,0 @@ [key: string]: any; |
@@ -126,2 +126,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}); }; | ||
this.solutions = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var response, body, organisations, nextUrl, pageNumber; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.client.solutions()]; | ||
case 1: | ||
response = _a.sent(); | ||
return [4 /*yield*/, response.json()]; | ||
case 2: | ||
body = _a.sent(); | ||
organisations = __spreadArrays(body.results); | ||
nextUrl = body.next; | ||
_a.label = 3; | ||
case 3: | ||
if (!!!nextUrl) return [3 /*break*/, 6]; | ||
pageNumber = this.extractPageNumber(nextUrl); | ||
return [4 /*yield*/, this.client.solutions(pageNumber)]; | ||
case 4: | ||
response = _a.sent(); | ||
return [4 /*yield*/, response.json()]; | ||
case 5: | ||
body = _a.sent(); | ||
nextUrl = body.next; | ||
organisations = __spreadArrays(organisations, body.results); | ||
return [3 /*break*/, 3]; | ||
case 6: return [2 /*return*/, organisations]; | ||
} | ||
}); | ||
}); }; | ||
this.updateUser = function (id, user) { return __awaiter(_this, void 0, void 0, function () { | ||
@@ -128,0 +157,0 @@ var response, body; |
@@ -8,2 +8,3 @@ declare type ISOString = string; | ||
deleteInvitation(id: string): Promise<Response>; | ||
solutions(page?: number): Promise<Response>; | ||
updateUser(id: string, user: { | ||
@@ -21,4 +22,5 @@ [key: string]: any; | ||
deleteInvitation(id: string): Promise<boolean>; | ||
getAllUsers(): Promise<IDMUser[]>; | ||
idm: IIDMClient; | ||
getAllUsers(): Promise<IDMUser[]>; | ||
solutions(): Promise<IDMSolutionConfigurations[]>; | ||
updateUser(id: string, user: { | ||
@@ -59,2 +61,23 @@ [key: string]: any; | ||
}; | ||
export declare type IDMSolutionConfigurations = { | ||
configurations: IDMSolution[]; | ||
name: string; | ||
url: string; | ||
}; | ||
export declare type IDMSolution = { | ||
body: { | ||
app_token: string; | ||
hospital_id: string; | ||
organisation_slug: string; | ||
ubiquity_app_id: number; | ||
ubiquity_organisation_id: number; | ||
ubiquity_organisation_slug: string; | ||
}; | ||
organisation: { | ||
pk: number; | ||
slug: string; | ||
name: string; | ||
}; | ||
solution_name: string; | ||
}; | ||
export declare type CreateInvitation = { | ||
@@ -61,0 +84,0 @@ organisation: string; |
{ | ||
"name": "@liquid-state/idm-client", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "A client for the idm", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
45389
9.26%643
10.1%