UNPKG

op-client-api-proof-of-concept

Version:
1,057 lines (1,056 loc) 930 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ //---------------------- // <auto-generated> // Generated using the NSwag toolchain v13.15.5.0 (NJsonSchema v10.6.6.0 (Newtonsoft.Json v12.0.0.0)) (http://NSwag.org) // </auto-generated> //---------------------- // ReSharper disable InconsistentNaming var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiException = exports.SubjectType = exports.ReverseTypesEnum = exports.RetentionMediaType = exports.RecordOfficeActionsEnum = exports.DossierVersionState = exports.ActDirection = exports.Client = void 0; var Client = /** @class */ (function () { function Client(baseUrl, http) { this.jsonParseReviver = undefined; this.http = http ? http : window; this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "https://localhost:5001"; } /** * Creates a new act from the request body data. * @param includeRelated (optional) * @param body (optional) * @return Success */ Client.prototype.createAct = function (options) { var _this = this; var includeRelated = options.includeRelated, body = options.body; var url_ = this.baseUrl + "/api/Acts?"; if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var content_ = JSON.stringify(body); var options_ = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processCreateAct(_response); }); }; Client.prototype.processCreateAct = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 201) { return response.text().then(function (_responseText) { var result201 = null; result201 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result201; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Updates the specified act with the request body data. * @param entityID (optional) * @param actCode (optional) * @param barcodeCode (optional) * @param includeRelated (optional) * @param body (optional) * @return Success */ Client.prototype.updateAct = function (entityID, actCode, barcodeCode, includeRelated, body) { var _this = this; var url_ = this.baseUrl + "/api/Acts?"; if (entityID === null) throw new Error("The parameter 'entityID' cannot be null."); else if (entityID !== undefined) url_ += "entityID=" + encodeURIComponent("" + entityID) + "&"; if (actCode === null) throw new Error("The parameter 'actCode' cannot be null."); else if (actCode !== undefined) url_ += "actCode=" + encodeURIComponent("" + actCode) + "&"; if (barcodeCode === null) throw new Error("The parameter 'barcodeCode' cannot be null."); else if (barcodeCode !== undefined) url_ += "barcodeCode=" + encodeURIComponent("" + barcodeCode) + "&"; if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var content_ = JSON.stringify(body); var options_ = { body: content_, method: "PATCH", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processUpdateAct(_response); }); }; Client.prototype.processUpdateAct = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Cancels the specified act. * @param entityID (optional) * @param actCode (optional) * @param barcodeCode (optional) * @return Success */ Client.prototype.cancelAct = function (entityID, actCode, barcodeCode) { var _this = this; var url_ = this.baseUrl + "/api/Acts?"; if (entityID === null) throw new Error("The parameter 'entityID' cannot be null."); else if (entityID !== undefined) url_ += "entityID=" + encodeURIComponent("" + entityID) + "&"; if (actCode === null) throw new Error("The parameter 'actCode' cannot be null."); else if (actCode !== undefined) url_ += "actCode=" + encodeURIComponent("" + actCode) + "&"; if (barcodeCode === null) throw new Error("The parameter 'barcodeCode' cannot be null."); else if (barcodeCode !== undefined) url_ += "barcodeCode=" + encodeURIComponent("" + barcodeCode) + "&"; url_ = url_.replace(/[?&]$/, ""); var options_ = { method: "DELETE", headers: {} }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processCancelAct(_response); }); }; Client.prototype.processCancelAct = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 204) { return response.text().then(function (_responseText) { return; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Gets all acts from the database using paging filters. * @param pageSize (optional) * @param page (optional) * @param includePropertySets (optional) * @param includeRelated (optional) * @param includeCancelled (optional) * @return Success */ Client.prototype.getAllActs = function (pageSize, page, includePropertySets, includeRelated, includeCancelled) { var _this = this; var url_ = this.baseUrl + "/api/Acts?"; if (pageSize === null) throw new Error("The parameter 'pageSize' cannot be null."); else if (pageSize !== undefined) url_ += "pageSize=" + encodeURIComponent("" + pageSize) + "&"; if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; if (includePropertySets === null) throw new Error("The parameter 'includePropertySets' cannot be null."); else if (includePropertySets !== undefined) url_ += "includePropertySets=" + encodeURIComponent("" + includePropertySets) + "&"; if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; if (includeCancelled === null) throw new Error("The parameter 'includeCancelled' cannot be null."); else if (includeCancelled !== undefined) url_ += "includeCancelled=" + encodeURIComponent("" + includeCancelled) + "&"; url_ = url_.replace(/[?&]$/, ""); var options_ = { method: "GET", headers: { "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processGetAllActs(_response); }); }; Client.prototype.processGetAllActs = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Gets the specified act. * @param entityID (optional) * @param actCode (optional) * @param barcodeCode (optional) * @param includePropertySets (optional) * @param includeRelated (optional) * @param includeCancelled (optional) * @return Success */ Client.prototype.getAct = function (entityID, actCode, barcodeCode, includePropertySets, includeRelated, includeCancelled) { var _this = this; var url_ = this.baseUrl + "/api/Acts/single?"; if (entityID === null) throw new Error("The parameter 'entityID' cannot be null."); else if (entityID !== undefined) url_ += "entityID=" + encodeURIComponent("" + entityID) + "&"; if (actCode === null) throw new Error("The parameter 'actCode' cannot be null."); else if (actCode !== undefined) url_ += "actCode=" + encodeURIComponent("" + actCode) + "&"; if (barcodeCode === null) throw new Error("The parameter 'barcodeCode' cannot be null."); else if (barcodeCode !== undefined) url_ += "barcodeCode=" + encodeURIComponent("" + barcodeCode) + "&"; if (includePropertySets === null) throw new Error("The parameter 'includePropertySets' cannot be null."); else if (includePropertySets !== undefined) url_ += "includePropertySets=" + encodeURIComponent("" + includePropertySets) + "&"; if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; if (includeCancelled === null) throw new Error("The parameter 'includeCancelled' cannot be null."); else if (includeCancelled !== undefined) url_ += "includeCancelled=" + encodeURIComponent("" + includeCancelled) + "&"; url_ = url_.replace(/[?&]$/, ""); var options_ = { method: "GET", headers: { "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processGetAct(_response); }); }; Client.prototype.processGetAct = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Gets acts filtered by the oData query. * @param includePropertySets (optional) * @param includeRelated (optional) * @param includeCancelled (optional) * @return Success */ Client.prototype.searchActs = function (oDataQuery, includePropertySets, includeRelated, includeCancelled) { var _this = this; var url_ = this.baseUrl + "/api/Acts/{oDataQuery}?"; if (oDataQuery === undefined || oDataQuery === null) throw new Error("The parameter 'oDataQuery' must be defined."); url_ = url_.replace("{oDataQuery}", encodeURIComponent("" + oDataQuery)); if (includePropertySets === null) throw new Error("The parameter 'includePropertySets' cannot be null."); else if (includePropertySets !== undefined) url_ += "includePropertySets=" + encodeURIComponent("" + includePropertySets) + "&"; if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; if (includeCancelled === null) throw new Error("The parameter 'includeCancelled' cannot be null."); else if (includeCancelled !== undefined) url_ += "includeCancelled=" + encodeURIComponent("" + includeCancelled) + "&"; url_ = url_.replace(/[?&]$/, ""); var options_ = { method: "GET", headers: { "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processSearchActs(_response); }); }; Client.prototype.processSearchActs = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Adds the specified act to the specified case. * @param includeRelated (optional) * @return Success */ Client.prototype.addActToCase = function (actIdentifier, caseIdentifier, includeRelated) { var _this = this; var url_ = this.baseUrl + "/api/Acts/{actIdentifier}/AddToCase/{caseIdentifier}?"; if (actIdentifier === undefined || actIdentifier === null) throw new Error("The parameter 'actIdentifier' must be defined."); url_ = url_.replace("{actIdentifier}", encodeURIComponent("" + actIdentifier)); if (caseIdentifier === undefined || caseIdentifier === null) throw new Error("The parameter 'caseIdentifier' must be defined."); url_ = url_.replace("{caseIdentifier}", encodeURIComponent("" + caseIdentifier)); if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var options_ = { method: "POST", headers: { "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processAddActToCase(_response); }); }; Client.prototype.processAddActToCase = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Sets the owner of the specified act. * @param includeRelated (optional) * @param body (optional) * @return Success */ Client.prototype.setActOwner = function (actIdentifier, includeRelated, body) { var _this = this; var url_ = this.baseUrl + "/api/Acts/{actIdentifier}/Owner?"; if (actIdentifier === undefined || actIdentifier === null) throw new Error("The parameter 'actIdentifier' must be defined."); url_ = url_.replace("{actIdentifier}", encodeURIComponent("" + actIdentifier)); if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var content_ = JSON.stringify(body); var options_ = { body: content_, method: "PUT", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processSetActOwner(_response); }); }; Client.prototype.processSetActOwner = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Adds the solvers to the specified act. * @param includeRelated (optional) * @param body (optional) * @return Success */ Client.prototype.addActSolvers = function (actIdentifier, includeRelated, body) { var _this = this; var url_ = this.baseUrl + "/api/Acts/{actIdentifier}/Solvers?"; if (actIdentifier === undefined || actIdentifier === null) throw new Error("The parameter 'actIdentifier' must be defined."); url_ = url_.replace("{actIdentifier}", encodeURIComponent("" + actIdentifier)); if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var content_ = JSON.stringify(body); var options_ = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processAddActSolvers(_response); }); }; Client.prototype.processAddActSolvers = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Gets the solvers of the specified act. * @param includeRelated (optional) * @return Success */ Client.prototype.getActSolvers = function (actIdentifier, includeRelated) { var _this = this; var url_ = this.baseUrl + "/api/Acts/{actIdentifier}/Solvers?"; if (actIdentifier === undefined || actIdentifier === null) throw new Error("The parameter 'actIdentifier' must be defined."); url_ = url_.replace("{actIdentifier}", encodeURIComponent("" + actIdentifier)); if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var options_ = { method: "GET", headers: { "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processGetActSolvers(_response); }); }; Client.prototype.processGetActSolvers = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Adds the readers to the specified act. * @param includeRelated (optional) * @param body (optional) * @return Success */ Client.prototype.addActReaders = function (actIdentifier, includeRelated, body) { var _this = this; var url_ = this.baseUrl + "/api/Acts/{actIdentifier}/Readers?"; if (actIdentifier === undefined || actIdentifier === null) throw new Error("The parameter 'actIdentifier' must be defined."); url_ = url_.replace("{actIdentifier}", encodeURIComponent("" + actIdentifier)); if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var content_ = JSON.stringify(body); var options_ = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processAddActReaders(_response); }); }; Client.prototype.processAddActReaders = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Gets the readers of the specified act. * @param includeRelated (optional) * @return Success */ Client.prototype.getActReaders = function (actIdentifier, includeRelated) { var _this = this; var url_ = this.baseUrl + "/api/Acts/{actIdentifier}/Readers?"; if (actIdentifier === undefined || actIdentifier === null) throw new Error("The parameter 'actIdentifier' must be defined."); url_ = url_.replace("{actIdentifier}", encodeURIComponent("" + actIdentifier)); if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var options_ = { method: "GET", headers: { "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processGetActReaders(_response); }); }; Client.prototype.processGetActReaders = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Removes a solvers from the specified act. * @param includeRelated (optional) * @return Success */ Client.prototype.removeActSolver = function (actIdentifier, solverRelationEntityID, includeRelated) { var _this = this; var url_ = this.baseUrl + "/api/Acts/{actIdentifier}/Solvers/{solverRelationEntityID}?"; if (actIdentifier === undefined || actIdentifier === null) throw new Error("The parameter 'actIdentifier' must be defined."); url_ = url_.replace("{actIdentifier}", encodeURIComponent("" + actIdentifier)); if (solverRelationEntityID === undefined || solverRelationEntityID === null) throw new Error("The parameter 'solverRelationEntityID' must be defined."); url_ = url_.replace("{solverRelationEntityID}", encodeURIComponent("" + solverRelationEntityID)); if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var options_ = { method: "DELETE", headers: { "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processRemoveActSolver(_response); }); }; Client.prototype.processRemoveActSolver = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Removes a reader from the specified act. * @param includeRelated (optional) * @return Success */ Client.prototype.removeActReader = function (actIdentifier, solverRelationEntityID, includeRelated) { var _this = this; var url_ = this.baseUrl + "/api/Acts/{actIdentifier}/Readers/{solverRelationEntityID}?"; if (actIdentifier === undefined || actIdentifier === null) throw new Error("The parameter 'actIdentifier' must be defined."); url_ = url_.replace("{actIdentifier}", encodeURIComponent("" + actIdentifier)); if (solverRelationEntityID === undefined || solverRelationEntityID === null) throw new Error("The parameter 'solverRelationEntityID' must be defined."); url_ = url_.replace("{solverRelationEntityID}", encodeURIComponent("" + solverRelationEntityID)); if (includeRelated === null) throw new Error("The parameter 'includeRelated' cannot be null."); else if (includeRelated !== undefined) url_ += "includeRelated=" + encodeURIComponent("" + includeRelated) + "&"; url_ = url_.replace(/[?&]$/, ""); var options_ = { method: "DELETE", headers: { "Accept": "text/plain" } }; return this.http.fetch(url_, options_).then(function (_response) { return _this.processRemoveActReader(_response); }); }; Client.prototype.processRemoveActReader = function (response) { var _this = this; var status = response.status; var _headers = {}; if (response.headers && response.headers.forEach) { response.headers.forEach(function (v, k) { return _headers[k] = v; }); } ; if (status === 200) { return response.text().then(function (_responseText) { var result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return result200; }); } else if (status === 400) { return response.text().then(function (_responseText) { var result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Bad Request", status, _responseText, _headers, result400); }); } else if (status === 404) { return response.text().then(function (_responseText) { var result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Not Found", status, _responseText, _headers, result404); }); } else if (status === 500) { return response.text().then(function (_responseText) { var result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver); return throwException("Server Error", status, _responseText, _headers, result500); }); } else if (status !== 200 && status !== 204) { return response.text().then(function (_responseText) { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null); }; /** * Adds an act document to the specified act.