/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## * ## ## * ## AUTHOR: acacode ## * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## * --------------------------------------------------------------- */ export interface Login { user_sid: string; token?: string; change_password?: boolean; } /** * @example {"sid":"9d26a637-1679-471f-8da8-7150266e1254","token":"589cead6-de24-4689-8ac3-08ffaf102811"} */ export interface SuccessfulApiKeyAdd { sid: string; token: string; } /** * @example {"sid":"9d26a637-1679-471f-8da8-7150266e1254"} */ export interface SuccessfulAdd { sid: string; } /** * @example {"msg":"specific error detail will be provided here"} */ export interface GeneralError { msg: string; } export interface ServiceProvider { /** @format uuid */ service_provider_sid: string; name: string; description?: string; root_domain?: string; /** authentication webhook for registration */ registration_hook?: Webhook; ms_teams_fqdn?: string; } export interface VoipCarrier { /** @format uuid */ voip_carrier_sid: string; name: string; description?: string; e164_leading_plus?: boolean; requires_register?: boolean; register_username?: string; register_sip_realm?: string; register_password?: string; } export interface SipGateway { /** @format uuid */ sip_gateway_sid: string; ipv4: string; port: number; /** @format uuid */ voip_carrier_sid: string; is_active?: boolean; inbound?: boolean; outbound?: boolean; } export interface Account { /** @format uuid */ account_sid: string; name: string; sip_realm?: string; /** authentication webhook for registration */ registration_hook?: Webhook; /** @format uuid */ device_calling_application_sid?: string; /** @format uuid */ service_provider_sid: string; } export interface Application { /** @format uuid */ application_sid: string; name: string; /** @format uuid */ account_sid: string; /** application webhook for inbound voice calls */ call_hook?: Webhook; /** webhhok for reporting call status events */ call_status_hook?: Webhook; /** application webhook for inbound SMS/MMS */ messaging_hook?: Webhook; speech_synthesis_vendor?: string; speech_synthesis_voice?: string; speech_recognizer_vendor?: string; speech_recognizer_language?: string; } export interface ApiKey { /** @format uuid */ api_key_sid: string; /** @format uuid */ token: string; /** @format uuid */ account_sid?: string; /** @format uuid */ service_provider_sid?: string; expires_at?: string; created_at?: string; last_used?: string; } export interface PhoneNumber { /** @format uuid */ phone_number_sid: string; number: string; /** @format uuid */ voip_carrier_sid: string; /** @format uuid */ account_sid?: string; /** @format uuid */ application_sid?: string; } export interface Registration { /** @format uuid */ registration_sid: string; username: string; domain: string; sip_contact: string; sip_user_agent?: string; } /** * @example {"url":"https://acme.com","method":"POST"} */ export interface Webhook { /** @format url */ url: string; method?: "GET" | "POST" | string; username?: string; password?: string; } export interface MsTeamsTenant { /** @format uuid */ service_provider_sid: string; /** @format uuid */ account_sid?: string; /** @format uuid */ application_sid?: string; tenant_fqdn: string; } export interface Call { /** @format uuid */ account_sid: string; /** @format uuid */ application_sid?: string; call_id: string; /** @format uuid */ call_sid: string; call_status: | "trying" | "ringing" | "alerting" | "in-progress" | "completed" | "busy" | "no-answer" | "failed" | "queued"; caller_name?: string; direction: "inbound" | "outbound"; duration?: number; from: string; originating_sip_trunk_name?: string; /** @format uuid */ parent_call_sid?: string; service_url: string; sip_status: number; to: string; } /** * @example {"type":"phone","number":"+16172375080"} */ export interface Target { type: "phone" | "sip" | "user"; number?: string; sipUri?: string; name?: string; auth?: { username?: string; password?: string }; } /** * @example {"from":"13394445678","to":"16173333456","text":"please call when you can"} */ export interface Message { provider?: string; from: string; to: string; text?: string; media?: string; } import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from "axios"; export type QueryParamsType = Record; export interface FullRequestParams extends Omit { /** set parameter to `true` for call `securityWorker` for this request */ secure?: boolean; /** request path */ path: string; /** content type of request body */ type?: ContentType; /** query params */ query?: QueryParamsType; /** format of response (i.e. response.json() -> format: "json") */ format?: ResponseType; /** request body */ body?: any; } export type RequestParams = Omit; export interface ApiConfig extends Omit { securityWorker?: ( securityData: SecurityDataType | null, ) => Promise | AxiosRequestConfig | void; secure?: boolean; format?: ResponseType; } export enum ContentType { Json = "application/json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", } export class HttpClient { public instance: AxiosInstance; private securityData: SecurityDataType | null = null; private securityWorker?: ApiConfig["securityWorker"]; private secure?: boolean; private format?: ResponseType; constructor({ securityWorker, secure, format, ...axiosConfig }: ApiConfig = {}) { this.instance = axios.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || "/v1" }); this.secure = secure; this.format = format; this.securityWorker = securityWorker; } public setSecurityData = (data: SecurityDataType | null) => { this.securityData = data; }; private mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig { return { ...this.instance.defaults, ...params1, ...(params2 || {}), headers: { ...(this.instance.defaults.headers || {}), ...(params1.headers || {}), ...((params2 && params2.headers) || {}), }, }; } public request = async ({ secure, path, type, query, format, body, ...params }: FullRequestParams): Promise> => { const secureParams = ((typeof secure === "boolean" ? secure : this.secure) && this.securityWorker && (await this.securityWorker(this.securityData))) || {}; const requestParams = this.mergeRequestParams(params, secureParams); const responseFormat = (format && this.format) || void 0; if (type === ContentType.FormData && body && body !== null && typeof body === "object") { requestParams.headers.common = { Accept: "*/*" }; requestParams.headers.post = {}; requestParams.headers.put = {}; const formData = new FormData(); for (const key in body) { formData.append(key, body[key]); } body = formData; } return this.instance.request({ ...requestParams, headers: { ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), ...(requestParams.headers || {}), }, params: query, responseType: responseFormat, data: body, url: path, }); }; } /** * @title jambonz REST API * @version 1.0.0 * @license MIT (https://opensource.org/licenses/MIT) * @baseUrl /v1 * @contact * * jambonz REST API */ export class Api extends HttpClient { sbcs = { /** * No description * * @name CreateSbc * @summary add an SBC address * @request POST:/Sbcs * @secure * @response `201` `SuccessfulAdd` sbc address successfully created * @response `400` `GeneralError` bad request * @response `500` `GeneralError` bad request */ createSbc: (data: { ipv4: string; port?: number; service_provider_sid?: string }, params: RequestParams = {}) => this.request({ path: `/Sbcs`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @name ListSbcs * @summary retrieve public IP addresses of the jambonz Sbcs * @request GET:/Sbcs * @secure * @response `200` `({ "ipv4": string })[]` list of SBC addresses * @response `500` `GeneralError` system error */ listSbcs: (query?: { service_provider_sid?: string }, params: RequestParams = {}) => this.request<{ ipv4: string }[], GeneralError>({ path: `/Sbcs`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * No description * * @name DeleteSbcAddress * @summary delete sbc address * @request DELETE:/Sbcs/{SbcSid} * @secure * @response `200` `void` sbc address deleted * @response `404` `void` sbc address not found */ deleteSbcAddress: (sbcSid: string, params: RequestParams = {}) => this.request({ path: `/Sbcs/${sbcSid}`, method: "DELETE", secure: true, ...params, }), }; apiKeys = { /** * No description * * @name CreateApikey * @summary create an api key * @request POST:/ApiKeys * @secure * @response `201` `SuccessfulApiKeyAdd` api key successfully created * @response `400` `GeneralError` bad request * @response `500` `GeneralError` bad request */ createApikey: ( data: { service_provider_sid?: string; account_sid?: string; expiry_secs?: number }, params: RequestParams = {}, ) => this.request({ path: `/ApiKeys`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; apikeys = { /** * No description * * @name DeleteApiKey * @summary delete api key * @request DELETE:/Apikeys/{ApiKeySid} * @secure * @response `200` `void` api key deleted * @response `404` `void` api key or account not found */ deleteApiKey: (apiKeySid: string, params: RequestParams = {}) => this.request({ path: `/Apikeys/${apiKeySid}`, method: "DELETE", secure: true, ...params, }), }; auth = { /** * No description * * @name LoginUser * @summary login a user and receive an api token * @request POST:/login * @secure * @response `200` `Login` login succeeded * @response `403` `GeneralError` login failed * @response `500` `GeneralError` system error */ login: (data: { username: string; password: string }, params: RequestParams = {}) => this.request({ path: `/login`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; users = { /** * No description * * @name UpdateUser * @summary update a user password * @request PUT:/Users/{UserSid} * @secure * @response `200` `Login` password successfully changed * @response `403` `GeneralError` password change failed * @response `500` `GeneralError` system error */ updateUser: (userSid: string, data: { old_password: string; new_password: string }, params: RequestParams = {}) => this.request({ path: `/Users/${userSid}`, method: "PUT", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; voipCarriers = { /** * No description * * @name CreateVoipCarrier * @summary create voip carrier * @request POST:/VoipCarriers * @secure * @response `201` `SuccessfulAdd` voip carrier successfully created * @response `400` `GeneralError` bad request * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ createVoipCarrier: ( data: { name: string; description?: string; e164_leading_plus?: boolean; requires_register?: boolean; register_username?: string; register_sip_realm?: string; register_password?: string; }, params: RequestParams = {}, ) => this.request({ path: `/VoipCarriers`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @name ListVoipCarriers * @summary list voip carriers * @request GET:/VoipCarriers * @secure * @response `200` `(VoipCarrier)[]` list of voip carriers * @response `500` `GeneralError` system error */ listVoipCarriers: (params: RequestParams = {}) => this.request({ path: `/VoipCarriers`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name DeleteVoipCarrier * @summary delete a voip carrier * @request DELETE:/VoipCarriers/{VoipCarrierSid} * @secure * @response `204` `void` voip carrier successfully deleted * @response `404` `void` voip carrier not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ deleteVoipCarrier: (voipCarrierSid: string, params: RequestParams = {}) => this.request({ path: `/VoipCarriers/${voipCarrierSid}`, method: "DELETE", secure: true, ...params, }), /** * No description * * @name GetVoipCarrier * @summary retrieve voip carrier * @request GET:/VoipCarriers/{VoipCarrierSid} * @secure * @response `200` `VoipCarrier` voip carrier found * @response `404` `void` voip carrier not found * @response `500` `GeneralError` system error */ getVoipCarrier: (voipCarrierSid: string, params: RequestParams = {}) => this.request({ path: `/VoipCarriers/${voipCarrierSid}`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name UpdateVoipCarrier * @summary update voip carrier * @request PUT:/VoipCarriers/{VoipCarrierSid} * @secure * @response `204` `VoipCarrier` voip carrier updated * @response `400` `GeneralError` bad request * @response `404` `void` voip carrier not found * @response `500` `GeneralError` system error */ updateVoipCarrier: ( voipCarrierSid: string, data: VoipCarrier, params: RequestParams = {}, ) => this.request({ path: `/VoipCarriers/${voipCarrierSid}`, method: "PUT", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; sipGateways = { /** * No description * * @name CreateSipGateway * @summary create sip gateway * @request POST:/SipGateways * @secure * @response `201` `SuccessfulAdd` sip gateway successfully created * @response `400` `GeneralError` bad request * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ createSipGateway: ( data: { voip_carrier_sid: string; ipv4: string; port?: number; is_active?: boolean; inbound?: boolean; outbound?: boolean; }, params: RequestParams = {}, ) => this.request({ path: `/SipGateways`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @name ListSipGateways * @summary list sip gateways * @request GET:/SipGateways * @secure * @response `200` `(SipGateway)[]` list of sip gateways * @response `500` `GeneralError` system error */ listSipGateways: (params: RequestParams = {}) => this.request({ path: `/SipGateways`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name DeleteSipGateway * @summary delete a sip gateway * @request DELETE:/SipGateways/{SipGatewaySid} * @secure * @response `204` `void` sip gateway successfully deleted * @response `404` `void` sip gateway not found * @response `500` `GeneralError` system error */ deleteSipGateway: (sipGatewaySid: string, params: RequestParams = {}) => this.request({ path: `/SipGateways/${sipGatewaySid}`, method: "DELETE", secure: true, ...params, }), /** * No description * * @name GetSipGateway * @summary retrieve sip gateway * @request GET:/SipGateways/{SipGatewaySid} * @secure * @response `200` `VoipCarrier` sip gateway found * @response `404` `void` sip gateway not found * @response `500` `GeneralError` system error */ getSipGateway: (sipGatewaySid: string, params: RequestParams = {}) => this.request({ path: `/SipGateways/${sipGatewaySid}`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name UpdateSipGateway * @summary update sip gateway * @request PUT:/SipGateways/{SipGatewaySid} * @secure * @response `204` `void` sip gateway updated * @response `400` `GeneralError` bad request * @response `404` `void` sip gateway not found * @response `500` `GeneralError` system error */ updateSipGateway: (sipGatewaySid: string, data: SipGateway, params: RequestParams = {}) => this.request({ path: `/SipGateways/${sipGatewaySid}`, method: "PUT", body: data, secure: true, type: ContentType.Json, ...params, }), }; phoneNumbers = { /** * No description * * @name ProvisionPhoneNumber * @summary provision a phone number into inventory from a Voip Carrier * @request POST:/PhoneNumbers * @secure * @response `201` `SuccessfulAdd` phone number successfully provisioned * @response `400` `GeneralError` bad request * @response `404` `void` voip carrier not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ provisionPhoneNumber: (data: { number: string; voip_carrier_sid: string }, params: RequestParams = {}) => this.request({ path: `/PhoneNumbers`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @name ListProvisionedPhoneNumbers * @summary list phone numbers * @request GET:/PhoneNumbers * @secure * @response `200` `(PhoneNumber)[]` list of phone numbers * @response `500` `GeneralError` system error */ listProvisionedPhoneNumbers: (params: RequestParams = {}) => this.request({ path: `/PhoneNumbers`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name DeletePhoneNumber * @summary delete a phone number * @request DELETE:/PhoneNumbers/{PhoneNumberSid} * @secure * @response `204` `void` phone number successfully deleted * @response `404` `void` phone number not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ deletePhoneNumber: (phoneNumberSid: string, params: RequestParams = {}) => this.request({ path: `/PhoneNumbers/${phoneNumberSid}`, method: "DELETE", secure: true, ...params, }), /** * No description * * @name GetPhoneNumber * @summary retrieve phone number * @request GET:/PhoneNumbers/{PhoneNumberSid} * @secure * @response `200` `PhoneNumber` phone number found * @response `404` `void` phone number not found * @response `500` `GeneralError` system error */ getPhoneNumber: (phoneNumberSid: string, params: RequestParams = {}) => this.request({ path: `/PhoneNumbers/${phoneNumberSid}`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name UpdatePhoneNumber * @summary update phone number * @request PUT:/PhoneNumbers/{PhoneNumberSid} * @secure * @response `204` `VoipCarrier` phone number updated * @response `400` `GeneralError` bad request * @response `404` `void` phone number not found * @response `500` `GeneralError` system error */ updatePhoneNumber: (phoneNumberSid: string, data: PhoneNumber, params: RequestParams = {}) => this.request({ path: `/PhoneNumbers/${phoneNumberSid}`, method: "PUT", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; serviceProviders = { /** * No description * * @name CreateServiceProvider * @summary create service provider * @request POST:/ServiceProviders * @secure * @response `201` `SuccessfulAdd` service provider successfully created * @response `422` `GeneralError` unprocessable entity */ createServiceProvider: ( data: { name: string; description?: string; root_domain?: string; registration_hook?: Webhook; ms_teams_fqdn?: string; }, params: RequestParams = {}, ) => this.request({ path: `/ServiceProviders`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @name ListServiceProviders * @summary list service providers * @request GET:/ServiceProviders * @secure * @response `200` `(ServiceProvider)[]` list of service providers * @response `500` `GeneralError` system error */ listServiceProviders: (params: RequestParams = {}) => this.request({ path: `/ServiceProviders`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name DeleteServiceProvider * @summary delete a service provider * @request DELETE:/ServiceProviders/{ServiceProviderSid} * @secure * @response `204` `void` service provider successfully deleted * @response `404` `void` service provider not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ deleteServiceProvider: (serviceProviderSid: string, params: RequestParams = {}) => this.request({ path: `/ServiceProviders/${serviceProviderSid}`, method: "DELETE", secure: true, ...params, }), /** * No description * * @name GetServiceProvider * @summary retrieve service provider * @request GET:/ServiceProviders/{ServiceProviderSid} * @secure * @response `200` `ServiceProvider` service provider found * @response `404` `void` service provider not found * @response `500` `GeneralError` system error */ getServiceProvider: (serviceProviderSid: string, params: RequestParams = {}) => this.request({ path: `/ServiceProviders/${serviceProviderSid}`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name UpdateServiceProvider * @summary update service provider * @request PUT:/ServiceProviders/{ServiceProviderSid} * @secure * @response `204` `void` service provider updated * @response `404` `void` service provider not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ updateServiceProvider: (serviceProviderSid: string, data: ServiceProvider, params: RequestParams = {}) => this.request({ path: `/ServiceProviders/${serviceProviderSid}`, method: "PUT", body: data, secure: true, type: ContentType.Json, ...params, }), }; microsoftTeamsTenants = { /** * No description * * @name CreateMsTeamsTenant * @summary provision a customer tenant for MS Teams * @request POST:/MicrosoftTeamsTenants * @secure * @response `201` `SuccessfulAdd` tenant successfully created * @response `400` `GeneralError` bad request * @response `500` `GeneralError` system error */ createMsTeamsTenant: ( data: { service_provider_sid: string; account_sid?: string; application_sid?: string; tenant_fqdn: string }, params: RequestParams = {}, ) => this.request({ path: `/MicrosoftTeamsTenants`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @name ListMsTeamsTenants * @summary list MS Teams tenants * @request GET:/MicrosoftTeamsTenants * @secure * @response `200` `(MsTeamsTenant)[]` list of tenants * @response `500` `GeneralError` system error */ listMsTeamsTenants: (params: RequestParams = {}) => this.request({ path: `/MicrosoftTeamsTenants`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name DeleteTenant * @summary delete an MS Teams tenant * @request DELETE:/MicrosoftTeamsTenants/{TenantSid} * @secure * @response `204` `void` tenant successfully deleted * @response `404` `void` tenant not found * @response `500` `GeneralError` system error */ deleteTenant: (tenantSid: string, params: RequestParams = {}) => this.request({ path: `/MicrosoftTeamsTenants/${tenantSid}`, method: "DELETE", secure: true, ...params, }), /** * No description * * @name GetTenant * @summary retrieve an MS Teams tenant * @request GET:/MicrosoftTeamsTenants/{TenantSid} * @secure * @response `200` `MsTeamsTenant` tenant found * @response `404` `void` account not found * @response `500` `GeneralError` system error */ getTenant: (tenantSid: string, params: RequestParams = {}) => this.request({ path: `/MicrosoftTeamsTenants/${tenantSid}`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name UpdateAccount * @summary update tenant * @request PUT:/MicrosoftTeamsTenants/{TenantSid} * @secure * @response `204` `void` tenant updated * @response `404` `void` tenant not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ updateAccount: (tenantSid: string, data: any, params: RequestParams = {}) => this.request({ path: `/MicrosoftTeamsTenants/${tenantSid}`, method: "PUT", body: data, secure: true, type: ContentType.Json, ...params, }), }; accounts = { /** * No description * * @name CreateAccount * @summary create an account * @request POST:/Accounts * @secure * @response `201` `SuccessfulAdd` account successfully created * @response `400` `GeneralError` bad request * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ createAccount: ( data: { name: string; sip_realm?: string; registration_hook?: Webhook; service_provider_sid: string }, params: RequestParams = {}, ) => this.request({ path: `/Accounts`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @name ListAccounts * @summary list accounts * @request GET:/Accounts * @secure * @response `200` `(Account)[]` list of accounts * @response `500` `GeneralError` system error */ listAccounts: (params: RequestParams = {}) => this.request({ path: `/Accounts`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name DeleteAccount * @summary delete an account * @request DELETE:/Accounts/{AccountSid} * @secure * @response `204` `void` account successfully deleted * @response `404` `void` account not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ deleteAccount: (accountSid: string, params: RequestParams = {}) => this.request({ path: `/Accounts/${accountSid}`, method: "DELETE", secure: true, ...params, }), /** * No description * * @name GetAccount * @summary retrieve account * @request GET:/Accounts/{AccountSid} * @secure * @response `200` `Account` account found * @response `404` `void` account not found * @response `500` `GeneralError` system error */ getAccount: (accountSid: string, params: RequestParams = {}) => this.request({ path: `/Accounts/${accountSid}`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name UpdateAccount * @summary update account * @request PUT:/Accounts/{AccountSid} * @secure * @response `204` `void` account updated * @response `404` `void` account not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ updateAccount: (accountSid: string, data: Account, params: RequestParams = {}) => this.request({ path: `/Accounts/${accountSid}`, method: "PUT", body: data, secure: true, type: ContentType.Json, ...params, }), /** * No description * * @name GetAccountApiKeys * @summary get all api keys for an account * @request GET:/Accounts/{AccountSid}/ApiKeys * @secure * @response `200` `(ApiKey)[]` list of api keys * @response `404` `void` account not found * @response `500` `GeneralError` system error */ getAccountApiKeys: (accountSid: string, params: RequestParams = {}) => this.request({ path: `/Accounts/${accountSid}/ApiKeys`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name CreateCall * @summary create a call * @request POST:/Accounts/{AccountSid}/Calls * @secure * @response `201` `{ sid: string }` call successfully created * @response `400` `void` bad request */ createCall: ( accountSid: string, data: { application_sid?: string; call_hook?: Webhook; call_status_hook?: Webhook; from: string; timeout?: number; tag?: object; to: Target; }, params: RequestParams = {}, ) => this.request<{ sid: string }, void>({ path: `/Accounts/${accountSid}/Calls`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @name ListCalls * @summary list calls * @request GET:/Accounts/{AccountSid}/Calls * @secure * @response `200` `(Call)[]` list of calls for a specified account * @response `500` `GeneralError` system error */ listCalls: (accountSid: string, params: RequestParams = {}) => this.request({ path: `/Accounts/${accountSid}/Calls`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name DeleteCall * @summary delete a call * @request DELETE:/Accounts/{AccountSid}/Calls/{CallSid} * @secure * @response `204` `void` call successfully deleted * @response `404` `void` call not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ deleteCall: (accountSid: string, callSid: string, params: RequestParams = {}) => this.request({ path: `/Accounts/${accountSid}/Calls/${callSid}`, method: "DELETE", secure: true, ...params, }), /** * No description * * @name GetCall * @summary retrieve a call * @request GET:/Accounts/{AccountSid}/Calls/{CallSid} * @secure * @response `200` `Call` call found * @response `404` `void` call not found * @response `500` `GeneralError` system error */ getCall: (accountSid: string, callSid: string, params: RequestParams = {}) => this.request({ path: `/Accounts/${accountSid}/Calls/${callSid}`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name UpdateCall * @summary update a call * @request POST:/Accounts/{AccountSid}/Calls/{CallSid} * @secure * @response `202` `void` Accepted * @response `400` `void` bad request * @response `404` `void` call not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ updateCall: ( accountSid: string, callSid: string, data: { call_hook?: Webhook; call_status?: "completed" | "no-answer"; listen_status?: "pause" | "resume"; mute_status?: "mute" | "unmute"; whisper?: Webhook; }, params: RequestParams = {}, ) => this.request({ path: `/Accounts/${accountSid}/Calls/${callSid}`, method: "POST", body: data, secure: true, type: ContentType.Json, ...params, }), /** * No description * * @name CreateMessage * @summary create an outgoing SMS message * @request POST:/Accounts/{AccountSid}/Messages * @secure * @response `201` `{ sid: string, providerResponse?: string }` call successfully created * @response `400` `void` bad request */ createMessage: (accountSid: string, data: Message, params: RequestParams = {}) => this.request<{ sid: string; providerResponse?: string }, void>({ path: `/Accounts/${accountSid}/Messages`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; applications = { /** * No description * * @name CreateApplication * @summary create application * @request POST:/Applications * @secure * @response `201` `SuccessfulAdd` application successfully created * @response `400` `GeneralError` bad request * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ createApplication: ( data: { name: string; account_sid: string; call_hook: Webhook; call_status_hook: Webhook; messaging_hook?: Webhook; speech_synthesis_vendor?: string; speech_synthesis_voice?: string; speech_recognizer_vendor?: string; speech_recognizer_language?: string; }, params: RequestParams = {}, ) => this.request({ path: `/Applications`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @name ListApplications * @summary list applications * @request GET:/Applications * @secure * @response `200` `(Application)[]` list of applications * @response `500` `GeneralError` system error */ listApplications: (params: RequestParams = {}) => this.request({ path: `/Applications`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name DeleteApplication * @summary delete an application * @request DELETE:/Applications/{ApplicationSid} * @secure * @response `204` `void` application successfully deleted * @response `404` `void` application not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ deleteApplication: (applicationSid: string, params: RequestParams = {}) => this.request({ path: `/Applications/${applicationSid}`, method: "DELETE", secure: true, ...params, }), /** * No description * * @name ApplicationsDetail * @summary retrieve an application * @request GET:/Applications/{ApplicationSid} * @secure * @response `200` `Application` application found * @response `404` `void` application not found * @response `500` `GeneralError` system error */ applicationsDetail: (applicationSid: string, params: RequestParams = {}) => this.request({ path: `/Applications/${applicationSid}`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @name UpdateApplication * @summary update application * @request PUT:/Applications/{ApplicationSid} * @secure * @response `204` `void` application updated * @response `404` `void` application not found * @response `422` `GeneralError` unprocessable entity * @response `500` `GeneralError` system error */ updateApplication: (applicationSid: string, data: Application, params: RequestParams = {}) => this.request({ path: `/Applications/${applicationSid}`, method: "PUT", body: data, secure: true, type: ContentType.Json, ...params, }), }; }