UNPKG

spitfirepm

Version:

Client API Tools for Spitfire Project Management

1,083 lines 1.23 MB
"use strict"; //---------------------- // <auto-generated> // Generated using the NSwag toolchain v14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // </auto-generated> //---------------------- Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiException = exports.PermissionFlags = exports.HttpStatusCode = exports.XTSClient = exports.UICFGClient = exports.SystemClient = exports.SessionClient = exports.ProjectsClient = exports.ProjectTeamClient = exports.ProjectKPIClient = exports.ProjectDocListClient = exports.ProjectToolsClient = exports.ExcelToolsClient = exports.DocumentToolsClient = exports.ContactClient = exports.ConfigClient = exports.CatalogClient = exports.LookupClient = exports.AlertsClient = exports.ActionItemsClient = exports.AccountClient = void 0; /* eslint-disable */ // ReSharper disable InconsistentNaming const APIClientBase_1 = require("./APIClientBase"); const jQuery = require("jquery"); class AccountClient extends APIClientBase_1.APIClientBase { baseUrl; beforeSend = undefined; jsonParseReviver = undefined; constructor(baseUrl) { super(); this.baseUrl = baseUrl ?? this.getBaseUrl("http://stany2023/SFPMS"); } /** * Authenticates a session and generates a FormsAuthenticationTicket and cookie */ postLogin(credentials) { return new Promise((resolve, reject) => { this.postLoginWithCallbacks(credentials, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } postLoginWithCallbacks(credentials, onSuccess, onFail) { let url_ = this.baseUrl + "/api/Account"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(credentials); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "post", data: content_, dataType: "text", headers: { "Content-Type": "application/json", "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processPostLoginWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processPostLoginWithCallbacks(url_, xhr, onSuccess, onFail); }); } processPostLoginWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processPostLogin(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processPostLogin(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 302) { const _responseText = xhr.responseText; let result302 = null; result302 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Unusable credentials with redirect to login ", status, _responseText, _headers, result302); } else if (status === 400) { const _responseText = xhr.responseText; let result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not allowed now (already authenticated?)", status, _responseText, _headers, result400); } else if (status === 401) { const _responseText = xhr.responseText; let result401 = null; result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Unusable credentials", status, _responseText, _headers, result401); } else if (status === 409) { const _responseText = xhr.responseText; let result409 = null; result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not allowed now (see message for issue) ", status, _responseText, _headers, result409); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Backend failure", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Returns general information about the Authenticated user */ getUserData() { return new Promise((resolve, reject) => { this.getUserDataWithCallbacks((result) => resolve(result), (exception, _reason) => reject(exception)); }); } getUserDataWithCallbacks(onSuccess, onFail) { let url_ = this.baseUrl + "/api/Account"; url_ = url_.replace(/[?&]$/, ""); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "get", dataType: "text", headers: { "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processGetUserDataWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processGetUserDataWithCallbacks(url_, xhr, onSuccess, onFail); }); } processGetUserDataWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processGetUserData(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processGetUserData(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 401) { const _responseText = xhr.responseText; let result401 = null; result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not currently authenticated", status, _responseText, _headers, result401); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Internal Error", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Returns authorization flags for specified demand if they match or exceed the request * @param demand Demand Context */ getAccessAllows(demand) { return new Promise((resolve, reject) => { this.getAccessAllowsWithCallbacks(demand, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } getAccessAllowsWithCallbacks(demand, onSuccess, onFail) { let url_ = this.baseUrl + "/api/account/allows"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(demand); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "post", data: content_, dataType: "text", headers: { "Content-Type": "application/json", "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processGetAccessAllowsWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processGetAccessAllowsWithCallbacks(url_, xhr, onSuccess, onFail); }); } processGetAccessAllowsWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processGetAccessAllows(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processGetAccessAllows(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 401) { const _responseText = xhr.responseText; let result401 = null; result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not currently authenticated", status, _responseText, _headers, result401); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Internal failure; see response", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Digest an identity from an Google token * @param subId google nonvolatile id * @param nonce nonce * @param token token */ shareGoogleAuth(subId, nonce, token) { return new Promise((resolve, reject) => { this.shareGoogleAuthWithCallbacks(subId, nonce, token, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } shareGoogleAuthWithCallbacks(subId, nonce, token, onSuccess, onFail) { let url_ = this.baseUrl + "/api/account/google/{subId}?"; if (subId === undefined || subId === null) throw new globalThis.Error("The parameter 'subId' must be defined."); url_ = url_.replace("{subId}", encodeURIComponent("" + subId)); if (nonce === undefined || nonce === null) throw new globalThis.Error("The parameter 'nonce' must be defined and cannot be null."); else url_ += "nonce=" + encodeURIComponent("" + nonce) + "&"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(token); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "post", data: content_, dataType: "text", headers: { "Content-Type": "application/json", "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processShareGoogleAuthWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processShareGoogleAuthWithCallbacks(url_, xhr, onSuccess, onFail); }); } processShareGoogleAuthWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processShareGoogleAuth(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processShareGoogleAuth(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 400) { const _responseText = xhr.responseText; let result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not allowed now (already authenticated?)", status, _responseText, _headers, result400); } else if (status === 401) { const _responseText = xhr.responseText; let result401 = null; result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Unusable credentials", status, _responseText, _headers, result401); } else if (status === 409) { const _responseText = xhr.responseText; let result409 = null; result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not allowed now (see message for issue) ", status, _responseText, _headers, result409); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Ugh", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Ends this session */ getEndOfSession() { return new Promise((resolve, reject) => { this.getEndOfSessionWithCallbacks((result) => resolve(result), (exception, _reason) => reject(exception)); }); } getEndOfSessionWithCallbacks(onSuccess, onFail) { let url_ = this.baseUrl + "/api/Account/Logout"; url_ = url_.replace(/[?&]$/, ""); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "get", dataType: "text", headers: { "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processGetEndOfSessionWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processGetEndOfSessionWithCallbacks(url_, xhr, onSuccess, onFail); }); } processGetEndOfSessionWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processGetEndOfSession(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processGetEndOfSession(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 401) { const _responseText = xhr.responseText; let result401 = null; result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not currently authenticated", status, _responseText, _headers, result401); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Internal Error", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Digest an identity from an MSAL token * @param entraID full oid.tid * @param nonce nonce * @param token token */ shareMSALAuth(entraID, nonce, token) { return new Promise((resolve, reject) => { this.shareMSALAuthWithCallbacks(entraID, nonce, token, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } shareMSALAuthWithCallbacks(entraID, nonce, token, onSuccess, onFail) { let url_ = this.baseUrl + "/api/account/msalauth/{entraID}?"; if (entraID === undefined || entraID === null) throw new globalThis.Error("The parameter 'entraID' must be defined."); url_ = url_.replace("{entraID}", encodeURIComponent("" + entraID)); if (nonce === undefined || nonce === null) throw new globalThis.Error("The parameter 'nonce' must be defined and cannot be null."); else url_ += "nonce=" + encodeURIComponent("" + nonce) + "&"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(token); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "post", data: content_, dataType: "text", headers: { "Content-Type": "application/json", "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processShareMSALAuthWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processShareMSALAuthWithCallbacks(url_, xhr, onSuccess, onFail); }); } processShareMSALAuthWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processShareMSALAuth(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processShareMSALAuth(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 400) { const _responseText = xhr.responseText; let result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not allowed now (already authenticated?)", status, _responseText, _headers, result400); } else if (status === 401) { const _responseText = xhr.responseText; let result401 = null; result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Unusable credentials", status, _responseText, _headers, result401); } else if (status === 409) { const _responseText = xhr.responseText; let result409 = null; result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not allowed now (see message for issue) ", status, _responseText, _headers, result409); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Ugh", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Returns information about password composition */ getPasswordOptions() { return new Promise((resolve, reject) => { this.getPasswordOptionsWithCallbacks((result) => resolve(result), (exception, _reason) => reject(exception)); }); } getPasswordOptionsWithCallbacks(onSuccess, onFail) { let url_ = this.baseUrl + "/api/Account/PasswordOptions"; url_ = url_.replace(/[?&]$/, ""); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "get", dataType: "text", headers: { "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processGetPasswordOptionsWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processGetPasswordOptionsWithCallbacks(url_, xhr, onSuccess, onFail); }); } processGetPasswordOptionsWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processGetPasswordOptions(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processGetPasswordOptions(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Returns true */ hasSession() { return new Promise((resolve, reject) => { this.hasSessionWithCallbacks((result) => resolve(result), (exception, _reason) => reject(exception)); }); } hasSessionWithCallbacks(onSuccess, onFail) { let url_ = this.baseUrl + "/api/account/session"; url_ = url_.replace(/[?&]$/, ""); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "get", dataType: "text", headers: { "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processHasSessionWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processHasSessionWithCallbacks(url_, xhr, onSuccess, onFail); }); } processHasSessionWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processHasSession(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processHasSession(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 401) { const _responseText = xhr.responseText; let result401 = null; result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not currently authenticated", status, _responseText, _headers, result401); } else if (status === 403) { const _responseText = xhr.responseText; let result403 = null; result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not allowed", status, _responseText, _headers, result403); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } } exports.AccountClient = AccountClient; class ActionItemsClient extends APIClientBase_1.APIClientBase { baseUrl; beforeSend = undefined; jsonParseReviver = undefined; constructor(baseUrl) { super(); this.baseUrl = baseUrl ?? this.getBaseUrl("http://stany2023/SFPMS"); } /** * Returns action items for specified User * @param forUserKey User Key (for proxy) or 00000000-0000-0000-0000-000000000000 for self */ getUserActionItems(forUserKey) { return new Promise((resolve, reject) => { this.getUserActionItemsWithCallbacks(forUserKey, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } getUserActionItemsWithCallbacks(forUserKey, onSuccess, onFail) { let url_ = this.baseUrl + "/api/ActionItems?"; if (forUserKey === undefined || forUserKey === null) throw new globalThis.Error("The parameter 'forUserKey' must be defined and cannot be null."); else url_ += "forUserKey=" + encodeURIComponent("" + forUserKey) + "&"; url_ = url_.replace(/[?&]$/, ""); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "get", dataType: "text", headers: { "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processGetUserActionItemsWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processGetUserActionItemsWithCallbacks(url_, xhr, onSuccess, onFail); }); } processGetUserActionItemsWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processGetUserActionItems(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processGetUserActionItems(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 403) { const _responseText = xhr.responseText; let result403 = null; result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not currently authenticated or lacks authorization", status, _responseText, _headers, result403); } else if (status === 404) { const _responseText = xhr.responseText; let result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("user not found, or not accessible", status, _responseText, _headers, result404); } else if (status === 406) { const _responseText = xhr.responseText; let result406 = null; result406 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("You are not allowed to proxy for this user", status, _responseText, _headers, result406); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Unexpected failure", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Returns an action item for the specified User * @param userID User Key or 1 for self * @param dtk Document Type * @param routeID Route ID (GUID) * @param projectLike Project ID or mask * @param titleLike (optional) Title Like (max 50) */ getRouteActionInfo(userID, dtk, routeID, projectLike, titleLike) { return new Promise((resolve, reject) => { this.getRouteActionInfoWithCallbacks(userID, dtk, routeID, projectLike, titleLike, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } getRouteActionInfoWithCallbacks(userID, dtk, routeID, projectLike, titleLike, onSuccess, onFail) { let url_ = this.baseUrl + "/api/ActionItems/{userID}/{dtk}/{routeID}?"; if (userID === undefined || userID === null) throw new globalThis.Error("The parameter 'userID' must be defined."); url_ = url_.replace("{userID}", encodeURIComponent("" + userID)); if (dtk === undefined || dtk === null) throw new globalThis.Error("The parameter 'dtk' must be defined."); url_ = url_.replace("{dtk}", encodeURIComponent("" + dtk)); if (routeID === undefined || routeID === null) throw new globalThis.Error("The parameter 'routeID' must be defined."); url_ = url_.replace("{routeID}", encodeURIComponent("" + routeID)); if (projectLike === undefined) throw new globalThis.Error("The parameter 'projectLike' must be defined."); else if (projectLike !== null) url_ += "projectLike=" + encodeURIComponent("" + projectLike) + "&"; if (titleLike !== undefined && titleLike !== null) url_ += "titleLike=" + encodeURIComponent("" + titleLike) + "&"; url_ = url_.replace(/[?&]$/, ""); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "get", dataType: "text", headers: { "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processGetRouteActionInfoWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processGetRouteActionInfoWithCallbacks(url_, xhr, onSuccess, onFail); }); } processGetRouteActionInfoWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processGetRouteActionInfo(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processGetRouteActionInfo(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 401) { const _responseText = xhr.responseText; let result401 = null; result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("unusable credentials", status, _responseText, _headers, result401); } else if (status === 404) { const _responseText = xhr.responseText; let result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Requested route not found", status, _responseText, _headers, result404); } else if (status === 406) { const _responseText = xhr.responseText; let result406 = null; result406 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Proxy denied", status, _responseText, _headers, result406); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("internal failure", status, _responseText, _headers, result500); } else if (status === 503) { const _responseText = xhr.responseText; let result503 = null; result503 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Try again after reauthentication", status, _responseText, _headers, result503); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Updates an action item for the specified User * @param userID User Key or 1 for self * @param routeID Route ID (guid) * @param actionData action patch data * @param actionMode (optional) Mode is id,match,every */ patchUserActionItems(userID, routeID, actionData, actionMode) { return new Promise((resolve, reject) => { this.patchUserActionItemsWithCallbacks(userID, routeID, actionData, actionMode, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } patchUserActionItemsWithCallbacks(userID, routeID, actionData, actionMode, onSuccess, onFail) { let url_ = this.baseUrl + "/api/ActionItems/{userID}/{routeID}?"; if (userID === undefined || userID === null) throw new globalThis.Error("The parameter 'userID' must be defined."); url_ = url_.replace("{userID}", encodeURIComponent("" + userID)); if (routeID === undefined || routeID === null) throw new globalThis.Error("The parameter 'routeID' must be defined."); url_ = url_.replace("{routeID}", encodeURIComponent("" + routeID)); if (actionMode !== undefined && actionMode !== null) url_ += "actionMode=" + encodeURIComponent("" + actionMode) + "&"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(actionData); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "patch", data: content_, dataType: "text", headers: { "Content-Type": "application/json", "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processPatchUserActionItemsWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processPatchUserActionItemsWithCallbacks(url_, xhr, onSuccess, onFail); }); } processPatchUserActionItemsWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processPatchUserActionItems(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processPatchUserActionItems(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 400) { const _responseText = xhr.responseText; let result400 = null; result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Request missing required information", status, _responseText, _headers, result400); } else if (status === 401) { const _responseText = xhr.responseText; let result401 = null; result401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not currently authenticated", status, _responseText, _headers, result401); } else if (status === 404) { const _responseText = xhr.responseText; let result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Requested route not found!", status, _responseText, _headers, result404); } else if (status === 409) { const _responseText = xhr.responseText; let result409 = null; result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Request inappropriate", status, _responseText, _headers, result409); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Internal failure; see response", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Returns documents data that has changed * @param forUserKey User Key (for proxy) or 00000000-0000-0000-0000-000000000000 for self * @param dataSummary KVP of current row keys (RouteID) and eTags */ getChangedActionItems(forUserKey, dataSummary) { return new Promise((resolve, reject) => { this.getChangedActionItemsWithCallbacks(forUserKey, dataSummary, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } getChangedActionItemsWithCallbacks(forUserKey, dataSummary, onSuccess, onFail) { let url_ = this.baseUrl + "/api/ActionItems/changes?"; if (forUserKey === undefined || forUserKey === null) throw new globalThis.Error("The parameter 'forUserKey' must be defined and cannot be null."); else url_ += "forUserKey=" + encodeURIComponent("" + forUserKey) + "&"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(dataSummary); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "post", data: content_, dataType: "text", headers: { "Content-Type": "application/json", "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processGetChangedActionItemsWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processGetChangedActionItemsWithCallbacks(url_, xhr, onSuccess, onFail); }); } processGetChangedActionItemsWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processGetChangedActionItems(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processGetChangedActionItems(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 403) { const _responseText = xhr.responseText; let result403 = null; result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not currently authenticated or lacks authorization", status, _responseText, _headers, result403); } else if (status === 404) { const _responseText = xhr.responseText; let result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("user not found, or not accessible", status, _responseText, _headers, result404); } else if (status === 406) { const _responseText = xhr.responseText; let result406 = null; result406 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("You are not allowed to proxy for this user", status, _responseText, _headers, result406); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Unexpected failure", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } /** * Returns action items that match filters ProjectLike, TitleLike, ForDocType, FromDate, ThruDate, NewOnly */ getMatchingUserActionItems(usingFilters) { return new Promise((resolve, reject) => { this.getMatchingUserActionItemsWithCallbacks(usingFilters, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } getMatchingUserActionItemsWithCallbacks(usingFilters, onSuccess, onFail) { let url_ = this.baseUrl + "/api/ActionItems/matching"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(usingFilters); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "get", data: content_, dataType: "text", headers: { "Content-Type": "application/json", "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processGetMatchingUserActionItemsWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processGetMatchingUserActionItemsWithCallbacks(url_, xhr, onSuccess, onFail); }); } processGetMatchingUserActionItemsWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processGetMatchingUserActionItems(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch (e) { if (onFail !== undefined) onFail(e, "http_service_exception"); } } processGetMatchingUserActionItems(xhr) { const status = xhr.status; let _headers = {}; if (status === 200) { const _responseText = xhr.responseText; let result200 = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return result200; } else if (status === 403) { const _responseText = xhr.responseText; let result403 = null; result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Not currently authenticated or lacks authorization", status, _responseText, _headers, result403); } else if (status === 404) { const _responseText = xhr.responseText; let result404 = null; result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("user not found, or not accessible", status, _responseText, _headers, result404); } else if (status === 406) { const _responseText = xhr.responseText; let result406 = null; result406 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("You are not allowed to proxy for this user", status, _responseText, _headers, result406); } else if (status === 500) { const _responseText = xhr.responseText; let result500 = null; result500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver); return throwException("Unexpected failure", status, _responseText, _headers, result500); } else if (status !== 200 && status !== 204) { const _responseText = xhr.responseText; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } return null; } } exports.ActionItemsClient = ActionItemsClient; class AlertsClient extends APIClientBase_1.APIClientBase { baseUrl; beforeSend = undefined; jsonParseReviver = undefined; constructor(baseUrl) { super(); this.baseUrl = baseUrl ?? this.getBaseUrl("http://stany2023/SFPMS"); } /** * Returns alert items for a specified user * @param forUserKey User Key (for proxy) or 00000000-0000-0000-0000-000000000000 for self */ getUserAlertList(forUserKey) { return new Promise((resolve, reject) => { this.getUserAlertListWithCallbacks(forUserKey, (result) => resolve(result), (exception, _reason) => reject(exception)); }); } getUserAlertListWithCallbacks(forUserKey, onSuccess, onFail) { let url_ = this.baseUrl + "/api/Alerts?"; if (forUserKey === undefined || forUserKey === null) throw new globalThis.Error("The parameter 'forUserKey' must be defined and cannot be null."); else url_ += "forUserKey=" + encodeURIComponent("" + forUserKey) + "&"; url_ = url_.replace(/[?&]$/, ""); jQuery.ajax({ url: url_, beforeSend: this.beforeSend, type: "get", dataType: "text", headers: { "Accept": "application/json" } }).done((_data, _textStatus, xhr) => { this.processGetUserAlertListWithCallbacks(url_, xhr, onSuccess, onFail); }).fail((xhr) => { this.processGetUserAlertListWithCallbacks(url_, xhr, onSuccess, onFail); }); } processGetUserAlertListWithCallbacks(_url, xhr, onSuccess, onFail) { try { let result = this.transformResult(_url, xhr, (xhr) => this.processGetUserAlertList(xhr)); if (onSuccess !== undefined) onSuccess(result); } catch