traccar-api
Version:
traccar-api-client
409 lines (386 loc) • 20.1 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 { Geofence } from '../models';
/**
* GeofencesApi - axios parameter creator
* @export
*/
export const GeofencesApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Without params, it returns a list of Geofences the user has access to
* @summary Fetch a list of Geofences
* @param {boolean} [all] Can only be used by admins or managers to fetch all entities
* @param {number} [userId] Standard users can use this only with their own _userId_
* @param {number} [deviceId] Standard users can use this only with _deviceId_s, they have access to
* @param {number} [groupId] Standard users can use this only with _groupId_s, they have access to
* @param {boolean} [refresh]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
geofencesGet: async (all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options: any = {}): Promise<RequestArgs> => {
const localVarPath = `/geofences`;
// 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
if (all !== undefined) {
localVarQueryParameter['all'] = all;
}
if (userId !== undefined) {
localVarQueryParameter['userId'] = userId;
}
if (deviceId !== undefined) {
localVarQueryParameter['deviceId'] = deviceId;
}
if (groupId !== undefined) {
localVarQueryParameter['groupId'] = groupId;
}
if (refresh !== undefined) {
localVarQueryParameter['refresh'] = refresh;
}
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,
};
},
/**
*
* @summary Delete a Geofence
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
geofencesIdDelete: 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 geofencesIdDelete.');
}
const localVarPath = `/geofences/{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: 'DELETE', ...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,
};
},
/**
*
* @summary Update a Geofence
* @param {Geofence} body
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
geofencesIdPut: async (body: Geofence, id: number, options: any = {}): Promise<RequestArgs> => {
// 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 geofencesIdPut.');
}
// 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 geofencesIdPut.');
}
const localVarPath = `/geofences/{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: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication basicAuth 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.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};
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,
};
},
/**
*
* @summary Create a Geofence
* @param {Geofence} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
geofencesPost: async (body: Geofence, options: any = {}): Promise<RequestArgs> => {
// 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 geofencesPost.');
}
const localVarPath = `/geofences`;
// 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: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication basicAuth 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.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};
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,
};
},
}
};
/**
* GeofencesApi - functional programming interface
* @export
*/
export const GeofencesApiFp = function(configuration?: Configuration) {
return {
/**
* Without params, it returns a list of Geofences the user has access to
* @summary Fetch a list of Geofences
* @param {boolean} [all] Can only be used by admins or managers to fetch all entities
* @param {number} [userId] Standard users can use this only with their own _userId_
* @param {number} [deviceId] Standard users can use this only with _deviceId_s, they have access to
* @param {number} [groupId] Standard users can use this only with _groupId_s, they have access to
* @param {boolean} [refresh]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async geofencesGet(all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Geofence>>> {
const localVarAxiosArgs = await GeofencesApiAxiosParamCreator(configuration).geofencesGet(all, userId, deviceId, groupId, refresh, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Delete a Geofence
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async geofencesIdDelete(id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await GeofencesApiAxiosParamCreator(configuration).geofencesIdDelete(id, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Update a Geofence
* @param {Geofence} body
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async geofencesIdPut(body: Geofence, id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Geofence>> {
const localVarAxiosArgs = await GeofencesApiAxiosParamCreator(configuration).geofencesIdPut(body, id, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Create a Geofence
* @param {Geofence} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async geofencesPost(body: Geofence, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Geofence>> {
const localVarAxiosArgs = await GeofencesApiAxiosParamCreator(configuration).geofencesPost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* GeofencesApi - factory interface
* @export
*/
export const GeofencesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
* Without params, it returns a list of Geofences the user has access to
* @summary Fetch a list of Geofences
* @param {boolean} [all] Can only be used by admins or managers to fetch all entities
* @param {number} [userId] Standard users can use this only with their own _userId_
* @param {number} [deviceId] Standard users can use this only with _deviceId_s, they have access to
* @param {number} [groupId] Standard users can use this only with _groupId_s, they have access to
* @param {boolean} [refresh]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
geofencesGet(all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options?: any): AxiosPromise<Array<Geofence>> {
return GeofencesApiFp(configuration).geofencesGet(all, userId, deviceId, groupId, refresh, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Delete a Geofence
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
geofencesIdDelete(id: number, options?: any): AxiosPromise<void> {
return GeofencesApiFp(configuration).geofencesIdDelete(id, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Update a Geofence
* @param {Geofence} body
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
geofencesIdPut(body: Geofence, id: number, options?: any): AxiosPromise<Geofence> {
return GeofencesApiFp(configuration).geofencesIdPut(body, id, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Create a Geofence
* @param {Geofence} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
geofencesPost(body: Geofence, options?: any): AxiosPromise<Geofence> {
return GeofencesApiFp(configuration).geofencesPost(body, options).then((request) => request(axios, basePath));
},
};
};
/**
* GeofencesApi - object-oriented interface
* @export
* @class GeofencesApi
* @extends {BaseAPI}
*/
export class GeofencesApi extends BaseAPI {
/**
* Without params, it returns a list of Geofences the user has access to
* @summary Fetch a list of Geofences
* @param {boolean} [all] Can only be used by admins or managers to fetch all entities
* @param {number} [userId] Standard users can use this only with their own _userId_
* @param {number} [deviceId] Standard users can use this only with _deviceId_s, they have access to
* @param {number} [groupId] Standard users can use this only with _groupId_s, they have access to
* @param {boolean} [refresh]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof GeofencesApi
*/
public geofencesGet(all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options?: any) {
return GeofencesApiFp(this.configuration).geofencesGet(all, userId, deviceId, groupId, refresh, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Delete a Geofence
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof GeofencesApi
*/
public geofencesIdDelete(id: number, options?: any) {
return GeofencesApiFp(this.configuration).geofencesIdDelete(id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Update a Geofence
* @param {Geofence} body
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof GeofencesApi
*/
public geofencesIdPut(body: Geofence, id: number, options?: any) {
return GeofencesApiFp(this.configuration).geofencesIdPut(body, id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Create a Geofence
* @param {Geofence} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof GeofencesApi
*/
public geofencesPost(body: Geofence, options?: any) {
return GeofencesApiFp(this.configuration).geofencesPost(body, options).then((request) => request(this.axios, this.basePath));
}
}