traccar-api
Version:
traccar-api-client
128 lines (121 loc) • 5.13 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* Traccar
* Traccar GPS tracking server API documentation. To use the API you need to have a server instance. For testing purposes you can use one of free [demo servers](https://www.traccar.org/demo-server/). For production use you can install your own server or get a [subscription service](https://www.traccar.org/product/tracking-server/).
*
* OpenAPI spec version: 4.11
* Contact: support@traccar.org
*
* 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, { AxiosPromise, AxiosInstance } 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 { Event } from '../models';
/**
* EventsApi - axios parameter creator
* @export
*/
export const EventsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
eventsIdGet: async (id: number, options: any = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new RequiredError('id','Required parameter id was null or undefined when calling eventsIdGet.');
}
const localVarPath = `/events/{id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// 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 = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication basicAuth required
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.query) {
query.set(key, options.query[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,
};
},
}
};
/**
* EventsApi - functional programming interface
* @export
*/
export const EventsApiFp = function(configuration?: Configuration) {
return {
/**
*
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async eventsIdGet(id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Event>> {
const localVarAxiosArgs = await EventsApiAxiosParamCreator(configuration).eventsIdGet(id, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* EventsApi - factory interface
* @export
*/
export const EventsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
*
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
eventsIdGet(id: number, options?: any): AxiosPromise<Event> {
return EventsApiFp(configuration).eventsIdGet(id, options).then((request) => request(axios, basePath));
},
};
};
/**
* EventsApi - object-oriented interface
* @export
* @class EventsApi
* @extends {BaseAPI}
*/
export class EventsApi extends BaseAPI {
/**
*
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof EventsApi
*/
public eventsIdGet(id: number, options?: any) {
return EventsApiFp(this.configuration).eventsIdGet(id, options).then((request) => request(this.axios, this.basePath));
}
}