UNPKG

arlas-tagger-api

Version:

(Un)Tag fields of ARLAS collections

633 lines 27.3 kB
/// <reference path="./custom.d.ts" /> // tslint:disable /** * ARLAS Tagger APIs * (Un)Tag fields of ARLAS collections * * OpenAPI spec version: API_VERSION * Contact: contact@gisaia.com * * NOTE: This file is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the file manually. */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import * as url from "url"; import * as isomorphicFetch from "isomorphic-fetch"; var BASE_PATH = "/arlas_tagger".replace(/\/+$/, ""); /** * * @export */ export var COLLECTION_FORMATS = { csv: ",", ssv: " ", tsv: "\t", pipes: "|", }; /** * * @export * @class BaseAPI */ var BaseAPI = (function () { function BaseAPI(configuration, basePath, fetch) { if (basePath === void 0) { basePath = BASE_PATH; } if (fetch === void 0) { fetch = isomorphicFetch; } this.basePath = basePath; this.fetch = fetch; if (configuration) { this.configuration = configuration; this.basePath = configuration.basePath || this.basePath; } } return BaseAPI; }()); export { BaseAPI }; ; /** * * @export * @class RequiredError * @extends {Error} */ var RequiredError = (function (_super) { __extends(RequiredError, _super); function RequiredError(field, msg) { var _this = _super.call(this, msg) || this; _this.field = field; return _this; } return RequiredError; }(Error)); export { RequiredError }; /** * @export * @namespace Expression */ export var Expression; (function (Expression) { /** * @export * @enum {string} */ var OpEnum; (function (OpEnum) { OpEnum[OpEnum["Eq"] = 'eq'] = "Eq"; OpEnum[OpEnum["Gte"] = 'gte'] = "Gte"; OpEnum[OpEnum["Gt"] = 'gt'] = "Gt"; OpEnum[OpEnum["Lte"] = 'lte'] = "Lte"; OpEnum[OpEnum["Lt"] = 'lt'] = "Lt"; OpEnum[OpEnum["Like"] = 'like'] = "Like"; OpEnum[OpEnum["Ne"] = 'ne'] = "Ne"; OpEnum[OpEnum["Range"] = 'range'] = "Range"; OpEnum[OpEnum["Within"] = 'within'] = "Within"; OpEnum[OpEnum["Notwithin"] = 'notwithin'] = "Notwithin"; OpEnum[OpEnum["Intersects"] = 'intersects'] = "Intersects"; OpEnum[OpEnum["Notintersects"] = 'notintersects'] = "Notintersects"; })(OpEnum = Expression.OpEnum || (Expression.OpEnum = {})); })(Expression || (Expression = {})); /** * @export * @namespace TagRefRequest */ export var TagRefRequest; (function (TagRefRequest) { /** * @export * @enum {string} */ var ActionEnum; (function (ActionEnum) { ActionEnum[ActionEnum["ADD"] = 'ADD'] = "ADD"; ActionEnum[ActionEnum["REMOVE"] = 'REMOVE'] = "REMOVE"; ActionEnum[ActionEnum["REMOVEALL"] = 'REMOVEALL'] = "REMOVEALL"; })(ActionEnum = TagRefRequest.ActionEnum || (TagRefRequest.ActionEnum = {})); })(TagRefRequest || (TagRefRequest = {})); /** * @export * @namespace UpdateResponse */ export var UpdateResponse; (function (UpdateResponse) { /** * @export * @enum {string} */ var ActionEnum; (function (ActionEnum) { ActionEnum[ActionEnum["ADD"] = 'ADD'] = "ADD"; ActionEnum[ActionEnum["REMOVE"] = 'REMOVE'] = "REMOVE"; ActionEnum[ActionEnum["REMOVEALL"] = 'REMOVEALL'] = "REMOVEALL"; })(ActionEnum = UpdateResponse.ActionEnum || (UpdateResponse.ActionEnum = {})); })(UpdateResponse || (UpdateResponse = {})); /** * StatusApi - fetch parameter creator * @export */ export var StatusApiFetchParamCreator = function (configuration) { return { /** * Get the status of the (un)tagging operation, given the id of a previously requested operation * @summary TagStatus * @param {string} collection collection * @param {string} id The id of a previously requested (un)tag operation. * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ taggingGet: function (collection, id, pretty, options) { if (options === void 0) { options = {}; } // verify required parameter 'collection' is not null or undefined if (collection === null || collection === undefined) { throw new RequiredError('collection', 'Required parameter collection was null or undefined when calling taggingGet.'); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling taggingGet.'); } var localVarPath = "/status/{collection}/_tag/{id}" .replace("{" + "collection" + "}", encodeURIComponent(String(collection))) .replace("{" + "id" + "}", encodeURIComponent(String(id))); var localVarUrlObj = url.parse(localVarPath, true); var localVarRequestOptions = Object.assign({ method: 'GET' }, options); var localVarHeaderParameter = {}; var localVarQueryParameter = {}; if (pretty !== undefined) { localVarQueryParameter['pretty'] = pretty; } localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); return { url: url.format(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Get the list of previously submitted tag requests * @summary TagList * @param {string} collection collection * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ taggingGetList: function (collection, pretty, options) { if (options === void 0) { options = {}; } // verify required parameter 'collection' is not null or undefined if (collection === null || collection === undefined) { throw new RequiredError('collection', 'Required parameter collection was null or undefined when calling taggingGetList.'); } var localVarPath = "/status/{collection}/_taglist" .replace("{" + "collection" + "}", encodeURIComponent(String(collection))); var localVarUrlObj = url.parse(localVarPath, true); var localVarRequestOptions = Object.assign({ method: 'GET' }, options); var localVarHeaderParameter = {}; var localVarQueryParameter = {}; if (pretty !== undefined) { localVarQueryParameter['pretty'] = pretty; } localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); return { url: url.format(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * StatusApi - functional programming interface * @export */ export var StatusApiFp = function (configuration) { return { /** * Get the status of the (un)tagging operation, given the id of a previously requested operation * @summary TagStatus * @param {string} collection collection * @param {string} id The id of a previously requested (un)tag operation. * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ taggingGet: function (collection, id, pretty, options) { var localVarFetchArgs = StatusApiFetchParamCreator(configuration).taggingGet(collection, id, pretty, options); return function (fetch, basePath) { if (fetch === void 0) { fetch = isomorphicFetch; } if (basePath === void 0) { basePath = BASE_PATH; } return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { if (response.status >= 200 && response.status < 300) { return response.json(); } else { throw response; } }); }; }, /** * Get the list of previously submitted tag requests * @summary TagList * @param {string} collection collection * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ taggingGetList: function (collection, pretty, options) { var localVarFetchArgs = StatusApiFetchParamCreator(configuration).taggingGetList(collection, pretty, options); return function (fetch, basePath) { if (fetch === void 0) { fetch = isomorphicFetch; } if (basePath === void 0) { basePath = BASE_PATH; } return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { if (response.status >= 200 && response.status < 300) { return response.json(); } else { throw response; } }); }; }, }; }; /** * StatusApi - factory interface * @export */ export var StatusApiFactory = function (configuration, fetch, basePath) { return { /** * Get the status of the (un)tagging operation, given the id of a previously requested operation * @summary TagStatus * @param {string} collection collection * @param {string} id The id of a previously requested (un)tag operation. * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ taggingGet: function (collection, id, pretty, options) { return StatusApiFp(configuration).taggingGet(collection, id, pretty, options)(fetch, basePath); }, /** * Get the list of previously submitted tag requests * @summary TagList * @param {string} collection collection * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ taggingGetList: function (collection, pretty, options) { return StatusApiFp(configuration).taggingGetList(collection, pretty, options)(fetch, basePath); }, }; }; /** * StatusApi - object-oriented interface * @export * @class StatusApi * @extends {BaseAPI} */ var StatusApi = (function (_super) { __extends(StatusApi, _super); function StatusApi() { return _super !== null && _super.apply(this, arguments) || this; } /** * Get the status of the (un)tagging operation, given the id of a previously requested operation * @summary TagStatus * @param {string} collection collection * @param {string} id The id of a previously requested (un)tag operation. * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StatusApi */ StatusApi.prototype.taggingGet = function (collection, id, pretty, options) { return StatusApiFp(this.configuration).taggingGet(collection, id, pretty, options)(this.fetch, this.basePath); }; /** * Get the list of previously submitted tag requests * @summary TagList * @param {string} collection collection * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof StatusApi */ StatusApi.prototype.taggingGetList = function (collection, pretty, options) { return StatusApiFp(this.configuration).taggingGetList(collection, pretty, options)(this.fetch, this.basePath); }; return StatusApi; }(BaseAPI)); export { StatusApi }; /** * WriteApi - fetch parameter creator * @export */ export var WriteApiFetchParamCreator = function (configuration) { return { /** * Search and tag the elements found in the collection, given the filters * @summary Tag * @param {string} collection collection * @param {TagRequest} [body] * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ tagPost: function (collection, body, pretty, options) { if (options === void 0) { options = {}; } // verify required parameter 'collection' is not null or undefined if (collection === null || collection === undefined) { throw new RequiredError('collection', 'Required parameter collection was null or undefined when calling tagPost.'); } var localVarPath = "/write/{collection}/_tag" .replace("{" + "collection" + "}", encodeURIComponent(String(collection))); var localVarUrlObj = url.parse(localVarPath, true); var localVarRequestOptions = Object.assign({ method: 'POST' }, options); var localVarHeaderParameter = {}; var localVarQueryParameter = {}; if (pretty !== undefined) { localVarQueryParameter['pretty'] = pretty; } localVarHeaderParameter['Content-Type'] = 'application/json;charset=utf-8'; localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); var needsSerialization = ("TagRequest" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || ""); return { url: url.format(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Scan the tagref topic and replay tagging operations from the given offset * @summary TagReplay * @param {string} collection collection * @param {number} offset The offset from which the replay must be done. * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ tagReplay: function (collection, offset, pretty, options) { if (options === void 0) { options = {}; } // verify required parameter 'collection' is not null or undefined if (collection === null || collection === undefined) { throw new RequiredError('collection', 'Required parameter collection was null or undefined when calling tagReplay.'); } // verify required parameter 'offset' is not null or undefined if (offset === null || offset === undefined) { throw new RequiredError('offset', 'Required parameter offset was null or undefined when calling tagReplay.'); } var localVarPath = "/write/{collection}/_tagreplay" .replace("{" + "collection" + "}", encodeURIComponent(String(collection))); var localVarUrlObj = url.parse(localVarPath, true); var localVarRequestOptions = Object.assign({ method: 'POST' }, options); var localVarHeaderParameter = {}; var localVarQueryParameter = {}; if (offset !== undefined) { localVarQueryParameter['offset'] = offset; } if (pretty !== undefined) { localVarQueryParameter['pretty'] = pretty; } localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); return { url: url.format(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Search and untag the elements found in the collection, given the filters * @summary Untag * @param {string} collection collection * @param {TagRequest} [body] * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ untagPost: function (collection, body, pretty, options) { if (options === void 0) { options = {}; } // verify required parameter 'collection' is not null or undefined if (collection === null || collection === undefined) { throw new RequiredError('collection', 'Required parameter collection was null or undefined when calling untagPost.'); } var localVarPath = "/write/{collection}/_untag" .replace("{" + "collection" + "}", encodeURIComponent(String(collection))); var localVarUrlObj = url.parse(localVarPath, true); var localVarRequestOptions = Object.assign({ method: 'POST' }, options); var localVarHeaderParameter = {}; var localVarQueryParameter = {}; if (pretty !== undefined) { localVarQueryParameter['pretty'] = pretty; } localVarHeaderParameter['Content-Type'] = 'application/json;charset=utf-8'; localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); var needsSerialization = ("TagRequest" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || ""); return { url: url.format(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * WriteApi - functional programming interface * @export */ export var WriteApiFp = function (configuration) { return { /** * Search and tag the elements found in the collection, given the filters * @summary Tag * @param {string} collection collection * @param {TagRequest} [body] * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ tagPost: function (collection, body, pretty, options) { var localVarFetchArgs = WriteApiFetchParamCreator(configuration).tagPost(collection, body, pretty, options); return function (fetch, basePath) { if (fetch === void 0) { fetch = isomorphicFetch; } if (basePath === void 0) { basePath = BASE_PATH; } return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { if (response.status >= 200 && response.status < 300) { return response.json(); } else { throw response; } }); }; }, /** * Scan the tagref topic and replay tagging operations from the given offset * @summary TagReplay * @param {string} collection collection * @param {number} offset The offset from which the replay must be done. * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ tagReplay: function (collection, offset, pretty, options) { var localVarFetchArgs = WriteApiFetchParamCreator(configuration).tagReplay(collection, offset, pretty, options); return function (fetch, basePath) { if (fetch === void 0) { fetch = isomorphicFetch; } if (basePath === void 0) { basePath = BASE_PATH; } return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { if (response.status >= 200 && response.status < 300) { return response.json(); } else { throw response; } }); }; }, /** * Search and untag the elements found in the collection, given the filters * @summary Untag * @param {string} collection collection * @param {TagRequest} [body] * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ untagPost: function (collection, body, pretty, options) { var localVarFetchArgs = WriteApiFetchParamCreator(configuration).untagPost(collection, body, pretty, options); return function (fetch, basePath) { if (fetch === void 0) { fetch = isomorphicFetch; } if (basePath === void 0) { basePath = BASE_PATH; } return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { if (response.status >= 200 && response.status < 300) { return response.json(); } else { throw response; } }); }; }, }; }; /** * WriteApi - factory interface * @export */ export var WriteApiFactory = function (configuration, fetch, basePath) { return { /** * Search and tag the elements found in the collection, given the filters * @summary Tag * @param {string} collection collection * @param {TagRequest} [body] * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ tagPost: function (collection, body, pretty, options) { return WriteApiFp(configuration).tagPost(collection, body, pretty, options)(fetch, basePath); }, /** * Scan the tagref topic and replay tagging operations from the given offset * @summary TagReplay * @param {string} collection collection * @param {number} offset The offset from which the replay must be done. * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ tagReplay: function (collection, offset, pretty, options) { return WriteApiFp(configuration).tagReplay(collection, offset, pretty, options)(fetch, basePath); }, /** * Search and untag the elements found in the collection, given the filters * @summary Untag * @param {string} collection collection * @param {TagRequest} [body] * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} */ untagPost: function (collection, body, pretty, options) { return WriteApiFp(configuration).untagPost(collection, body, pretty, options)(fetch, basePath); }, }; }; /** * WriteApi - object-oriented interface * @export * @class WriteApi * @extends {BaseAPI} */ var WriteApi = (function (_super) { __extends(WriteApi, _super); function WriteApi() { return _super !== null && _super.apply(this, arguments) || this; } /** * Search and tag the elements found in the collection, given the filters * @summary Tag * @param {string} collection collection * @param {TagRequest} [body] * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WriteApi */ WriteApi.prototype.tagPost = function (collection, body, pretty, options) { return WriteApiFp(this.configuration).tagPost(collection, body, pretty, options)(this.fetch, this.basePath); }; /** * Scan the tagref topic and replay tagging operations from the given offset * @summary TagReplay * @param {string} collection collection * @param {number} offset The offset from which the replay must be done. * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WriteApi */ WriteApi.prototype.tagReplay = function (collection, offset, pretty, options) { return WriteApiFp(this.configuration).tagReplay(collection, offset, pretty, options)(this.fetch, this.basePath); }; /** * Search and untag the elements found in the collection, given the filters * @summary Untag * @param {string} collection collection * @param {TagRequest} [body] * @param {boolean} [pretty] Pretty print * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WriteApi */ WriteApi.prototype.untagPost = function (collection, body, pretty, options) { return WriteApiFp(this.configuration).untagPost(collection, body, pretty, options)(this.fetch, this.basePath); }; return WriteApi; }(BaseAPI)); export { WriteApi }; //# sourceMappingURL=api.js.map