@acceleratxr/core_sdk
Advanced tools
Comparing version
@@ -126,2 +126,42 @@ "use strict"; | ||
} | ||
/** | ||
* Returns the count of users in a given zone. | ||
*/ | ||
countUsers(id) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let result = 0; | ||
let url = this.config.getBaseServicePath(ZoneService) + "/:id/users"; | ||
if (url) { | ||
url = url.replace(":id", id); | ||
const headers = yield this.apiClient.head(url); | ||
if (headers["content-length"]) { | ||
result = Number(headers["content-length"]); | ||
} | ||
} | ||
else { | ||
throw new Error("Failed to retrieve service base path. Is it configured properly?"); | ||
} | ||
return result; | ||
}); | ||
} | ||
/** | ||
* Returns the list of all user id's in a given zone. | ||
*/ | ||
getUsers(id) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let url = this.config.getBaseServicePath(ZoneService) + "/:id/users"; | ||
if (url) { | ||
const response = yield this.apiClient.get(url); | ||
if (response.status >= 200 && response.status < 300 && response.data) { | ||
return response.data; | ||
} | ||
else { | ||
throw response.data; | ||
} | ||
} | ||
else { | ||
throw new Error("Failed to retrieve service base path. Is it configured properly?"); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -128,0 +168,0 @@ // Generated https://www.uuidgenerator.net/version4 |
@@ -36,2 +36,10 @@ import { ServiceBase } from "../ServiceBase"; | ||
delete(id: string): Promise<void>; | ||
/** | ||
* Returns the count of users in a given zone. | ||
*/ | ||
countUsers(id: string): Promise<number>; | ||
/** | ||
* Returns the list of all user id's in a given zone. | ||
*/ | ||
getUsers(id: string): Promise<string[] | undefined>; | ||
} |
{ | ||
"name": "@acceleratxr/core_sdk", | ||
"version": "1.54.3", | ||
"version": "1.55.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Jean-Philippe Steinmetz <info@acceleratxr.com>", |
Sorry, the diff of this file is not supported yet
4288756
0.06%19016
0.25%