spitfirepm
Version:
Client API Tools for Spitfire Project Management
946 lines (945 loc) • 1.64 MB
JavaScript
"use strict";
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v10.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------
Object.defineProperty(exports, "__esModule", { value: true });
exports.TokenRequest = exports.PermissionFlags = exports.UserSessionInfo = exports.ProcessDocumentType = exports.CodeChoice = exports.DVRequest = exports.FieldAudit = exports.Contact = exports.ContactFilters = exports.ContactSummary = exports.ProjectCommitmentDetail = exports.ProjectTranDetail = exports.Comment = exports.WeatherAtLocation = exports.ProjectWeatherNow = exports.DocItemTask = exports.ProjectWBS = exports.ProjectLink = exports.ProjectPrograms = exports.Suggestion = exports.MenuAction = exports.ProjectXTSTaskState = exports.ProjectAbstract = exports.RouteActionData = exports.HttpStatusCode = exports.SelectCodeNode = exports.RouteActionInfo = exports.RouteActionInfo2 = exports.DateRange = exports.QueryFilters = exports.UserActionItem = exports.CurrentDataSummary = exports.DataDifferential = exports.ProjectDocListClient = exports.AccountClient = exports.ProjectTeamClient = exports.UICFGClient = exports.XTSClient = exports.ProjectsClient = exports.CatalogClient = exports.ExcelToolsClient = exports.AlertsClient = exports.DocumentToolsClient = exports.ProjectKPIClient = exports.SessionClient = exports.SystemClient = exports.LookupClient = exports.ContactClient = exports.ProjectToolsClient = exports.ActionItemsClient = void 0;
exports.MediaTypeHeaderValue = exports.ContentRangeHeaderValue = exports.NameValueHeaderValue = exports.ContentDispositionHeaderValue = exports.HttpContentHeaders = exports.Anonymous = exports.HttpContent = exports.Version = exports.HttpRequestMessage = exports.RedirectResult = exports.FileVersion = exports.FileAccessHistory = exports.CatalogPreset = exports.FileInformation = exports.UIDisplayConfigBasics = exports.ExportRequest = exports.PeriodDistributionAbstract = exports.SOVAbstract = exports.BFAAbstract = exports.ProjectSnapshotDelta = exports.ProjectSnapshot = exports.UserAlert = exports.DocMasterDetail = exports.DocFieldChange = exports.DocumentState = exports.DocAccessControl = exports.DocItemComment = exports.DocAttribute = exports.DocMeetingAttendee = exports.DocCompliance = exports.DocInclusion = exports.DocAttachment = exports.DocAddress = exports.DocDate = exports.DocRoute = exports.RelatedItemDetail = exports.DocItemMap = exports.DocItem = exports.ProjKPIFact = exports.PDSData = exports.APIData = exports.TabDisplay = exports.TabStripDetails = exports.Stream = exports.MarshalByRefObject = exports.HttpResponseJsonContent = exports.HttpResponseJsonContent2 = exports.UCPermit = exports.UCPermitSet = exports.AuthenticationExchangeData = void 0;
exports.ApiException = exports.ProjectDocsOfType = exports.TypeSummary = exports.PermissionContext = exports.PasswordConfiguredOptions = exports.CurrentUser = exports.SiteLogin = exports.ProjectTeamMember = exports.UIDisplayFilter = exports.UIDisplayConfig = exports.UIDisplayPart = exports.CloudChange = exports.AlertCondition = exports.InboundComplianceItem = exports.XTSKeyMap = exports.XTSAction = exports.ProjectSummary = exports.XferFilesStatus = exports.WarningHeaderValue = exports.ViaHeaderValue = exports.CacheControlHeaderValue = exports.ProductHeaderValue = exports.ProductInfoHeaderValue = exports.TransferCodingWithQualityHeaderValue = exports.TransferCodingHeaderValue = exports.RangeItemHeaderValue = exports.RangeHeaderValue = exports.RangeConditionHeaderValue = exports.EntityTagHeaderValue = exports.NameValueWithParametersHeaderValue = exports.AuthenticationHeaderValue = exports.StringWithQualityHeaderValue = exports.MediaTypeWithQualityHeaderValue = exports.HttpRequestHeaders = exports.Anonymous2 = exports.HttpMethod = exports.KeyValuePairOfStringAndIEnumerableOfString = void 0;
/* tslint:disable */
/* eslint-disable */
// ReSharper disable InconsistentNaming
const APIClientBase_1 = require("./APIClientBase");
const jQuery = require("jquery");
class ActionItemsClient extends APIClientBase_1.APIClientBase {
constructor(baseUrl) {
super();
this.beforeSend = undefined;
this.jsonParseReviver = undefined;
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("http://stany2023/SFPMS");
}
/**
* 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 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 === 403) {
const _responseText = xhr.responseText;
let result403 = null;
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result403 = resultData403 !== undefined ? resultData403 : null;
return throwException("Not currently authenticated or lacks authorization", status, _responseText, _headers, result403);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("user not found, or not accessible", status, _responseText, _headers, result404);
}
else if (status === 406) {
const _responseText = xhr.responseText;
let result406 = null;
let resultData406 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result406 = resultData406 !== undefined ? resultData406 : null;
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;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("Unexpected failure", status, _responseText, _headers, result500);
}
else if (status === 200) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 ? DataDifferential.fromJS(resultData200) : null;
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 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 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 === 403) {
const _responseText = xhr.responseText;
let result403 = null;
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result403 = resultData403 !== undefined ? resultData403 : null;
return throwException("Not currently authenticated or lacks authorization", status, _responseText, _headers, result403);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("user not found, or not accessible", status, _responseText, _headers, result404);
}
else if (status === 406) {
const _responseText = xhr.responseText;
let result406 = null;
let resultData406 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result406 = resultData406 !== undefined ? resultData406 : null;
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;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("Unexpected failure", status, _responseText, _headers, result500);
}
else if (status === 200) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
if (Array.isArray(resultData200)) {
result200 = [];
for (let item of resultData200)
result200.push(UserActionItem.fromJS(item));
}
else {
result200 = null;
}
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 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 === 403) {
const _responseText = xhr.responseText;
let result403 = null;
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result403 = resultData403 !== undefined ? resultData403 : null;
return throwException("Not currently authenticated or lacks authorization", status, _responseText, _headers, result403);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("user not found, or not accessible", status, _responseText, _headers, result404);
}
else if (status === 406) {
const _responseText = xhr.responseText;
let result406 = null;
let resultData406 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result406 = resultData406 !== undefined ? resultData406 : null;
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;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("Unexpected failure", status, _responseText, _headers, result500);
}
else if (status === 200) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
if (Array.isArray(resultData200)) {
result200 = [];
for (let item of resultData200)
result200.push(UserActionItem.fromJS(item));
}
else {
result200 = null;
}
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 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 Error("The parameter 'userID' must be defined.");
url_ = url_.replace("{userID}", encodeURIComponent("" + userID));
if (dtk === undefined || dtk === null)
throw new Error("The parameter 'dtk' must be defined.");
url_ = url_.replace("{dtk}", encodeURIComponent("" + dtk));
if (routeID === undefined || routeID === null)
throw new Error("The parameter 'routeID' must be defined.");
url_ = url_.replace("{routeID}", encodeURIComponent("" + routeID));
if (projectLike === undefined)
throw new 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 === 401) {
const _responseText = xhr.responseText;
let result401 = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : null;
return throwException("unusable credentials", status, _responseText, _headers, result401);
}
else if (status === 500) {
const _responseText = xhr.responseText;
let result500 = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("internal failure", status, _responseText, _headers, result500);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("Requested route not found", status, _responseText, _headers, result404);
}
else if (status === 406) {
const _responseText = xhr.responseText;
let result406 = null;
let resultData406 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result406 = resultData406 !== undefined ? resultData406 : null;
return throwException("Proxy denied", status, _responseText, _headers, result406);
}
else if (status === 503) {
const _responseText = xhr.responseText;
let result503 = null;
let resultData503 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result503 = resultData503 !== undefined ? resultData503 : null;
return throwException("Try again after reauthentication", status, _responseText, _headers, result503);
}
else if (status === 200) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 ? RouteActionInfo.fromJS(resultData200) : null;
return result200;
}
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 Error("The parameter 'userID' must be defined.");
url_ = url_.replace("{userID}", encodeURIComponent("" + userID));
if (routeID === undefined || routeID === null)
throw new 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 === 401) {
const _responseText = xhr.responseText;
let result401 = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : null;
return throwException("Not currently authenticated", status, _responseText, _headers, result401);
}
else if (status === 400) {
const _responseText = xhr.responseText;
let result400 = null;
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result400 = resultData400 !== undefined ? resultData400 : null;
return throwException("Request missing required information", status, _responseText, _headers, result400);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("Requested route not found!", status, _responseText, _headers, result404);
}
else if (status === 409) {
const _responseText = xhr.responseText;
let result409 = null;
let resultData409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result409 = resultData409 !== undefined ? resultData409 : null;
return throwException("Request inappropriate", status, _responseText, _headers, result409);
}
else if (status === 500) {
const _responseText = xhr.responseText;
let result500 = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("Internal failure; see response", status, _responseText, _headers, result500);
}
else if (status === 200) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 !== undefined ? resultData200 : null;
return result200;
}
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 ProjectToolsClient extends APIClientBase_1.APIClientBase {
constructor(baseUrl) {
super();
this.beforeSend = undefined;
this.jsonParseReviver = undefined;
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("http://stany2023/SFPMS");
}
/**
* Returns a summary overview of the specified project
* @param projectID Full Project ID
*/
getProjectDetail(projectID) {
return new Promise((resolve, reject) => {
this.getProjectDetailWithCallbacks(projectID, (result) => resolve(result), (exception, _reason) => reject(exception));
});
}
getProjectDetailWithCallbacks(projectID, onSuccess, onFail) {
let url_ = this.baseUrl + "/api/Project/{projectID}/Abstract";
if (projectID === undefined || projectID === null)
throw new Error("The parameter 'projectID' must be defined.");
url_ = url_.replace("{projectID}", encodeURIComponent("" + projectID));
url_ = url_.replace(/[?&]$/, "");
jQuery.ajax({
url: url_,
beforeSend: this.beforeSend,
type: "get",
dataType: "text",
headers: {
"Accept": "application/json"
}
}).done((_data, _textStatus, xhr) => {
this.processGetProjectDetailWithCallbacks(url_, xhr, onSuccess, onFail);
}).fail((xhr) => {
this.processGetProjectDetailWithCallbacks(url_, xhr, onSuccess, onFail);
});
}
processGetProjectDetailWithCallbacks(_url, xhr, onSuccess, onFail) {
try {
let result = this.transformResult(_url, xhr, (xhr) => this.processGetProjectDetail(xhr));
if (onSuccess !== undefined)
onSuccess(result);
}
catch (e) {
if (onFail !== undefined)
onFail(e, "http_service_exception");
}
}
processGetProjectDetail(xhr) {
const status = xhr.status;
let _headers = {};
if (status === 401) {
const _responseText = xhr.responseText;
let result401 = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : null;
return throwException("Not currently authenticated", status, _responseText, _headers, result401);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("Not found", status, _responseText, _headers, result404);
}
else if (status === 403) {
const _responseText = xhr.responseText;
let result403 = null;
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result403 = resultData403 !== undefined ? resultData403 : null;
return throwException("Access denied", status, _responseText, _headers, result403);
}
else if (status === 500) {
const _responseText = xhr.responseText;
let result500 = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("Internal failure; see response", status, _responseText, _headers, result500);
}
else if (status === 200) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 ? ProjectAbstract.fromJS(resultData200) : null;
return result200;
}
else if (status !== 200 && status !== 204) {
const _responseText = xhr.responseText;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return null;
}
/**
* Releases all cached financial data
* @param projectID Full Project ID
*/
deleteProjectCache(projectID) {
return new Promise((resolve, reject) => {
this.deleteProjectCacheWithCallbacks(projectID, (result) => resolve(result), (exception, _reason) => reject(exception));
});
}
deleteProjectCacheWithCallbacks(projectID, onSuccess, onFail) {
let url_ = this.baseUrl + "/api/Project/{projectID}/cache";
if (projectID === undefined || projectID === null)
throw new Error("The parameter 'projectID' must be defined.");
url_ = url_.replace("{projectID}", encodeURIComponent("" + projectID));
url_ = url_.replace(/[?&]$/, "");
jQuery.ajax({
url: url_,
beforeSend: this.beforeSend,
type: "delete",
dataType: "text",
headers: {
"Accept": "application/octet-stream"
}
}).done((_data, _textStatus, xhr) => {
this.processDeleteProjectCacheWithCallbacks(url_, xhr, onSuccess, onFail);
}).fail((xhr) => {
this.processDeleteProjectCacheWithCallbacks(url_, xhr, onSuccess, onFail);
});
}
processDeleteProjectCacheWithCallbacks(_url, xhr, onSuccess, onFail) {
try {
let result = this.transformResult(_url, xhr, (xhr) => this.processDeleteProjectCache(xhr));
if (onSuccess !== undefined)
onSuccess(result);
}
catch (e) {
if (onFail !== undefined)
onFail(e, "http_service_exception");
}
}
processDeleteProjectCache(xhr) {
const status = xhr.status;
let _headers = {};
if (status === 401) {
const _responseText = xhr.responseText;
let result401 = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : null;
return throwException("Not currently authenticated", status, _responseText, _headers, result401);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("Not found", status, _responseText, _headers, result404);
}
else if (status === 403) {
const _responseText = xhr.responseText;
let result403 = null;
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result403 = resultData403 !== undefined ? resultData403 : null;
return throwException("Access denied", status, _responseText, _headers, result403);
}
else if (status === 500) {
const _responseText = xhr.responseText;
let result500 = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("Internal failure; see response", status, _responseText, _headers, result500);
}
else if (status === 200 || status === 206) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 !== undefined ? resultData200 : null;
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 a summary of peer tasks for this project
* @param projectID Full Project ID
*/
getProjectPeerSummary(projectID) {
return new Promise((resolve, reject) => {
this.getProjectPeerSummaryWithCallbacks(projectID, (result) => resolve(result), (exception, _reason) => reject(exception));
});
}
getProjectPeerSummaryWithCallbacks(projectID, onSuccess, onFail) {
let url_ = this.baseUrl + "/api/Project/{projectID}/xts";
if (projectID === undefined || projectID === null)
throw new Error("The parameter 'projectID' must be defined.");
url_ = url_.replace("{projectID}", encodeURIComponent("" + projectID));
url_ = url_.replace(/[?&]$/, "");
jQuery.ajax({
url: url_,
beforeSend: this.beforeSend,
type: "get",
dataType: "text",
headers: {
"Accept": "application/json"
}
}).done((_data, _textStatus, xhr) => {
this.processGetProjectPeerSummaryWithCallbacks(url_, xhr, onSuccess, onFail);
}).fail((xhr) => {
this.processGetProjectPeerSummaryWithCallbacks(url_, xhr, onSuccess, onFail);
});
}
processGetProjectPeerSummaryWithCallbacks(_url, xhr, onSuccess, onFail) {
try {
let result = this.transformResult(_url, xhr, (xhr) => this.processGetProjectPeerSummary(xhr));
if (onSuccess !== undefined)
onSuccess(result);
}
catch (e) {
if (onFail !== undefined)
onFail(e, "http_service_exception");
}
}
processGetProjectPeerSummary(xhr) {
const status = xhr.status;
let _headers = {};
if (status === 401) {
const _responseText = xhr.responseText;
let result401 = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : null;
return throwException("Not currently authenticated", status, _responseText, _headers, result401);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("Not found", status, _responseText, _headers, result404);
}
else if (status === 403) {
const _responseText = xhr.responseText;
let result403 = null;
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result403 = resultData403 !== undefined ? resultData403 : null;
return throwException("Access denied", status, _responseText, _headers, result403);
}
else if (status === 500) {
const _responseText = xhr.responseText;
let result500 = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("Internal failure; see response", status, _responseText, _headers, result500);
}
else if (status === 200) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
if (Array.isArray(resultData200)) {
result200 = [];
for (let item of resultData200)
result200.push(ProjectXTSTaskState.fromJS(item));
}
else {
result200 = null;
}
return result200;
}
else if (status !== 200 && status !== 204) {
const _responseText = xhr.responseText;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return null;
}
/**
* Requests peer re-sync
* @param projectID Full Project ID
*/
refreshPeerSummary(projectID) {
return new Promise((resolve, reject) => {
this.refreshPeerSummaryWithCallbacks(projectID, (result) => resolve(result), (exception, _reason) => reject(exception));
});
}
refreshPeerSummaryWithCallbacks(projectID, onSuccess, onFail) {
let url_ = this.baseUrl + "/api/Project/{projectID}/xts";
if (projectID === undefined || projectID === null)
throw new Error("The parameter 'projectID' must be defined.");
url_ = url_.replace("{projectID}", encodeURIComponent("" + projectID));
url_ = url_.replace(/[?&]$/, "");
jQuery.ajax({
url: url_,
beforeSend: this.beforeSend,
type: "patch",
dataType: "text",
headers: {
"Accept": "application/octet-stream"
}
}).done((_data, _textStatus, xhr) => {
this.processRefreshPeerSummaryWithCallbacks(url_, xhr, onSuccess, onFail);
}).fail((xhr) => {
this.processRefreshPeerSummaryWithCallbacks(url_, xhr, onSuccess, onFail);
});
}
processRefreshPeerSummaryWithCallbacks(_url, xhr, onSuccess, onFail) {
try {
let result = this.transformResult(_url, xhr, (xhr) => this.processRefreshPeerSummary(xhr));
if (onSuccess !== undefined)
onSuccess(result);
}
catch (e) {
if (onFail !== undefined)
onFail(e, "http_service_exception");
}
}
processRefreshPeerSummary(xhr) {
const status = xhr.status;
let _headers = {};
if (status === 401) {
const _responseText = xhr.responseText;
let result401 = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : null;
return throwException("Not currently authenticated", status, _responseText, _headers, result401);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("Not found", status, _responseText, _headers, result404);
}
else if (status === 403) {
const _responseText = xhr.responseText;
let result403 = null;
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result403 = resultData403 !== undefined ? resultData403 : null;
return throwException("Access denied", status, _responseText, _headers, result403);
}
else if (status === 500) {
const _responseText = xhr.responseText;
let result500 = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("Internal failure; see response", status, _responseText, _headers, result500);
}
else if (status === 200 || status === 206) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 !== undefined ? resultData200 : null;
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 programs in which the specified project is listed
* @param projectID Full Project ID
*/
getProjectPrograms(projectID) {
return new Promise((resolve, reject) => {
this.getProjectProgramsWithCallbacks(projectID, (result) => resolve(result), (exception, _reason) => reject(exception));
});
}
getProjectProgramsWithCallbacks(projectID, onSuccess, onFail) {
let url_ = this.baseUrl + "/api/Project/{projectID}/programs";
if (projectID === undefined || projectID === null)
throw new Error("The parameter 'projectID' must be defined.");
url_ = url_.replace("{projectID}", encodeURIComponent("" + projectID));
url_ = url_.replace(/[?&]$/, "");
jQuery.ajax({
url: url_,
beforeSend: this.beforeSend,
type: "get",
dataType: "text",
headers: {
"Accept": "application/json"
}
}).done((_data, _textStatus, xhr) => {
this.processGetProjectProgramsWithCallbacks(url_, xhr, onSuccess, onFail);
}).fail((xhr) => {
this.processGetProjectProgramsWithCallbacks(url_, xhr, onSuccess, onFail);
});
}
processGetProjectProgramsWithCallbacks(_url, xhr, onSuccess, onFail) {
try {
let result = this.transformResult(_url, xhr, (xhr) => this.processGetProjectPrograms(xhr));
if (onSuccess !== undefined)
onSuccess(result);
}
catch (e) {
if (onFail !== undefined)
onFail(e, "http_service_exception");
}
}
processGetProjectPrograms(xhr) {
const status = xhr.status;
let _headers = {};
if (status === 401) {
const _responseText = xhr.responseText;
let result401 = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : null;
return throwException("Not currently authenticated", status, _responseText, _headers, result401);
}
else if (status === 404) {
const _responseText = xhr.responseText;
let result404 = null;
let resultData404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result404 = resultData404 !== undefined ? resultData404 : null;
return throwException("Not found", status, _responseText, _headers, result404);
}
else if (status === 403) {
const _responseText = xhr.responseText;
let result403 = null;
let resultData403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result403 = resultData403 !== undefined ? resultData403 : null;
return throwException("Access denied", status, _responseText, _headers, result403);
}
else if (status === 500) {
const _responseText = xhr.responseText;
let result500 = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : null;
return throwException("Internal failure; see response", status, _responseText, _headers, result500);
}
else if (status === 200) {
const _responseText = xhr.responseText;
let result200 = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
if (Array.isArray(resultData200)) {
result200 = [];
for (let item of resultData200)
result200.push(ProjectPrograms.fromJS(item));
}
else {
result200 = null;
}
return result200;
}
else if (status !== 200 && status !== 204) {
const _responseText = xhr.responseText;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return null;
}