/* 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 { AggregatedDataUsageStats } from '../models'; /** * AnalyticsApi - axios parameter creator * @export */ export const AnalyticsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Users data usage dtatistics for each device * @summary Data Usage Stats * @param {string} aggr_interval No more than 3 days for hour aggregation type * @param {string} [profile] Profile ID * @param {string} [date_after] No more than 3 months between date_after and date_before * @param {string} [date_before] No more than 3 months between date_after and date_before * @param {Array} [profile__in] Filter by profile * @param {string} [ordering] Sort output by (use \"-\" for desc ordering (i.g \"-usage_time\")) * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDataUsageStats: async (aggr_interval: string, profile?: string, date_after?: string, date_before?: string, profile__in?: Array, ordering?: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'aggr_interval' is not null or undefined if (aggr_interval === null || aggr_interval === undefined) { throw new RequiredError('aggr_interval','Required parameter aggr_interval was null or undefined when calling getDataUsageStats.'); } const localVarPath = `/analytics/data-usage/`; // 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 (profile !== undefined) { localVarQueryParameter['profile'] = profile; } if (aggr_interval !== undefined) { localVarQueryParameter['aggr_interval'] = aggr_interval; } if (date_after !== undefined) { localVarQueryParameter['date_after'] = (date_after as any instanceof Date) ? (date_after as any).toISOString().substr(0,10) : date_after; } if (date_before !== undefined) { localVarQueryParameter['date_before'] = (date_before as any instanceof Date) ? (date_before as any).toISOString().substr(0,10) : date_before; } if (profile__in) { localVarQueryParameter['profile__in'] = profile__in; } if (ordering !== undefined) { localVarQueryParameter['ordering'] = ordering; } 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, }; }, } }; /** * AnalyticsApi - functional programming interface * @export */ export const AnalyticsApiFp = function(configuration?: Configuration) { return { /** * Users data usage dtatistics for each device * @summary Data Usage Stats * @param {string} aggr_interval No more than 3 days for hour aggregation type * @param {string} [profile] Profile ID * @param {string} [date_after] No more than 3 months between date_after and date_before * @param {string} [date_before] No more than 3 months between date_after and date_before * @param {Array} [profile__in] Filter by profile * @param {string} [ordering] Sort output by (use \"-\" for desc ordering (i.g \"-usage_time\")) * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDataUsageStats(aggr_interval: string, profile?: string, date_after?: string, date_before?: string, profile__in?: Array, ordering?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>>> { const localVarAxiosArgs = await AnalyticsApiAxiosParamCreator(configuration).getDataUsageStats(aggr_interval, profile, date_after, date_before, profile__in, ordering, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * AnalyticsApi - factory interface * @export */ export const AnalyticsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Users data usage dtatistics for each device * @summary Data Usage Stats * @param {string} aggr_interval No more than 3 days for hour aggregation type * @param {string} [profile] Profile ID * @param {string} [date_after] No more than 3 months between date_after and date_before * @param {string} [date_before] No more than 3 months between date_after and date_before * @param {Array} [profile__in] Filter by profile * @param {string} [ordering] Sort output by (use \"-\" for desc ordering (i.g \"-usage_time\")) * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDataUsageStats(aggr_interval: string, profile?: string, date_after?: string, date_before?: string, profile__in?: Array, ordering?: string, options?: AxiosRequestConfig): Promise>> { return AnalyticsApiFp(configuration).getDataUsageStats(aggr_interval, profile, date_after, date_before, profile__in, ordering, options).then((request) => request(axios, basePath)); }, }; }; /** * AnalyticsApi - object-oriented interface * @export * @class AnalyticsApi * @extends {BaseAPI} */ export class AnalyticsApi extends BaseAPI { /** * Users data usage dtatistics for each device * @summary Data Usage Stats * @param {string} aggr_interval No more than 3 days for hour aggregation type * @param {string} [profile] Profile ID * @param {string} [date_after] No more than 3 months between date_after and date_before * @param {string} [date_before] No more than 3 months between date_after and date_before * @param {Array} [profile__in] Filter by profile * @param {string} [ordering] Sort output by (use \"-\" for desc ordering (i.g \"-usage_time\")) * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AnalyticsApi */ public async getDataUsageStats(aggr_interval: string, profile?: string, date_after?: string, date_before?: string, profile__in?: Array, ordering?: string, options?: AxiosRequestConfig) : Promise>> { return AnalyticsApiFp(this.configuration).getDataUsageStats(aggr_interval, profile, date_after, date_before, profile__in, ordering, options).then((request) => request(this.axios, this.basePath)); } }