@itwin/imodels-client-management
Version:
iModels API client wrapper for applications that manage iModels.
26 lines • 945 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUser = getUser;
exports.assertStringHeaderValue = assertStringHeaderValue;
exports.assertLink = assertLink;
async function getUser(authorization, userOperations, urlFormatter, userLink, headers) {
if (!userLink)
return undefined;
const { iModelId, userId } = urlFormatter.parseUserUrl(userLink);
return userOperations.getSingle({
authorization,
iModelId,
userId,
headers,
});
}
function assertStringHeaderValue(headerName, headerValue) {
const isString = typeof headerValue === "string" || headerValue instanceof String;
if (!isString)
throw new Error(`Assertion failed: header's ${headerName} value is not a string.`);
}
function assertLink(link) {
if (!link || !link.href)
throw new Error("Assertion failed: link is falsy.");
}
//# sourceMappingURL=SharedFunctions.js.map