/* tslint:disable */ /* eslint-disable */ /** * Bandwidth * Bandwidth\'s Communication APIs * * The version of the OpenAPI document: 1.0.0 * Contact: letstalk@bandwidth.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 type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; // @ts-ignore import type { BrtcErrorResponse } from '../models'; // @ts-ignore import type { CreateEndpointResponse } from '../models'; // @ts-ignore import type { CreateWebRtcConnectionRequest } from '../models'; // @ts-ignore import type { EndpointResponse } from '../models'; // @ts-ignore import type { EndpointStatusEnum } from '../models'; // @ts-ignore import type { EndpointTypeEnum } from '../models'; // @ts-ignore import type { ListEndpointsResponse } from '../models'; /** * EndpointsApi - axios parameter creator */ export const EndpointsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Creates a new Endpoint for the specified account. * @summary Create Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {CreateWebRtcConnectionRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ createEndpoint: async (accountId: string, body: CreateWebRtcConnectionRequest, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'accountId' is not null or undefined assertParamExists('createEndpoint', 'accountId', accountId) // verify required parameter 'body' is not null or undefined assertParamExists('createEndpoint', 'body', body) const localVarPath = `/accounts/{accountId}/endpoints` .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication Basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration) // authentication OAuth2 required // oauth required await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. * @summary Delete Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteEndpoint: async (accountId: string, endpointId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'accountId' is not null or undefined assertParamExists('deleteEndpoint', 'accountId', accountId) // verify required parameter 'endpointId' is not null or undefined assertParamExists('deleteEndpoint', 'endpointId', endpointId) const localVarPath = `/accounts/{accountId}/endpoints/{endpointId}` .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) .replace(`{${"endpointId"}}`, encodeURIComponent(String(endpointId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication Basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration) // authentication OAuth2 required // oauth required await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Returns information about the specified endpoint. * @summary Get Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEndpoint: async (accountId: string, endpointId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'accountId' is not null or undefined assertParamExists('getEndpoint', 'accountId', accountId) // verify required parameter 'endpointId' is not null or undefined assertParamExists('getEndpoint', 'endpointId', endpointId) const localVarPath = `/accounts/{accountId}/endpoints/{endpointId}` .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) .replace(`{${"endpointId"}}`, encodeURIComponent(String(endpointId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication Basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration) // authentication OAuth2 required // oauth required await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Returns a list of endpoints associated with the specified account. * @summary List Endpoints * @param {string} accountId Your Bandwidth Account ID. * @param {EndpointTypeEnum} [type] The type of endpoint. * @param {EndpointStatusEnum} [status] The status of the endpoint. * @param {string} [afterCursor] The cursor to use for pagination. This is the value of the `next` link in the previous response. * @param {number} [limit] The maximum number of endpoints to return in the response. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listEndpoints: async (accountId: string, type?: EndpointTypeEnum, status?: EndpointStatusEnum, afterCursor?: string, limit?: number, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'accountId' is not null or undefined assertParamExists('listEndpoints', 'accountId', accountId) const localVarPath = `/accounts/{accountId}/endpoints` .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication Basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration) // authentication OAuth2 required // oauth required await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration) if (type !== undefined) { localVarQueryParameter['type'] = type; } if (status !== undefined) { localVarQueryParameter['status'] = status; } if (afterCursor !== undefined) { localVarQueryParameter['afterCursor'] = afterCursor; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Updates the BXML for the specified endpoint. * @summary Update Endpoint BXML * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {string} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateEndpointBxml: async (accountId: string, endpointId: string, body: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'accountId' is not null or undefined assertParamExists('updateEndpointBxml', 'accountId', accountId) // verify required parameter 'endpointId' is not null or undefined assertParamExists('updateEndpointBxml', 'endpointId', endpointId) // verify required parameter 'body' is not null or undefined assertParamExists('updateEndpointBxml', 'body', body) const localVarPath = `/accounts/{accountId}/endpoints/{endpointId}/bxml` .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) .replace(`{${"endpointId"}}`, encodeURIComponent(String(endpointId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication Basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration) // authentication OAuth2 required // oauth required await setOAuthToObject(localVarHeaderParameter, "OAuth2", [], configuration) localVarHeaderParameter['Content-Type'] = 'application/xml'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * EndpointsApi - functional programming interface */ export const EndpointsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = EndpointsApiAxiosParamCreator(configuration) return { /** * Creates a new Endpoint for the specified account. * @summary Create Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {CreateWebRtcConnectionRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createEndpoint(accountId: string, body: CreateWebRtcConnectionRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.createEndpoint(accountId, body, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['EndpointsApi.createEndpoint']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. * @summary Delete Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async deleteEndpoint(accountId: string, endpointId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteEndpoint(accountId, endpointId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['EndpointsApi.deleteEndpoint']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Returns information about the specified endpoint. * @summary Get Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getEndpoint(accountId: string, endpointId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getEndpoint(accountId, endpointId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['EndpointsApi.getEndpoint']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Returns a list of endpoints associated with the specified account. * @summary List Endpoints * @param {string} accountId Your Bandwidth Account ID. * @param {EndpointTypeEnum} [type] The type of endpoint. * @param {EndpointStatusEnum} [status] The status of the endpoint. * @param {string} [afterCursor] The cursor to use for pagination. This is the value of the `next` link in the previous response. * @param {number} [limit] The maximum number of endpoints to return in the response. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listEndpoints(accountId: string, type?: EndpointTypeEnum, status?: EndpointStatusEnum, afterCursor?: string, limit?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listEndpoints(accountId, type, status, afterCursor, limit, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['EndpointsApi.listEndpoints']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Updates the BXML for the specified endpoint. * @summary Update Endpoint BXML * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {string} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateEndpointBxml(accountId: string, endpointId: string, body: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.updateEndpointBxml(accountId, endpointId, body, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['EndpointsApi.updateEndpointBxml']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * EndpointsApi - factory interface */ export const EndpointsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = EndpointsApiFp(configuration) return { /** * Creates a new Endpoint for the specified account. * @summary Create Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {CreateWebRtcConnectionRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ createEndpoint(accountId: string, body: CreateWebRtcConnectionRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.createEndpoint(accountId, body, options).then((request) => request(axios, basePath)); }, /** * Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. * @summary Delete Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteEndpoint(accountId: string, endpointId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.deleteEndpoint(accountId, endpointId, options).then((request) => request(axios, basePath)); }, /** * Returns information about the specified endpoint. * @summary Get Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getEndpoint(accountId: string, endpointId: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getEndpoint(accountId, endpointId, options).then((request) => request(axios, basePath)); }, /** * Returns a list of endpoints associated with the specified account. * @summary List Endpoints * @param {string} accountId Your Bandwidth Account ID. * @param {EndpointTypeEnum} [type] The type of endpoint. * @param {EndpointStatusEnum} [status] The status of the endpoint. * @param {string} [afterCursor] The cursor to use for pagination. This is the value of the `next` link in the previous response. * @param {number} [limit] The maximum number of endpoints to return in the response. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listEndpoints(accountId: string, type?: EndpointTypeEnum, status?: EndpointStatusEnum, afterCursor?: string, limit?: number, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.listEndpoints(accountId, type, status, afterCursor, limit, options).then((request) => request(axios, basePath)); }, /** * Updates the BXML for the specified endpoint. * @summary Update Endpoint BXML * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {string} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateEndpointBxml(accountId: string, endpointId: string, body: string, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.updateEndpointBxml(accountId, endpointId, body, options).then((request) => request(axios, basePath)); }, }; }; /** * EndpointsApi - object-oriented interface */ export class EndpointsApi extends BaseAPI { /** * Creates a new Endpoint for the specified account. * @summary Create Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {CreateWebRtcConnectionRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ public createEndpoint(accountId: string, body: CreateWebRtcConnectionRequest, options?: RawAxiosRequestConfig) { return EndpointsApiFp(this.configuration).createEndpoint(accountId, body, options).then((request) => request(this.axios, this.basePath)); } /** * Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. * @summary Delete Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public deleteEndpoint(accountId: string, endpointId: string, options?: RawAxiosRequestConfig) { return EndpointsApiFp(this.configuration).deleteEndpoint(accountId, endpointId, options).then((request) => request(this.axios, this.basePath)); } /** * Returns information about the specified endpoint. * @summary Get Endpoint * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getEndpoint(accountId: string, endpointId: string, options?: RawAxiosRequestConfig) { return EndpointsApiFp(this.configuration).getEndpoint(accountId, endpointId, options).then((request) => request(this.axios, this.basePath)); } /** * Returns a list of endpoints associated with the specified account. * @summary List Endpoints * @param {string} accountId Your Bandwidth Account ID. * @param {EndpointTypeEnum} [type] The type of endpoint. * @param {EndpointStatusEnum} [status] The status of the endpoint. * @param {string} [afterCursor] The cursor to use for pagination. This is the value of the `next` link in the previous response. * @param {number} [limit] The maximum number of endpoints to return in the response. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public listEndpoints(accountId: string, type?: EndpointTypeEnum, status?: EndpointStatusEnum, afterCursor?: string, limit?: number, options?: RawAxiosRequestConfig) { return EndpointsApiFp(this.configuration).listEndpoints(accountId, type, status, afterCursor, limit, options).then((request) => request(this.axios, this.basePath)); } /** * Updates the BXML for the specified endpoint. * @summary Update Endpoint BXML * @param {string} accountId Your Bandwidth Account ID. * @param {string} endpointId BRTC Endpoint ID. * @param {string} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ public updateEndpointBxml(accountId: string, endpointId: string, body: string, options?: RawAxiosRequestConfig) { return EndpointsApiFp(this.configuration).updateEndpointBxml(accountId, endpointId, body, options).then((request) => request(this.axios, this.basePath)); } }