UNPKG

jack-kafka-instance-sdk

Version:
258 lines (257 loc) 15.8 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * Kafka Instance API * API for interacting with Kafka Instance. Includes Produce, Consume and Admin APIs * * The version of the OpenAPI document: 0.14.1-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RecordsApi = exports.RecordsApiFactory = exports.RecordsApiFp = exports.RecordsApiAxiosParamCreator = void 0; const axios_1 = require("axios"); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("../common"); // @ts-ignore const base_1 = require("../base"); /** * RecordsApi - axios parameter creator * @export */ const RecordsApiAxiosParamCreator = function (configuration) { return { /** * Consume a limited number of records from a topic, optionally specifying a partition and an absolute offset or timestamp as the starting point for message retrieval. * @summary Consume records from a topic * @param {string} topicName Topic name * @param {Array<RecordIncludedProperty>} [include] List of properties to include for each record in the response * @param {number} [limit] Limit the number of records fetched and returned * @param {number} [maxValueLength] Maximum length of string values returned in the response. Values with a length that exceeds this parameter will be truncated. When this parameter is not included in the request, the full string values will be returned. * @param {number} [offset] Retrieve messages with an offset equal to or greater than this offset. If both &#x60;timestamp&#x60; and &#x60;offset&#x60; are requested, &#x60;timestamp&#x60; is given preference. * @param {number} [partition] Retrieve messages only from this partition * @param {any} [timestamp] Retrieve messages with a timestamp equal to or later than this timestamp. If both &#x60;timestamp&#x60; and &#x60;offset&#x60; are requested, &#x60;timestamp&#x60; is given preference. * @param {*} [options] Override http request option. * @throws {RequiredError} */ consumeRecords: (topicName, include, limit, maxValueLength, offset, partition, timestamp, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'topicName' is not null or undefined (0, common_1.assertParamExists)('consumeRecords', 'topicName', topicName); const localVarPath = `/api/v1/topics/{topicName}/records` .replace(`{${"topicName"}}`, encodeURIComponent(String(topicName))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication Bearer required // http bearer authentication required yield (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration); // authentication OAuth2 required // oauth required yield (0, common_1.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration); if (include) { localVarQueryParameter['include'] = include.join(base_1.COLLECTION_FORMATS.csv); } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (maxValueLength !== undefined) { localVarQueryParameter['maxValueLength'] = maxValueLength; } if (offset !== undefined) { localVarQueryParameter['offset'] = offset; } if (partition !== undefined) { localVarQueryParameter['partition'] = partition; } if (timestamp !== undefined) { localVarQueryParameter['timestamp'] = timestamp; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Produce (write) a single record to a topic. * @summary Send a record to a topic * @param {string} topicName Topic name * @param {Record} record * @param {*} [options] Override http request option. * @throws {RequiredError} */ produceRecord: (topicName, record, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'topicName' is not null or undefined (0, common_1.assertParamExists)('produceRecord', 'topicName', topicName); // verify required parameter 'record' is not null or undefined (0, common_1.assertParamExists)('produceRecord', 'record', record); const localVarPath = `/api/v1/topics/{topicName}/records` .replace(`{${"topicName"}}`, encodeURIComponent(String(topicName))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication Bearer required // http bearer authentication required yield (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration); // authentication OAuth2 required // oauth required yield (0, common_1.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(record, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; exports.RecordsApiAxiosParamCreator = RecordsApiAxiosParamCreator; /** * RecordsApi - functional programming interface * @export */ const RecordsApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.RecordsApiAxiosParamCreator)(configuration); return { /** * Consume a limited number of records from a topic, optionally specifying a partition and an absolute offset or timestamp as the starting point for message retrieval. * @summary Consume records from a topic * @param {string} topicName Topic name * @param {Array<RecordIncludedProperty>} [include] List of properties to include for each record in the response * @param {number} [limit] Limit the number of records fetched and returned * @param {number} [maxValueLength] Maximum length of string values returned in the response. Values with a length that exceeds this parameter will be truncated. When this parameter is not included in the request, the full string values will be returned. * @param {number} [offset] Retrieve messages with an offset equal to or greater than this offset. If both &#x60;timestamp&#x60; and &#x60;offset&#x60; are requested, &#x60;timestamp&#x60; is given preference. * @param {number} [partition] Retrieve messages only from this partition * @param {any} [timestamp] Retrieve messages with a timestamp equal to or later than this timestamp. If both &#x60;timestamp&#x60; and &#x60;offset&#x60; are requested, &#x60;timestamp&#x60; is given preference. * @param {*} [options] Override http request option. * @throws {RequiredError} */ consumeRecords(topicName, include, limit, maxValueLength, offset, partition, timestamp, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.consumeRecords(topicName, include, limit, maxValueLength, offset, partition, timestamp, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, /** * Produce (write) a single record to a topic. * @summary Send a record to a topic * @param {string} topicName Topic name * @param {Record} record * @param {*} [options] Override http request option. * @throws {RequiredError} */ produceRecord(topicName, record, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.produceRecord(topicName, record, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }); }, }; }; exports.RecordsApiFp = RecordsApiFp; /** * RecordsApi - factory interface * @export */ const RecordsApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.RecordsApiFp)(configuration); return { /** * Consume a limited number of records from a topic, optionally specifying a partition and an absolute offset or timestamp as the starting point for message retrieval. * @summary Consume records from a topic * @param {string} topicName Topic name * @param {Array<RecordIncludedProperty>} [include] List of properties to include for each record in the response * @param {number} [limit] Limit the number of records fetched and returned * @param {number} [maxValueLength] Maximum length of string values returned in the response. Values with a length that exceeds this parameter will be truncated. When this parameter is not included in the request, the full string values will be returned. * @param {number} [offset] Retrieve messages with an offset equal to or greater than this offset. If both &#x60;timestamp&#x60; and &#x60;offset&#x60; are requested, &#x60;timestamp&#x60; is given preference. * @param {number} [partition] Retrieve messages only from this partition * @param {any} [timestamp] Retrieve messages with a timestamp equal to or later than this timestamp. If both &#x60;timestamp&#x60; and &#x60;offset&#x60; are requested, &#x60;timestamp&#x60; is given preference. * @param {*} [options] Override http request option. * @throws {RequiredError} */ consumeRecords(topicName, include, limit, maxValueLength, offset, partition, timestamp, options) { return localVarFp.consumeRecords(topicName, include, limit, maxValueLength, offset, partition, timestamp, options).then((request) => request(axios, basePath)); }, /** * Produce (write) a single record to a topic. * @summary Send a record to a topic * @param {string} topicName Topic name * @param {Record} record * @param {*} [options] Override http request option. * @throws {RequiredError} */ produceRecord(topicName, record, options) { return localVarFp.produceRecord(topicName, record, options).then((request) => request(axios, basePath)); }, }; }; exports.RecordsApiFactory = RecordsApiFactory; /** * RecordsApi - object-oriented interface * @export * @class RecordsApi * @extends {BaseAPI} */ class RecordsApi extends base_1.BaseAPI { /** * Consume a limited number of records from a topic, optionally specifying a partition and an absolute offset or timestamp as the starting point for message retrieval. * @summary Consume records from a topic * @param {string} topicName Topic name * @param {Array<RecordIncludedProperty>} [include] List of properties to include for each record in the response * @param {number} [limit] Limit the number of records fetched and returned * @param {number} [maxValueLength] Maximum length of string values returned in the response. Values with a length that exceeds this parameter will be truncated. When this parameter is not included in the request, the full string values will be returned. * @param {number} [offset] Retrieve messages with an offset equal to or greater than this offset. If both &#x60;timestamp&#x60; and &#x60;offset&#x60; are requested, &#x60;timestamp&#x60; is given preference. * @param {number} [partition] Retrieve messages only from this partition * @param {any} [timestamp] Retrieve messages with a timestamp equal to or later than this timestamp. If both &#x60;timestamp&#x60; and &#x60;offset&#x60; are requested, &#x60;timestamp&#x60; is given preference. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RecordsApi */ consumeRecords(topicName, include, limit, maxValueLength, offset, partition, timestamp, options) { return (0, exports.RecordsApiFp)(this.configuration).consumeRecords(topicName, include, limit, maxValueLength, offset, partition, timestamp, options).then((request) => request(this.axios, this.basePath)); } /** * Produce (write) a single record to a topic. * @summary Send a record to a topic * @param {string} topicName Topic name * @param {Record} record * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RecordsApi */ produceRecord(topicName, record, options) { return (0, exports.RecordsApiFp)(this.configuration).produceRecord(topicName, record, options).then((request) => request(this.axios, this.basePath)); } } exports.RecordsApi = RecordsApi;