@itwin/access-control-client
Version:
Access control client for the iTwin platform
43 lines • 1.87 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.OwnerMembersClient = void 0;
const BaseClient_1 = require("./BaseClient");
class OwnerMembersClient extends BaseClient_1.BaseClient {
constructor(url) {
super(url);
}
/** Retrieves a list of iTwin owner members on an iTwin.
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @returns Array of members
*/
async queryITwinOwnerMembersAsync(accessToken, iTwinId, arg) {
let url = `${this._baseUrl}/${iTwinId}/members/owners`;
if (arg) {
url += `?${this.getQueryString(arg)}`;
}
return this.sendGenericAPIRequest(accessToken, "GET", url, undefined, "members"); // TODO: Consider how to handle paging
}
/** Add new iTwin owner member
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @param newMember The new owner member to add or invite
* @returns AddOwnerMemberResponse -- the added or invited owner
*/
async addITwinOwnerMemberAsync(accessToken, iTwinId, newMember) {
const url = `${this._baseUrl}/${iTwinId}/members/owners`;
return this.sendGenericAPIRequest(accessToken, "POST", url, newMember);
}
/** Remove the specified owner member from the iTwin
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @param memberId The id of the member
* @returns No Content
*/
async removeITwinOwnerMemberAsync(accessToken, iTwinId, memberId) {
const url = `${this._baseUrl}/${iTwinId}/members/owners/${memberId}`;
return this.sendGenericAPIRequest(accessToken, "DELETE", url);
}
}
exports.OwnerMembersClient = OwnerMembersClient;
//# sourceMappingURL=OwnerMembersClient.js.map
;