UNPKG

io.parrots

Version:

Parrots.io App

1,003 lines 683 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ import * as tslib_1 from "tslib"; import { Headers, RequestOptions, URLSearchParams, RequestMethod } from '@angular/http'; import { AbstractParrotsServerResource } from '../AbstractParrotsServerResource'; var /** @type {?} */ BASE_PATH = "./classes"; var ClassesResource = /** @class */ (function (_super) { tslib_1.__extends(ClassesResource, _super); function ClassesResource(connectionMgr, basePath) { var _this = _super.call(this, connectionMgr) || this; _this.basePath = BASE_PATH; _this.defaultHeaders = new Headers(); if (basePath !== null && basePath !== undefined && basePath !== '') { _this.basePath = basePath; } return _this; } /** * @return {?} */ ClassesResource.prototype.uuid4Generate = /** * @return {?} */ function () { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var /** @type {?} */ r = Math.random() * 16 | 0, /** @type {?} */ v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); }; /** * @param {?} classname * @param {?} uuid * @return {?} */ ClassesResource.prototype.findTestData = /** * @param {?} classname * @param {?} uuid * @return {?} */ function (classname, uuid) { var /** @type {?} */ testData = this.getTestData(); var /** @type {?} */ testArray = (testData !== null && testData !== undefined) ? testData[classname] : []; try { for (var testArray_1 = tslib_1.__values(testArray), testArray_1_1 = testArray_1.next(); !testArray_1_1.done; testArray_1_1 = testArray_1.next()) { var item = testArray_1_1.value; if (item._uuid === uuid) { return item; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (testArray_1_1 && !testArray_1_1.done && (_a = testArray_1.return)) _a.call(testArray_1); } finally { if (e_1) throw e_1.error; } } return null; var e_1, _a; }; /** * @param {?} classname * @return {?} */ ClassesResource.prototype.findTestDataSchema = /** * @param {?} classname * @return {?} */ function (classname) { var /** @type {?} */ key = classname + "-schema"; var /** @type {?} */ testData = this.getTestData(); var /** @type {?} */ schemaResult = (testData !== null && testData !== undefined) ? testData[key] : {}; return schemaResult; }; /** * Configure the persisent class metadata. * * @param {?} body The metadata object to configure. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.configure = /** * Configure the persisent class metadata. * * @param {?} body The metadata object to configure. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (body, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.configureWithHttpInfo(body, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Create a new persistent object (insert new row). * * @param {?} body The object to be created. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.create = /** * Create a new persistent object (insert new row). * * @param {?} body The object to be created. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (body, classname, langPreference, extraHttpRequestParams) { var _this = this; if (this.isTestMode()) { if (body !== null && body !== undefined) { body._uuid = this.uuid4Generate(); var /** @type {?} */ testData = this.getTestData(); var /** @type {?} */ testResult = (testData !== null && testData !== undefined) ? testData[classname] : []; if (testResult.length == 0) { testData[classname] = testResult; } testResult.push(body); } return Promise.resolve(body); } return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.createWithHttpInfo(body, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Create a new persistent object (insert new row) with the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} body The object to be created. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.createLang = /** * Create a new persistent object (insert new row) with the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} body The object to be created. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, body, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.createLangWithHttpInfo(lang, body, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Create a new persistent object (insert new row) with the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} body The object to be created. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.createUUIDLang = /** * Create a new persistent object (insert new row) with the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} body The object to be created. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, body, uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.createUUIDLangWithHttpInfo(lang, body, uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Delete the object (row) from the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} permanent To permanent delete (destroy) the object or not. The destroyed objects will not be able to be recycled. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.delete = /** * Delete the object (row) from the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} permanent To permanent delete (destroy) the object or not. The destroyed objects will not be able to be recycled. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (uuid, classname, permanent, langPreference, extraHttpRequestParams) { var _this = this; if (this.isTestMode()) { return Promise.resolve(this.findTestData(classname, uuid)); } return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.deleteWithHttpInfo(uuid, classname, permanent, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Delete the object (row) from the given \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} permanent To permanent delete (destroy) the object or not. The destroyed objects will not be able to be recycled. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.deleteLang = /** * Delete the object (row) from the given \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} permanent To permanent delete (destroy) the object or not. The destroyed objects will not be able to be recycled. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, uuid, classname, permanent, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.deleteLangWithHttpInfo(lang, uuid, classname, permanent, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Delete (destroy) the specified \&quot;version\&quot; copy of the given object \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be deleted (ISO-639) * @param {?} version The object \&quot;version\&quot; number to be deleted. * @param {?} permanent You must explicitly set this header to \&quot;true\&quot; to perform this operation. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.destroyLangVersion = /** * Delete (destroy) the specified \&quot;version\&quot; copy of the given object \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be deleted (ISO-639) * @param {?} version The object \&quot;version\&quot; number to be deleted. * @param {?} permanent You must explicitly set this header to \&quot;true\&quot; to perform this operation. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, version, permanent, uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.destroyLangVersionWithHttpInfo(lang, version, permanent, uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Delete (destroy) the specified \&quot;version\&quot; of the given object \&quot;uuid\&quot;. * * @param {?} version The object \&quot;version\&quot; number to be deleted. * @param {?} permanent You must explicitly set this header to \&quot;true\&quot; to perform this operation. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.destroyVersion = /** * Delete (destroy) the specified \&quot;version\&quot; of the given object \&quot;uuid\&quot;. * * @param {?} version The object \&quot;version\&quot; number to be deleted. * @param {?} permanent You must explicitly set this header to \&quot;true\&quot; to perform this operation. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (version, permanent, uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.destroyVersionWithHttpInfo(version, permanent, uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Find the object (row) from the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.find = /** * Find the object (row) from the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (uuid, classname, deleted, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.findWithHttpInfo(uuid, classname, deleted, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Find the object (row) from the given \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.findLang = /** * Find the object (row) from the given \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, uuid, classname, deleted, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.findLangWithHttpInfo(lang, uuid, classname, deleted, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Find the specified \&quot;version\&quot; copy of the given object \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to find (ISO-639) * @param {?} version The object \&quot;version\&quot; number to find. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.findLangVersion = /** * Find the specified \&quot;version\&quot; copy of the given object \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to find (ISO-639) * @param {?} version The object \&quot;version\&quot; number to find. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, version, uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.findLangVersionWithHttpInfo(lang, version, uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Find the specified \&quot;version\&quot; copy of the given object \&quot;uuid\&quot;. * * @param {?} version The object \&quot;version\&quot; number to find. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.findVersion = /** * Find the specified \&quot;version\&quot; copy of the given object \&quot;uuid\&quot;. * * @param {?} version The object \&quot;version\&quot; number to find. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (version, uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.findVersionWithHttpInfo(version, uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Get current object&#39;s available actions. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.getActions = /** * Get current object&#39;s available actions. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (uuid, classname, deleted, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.getActionsWithHttpInfo(uuid, classname, deleted, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Get persistent class&#39;s info. * * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.getClassInfo = /** * Get persistent class&#39;s info. * * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.getClassInfoWithHttpInfo(classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Get current object&#39;s available actions in the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.getLangActions = /** * Get current object&#39;s available actions in the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, uuid, classname, deleted, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.getLangActionsWithHttpInfo(lang, uuid, classname, deleted, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Get the current object&#39;s state in the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.getLangState = /** * Get the current object&#39;s state in the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, uuid, classname, deleted, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.getLangStateWithHttpInfo(lang, uuid, classname, deleted, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * List all object&#39;s versions from the given \&quot;uuid\&quot; and the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} startIndex The query cursor start index (or the number of first rows to be skipped). * @param {?=} endIndex The query cursor end index (the max rows to be returned will be [\&quot;endIndex\&quot; - \&quot;startIndex\&quot;]). * @param {?=} sortDescending To sort the result list using field \&quot;_version\&quot; in descending order (newest first). * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.getLangVersions = /** * List all object&#39;s versions from the given \&quot;uuid\&quot; and the specified \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} startIndex The query cursor start index (or the number of first rows to be skipped). * @param {?=} endIndex The query cursor end index (the max rows to be returned will be [\&quot;endIndex\&quot; - \&quot;startIndex\&quot;]). * @param {?=} sortDescending To sort the result list using field \&quot;_version\&quot; in descending order (newest first). * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, uuid, classname, startIndex, endIndex, sortDescending, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.getLangVersionsWithHttpInfo(lang, uuid, classname, startIndex, endIndex, sortDescending, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Get persistent class&#39;s metadata. * * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.getMetadata = /** * Get persistent class&#39;s metadata. * * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.getMetadataWithHttpInfo(classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Get the object&#39;s json schema. * * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.getSchemaInfo = /** * Get the object&#39;s json schema. * * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (classname, langPreference, extraHttpRequestParams) { var _this = this; if (this.isTestMode()) { return Promise.resolve(this.findTestDataSchema(classname)); } return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.getSchemaInfoWithHttpInfo(classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Get the current object&#39;s state. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.getState = /** * Get the current object&#39;s state. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} deleted To query the deleted [true], in-used [false] or both [both|all] object. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (uuid, classname, deleted, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.getStateWithHttpInfo(uuid, classname, deleted, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * List all object&#39;s versions from the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} startIndex The query cursor start index (or the number of first rows to be skipped). * @param {?=} endIndex The query cursor end index (the max rows to be returned will be [\&quot;endIndex\&quot; - \&quot;startIndex\&quot;]). * @param {?=} sortDescending To sort the result list using field \&quot;_version\&quot; in descending order (newest first). * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.getVersions = /** * List all object&#39;s versions from the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} startIndex The query cursor start index (or the number of first rows to be skipped). * @param {?=} endIndex The query cursor end index (the max rows to be returned will be [\&quot;endIndex\&quot; - \&quot;startIndex\&quot;]). * @param {?=} sortDescending To sort the result list using field \&quot;_version\&quot; in descending order (newest first). * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (uuid, classname, startIndex, endIndex, sortDescending, langPreference, extraHttpRequestParams) { var _this = this; if (this.isTestMode()) { var /** @type {?} */ obj = this.findTestData(classname, uuid); var /** @type {?} */ testResult = []; if (obj !== null && obj !== undefined) { if (obj._version === undefined || obj._version === null) { obj._version = 0; obj._created = new Date(); } testResult.push(obj); for (var /** @type {?} */ i = 1; i <= 3; i++) { var /** @type {?} */ newObj = JSON.parse(JSON.stringify(obj)); newObj._version = i; newObj._created = new Date(); testResult.push(newObj); } } var /** @type {?} */ result = { "items": testResult }; return Promise.resolve(result); } return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.getVersionsWithHttpInfo(uuid, classname, startIndex, endIndex, sortDescending, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * List all available persistent classes. * * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.listClassNames = /** * List all available persistent classes. * * @param {?=} extraHttpRequestParams * @return {?} */ function (extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.listClassNamesWithHttpInfo(extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Make a stateless object to be stateful with the given \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.makeLangStateful = /** * Make a stateless object to be stateful with the given \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.makeLangStatefulWithHttpInfo(lang, uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Make a stateless object to be stateful with the given \&quot;uuid\&quot; and \&quot;lang\&quot; starting at the specified \&quot;activityId\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} activityId The \&quot;activityId\&quot; of object&#39;s starting state. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.makeLangStatefulActivity = /** * Make a stateless object to be stateful with the given \&quot;uuid\&quot; and \&quot;lang\&quot; starting at the specified \&quot;activityId\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} activityId The \&quot;activityId\&quot; of object&#39;s starting state. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, activityId, uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.makeLangStatefulActivityWithHttpInfo(lang, activityId, uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Make a stateful object to be stateless with the given \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.makeLangStateless = /** * Make a stateful object to be stateless with the given \&quot;uuid\&quot; and \&quot;lang\&quot;. * * @param {?} lang The object&#39;s lang code to be queried (ISO-639) * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (lang, uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.makeLangStatelessWithHttpInfo(lang, uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Make a stateless object to be stateful with the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.makeStateful = /** * Make a stateless object to be stateful with the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.makeStatefulWithHttpInfo(uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Make a stateless object to be stateful with the given \&quot;uuid\&quot; starting at the specified \&quot;activityId\&quot;. * * @param {?} activityId The \&quot;activityId\&quot; of object&#39;s starting state. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.makeStateful1 = /** * Make a stateless object to be stateful with the given \&quot;uuid\&quot; starting at the specified \&quot;activityId\&quot;. * * @param {?} activityId The \&quot;activityId\&quot; of object&#39;s starting state. * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (activityId, uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.makeStatefulActivityWithHttpInfo(activityId, uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Make a stateful object to be stateless with the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.makeStateless = /** * Make a stateful object to be stateless with the given \&quot;uuid\&quot;. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ function (uuid, classname, langPreference, extraHttpRequestParams) { var _this = this; return new Promise(function (resolve, reject) { var /** @type {?} */ prom = _this.makeStatelessWithHttpInfo(uuid, classname, langPreference, extraHttpRequestParams); prom.then(function (response) { resolve(response.json()); }, function (error) { reject(error); }); }); }; /** * Partial update the object (row) on the given \&quot;uuid\&quot;. \@PATCH operation will only update the fields specified in request data. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} body The object fields to be updated. All object fields not presented in this request data will be leaved to be the same. * @param {?=} incrementVersion Increment the object \&quot;_version\&quot; (if it is version-controlled). * @param {?=} langPreference The language preference used to perform the operation (especially in READ operations such as find/query). * @param {?=} extraHttpRequestParams * @return {?} */ ClassesResource.prototype.patchUpdate = /** * Partial update the object (row) on the given \&quot;uuid\&quot;. \@PATCH operation will only update the fields specified in request data. * * @param {?} uuid The persistent object (row) \&quot;uuid\&quot;. * @param {?} classname The persistent class name. * @param {?=} body The object fields to be updated. All object fields not presented in this request data will be leaved to be the same. * @param {?=}