@forestvpn/forestvpn_api
Version:
A package to interact api.forestvpn.com (manage vpn profiles, check usage statistics, manage locations, ...)
140 lines (131 loc) • 6.4 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* ForestVPN API
* ForestVPN - Fast, secure, and modern VPN. It offers Distributed Computing, Crypto Mining, P2P, Ad Blocking, TOR over VPN, 30+ locations, and a free version with unlimited data.
*
* 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 { CloudPaymentsPaymentMethod } from '../models';
import { CloudPaymentsPaymentMethodCreateRequest } from '../models';
/**
* CloudPaymentsApi - axios parameter creator
* @export
*/
export const CloudPaymentsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Create Cloud Payments Payment Method
* @param {CloudPaymentsPaymentMethodCreateRequest} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createCloudPaymentsPaymentMethod: async (body?: CloudPaymentsPaymentMethodCreateRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/cloud-payments/payment-methods/`;
// 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 bearerAuth required
// http bearer authentication required
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
}
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,
};
},
}
};
/**
* CloudPaymentsApi - functional programming interface
* @export
*/
export const CloudPaymentsApiFp = function(configuration?: Configuration) {
return {
/**
*
* @summary Create Cloud Payments Payment Method
* @param {CloudPaymentsPaymentMethodCreateRequest} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createCloudPaymentsPaymentMethod(body?: CloudPaymentsPaymentMethodCreateRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<CloudPaymentsPaymentMethod>>> {
const localVarAxiosArgs = await CloudPaymentsApiAxiosParamCreator(configuration).createCloudPaymentsPaymentMethod(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* CloudPaymentsApi - factory interface
* @export
*/
export const CloudPaymentsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
*
* @summary Create Cloud Payments Payment Method
* @param {CloudPaymentsPaymentMethodCreateRequest} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createCloudPaymentsPaymentMethod(body?: CloudPaymentsPaymentMethodCreateRequest, options?: AxiosRequestConfig): Promise<AxiosResponse<CloudPaymentsPaymentMethod>> {
return CloudPaymentsApiFp(configuration).createCloudPaymentsPaymentMethod(body, options).then((request) => request(axios, basePath));
},
};
};
/**
* CloudPaymentsApi - object-oriented interface
* @export
* @class CloudPaymentsApi
* @extends {BaseAPI}
*/
export class CloudPaymentsApi extends BaseAPI {
/**
*
* @summary Create Cloud Payments Payment Method
* @param {CloudPaymentsPaymentMethodCreateRequest} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CloudPaymentsApi
*/
public async createCloudPaymentsPaymentMethod(body?: CloudPaymentsPaymentMethodCreateRequest, options?: AxiosRequestConfig) : Promise<AxiosResponse<CloudPaymentsPaymentMethod>> {
return CloudPaymentsApiFp(this.configuration).createCloudPaymentsPaymentMethod(body, options).then((request) => request(this.axios, this.basePath));
}
}