/** * Generated by orval v8.19.0 🍺 * Do not edit manually. * Webitel API * OpenAPI spec version: 24.04.0 */ import axios from '@aliasedDeps/api-services/axios'; import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; import type { ThreadManagementGetParams, ThreadManagementSearchLeftParams, ThreadManagementSearchParams, ThreadManagementSearchVariablesParams, WebitelImApiGatewayV1AddMemberResponse, WebitelImApiGatewayV1RemoveMemberResponse, WebitelImApiGatewayV1SearchLeftResponse, WebitelImApiGatewayV1SearchThreadResponse, WebitelImApiGatewayV1SearchVariablesResponse, WebitelImApiGatewayV1Thread, WebitelImApiGatewayV1ThreadManagementAddMemberBody, WebitelImApiGatewayV1ThreadManagementCreateRequest, WebitelImApiGatewayV1ThreadManagementCreateResponse, WebitelImApiGatewayV1ThreadManagementFlushVariablesBody, WebitelImApiGatewayV1ThreadManagementSetVariablesBody, WebitelImApiGatewayV1ThreadManagementTransferBody, WebitelImApiGatewayV1ThreadVariables, WebitelImApiGatewayV1TransferResponse, } from '../_models'; // --- header start // export const // --- title start getWebitelImApiGatewayV1Threadmanagement = // --- title end (axiosInstance: AxiosInstance = axios) => { // --- header end /** * @summary Search threads with filters */ const threadManagementSearch = ( params?: ThreadManagementSearchParams, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.get(`/v1/threads`, { ...options, params: { ...params, ...options?.params, }, }); }; const threadManagementCreate = ( webitelImApiGatewayV1ThreadManagementCreateRequest: WebitelImApiGatewayV1ThreadManagementCreateRequest, options?: AxiosRequestConfig, ): Promise< AxiosResponse > => { return axiosInstance.post( `/v1/threads`, webitelImApiGatewayV1ThreadManagementCreateRequest, options, ); }; /** * @summary Search threads that the caller has left from */ const threadManagementSearchLeft = ( params?: ThreadManagementSearchLeftParams, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.get(`/v1/threads/left`, { ...options, params: { ...params, ...options?.params, }, }); }; /** * @summary Returns a single thread by its identifier. */ const threadManagementGet = ( id: string, params?: ThreadManagementGetParams, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.get(`/v1/threads/${id}`, { ...options, params: { ...params, ...options?.params, }, }); }; /** * @summary Add member to the thread. */ const threadManagementAddMember = ( threadId: string, webitelImApiGatewayV1ThreadManagementAddMemberBody: WebitelImApiGatewayV1ThreadManagementAddMemberBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.post( `/v1/threads/${threadId}/members`, webitelImApiGatewayV1ThreadManagementAddMemberBody, options, ); }; /** * @summary Remove member from the thread. */ const threadManagementRemoveMember = ( threadId: string, memberId: string, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.delete( `/v1/threads/${threadId}/members/${memberId}`, options, ); }; /** * @summary Transfer unites add member and remove member. It adds a new member to the thread and removes the initiator from the thread. */ const threadManagementTransfer = ( threadId: string, webitelImApiGatewayV1ThreadManagementTransferBody: WebitelImApiGatewayV1ThreadManagementTransferBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.post( `/v1/threads/${threadId}/transfer`, webitelImApiGatewayV1ThreadManagementTransferBody, options, ); }; /** * @summary Retrieves all variables for a specific thread. */ const threadManagementLocateVariables = ( threadId: string, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.get(`/v1/threads/${threadId}/variables`, options); }; /** * @summary Sets or updates variables for a specific thread. Existing variables with the same keys will be overwritten if were setted by the caller. New variables will be created if they do not exist. */ const threadManagementSetVariables = ( threadId: string, webitelImApiGatewayV1ThreadManagementSetVariablesBody: WebitelImApiGatewayV1ThreadManagementSetVariablesBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.post( `/v1/threads/${threadId}/variables`, webitelImApiGatewayV1ThreadManagementSetVariablesBody, options, ); }; /** * @summary Removes specified variables from a thread with caller's permission. If no keys are provided, all variables may be removed depending on implementation. */ const threadManagementFlushVariables = ( threadId: string, webitelImApiGatewayV1ThreadManagementFlushVariablesBody: WebitelImApiGatewayV1ThreadManagementFlushVariablesBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.delete(`/v1/threads/${threadId}/variables/flush`, { data: webitelImApiGatewayV1ThreadManagementFlushVariablesBody, ...options, }); }; /** * @summary Searches thread variables across multiple threads. Supports pagination and field projection. */ const threadManagementSearchVariables = ( params?: ThreadManagementSearchVariablesParams, options?: AxiosRequestConfig, ): Promise< AxiosResponse > => { return axiosInstance.get(`/v1/variables`, { ...options, params: { ...params, ...options?.params, }, }); }; // --- footer start return { threadManagementSearch, threadManagementCreate, threadManagementSearchLeft, threadManagementGet, threadManagementAddMember, threadManagementRemoveMember, threadManagementTransfer, threadManagementLocateVariables, threadManagementSetVariables, threadManagementFlushVariables, threadManagementSearchVariables, }; }; export type ThreadManagementSearchResult = AxiosResponse; export type ThreadManagementCreateResult = AxiosResponse; export type ThreadManagementSearchLeftResult = AxiosResponse; export type ThreadManagementGetResult = AxiosResponse; export type ThreadManagementAddMemberResult = AxiosResponse; export type ThreadManagementRemoveMemberResult = AxiosResponse; export type ThreadManagementTransferResult = AxiosResponse; export type ThreadManagementLocateVariablesResult = AxiosResponse; export type ThreadManagementSetVariablesResult = AxiosResponse; export type ThreadManagementFlushVariablesResult = AxiosResponse; export type ThreadManagementSearchVariablesResult = AxiosResponse; // --- footer end