/** * 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 { EngineActiveCall, EngineAggregateHistoryCallRequest, EngineBlindTransferCallResponse, EngineCallAnnotation, EngineCallServiceBlindTransferCallBody, EngineCallServiceCreateCallAnnotationBody, EngineCallServiceDtmfCallBody, EngineCallServiceEavesdropCallBody, EngineCallServiceHangupCallBody, EngineCallServiceHoldCallBody, EngineCallServicePatchHistoryCallBody, EngineCallServiceRedialCallBody, EngineCallServiceSetVariablesCallBody, EngineCallServiceUnHoldCallBody, EngineCallServiceUpdateCallAnnotationBody, EngineConfirmPushResponse, EngineCreateCallRequest, EngineCreateCallResponse, EngineDtmfCallResponse, EngineHangupCallResponse, EngineHistoryCall, EngineHoldCallResponse, EngineListAggregate, EngineListCall, EngineListHistoryCall, EngineSearchHistoryCallRequest, EngineSetVariablesCallResponse, ReadCallParams, SearchActiveCallParams, SearchHistoryCallParams, } from '../_models'; // --- header start // export const // --- title start getCallService = // --- title end (axiosInstance: AxiosInstance = axios) => { // --- header end /** * @summary CreateCall initiates a new outbound call with specified parameters. */ const createCall = ( engineCreateCallRequest: EngineCreateCallRequest, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.post(`/calls`, engineCreateCallRequest, options); }; /** * @summary SearchActiveCall returns a list of all calls currently in progress. */ const searchActiveCall = ( params?: SearchActiveCallParams, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.get(`/calls/active`, { ...options, params: { ...params, ...options?.params, }, }); }; /** * @summary HangupCall terminates an active call session. */ const hangupCall = ( id: string, engineCallServiceHangupCallBody: EngineCallServiceHangupCallBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.delete(`/calls/active/${id}`, { data: engineCallServiceHangupCallBody, ...options, }); }; /** * @summary ReadCall returns detailed real-time information for a specific active call. */ const readCall = ( id: string, params?: ReadCallParams, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.get(`/calls/active/${id}`, { ...options, params: { ...params, ...options?.params, }, }); }; /** * @summary ConfirmPush confirms receipt of a push notification for synchronization. */ const confirmPush = ( id: string, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.patch( `/calls/active/${id}/confirm_push`, undefined, options, ); }; /** * @summary DtmfCall sends DTMF digits to an active call. */ const dtmfCall = ( id: string, engineCallServiceDtmfCallBody: EngineCallServiceDtmfCallBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.patch( `/calls/active/${id}/dtmf`, engineCallServiceDtmfCallBody, options, ); }; /** * @summary EavesdropCall allows a supervisor to listen, whisper, or join an active call. */ const eavesdropCall = ( id: string, engineCallServiceEavesdropCallBody: EngineCallServiceEavesdropCallBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.post( `/calls/active/${id}/eavesdrop`, engineCallServiceEavesdropCallBody, options, ); }; /** * @summary HoldCall puts an active call on hold. */ const holdCall = ( id: string, engineCallServiceHoldCallBody: EngineCallServiceHoldCallBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.patch( `/calls/active/${id}/hold`, engineCallServiceHoldCallBody, options, ); }; /** * @summary BlindTransferCall redirects an active call to another destination. */ const blindTransferCall = ( id: string, engineCallServiceBlindTransferCallBody: EngineCallServiceBlindTransferCallBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.patch( `/calls/active/${id}/transfer`, engineCallServiceBlindTransferCallBody, options, ); }; /** * @summary UnHoldCall resumes a call from hold state. */ const unHoldCall = ( id: string, engineCallServiceUnHoldCallBody: EngineCallServiceUnHoldCallBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.patch( `/calls/active/${id}/unhold`, engineCallServiceUnHoldCallBody, options, ); }; /** * @summary SetVariablesCall updates call channel variables in real-time. */ const setVariablesCall = ( id: string, engineCallServiceSetVariablesCallBody: EngineCallServiceSetVariablesCallBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.patch( `/calls/active/${id}/variables`, engineCallServiceSetVariablesCallBody, options, ); }; /** * @summary SearchHistoryCall retrieves a list of completed calls using filters (GET). Supports advanced filtering by participants, duration, causes, and custom variables. */ const searchHistoryCall = ( params?: SearchHistoryCallParams, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.get(`/calls/history`, { ...options, params: { ...params, ...options?.params, }, }); }; /** * @summary SearchHistoryCallPost retrieves a list of completed calls using a complex filter body (POST). Ideal for large filter sets that exceed URL length limits. */ const searchHistoryCallPost = ( engineSearchHistoryCallRequest: EngineSearchHistoryCallRequest, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.post( `/calls/history`, engineSearchHistoryCallRequest, options, ); }; /** * @summary AggregateHistoryCall performs statistical analysis on historical data. Group and aggregate metrics like average duration, call counts, or peak hours. */ const aggregateHistoryCall = ( engineAggregateHistoryCallRequest: EngineAggregateHistoryCallRequest, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.post( `/calls/history/aggregate`, engineAggregateHistoryCallRequest, options, ); }; /** * @summary CreateCallAnnotation adds a text note to a specific timeframe of a historical call. */ const createCallAnnotation = ( callId: string, engineCallServiceCreateCallAnnotationBody: EngineCallServiceCreateCallAnnotationBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.post( `/calls/history/${callId}/annotation`, engineCallServiceCreateCallAnnotationBody, options, ); }; /** * @summary DeleteCallAnnotation removes an annotation from a historical call. */ const deleteCallAnnotation = ( callId: string, id: string, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.delete( `/calls/history/${callId}/annotation/${id}`, options, ); }; /** * @summary UpdateCallAnnotation modifies an existing call note. */ const updateCallAnnotation = ( callId: string, id: string, engineCallServiceUpdateCallAnnotationBody: EngineCallServiceUpdateCallAnnotationBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.put( `/calls/history/${callId}/annotation/${id}`, engineCallServiceUpdateCallAnnotationBody, options, ); }; /** * @summary RedialCall quickly initiates a new call using data from a previous history record. */ const redialCall = ( callId: string, engineCallServiceRedialCallBody: EngineCallServiceRedialCallBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.post( `/calls/history/${callId}/redial`, engineCallServiceRedialCallBody, options, ); }; /** * @summary PatchHistoryCall updates metadata for a completed call (e.g., variables or visibility). */ const patchHistoryCall = ( id: string, engineCallServicePatchHistoryCallBody: EngineCallServicePatchHistoryCallBody, options?: AxiosRequestConfig, ): Promise> => { return axiosInstance.patch( `/calls/history/${id}`, engineCallServicePatchHistoryCallBody, options, ); }; // --- footer start return { createCall, searchActiveCall, hangupCall, readCall, confirmPush, dtmfCall, eavesdropCall, holdCall, blindTransferCall, unHoldCall, setVariablesCall, searchHistoryCall, searchHistoryCallPost, aggregateHistoryCall, createCallAnnotation, deleteCallAnnotation, updateCallAnnotation, redialCall, patchHistoryCall, }; }; export type CreateCallResult = AxiosResponse; export type SearchActiveCallResult = AxiosResponse; export type HangupCallResult = AxiosResponse; export type ReadCallResult = AxiosResponse; export type ConfirmPushResult = AxiosResponse; export type DtmfCallResult = AxiosResponse; export type EavesdropCallResult = AxiosResponse; export type HoldCallResult = AxiosResponse; export type BlindTransferCallResult = AxiosResponse; export type UnHoldCallResult = AxiosResponse; export type SetVariablesCallResult = AxiosResponse; export type SearchHistoryCallResult = AxiosResponse; export type SearchHistoryCallPostResult = AxiosResponse; export type AggregateHistoryCallResult = AxiosResponse; export type CreateCallAnnotationResult = AxiosResponse; export type DeleteCallAnnotationResult = AxiosResponse; export type UpdateCallAnnotationResult = AxiosResponse; export type RedialCallResult = AxiosResponse; export type PatchHistoryCallResult = AxiosResponse; // --- footer end