traccar-api
Version:
traccar-api-client
408 lines (394 loc) • 23 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*/
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
import { Configuration } from '../configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import { BASE_PATH, RequestArgs, BaseAPI, RequiredError, COLLECTION_FORMATS } from '../base';
import { Event } from '../models';
import { Position } from '../models';
import { ReportStops } from '../models';
import { ReportSummary } from '../models';
import { ReportTrips } from '../models';
function Get(localVarPath: string, from: Date, to: Date, configuration: Configuration, options: any, groupId: Array<number>, deviceId: Array<number>, type?: Array<string>) {
if (from === null || from === undefined) {
throw new RequiredError('from', 'Required parameter from was null or undefined when calling reportsTripsGet.');
}
if (to === null || to === undefined) {
throw new RequiredError('to', 'Required parameter to was null or undefined when calling reportsTripsGet.');
}
// 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
localVarQueryParameter['from'] = (from as any instanceof Date) ?
(from as any).toISOString() :
from;
localVarQueryParameter['to'] = (to as any instanceof Date) ?
(to as any).toISOString() :
to;
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]);
}
const searchParams = new URLSearchParams(query)
if (deviceId) {
deviceId.forEach(d => {
searchParams.append('deviceId', d.toString())
})
}
if (type) {
type.forEach(d => {
searchParams.append('type', d.toString())
})
}
if (groupId) {
groupId.forEach(d => {
searchParams.append('groupId', d.toString())
})
}
localVarUrlObj.search = (searchParams).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
}
/**
* ReportsApi - axios parameter creator
* @export
*/
export const ReportsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of Events within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {Array<string>} [type] % can be used to return events of all types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsEventsGet: async (from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, type?: Array<string>, options: any = {}): Promise<RequestArgs> => {
// verify required parameter 'from' is not null or undefined
return Get('/reports/events', from, to, configuration, options, groupId, deviceId, type)
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of Positions within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsRouteGet: async (from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options: any = {}): Promise<RequestArgs> => {
// verify required parameter 'from' is not null or undefined
return Get('/reports/route', from, to, configuration, options, groupId, deviceId)
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportStops within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsStopsGet: async (from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options: any = {}): Promise<RequestArgs> => {
return Get('/reports/stops', from, to, configuration, options, groupId, deviceId)
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportSummary within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsSummaryGet: async (from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options: any = {}): Promise<RequestArgs> => {
// verify required parameter 'from' is not null or undefined
return Get('/reports/summary', from, to, configuration, options, groupId, deviceId)
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportTrips within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsTripsGet: async (from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options: any = {}): Promise<RequestArgs> => {
return Get('/reports/trips', from, to, configuration, options, groupId, deviceId);
},
}
};
/**
* ReportsApi - functional programming interface
* @export
*/
export const ReportsApiFp = function(configuration?: Configuration) {
return {
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of Events within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {Array<string>} [type] % can be used to return events of all types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async reportsEventsGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, type?: Array<string>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Event>>> {
const localVarAxiosArgs = await ReportsApiAxiosParamCreator(configuration).reportsEventsGet(from, to, deviceId, groupId, type, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of Positions within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async reportsRouteGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Position>>> {
const localVarAxiosArgs = await ReportsApiAxiosParamCreator(configuration).reportsRouteGet(from, to, deviceId, groupId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportStops within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async reportsStopsGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ReportStops>>> {
const localVarAxiosArgs = await ReportsApiAxiosParamCreator(configuration).reportsStopsGet(from, to, deviceId, groupId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportSummary within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async reportsSummaryGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ReportSummary>>> {
const localVarAxiosArgs = await ReportsApiAxiosParamCreator(configuration).reportsSummaryGet(from, to, deviceId, groupId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportTrips within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async reportsTripsGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ReportTrips>>> {
const localVarAxiosArgs = await ReportsApiAxiosParamCreator(configuration).reportsTripsGet(from, to, deviceId, groupId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* ReportsApi - factory interface
* @export
*/
export const ReportsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of Events within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {Array<string>} [type] % can be used to return events of all types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsEventsGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, type?: Array<string>, options?: any): AxiosPromise<Array<Event>> {
return ReportsApiFp(configuration).reportsEventsGet(from, to, deviceId, groupId, type, options).then((request) => request(axios, basePath));
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of Positions within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsRouteGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any): AxiosPromise<Array<Position>> {
return ReportsApiFp(configuration).reportsRouteGet(from, to, deviceId, groupId, options).then((request) => request(axios, basePath));
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportStops within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsStopsGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any): AxiosPromise<Array<ReportStops>> {
return ReportsApiFp(configuration).reportsStopsGet(from, to, deviceId, groupId, options).then((request) => request(axios, basePath));
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportSummary within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsSummaryGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any): AxiosPromise<Array<ReportSummary>> {
return ReportsApiFp(configuration).reportsSummaryGet(from, to, deviceId, groupId, options).then((request) => request(axios, basePath));
},
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportTrips within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsTripsGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any): AxiosPromise<Array<ReportTrips>> {
return ReportsApiFp(configuration).reportsTripsGet(from, to, deviceId, groupId, options).then((request) => request(axios, basePath));
},
};
};
/**
* ReportsApi - object-oriented interface
* @export
* @class ReportsApi
* @extends {BaseAPI}
*/
export class ReportsApi extends BaseAPI {
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of Events within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {Array<string>} [type] % can be used to return events of all types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ReportsApi
*/
public reportsEventsGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, type?: Array<string>, options?: any) {
return ReportsApiFp(this.configuration).reportsEventsGet(from, to, deviceId, groupId, type, options).then((request) => request(this.axios, this.basePath));
}
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of Positions within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ReportsApi
*/
public reportsRouteGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any) {
return ReportsApiFp(this.configuration).reportsRouteGet(from, to, deviceId, groupId, options).then((request) => request(this.axios, this.basePath));
}
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportStops within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ReportsApi
*/
public reportsStopsGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any) {
return ReportsApiFp(this.configuration).reportsStopsGet(from, to, deviceId, groupId, options).then((request) => request(this.axios, this.basePath));
}
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportSummary within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ReportsApi
*/
public reportsSummaryGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any) {
return ReportsApiFp(this.configuration).reportsSummaryGet(from, to, deviceId, groupId, options).then((request) => request(this.axios, this.basePath));
}
/**
* At least one _deviceId_ or one _groupId_ must be passed
* @summary Fetch a list of ReportTrips within the time period for the Devices or Groups
* @param {Date} from in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Date} to in IS0 8601 format. eg. `1963-11-22T18:30:00Z`
* @param {Array<number>} [deviceId]
* @param {Array<number>} [groupId]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ReportsApi
*/
public reportsTripsGet(from: Date, to: Date, deviceId?: Array<number>, groupId?: Array<number>, options?: any) {
return ReportsApiFp(this.configuration).reportsTripsGet(from, to, deviceId, groupId, options).then((request) => request(this.axios, this.basePath));
}
}