UNPKG

@forestvpn/forestvpn_api

Version:

A package to interact api.forestvpn.com (manage vpn profiles, check usage statistics, manage locations, ...)

425 lines (403 loc) 20.4 kB
/* 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 { AppStoreOfferSignature } from '../models'; import { Offer } from '../models'; import { PlayStoreOffer } from '../models'; /** * OfferApi - axios parameter creator * @export */ export const OfferApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Get App Store offer signature * @param {string} product * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAppStoreOfferSignatureForm: async (product: string, offerID: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'product' is not null or undefined if (product === null || product === undefined) { throw new RequiredError('product','Required parameter product was null or undefined when calling getAppStoreOfferSignatureForm.'); } // verify required parameter 'offerID' is not null or undefined if (offerID === null || offerID === undefined) { throw new RequiredError('offerID','Required parameter offerID was null or undefined when calling getAppStoreOfferSignatureForm.'); } const localVarPath = `/offer/offers/{offerID}/appstore/sign/` .replace(`{${"offerID"}}`, encodeURIComponent(String(offerID))); // 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; const localVarFormParams = new FormData(); // 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; } if (product !== undefined) { localVarFormParams.append('product', product as any); } localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; 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}; localVarRequestOptions.data = localVarFormParams; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get offer detail * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOffer: async (offerID: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'offerID' is not null or undefined if (offerID === null || offerID === undefined) { throw new RequiredError('offerID','Required parameter offerID was null or undefined when calling getOffer.'); } const localVarPath = `/offer/offers/{offerID}/` .replace(`{${"offerID"}}`, encodeURIComponent(String(offerID))); // 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 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; } 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 Get Play Store offer * @param {string} product * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlayStoreOfferForm: async (product: string, offerID: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'product' is not null or undefined if (product === null || product === undefined) { throw new RequiredError('product','Required parameter product was null or undefined when calling getPlayStoreOfferForm.'); } // verify required parameter 'offerID' is not null or undefined if (offerID === null || offerID === undefined) { throw new RequiredError('offerID','Required parameter offerID was null or undefined when calling getPlayStoreOfferForm.'); } const localVarPath = `/offer/offers/{offerID}/playstore/offer/` .replace(`{${"offerID"}}`, encodeURIComponent(String(offerID))); // 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; const localVarFormParams = new FormData(); // 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; } if (product !== undefined) { localVarFormParams.append('product', product as any); } localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; 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}; localVarRequestOptions.data = localVarFormParams; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get offers * @param {Array<string>} [product] Filter by product * @param {*} [options] Override http request option. * @throws {RequiredError} */ listOffers: async (product?: Array<string>, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { const localVarPath = `/offer/offers/`; // 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 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; } if (product) { localVarQueryParameter['product'] = product; } 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, }; }, } }; /** * OfferApi - functional programming interface * @export */ export const OfferApiFp = function(configuration?: Configuration) { return { /** * * @summary Get App Store offer signature * @param {string} product * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAppStoreOfferSignatureForm(product: string, offerID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AppStoreOfferSignature>>> { const localVarAxiosArgs = await OfferApiAxiosParamCreator(configuration).getAppStoreOfferSignatureForm(product, offerID, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get offer detail * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getOffer(offerID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<Offer>>> { const localVarAxiosArgs = await OfferApiAxiosParamCreator(configuration).getOffer(offerID, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get Play Store offer * @param {string} product * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getPlayStoreOfferForm(product: string, offerID: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<PlayStoreOffer>>> { const localVarAxiosArgs = await OfferApiAxiosParamCreator(configuration).getPlayStoreOfferForm(product, offerID, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get offers * @param {Array<string>} [product] Filter by product * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listOffers(product?: Array<string>, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<Array<Offer>>>> { const localVarAxiosArgs = await OfferApiAxiosParamCreator(configuration).listOffers(product, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * OfferApi - factory interface * @export */ export const OfferApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Get App Store offer signature * @param {string} product * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAppStoreOfferSignatureForm(product: string, offerID: string, options?: AxiosRequestConfig): Promise<AxiosResponse<AppStoreOfferSignature>> { return OfferApiFp(configuration).getAppStoreOfferSignatureForm(product, offerID, options).then((request) => request(axios, basePath)); }, /** * * @summary Get offer detail * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getOffer(offerID: string, options?: AxiosRequestConfig): Promise<AxiosResponse<Offer>> { return OfferApiFp(configuration).getOffer(offerID, options).then((request) => request(axios, basePath)); }, /** * * @summary Get Play Store offer * @param {string} product * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getPlayStoreOfferForm(product: string, offerID: string, options?: AxiosRequestConfig): Promise<AxiosResponse<PlayStoreOffer>> { return OfferApiFp(configuration).getPlayStoreOfferForm(product, offerID, options).then((request) => request(axios, basePath)); }, /** * * @summary Get offers * @param {Array<string>} [product] Filter by product * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listOffers(product?: Array<string>, options?: AxiosRequestConfig): Promise<AxiosResponse<Array<Offer>>> { return OfferApiFp(configuration).listOffers(product, options).then((request) => request(axios, basePath)); }, }; }; /** * OfferApi - object-oriented interface * @export * @class OfferApi * @extends {BaseAPI} */ export class OfferApi extends BaseAPI { /** * * @summary Get App Store offer signature * @param {string} product * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OfferApi */ public async getAppStoreOfferSignatureForm(product: string, offerID: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<AppStoreOfferSignature>> { return OfferApiFp(this.configuration).getAppStoreOfferSignatureForm(product, offerID, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get offer detail * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OfferApi */ public async getOffer(offerID: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<Offer>> { return OfferApiFp(this.configuration).getOffer(offerID, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get Play Store offer * @param {string} product * @param {string} offerID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OfferApi */ public async getPlayStoreOfferForm(product: string, offerID: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<PlayStoreOffer>> { return OfferApiFp(this.configuration).getPlayStoreOfferForm(product, offerID, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get offers * @param {Array<string>} [product] Filter by product * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OfferApi */ public async listOffers(product?: Array<string>, options?: AxiosRequestConfig) : Promise<AxiosResponse<Array<Offer>>> { return OfferApiFp(this.configuration).listOffers(product, options).then((request) => request(this.axios, this.basePath)); } }