From 9360724ad2be76cfb9688b8c07c1f93affd965af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Mon, 11 Oct 2021 13:41:19 +0500 Subject: [PATCH] update api client --- src/services/api/services/FileService.ts | 2 +- .../api/services/WellOperationService.ts | 58 ++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/services/api/services/FileService.ts b/src/services/api/services/FileService.ts index cd51ab2..7d591b5 100644 --- a/src/services/api/services/FileService.ts +++ b/src/services/api/services/FileService.ts @@ -51,7 +51,7 @@ companyName?: string, fileName?: string, begin?: string, end?: string, -skip?: number, +skip: number = 0, take: number = 32, ): Promise { const result = await __request({ diff --git a/src/services/api/services/WellOperationService.ts b/src/services/api/services/WellOperationService.ts index 0fdbd49..dccf339 100644 --- a/src/services/api/services/WellOperationService.ts +++ b/src/services/api/services/WellOperationService.ts @@ -48,7 +48,7 @@ begin?: string, end?: string, minDepth: number = -1.7976931348623157e+308, maxDepth: number = 1.7976931348623157e+308, -skip?: number, +skip: number = 0, take: number = 32, ): Promise { const result = await __request({ @@ -145,4 +145,60 @@ idOperation: number, return result.body; } + /** + * Импортирует операции из excel (xlsx) файла + * @param idWell id скважины + * @param deleteWellOperationsBeforeImport Удалить операции перед импортом, если фал валидный + * @param requestBody + * @returns any Success + * @throws ApiError + */ + public static async import( +idWell: number, +deleteWellOperationsBeforeImport: boolean = false, +requestBody?: any, +): Promise { + const result = await __request({ + method: 'POST', + path: `/api/well/${idWell}/wellOperations/import`, + query: { + 'deleteWellOperationsBeforeImport': deleteWellOperationsBeforeImport, + }, + body: requestBody, + }); + return result.body; + } + + /** + * Создает excel файл с операциями по скважине + * @param idWell id скважины + * @returns string Success + * @throws ApiError + */ + public static async export( +idWell: number, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/wellOperations/export`, + }); + return result.body; + } + + /** + * Возвращает шаблон файла импорта + * @param idWell + * @returns string Success + * @throws ApiError + */ + public static async getTamplate( +idWell: string, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/wellOperations/tamplate`, + }); + return result.body; + } + } \ No newline at end of file