traccar-api
Version:
traccar-api-client
546 lines (517 loc) • 27.3 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 { Notification } from '../models';
import { NotificationType } from '../models';
/**
* NotificationsApi - axios parameter creator
* @export
*/
export const NotificationsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Without params, it returns a list of Notifications the user has access to
* @summary Fetch a list of Notifications
* @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}
*/
notificationsGet: async (all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options: any = {}): Promise<RequestArgs> => {
const localVarPath = `/notifications`;
// 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 Notification
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsIdDelete: 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 notificationsIdDelete.');
}
const localVarPath = `/notifications/{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 Notification
* @param {Notification} body
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsIdPut: async (body: Notification, 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 notificationsIdPut.');
}
// 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 notificationsIdPut.');
}
const localVarPath = `/notifications/{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 Notification
* @param {Notification} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsPost: async (body: Notification, 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 notificationsPost.');
}
const localVarPath = `/notifications`;
// 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,
};
},
/**
*
* @summary Send test notification to current user via Email and SMS
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsTestPost: async (options: any = {}): Promise<RequestArgs> => {
const localVarPath = `/notifications/test`;
// 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
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 Fetch a list of available Notification types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsTypesGet: async (options: any = {}): Promise<RequestArgs> => {
const localVarPath = `/notifications/types`;
// 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,
};
},
}
};
/**
* NotificationsApi - functional programming interface
* @export
*/
export const NotificationsApiFp = function(configuration?: Configuration) {
return {
/**
* Without params, it returns a list of Notifications the user has access to
* @summary Fetch a list of Notifications
* @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 notificationsGet(all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Notification>>> {
const localVarAxiosArgs = await NotificationsApiAxiosParamCreator(configuration).notificationsGet(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 Notification
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async notificationsIdDelete(id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await NotificationsApiAxiosParamCreator(configuration).notificationsIdDelete(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 Notification
* @param {Notification} body
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async notificationsIdPut(body: Notification, id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Notification>> {
const localVarAxiosArgs = await NotificationsApiAxiosParamCreator(configuration).notificationsIdPut(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 Notification
* @param {Notification} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async notificationsPost(body: Notification, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Notification>> {
const localVarAxiosArgs = await NotificationsApiAxiosParamCreator(configuration).notificationsPost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Send test notification to current user via Email and SMS
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async notificationsTestPost(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await NotificationsApiAxiosParamCreator(configuration).notificationsTestPost(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Fetch a list of available Notification types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async notificationsTypesGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<NotificationType>>> {
const localVarAxiosArgs = await NotificationsApiAxiosParamCreator(configuration).notificationsTypesGet(options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* NotificationsApi - factory interface
* @export
*/
export const NotificationsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
* Without params, it returns a list of Notifications the user has access to
* @summary Fetch a list of Notifications
* @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}
*/
notificationsGet(all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options?: any): AxiosPromise<Array<Notification>> {
return NotificationsApiFp(configuration).notificationsGet(all, userId, deviceId, groupId, refresh, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Delete a Notification
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsIdDelete(id: number, options?: any): AxiosPromise<void> {
return NotificationsApiFp(configuration).notificationsIdDelete(id, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Update a Notification
* @param {Notification} body
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsIdPut(body: Notification, id: number, options?: any): AxiosPromise<Notification> {
return NotificationsApiFp(configuration).notificationsIdPut(body, id, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Create a Notification
* @param {Notification} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsPost(body: Notification, options?: any): AxiosPromise<Notification> {
return NotificationsApiFp(configuration).notificationsPost(body, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Send test notification to current user via Email and SMS
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsTestPost(options?: any): AxiosPromise<void> {
return NotificationsApiFp(configuration).notificationsTestPost(options).then((request) => request(axios, basePath));
},
/**
*
* @summary Fetch a list of available Notification types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
notificationsTypesGet(options?: any): AxiosPromise<Array<NotificationType>> {
return NotificationsApiFp(configuration).notificationsTypesGet(options).then((request) => request(axios, basePath));
},
};
};
/**
* NotificationsApi - object-oriented interface
* @export
* @class NotificationsApi
* @extends {BaseAPI}
*/
export class NotificationsApi extends BaseAPI {
/**
* Without params, it returns a list of Notifications the user has access to
* @summary Fetch a list of Notifications
* @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 NotificationsApi
*/
public notificationsGet(all?: boolean, userId?: number, deviceId?: number, groupId?: number, refresh?: boolean, options?: any) {
return NotificationsApiFp(this.configuration).notificationsGet(all, userId, deviceId, groupId, refresh, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Delete a Notification
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof NotificationsApi
*/
public notificationsIdDelete(id: number, options?: any) {
return NotificationsApiFp(this.configuration).notificationsIdDelete(id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Update a Notification
* @param {Notification} body
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof NotificationsApi
*/
public notificationsIdPut(body: Notification, id: number, options?: any) {
return NotificationsApiFp(this.configuration).notificationsIdPut(body, id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Create a Notification
* @param {Notification} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof NotificationsApi
*/
public notificationsPost(body: Notification, options?: any) {
return NotificationsApiFp(this.configuration).notificationsPost(body, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Send test notification to current user via Email and SMS
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof NotificationsApi
*/
public notificationsTestPost(options?: any) {
return NotificationsApiFp(this.configuration).notificationsTestPost(options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Fetch a list of available Notification types
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof NotificationsApi
*/
public notificationsTypesGet(options?: any) {
return NotificationsApiFp(this.configuration).notificationsTypesGet(options).then((request) => request(this.axios, this.basePath));
}
}