/* tslint:disable */ /* eslint-disable */ /** * Fasterbase * Fasterbase API description * * OpenAPI spec version: 1.0 * * * 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 { AcceptDto } from '../models'; import { DeviceDto } from '../models'; import { DeviceModel } from '../models'; import { GetAllDevices } from '../models'; import { UpdateDeviceDto } from '../models'; /** * DeviceApi - axios parameter creator * @export */ export const DeviceApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAllDevices: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/device/list`; // 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 bearer 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, }; }, /** * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDeviceById: async (deviceId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'deviceId' is not null or undefined if (deviceId === null || deviceId === undefined) { throw new RequiredError('deviceId','Required parameter deviceId was null or undefined when calling getDeviceById.'); } const localVarPath = `/device/{deviceId}` .replace(`{${"deviceId"}}`, encodeURIComponent(String(deviceId))); // 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 bearer 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, }; }, /** * * @param {DeviceDto} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ newDevice: async (body: DeviceDto, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling newDevice.'); } const localVarPath = `/device`; // 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 bearer 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, }; }, /** * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ softDeleteDevice: async (deviceId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'deviceId' is not null or undefined if (deviceId === null || deviceId === undefined) { throw new RequiredError('deviceId','Required parameter deviceId was null or undefined when calling softDeleteDevice.'); } const localVarPath = `/device/{deviceId}` .replace(`{${"deviceId"}}`, encodeURIComponent(String(deviceId))); // 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: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearer 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, }; }, /** * * @param {UpdateDeviceDto} body * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateDevice: async (body: UpdateDeviceDto, deviceId: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling updateDevice.'); } // verify required parameter 'deviceId' is not null or undefined if (deviceId === null || deviceId === undefined) { throw new RequiredError('deviceId','Required parameter deviceId was null or undefined when calling updateDevice.'); } const localVarPath = `/device/{deviceId}` .replace(`{${"deviceId"}}`, encodeURIComponent(String(deviceId))); // 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: 'PUT', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearer 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, }; }, } }; /** * DeviceApi - functional programming interface * @export */ export const DeviceApiFp = function(configuration?: Configuration) { return { /** * * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAllDevices(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await DeviceApiAxiosParamCreator(configuration).getAllDevices(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDeviceById(deviceId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await DeviceApiAxiosParamCreator(configuration).getDeviceById(deviceId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @param {DeviceDto} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async newDevice(body: DeviceDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await DeviceApiAxiosParamCreator(configuration).newDevice(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async softDeleteDevice(deviceId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await DeviceApiAxiosParamCreator(configuration).softDeleteDevice(deviceId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @param {UpdateDeviceDto} body * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateDevice(body: UpdateDeviceDto, deviceId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await DeviceApiAxiosParamCreator(configuration).updateDevice(body, deviceId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * DeviceApi - factory interface * @export */ export const DeviceApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAllDevices(options?: AxiosRequestConfig): Promise> { return DeviceApiFp(configuration).getAllDevices(options).then((request) => request(axios, basePath)); }, /** * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDeviceById(deviceId: string, options?: AxiosRequestConfig): Promise> { return DeviceApiFp(configuration).getDeviceById(deviceId, options).then((request) => request(axios, basePath)); }, /** * * @param {DeviceDto} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async newDevice(body: DeviceDto, options?: AxiosRequestConfig): Promise> { return DeviceApiFp(configuration).newDevice(body, options).then((request) => request(axios, basePath)); }, /** * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async softDeleteDevice(deviceId: string, options?: AxiosRequestConfig): Promise> { return DeviceApiFp(configuration).softDeleteDevice(deviceId, options).then((request) => request(axios, basePath)); }, /** * * @param {UpdateDeviceDto} body * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateDevice(body: UpdateDeviceDto, deviceId: string, options?: AxiosRequestConfig): Promise> { return DeviceApiFp(configuration).updateDevice(body, deviceId, options).then((request) => request(axios, basePath)); }, }; }; /** * DeviceApi - object-oriented interface * @export * @class DeviceApi * @extends {BaseAPI} */ export class DeviceApi extends BaseAPI { /** * * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DeviceApi */ public async getAllDevices(options?: AxiosRequestConfig) : Promise> { return DeviceApiFp(this.configuration).getAllDevices(options).then((request) => request(this.axios, this.basePath)); } /** * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DeviceApi */ public async getDeviceById(deviceId: string, options?: AxiosRequestConfig) : Promise> { return DeviceApiFp(this.configuration).getDeviceById(deviceId, options).then((request) => request(this.axios, this.basePath)); } /** * * @param {DeviceDto} body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DeviceApi */ public async newDevice(body: DeviceDto, options?: AxiosRequestConfig) : Promise> { return DeviceApiFp(this.configuration).newDevice(body, options).then((request) => request(this.axios, this.basePath)); } /** * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DeviceApi */ public async softDeleteDevice(deviceId: string, options?: AxiosRequestConfig) : Promise> { return DeviceApiFp(this.configuration).softDeleteDevice(deviceId, options).then((request) => request(this.axios, this.basePath)); } /** * * @param {UpdateDeviceDto} body * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DeviceApi */ public async updateDevice(body: UpdateDeviceDto, deviceId: string, options?: AxiosRequestConfig) : Promise> { return DeviceApiFp(this.configuration).updateDevice(body, deviceId, options).then((request) => request(this.axios, this.basePath)); } }