UNPKG

traccar-api

Version:

traccar-api-client

409 lines (386 loc) 19.9 kB
/* 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 { Driver } from '../models'; /** * DriversApi - axios parameter creator * @export */ export const DriversApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Without params, it returns a list of Drivers the user has access to * @summary Fetch a list of Drivers * @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} */ driversGet: async (all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options: any = {}): Promise<RequestArgs> => { const localVarPath = `/drivers`; // 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 Driver * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} */ driversIdDelete: 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 driversIdDelete.'); } const localVarPath = `/drivers/{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 Driver * @param {Driver} body * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} */ driversIdPut: async (body: Driver, 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 driversIdPut.'); } // 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 driversIdPut.'); } const localVarPath = `/drivers/{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 Driver * @param {Driver} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ driversPost: async (body: Driver, 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 driversPost.'); } const localVarPath = `/drivers`; // 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, }; }, } }; /** * DriversApi - functional programming interface * @export */ export const DriversApiFp = function(configuration?: Configuration) { return { /** * Without params, it returns a list of Drivers the user has access to * @summary Fetch a list of Drivers * @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 driversGet(all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Driver>>> { const localVarAxiosArgs = await DriversApiAxiosParamCreator(configuration).driversGet(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 Driver * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async driversIdDelete(id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> { const localVarAxiosArgs = await DriversApiAxiosParamCreator(configuration).driversIdDelete(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 Driver * @param {Driver} body * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async driversIdPut(body: Driver, id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Driver>> { const localVarAxiosArgs = await DriversApiAxiosParamCreator(configuration).driversIdPut(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 Driver * @param {Driver} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async driversPost(body: Driver, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Driver>> { const localVarAxiosArgs = await DriversApiAxiosParamCreator(configuration).driversPost(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * DriversApi - factory interface * @export */ export const DriversApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Without params, it returns a list of Drivers the user has access to * @summary Fetch a list of Drivers * @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} */ driversGet(all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options?: any): AxiosPromise<Array<Driver>> { return DriversApiFp(configuration).driversGet(all, userId, deviceId, groupId, refresh, options).then((request) => request(axios, basePath)); }, /** * * @summary Delete a Driver * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} */ driversIdDelete(id: number, options?: any): AxiosPromise<void> { return DriversApiFp(configuration).driversIdDelete(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Update a Driver * @param {Driver} body * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} */ driversIdPut(body: Driver, id: number, options?: any): AxiosPromise<Driver> { return DriversApiFp(configuration).driversIdPut(body, id, options).then((request) => request(axios, basePath)); }, /** * * @summary Create a Driver * @param {Driver} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ driversPost(body: Driver, options?: any): AxiosPromise<Driver> { return DriversApiFp(configuration).driversPost(body, options).then((request) => request(axios, basePath)); }, }; }; /** * DriversApi - object-oriented interface * @export * @class DriversApi * @extends {BaseAPI} */ export class DriversApi extends BaseAPI { /** * Without params, it returns a list of Drivers the user has access to * @summary Fetch a list of Drivers * @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 DriversApi */ public driversGet(all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options?: any) { return DriversApiFp(this.configuration).driversGet(all, userId, deviceId, groupId, refresh, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Delete a Driver * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DriversApi */ public driversIdDelete(id: number, options?: any) { return DriversApiFp(this.configuration).driversIdDelete(id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Update a Driver * @param {Driver} body * @param {number} id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DriversApi */ public driversIdPut(body: Driver, id: number, options?: any) { return DriversApiFp(this.configuration).driversIdPut(body, id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Create a Driver * @param {Driver} body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DriversApi */ public driversPost(body: Driver, options?: any) { return DriversApiFp(this.configuration).driversPost(body, options).then((request) => request(this.axios, this.basePath)); } }