@itwin/access-control-client
Version:
Access control client for the iTwin platform
53 lines • 2.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ITwinJobsClient = void 0;
const BaseClient_1 = require("./BaseClient");
class ITwinJobsClient extends BaseClient_1.BaseClient {
constructor(url) {
super(url);
}
/** Create a new iTwin Job
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @param iTwinActions The actions of the iTwin Job
* @returns ITwin Job
*/
async createITwinJobAsync(accessToken, iTwinId, iTwinJobActions) {
const url = `${this._baseUrl}/${iTwinId}/jobs`;
return this.sendGenericAPIRequest(accessToken, "POST", url, { actions: iTwinJobActions });
}
/** Gets an iTwin Job.
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @param iTwinJobId The id of the iTwin Job
* @param resultMode (Optional) Access Control result mode: minimal or representation (defaults to minimal)
* @returns ITwin Job
*/
async getITwinJobAsync(accessToken, iTwinId, iTwinJobId, resultMode) {
const headers = this.getResultModeHeaders(resultMode);
const url = `${this._baseUrl}/${iTwinId}/jobs/${iTwinJobId}`;
return this.sendGenericAPIRequest(accessToken, "GET", url, undefined, undefined, headers);
}
/** Gets an iTwin Job.
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @param iTwinJobId The id of the iTwin Job
* @returns ITwin Job Actions
*/
async getITwinJobActionsAsync(accessToken, iTwinId, iTwinJobId) {
const url = `${this._baseUrl}/${iTwinId}/jobs/${iTwinJobId}/actions`;
return this.sendGenericAPIRequest(accessToken, "GET", url, undefined, "actions");
}
/**
* Format result mode parameter into a headers entry
* @param resultMode (Optional) Access Control result mode
* @protected
*/
getResultModeHeaders(resultMode = "minimal") {
return {
prefer: `return=${resultMode}`,
};
}
}
exports.ITwinJobsClient = ITwinJobsClient;
//# sourceMappingURL=ITwinJobsClient.js.map