// tslint:disable
/**
 * Webitel API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 24.04.0
 * Contact: support@webitel.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
import { __awaiter } from "tslib";
import * as globalImportUrl from 'url';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { BASE_PATH, BaseAPI, RequiredError, } from '../base';
/**
 * MessageHistoryApi - axios parameter creator
 * @export
 */
export const MessageHistoryApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Searches messages within a specific thread. Supports cursor-based pagination and field selection.
         * @param {string} threadId Filter by thread IDs.
         * @param {Array<string>} [fields] List of message fields to be returned. Used to reduce payload size.
         * @param {Array<string>} [ids] Filter by specific message IDs.
         * @param {Array<string>} [senderIds] Filter messages by sender user IDs.
         * @param {Array<number>} [types] Filter messages by message types.
         * @param {string} [cursorCreatedAt] Message creation timestamp (Unix time, microseconds).
         * @param {string} [cursorId] Unique message identifier.
         * @param {boolean} [cursorDirection] Pagination direction. true - backward (older messages). false - forward (newer messages).
         * @param {number} [size] Maximum number of messages to return.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchThreadMessagesHistory: (threadId, fields, ids, senderIds, types, cursorCreatedAt, cursorId, cursorDirection, size, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'threadId' is not null or undefined
            if (threadId === null || threadId === undefined) {
                throw new RequiredError('threadId', 'Required parameter threadId was null or undefined when calling searchThreadMessagesHistory.');
            }
            const localVarPath = `/v1/{thread_id}/messages`.replace(`{${'thread_id'}}`, encodeURIComponent(String(threadId)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? yield configuration.apiKey('X-Webitel-Access')
                    : yield configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            if (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            if (ids) {
                localVarQueryParameter['ids'] = ids;
            }
            if (senderIds) {
                localVarQueryParameter['sender_ids'] = senderIds;
            }
            if (types) {
                localVarQueryParameter['types'] = types;
            }
            if (cursorCreatedAt !== undefined) {
                localVarQueryParameter['cursor.created_at'] = cursorCreatedAt;
            }
            if (cursorId !== undefined) {
                localVarQueryParameter['cursor.id'] = cursorId;
            }
            if (cursorDirection !== undefined) {
                localVarQueryParameter['cursor.direction'] = cursorDirection;
            }
            if (size !== undefined) {
                localVarQueryParameter['size'] = size;
            }
            localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
    };
};
/**
 * MessageHistoryApi - functional programming interface
 * @export
 */
export const MessageHistoryApiFp = function (configuration) {
    return {
        /**
         *
         * @summary Searches messages within a specific thread. Supports cursor-based pagination and field selection.
         * @param {string} threadId Filter by thread IDs.
         * @param {Array<string>} [fields] List of message fields to be returned. Used to reduce payload size.
         * @param {Array<string>} [ids] Filter by specific message IDs.
         * @param {Array<string>} [senderIds] Filter messages by sender user IDs.
         * @param {Array<number>} [types] Filter messages by message types.
         * @param {string} [cursorCreatedAt] Message creation timestamp (Unix time, microseconds).
         * @param {string} [cursorId] Unique message identifier.
         * @param {boolean} [cursorDirection] Pagination direction. true - backward (older messages). false - forward (newer messages).
         * @param {number} [size] Maximum number of messages to return.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchThreadMessagesHistory(threadId, fields, ids, senderIds, types, cursorCreatedAt, cursorId, cursorDirection, size, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield MessageHistoryApiAxiosParamCreator(configuration).searchThreadMessagesHistory(threadId, fields, ids, senderIds, types, cursorCreatedAt, cursorId, cursorDirection, size, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * MessageHistoryApi - factory interface
 * @export
 */
export const MessageHistoryApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @summary Searches messages within a specific thread. Supports cursor-based pagination and field selection.
         * @param {string} threadId Filter by thread IDs.
         * @param {Array<string>} [fields] List of message fields to be returned. Used to reduce payload size.
         * @param {Array<string>} [ids] Filter by specific message IDs.
         * @param {Array<string>} [senderIds] Filter messages by sender user IDs.
         * @param {Array<number>} [types] Filter messages by message types.
         * @param {string} [cursorCreatedAt] Message creation timestamp (Unix time, microseconds).
         * @param {string} [cursorId] Unique message identifier.
         * @param {boolean} [cursorDirection] Pagination direction. true - backward (older messages). false - forward (newer messages).
         * @param {number} [size] Maximum number of messages to return.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchThreadMessagesHistory(threadId, fields, ids, senderIds, types, cursorCreatedAt, cursorId, cursorDirection, size, options) {
            return MessageHistoryApiFp(configuration)
                .searchThreadMessagesHistory(threadId, fields, ids, senderIds, types, cursorCreatedAt, cursorId, cursorDirection, size, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * MessageHistoryApi - object-oriented interface
 * @export
 * @class MessageHistoryApi
 * @extends {BaseAPI}
 */
export class MessageHistoryApi extends BaseAPI {
    /**
     *
     * @summary Searches messages within a specific thread. Supports cursor-based pagination and field selection.
     * @param {string} threadId Filter by thread IDs.
     * @param {Array<string>} [fields] List of message fields to be returned. Used to reduce payload size.
     * @param {Array<string>} [ids] Filter by specific message IDs.
     * @param {Array<string>} [senderIds] Filter messages by sender user IDs.
     * @param {Array<number>} [types] Filter messages by message types.
     * @param {string} [cursorCreatedAt] Message creation timestamp (Unix time, microseconds).
     * @param {string} [cursorId] Unique message identifier.
     * @param {boolean} [cursorDirection] Pagination direction. true - backward (older messages). false - forward (newer messages).
     * @param {number} [size] Maximum number of messages to return.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MessageHistoryApi
     */
    searchThreadMessagesHistory(threadId, fields, ids, senderIds, types, cursorCreatedAt, cursorId, cursorDirection, size, options) {
        return MessageHistoryApiFp(this.configuration)
            .searchThreadMessagesHistory(threadId, fields, ids, senderIds, types, cursorCreatedAt, cursorId, cursorDirection, size, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=message-history-api.js.map