update web-api client

This commit is contained in:
Фролов 2021-04-23 10:45:56 +05:00
parent 10b6dcc307
commit 218d4b97fd
13 changed files with 201 additions and 26 deletions

View File

@ -27,14 +27,6 @@ const columns = [
},
];
// const groupBy = (table, key) => {
// return table.reduce((rv, item) => {
// rv[item[key]] = rv[item[key]] || []
// rv[item[key]].push(item);
// return rv;
// }, []);
// };
const groupBy = (table, ...keys) => {
let key = keys[0]

View File

@ -6,12 +6,17 @@ export { OpenAPI } from './core/OpenAPI';
export type { AuthDto } from './models/AuthDto';
export type { DataSaubBaseDto } from './models/DataSaubBaseDto';
export type { TelemetryDataDto } from './models/TelemetryDataDto';
export type { EventDto } from './models/EventDto';
export type { MessageDto } from './models/MessageDto';
export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer';
export type { TelemetryInfoDto } from './models/TelemetryInfoDto';
export type { TelemetryMessageDto } from './models/TelemetryMessageDto';
export type { TelemetryUserDto } from './models/TelemetryUserDto';
export type { UserTokenDto } from './models/UserTokenDto';
export type { WellDto } from './models/WellDto';
export { AuthService } from './services/AuthService';
export { DataService } from './services/DataService';
export { MessageService } from './services/MessageService';
export { TelemetryService } from './services/TelemetryService';
export { WellService } from './services/WellService';

View File

@ -5,14 +5,23 @@
export type DataSaubBaseDto = {
date?: string;
mode?: number | null;
user?: string | null;
wellDepth?: number | null;
bitDepth?: number | null;
blockHeight?: number | null;
blockPosition?: number | null;
blockPositionMin?: number | null;
blockPositionMax?: number | null;
blockSpeed?: number | null;
blockSpeedSp?: number | null;
blockSpeedSpRotor?: number | null;
blockSpeedSpSlide?: number | null;
blockSpeedSpDevelop?: number | null;
pressure?: number | null;
pressureIdle?: number | null;
pressureSp?: number | null;
pressureSpRotor?: number | null;
pressureSpSlide?: number | null;
pressureSpDevelop?: number | null;
pressureDeltaLimitMax?: number | null;
axialLoad?: number | null;
axialLoadSp?: number | null;

View File

@ -0,0 +1,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type EventDto = {
id?: number;
message?: string | null;
idCategory?: number;
tag?: string | null;
eventType?: number;
idSound?: number;
}

View File

@ -0,0 +1,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type MessageDto = {
id?: number;
date?: string;
categoryId?: number;
user?: string | null;
message?: string | null;
}

View File

@ -0,0 +1,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { MessageDto } from './MessageDto';
export type MessageDtoPaginationContainer = {
skip?: number;
take?: number;
count?: number;
items?: Array<MessageDto> | null;
}

View File

@ -1,12 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { DataSaubBaseDto } from './DataSaubBaseDto';
export type TelemetryDataDto = {
date?: string;
hmiVersion?: string | null;
userName?: string | null;
dataSaub?: Array<DataSaubBaseDto> | null;
}

View File

@ -3,7 +3,13 @@
/* eslint-disable */
export type TelemetryInfoDto = {
date?: string;
timeZoneId?: string | null;
timeZoneOffsetTotalHours?: number;
caption?: string | null;
cluster?: string | null;
deposit?: string | null;
hmiVersion?: string | null;
plcVersion?: string | null;
comment?: string | null;
}

View File

@ -0,0 +1,15 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type TelemetryMessageDto = {
id?: number;
date?: string;
idEvent?: number;
state?: number | null;
idTelemetryUser?: number | null;
arg0?: string | null;
arg1?: string | null;
arg2?: string | null;
arg3?: string | null;
}

View File

@ -0,0 +1,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type TelemetryUserDto = {
id?: number;
name?: string | null;
surname?: string | null;
patronymic?: string | null;
level?: number;
}

View File

@ -7,17 +7,29 @@ import { request as __request } from '../core/request';
export class DataService {
/**
* Возвращает данные САУБ по скважине
* @param wellId
* Возвращает данные САУБ по скважине.
* По умолчанию за последние 10 минут.
* @param wellId id скважины
* @param begin дата начала выборки. По умолчанию: текущее время - intervalSec
* @param intervalSec интервал времени даты начала выборки, секунды
* @param approxPointsCount желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.
* @returns DataSaubBaseDto Success
* @throws ApiError
*/
public static async get(
wellId: number,
begin?: string,
intervalSec: number = 600,
approxPointsCount: number = 1024,
): Promise<Array<DataSaubBaseDto>> {
const result = await __request({
method: 'GET',
path: `/api/well/${wellId}/data`,
query: {
'begin': begin,
'intervalSec': intervalSec,
'approxPointsCount': approxPointsCount,
},
});
return result.body;
}

View File

@ -0,0 +1,42 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { MessageDtoPaginationContainer } from '../models/MessageDtoPaginationContainer';
import { request as __request } from '../core/request';
export class MessageService {
/**
* Выдает список сообщений по скважине
* @param wellId id скважины
* @param categoryids список категорий
* @param begin дата начала
* @param end окончание
* @param skip для пагинации кол-во записей пропустить
* @param take для пагинации кол-во записей
* @returns MessageDtoPaginationContainer Success
* @throws ApiError
*/
public static async get(
wellId: number,
categoryids?: Array<number>,
begin?: string,
end?: string,
skip: number,
take: number = 32,
): Promise<MessageDtoPaginationContainer> {
const result = await __request({
method: 'GET',
path: `/api/well/${wellId}/message`,
query: {
'categoryids': categoryids,
'begin': begin,
'end': end,
'skip': skip,
'take': take,
},
});
return result.body;
}
}

View File

@ -1,8 +1,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { TelemetryDataDto } from '../models/TelemetryDataDto';
import type { DataSaubBaseDto } from '../models/DataSaubBaseDto';
import type { EventDto } from '../models/EventDto';
import type { TelemetryInfoDto } from '../models/TelemetryInfoDto';
import type { TelemetryMessageDto } from '../models/TelemetryMessageDto';
import type { TelemetryUserDto } from '../models/TelemetryUserDto';
import { request as __request } from '../core/request';
export class TelemetryService {
@ -35,7 +38,7 @@ requestBody?: TelemetryInfoDto,
*/
public static async data(
uid: string,
requestBody?: TelemetryDataDto,
requestBody?: Array<DataSaubBaseDto>,
): Promise<any> {
const result = await __request({
method: 'POST',
@ -45,4 +48,61 @@ requestBody?: TelemetryDataDto,
return result.body;
}
/**
* Принимает список новых сообщений от телеметрии
* @param uid Уникальный идентификатор отправителя
* @param requestBody сообщения
* @returns any Success
* @throws ApiError
*/
public static async message(
uid: string,
requestBody?: Array<TelemetryMessageDto>,
): Promise<any> {
const result = await __request({
method: 'POST',
path: `/api/telemetry/${uid}/message`,
body: requestBody,
});
return result.body;
}
/**
* Принимает справочник событий
* @param uid Уникальный идентификатор отправителя
* @param requestBody справочник событий
* @returns any Success
* @throws ApiError
*/
public static async events(
uid: string,
requestBody?: Array<EventDto>,
): Promise<any> {
const result = await __request({
method: 'POST',
path: `/api/telemetry/${uid}/event`,
body: requestBody,
});
return result.body;
}
/**
* Принимает справочник пользователей телеметрии
* @param uid Уникальный идентификатор отправителя
* @param requestBody справочник пользователей телеметрии
* @returns any Success
* @throws ApiError
*/
public static async users(
uid: string,
requestBody?: Array<TelemetryUserDto>,
): Promise<any> {
const result = await __request({
method: 'POST',
path: `/api/telemetry/${uid}/user`,
body: requestBody,
});
return result.body;
}
}