/* tslint:disable */ /* eslint-disable */ /** * ForestVPN Cloud API * ForestVPN Cloud - it's a Google Cloud but for VPN apps. Ready to use VPN Cloud Platform minimizes efforts to build fast, secure, and modern VPN apps. * * OpenAPI spec version: 2.0 * Contact: support@forestvpn.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; import { Configuration } from '../configuration'; // Some imports not used depending on template conditions // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { CreateOrUpdateWebhookEndpointRequest } from '../models'; import { WebhookEndpoint } from '../models'; /** * WebhooksApi - axios parameter creator * @export */ export const WebhooksApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Create a new webhook endpoint * @param {CreateOrUpdateWebhookEndpointRequest} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ createWebhookEndpoint: async (body?: CreateOrUpdateWebhookEndpointRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/webhooks/endpoints/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiTokenAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-TOKEN") : await configuration.apiKey; localVarHeaderParameter["X-API-TOKEN"] = localVarApiKeyValue; } // authentication BearerTokenAuth required localVarHeaderParameter['Content-Type'] = 'application/json'; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get webhook endpoint by ID * @param {string} endpointId Webhook endpoint id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getWebhookEndpoint: async (endpointId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'endpointId' is not null or undefined if (endpointId === null || endpointId === undefined) { throw new RequiredError('endpointId','Required parameter endpointId was null or undefined when calling getWebhookEndpoint.'); } const localVarPath = `/webhooks/endpoints/{endpointId}/` .replace(`{${"endpointId"}}`, encodeURIComponent(String(endpointId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiTokenAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-TOKEN") : await configuration.apiKey; localVarHeaderParameter["X-API-TOKEN"] = localVarApiKeyValue; } // authentication BearerTokenAuth required const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary List webhook endpoint * @param {number} [per_page] * @param {number} [page] * @param {*} [options] Override http request option. * @throws {RequiredError} */ listWebhookEndpoint: async (per_page?: number, page?: number, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/webhooks/endpoints/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiTokenAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-TOKEN") : await configuration.apiKey; localVarHeaderParameter["X-API-TOKEN"] = localVarApiKeyValue; } // authentication BearerTokenAuth required if (per_page !== undefined) { localVarQueryParameter['per_page'] = per_page; } if (page !== undefined) { localVarQueryParameter['page'] = page; } const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Update webhook endpoint * @param {string} endpointId Webhook endpoint id * @param {CreateOrUpdateWebhookEndpointRequest} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateWebhookEndpoint: async (endpointId: string, body?: CreateOrUpdateWebhookEndpointRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'endpointId' is not null or undefined if (endpointId === null || endpointId === undefined) { throw new RequiredError('endpointId','Required parameter endpointId was null or undefined when calling updateWebhookEndpoint.'); } const localVarPath = `/webhooks/endpoints/{endpointId}/` .replace(`{${"endpointId"}}`, encodeURIComponent(String(endpointId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'PATCH', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiTokenAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-TOKEN") : await configuration.apiKey; localVarHeaderParameter["X-API-TOKEN"] = localVarApiKeyValue; } // authentication BearerTokenAuth required localVarHeaderParameter['Content-Type'] = 'application/json'; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * WebhooksApi - functional programming interface * @export */ export const WebhooksApiFp = function(configuration?: Configuration) { return { /** * * @summary Create a new webhook endpoint * @param {CreateOrUpdateWebhookEndpointRequest} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createWebhookEndpoint(body?: CreateOrUpdateWebhookEndpointRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await WebhooksApiAxiosParamCreator(configuration).createWebhookEndpoint(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get webhook endpoint by ID * @param {string} endpointId Webhook endpoint id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getWebhookEndpoint(endpointId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await WebhooksApiAxiosParamCreator(configuration).getWebhookEndpoint(endpointId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary List webhook endpoint * @param {number} [per_page] * @param {number} [page] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listWebhookEndpoint(per_page?: number, page?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>>> { const localVarAxiosArgs = await WebhooksApiAxiosParamCreator(configuration).listWebhookEndpoint(per_page, page, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Update webhook endpoint * @param {string} endpointId Webhook endpoint id * @param {CreateOrUpdateWebhookEndpointRequest} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateWebhookEndpoint(endpointId: string, body?: CreateOrUpdateWebhookEndpointRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await WebhooksApiAxiosParamCreator(configuration).updateWebhookEndpoint(endpointId, body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * WebhooksApi - factory interface * @export */ export const WebhooksApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Create a new webhook endpoint * @param {CreateOrUpdateWebhookEndpointRequest} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createWebhookEndpoint(body?: CreateOrUpdateWebhookEndpointRequest, options?: AxiosRequestConfig): Promise> { return WebhooksApiFp(configuration).createWebhookEndpoint(body, options).then((request) => request(axios, basePath)); }, /** * * @summary Get webhook endpoint by ID * @param {string} endpointId Webhook endpoint id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getWebhookEndpoint(endpointId: string, options?: AxiosRequestConfig): Promise> { return WebhooksApiFp(configuration).getWebhookEndpoint(endpointId, options).then((request) => request(axios, basePath)); }, /** * * @summary List webhook endpoint * @param {number} [per_page] * @param {number} [page] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listWebhookEndpoint(per_page?: number, page?: number, options?: AxiosRequestConfig): Promise>> { return WebhooksApiFp(configuration).listWebhookEndpoint(per_page, page, options).then((request) => request(axios, basePath)); }, /** * * @summary Update webhook endpoint * @param {string} endpointId Webhook endpoint id * @param {CreateOrUpdateWebhookEndpointRequest} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateWebhookEndpoint(endpointId: string, body?: CreateOrUpdateWebhookEndpointRequest, options?: AxiosRequestConfig): Promise> { return WebhooksApiFp(configuration).updateWebhookEndpoint(endpointId, body, options).then((request) => request(axios, basePath)); }, }; }; /** * WebhooksApi - object-oriented interface * @export * @class WebhooksApi * @extends {BaseAPI} */ export class WebhooksApi extends BaseAPI { /** * * @summary Create a new webhook endpoint * @param {CreateOrUpdateWebhookEndpointRequest} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApi */ public async createWebhookEndpoint(body?: CreateOrUpdateWebhookEndpointRequest, options?: AxiosRequestConfig) : Promise> { return WebhooksApiFp(this.configuration).createWebhookEndpoint(body, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get webhook endpoint by ID * @param {string} endpointId Webhook endpoint id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApi */ public async getWebhookEndpoint(endpointId: string, options?: AxiosRequestConfig) : Promise> { return WebhooksApiFp(this.configuration).getWebhookEndpoint(endpointId, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary List webhook endpoint * @param {number} [per_page] * @param {number} [page] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApi */ public async listWebhookEndpoint(per_page?: number, page?: number, options?: AxiosRequestConfig) : Promise>> { return WebhooksApiFp(this.configuration).listWebhookEndpoint(per_page, page, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Update webhook endpoint * @param {string} endpointId Webhook endpoint id * @param {CreateOrUpdateWebhookEndpointRequest} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof WebhooksApi */ public async updateWebhookEndpoint(endpointId: string, body?: CreateOrUpdateWebhookEndpointRequest, options?: AxiosRequestConfig) : Promise> { return WebhooksApiFp(this.configuration).updateWebhookEndpoint(endpointId, body, options).then((request) => request(this.axios, this.basePath)); } }