From 1967cad76d2fa9aeb422ab021c24f2f60ab0a634 Mon Sep 17 00:00:00 2001 From: csba1652 <Bilal.Hassan@student.uibk.ac.at> Date: Tue, 16 May 2023 17:55:58 +0100 Subject: [PATCH] refactoring -remove dead/dupicated code in pro view -simplify code in pro view -leaving no memory leaks in pro view -commenting in pro view -removing unused services --- projects/swagger-client/README.md | 24 -- projects/swagger-client/ng-package.json | 7 - projects/swagger-client/package.json | 11 - projects/swagger-client/src/.gitignore | 4 - projects/swagger-client/src/.npmignore | 5 - .../src/.swagger-codegen-ignore | 23 -- .../src/.swagger-codegen/VERSION | 1 - projects/swagger-client/src/api.module.ts | 45 -- projects/swagger-client/src/api/api.ts | 15 - .../src/api/clientController.service.ts | 352 ---------------- .../src/api/hostController.service.ts | 352 ---------------- .../src/api/sensorController.service.ts | 311 -------------- .../src/api/sensorGroupController.service.ts | 352 ---------------- .../src/api/serverController.service.ts | 329 --------------- .../src/api/stationController.service.ts | 352 ---------------- .../src/api/userController.service.ts | 330 --------------- projects/swagger-client/src/configuration.ts | 79 ---- projects/swagger-client/src/encoder.ts | 19 - projects/swagger-client/src/git_push.sh | 52 --- projects/swagger-client/src/index.ts | 5 - .../src/lib/swagger-client.component.spec.ts | 23 -- .../src/lib/swagger-client.component.ts | 15 - .../src/lib/swagger-client.module.ts | 16 - .../src/lib/swagger-client.service.spec.ts | 16 - .../src/lib/swagger-client.service.ts | 9 - .../swagger-client/src/model/avgMinMax.ts | 33 -- projects/swagger-client/src/model/client.ts | 20 - .../src/model/dendrometerValue.ts | 26 -- projects/swagger-client/src/model/document.ts | 18 - projects/swagger-client/src/model/host.ts | 18 - .../src/model/levelOneResponse.ts | 20 - projects/swagger-client/src/model/location.ts | 18 - .../swagger-client/src/model/measurement.ts | 28 -- projects/swagger-client/src/model/models.ts | 19 - .../src/model/readingPayload.ts | 22 - .../swagger-client/src/model/readingValue.ts | 28 -- projects/swagger-client/src/model/role.ts | 24 -- projects/swagger-client/src/model/sensor.ts | 23 -- .../swagger-client/src/model/sensorGroup.ts | 31 -- projects/swagger-client/src/model/station.ts | 23 -- projects/swagger-client/src/model/sumOrAvg.ts | 36 -- .../src/model/threePhaseDendrometer.ts | 18 - .../src/model/userLoginRequest.ts | 16 - .../src/model/userSignUpRequest.ts | 18 - .../src/model/valueWithTimestamp.ts | 16 - projects/swagger-client/src/ng-package.json | 6 - projects/swagger-client/src/public-api.ts | 7 - projects/swagger-client/src/variables.ts | 9 - projects/swagger-client/tsconfig.lib.json | 14 - .../swagger-client/tsconfig.lib.prod.json | 10 - projects/swagger-client/tsconfig.spec.json | 14 - src/app/app.component.html | 2 +- src/app/app.component.ts | 1 - src/app/app.module.ts | 8 +- src/app/core/service/level1/AvgMinMax.ts | 10 - src/app/core/service/level1/Limit.ts | 4 - src/app/core/service/level1/Lv1.ts | 9 - src/app/core/service/level1/Readings.ts | 5 - src/app/core/service/level1/SumOrAvg.ts | 7 - .../service/level1/ThreePhaseDendrometer.ts | 6 - .../Cjs-timeline/light-chart.component.ts | 2 +- .../pro-view/pro-view.component.html | 7 +- .../components/pro-view/pro-view.component.ts | 384 +++++++++--------- .../summaryIcons/summaryIcons.component.ts | 6 +- .../components/summaryList/summaryList.ts | 8 +- src/app/shared/unsubscribeOnDestroy.class.ts | 11 + 66 files changed, 208 insertions(+), 3524 deletions(-) delete mode 100644 projects/swagger-client/README.md delete mode 100644 projects/swagger-client/ng-package.json delete mode 100644 projects/swagger-client/package.json delete mode 100644 projects/swagger-client/src/.gitignore delete mode 100644 projects/swagger-client/src/.npmignore delete mode 100644 projects/swagger-client/src/.swagger-codegen-ignore delete mode 100644 projects/swagger-client/src/.swagger-codegen/VERSION delete mode 100644 projects/swagger-client/src/api.module.ts delete mode 100644 projects/swagger-client/src/api/api.ts delete mode 100644 projects/swagger-client/src/api/clientController.service.ts delete mode 100644 projects/swagger-client/src/api/hostController.service.ts delete mode 100644 projects/swagger-client/src/api/sensorController.service.ts delete mode 100644 projects/swagger-client/src/api/sensorGroupController.service.ts delete mode 100644 projects/swagger-client/src/api/serverController.service.ts delete mode 100644 projects/swagger-client/src/api/stationController.service.ts delete mode 100644 projects/swagger-client/src/api/userController.service.ts delete mode 100644 projects/swagger-client/src/configuration.ts delete mode 100644 projects/swagger-client/src/encoder.ts delete mode 100644 projects/swagger-client/src/git_push.sh delete mode 100644 projects/swagger-client/src/index.ts delete mode 100644 projects/swagger-client/src/lib/swagger-client.component.spec.ts delete mode 100644 projects/swagger-client/src/lib/swagger-client.component.ts delete mode 100644 projects/swagger-client/src/lib/swagger-client.module.ts delete mode 100644 projects/swagger-client/src/lib/swagger-client.service.spec.ts delete mode 100644 projects/swagger-client/src/lib/swagger-client.service.ts delete mode 100644 projects/swagger-client/src/model/avgMinMax.ts delete mode 100644 projects/swagger-client/src/model/client.ts delete mode 100644 projects/swagger-client/src/model/dendrometerValue.ts delete mode 100644 projects/swagger-client/src/model/document.ts delete mode 100644 projects/swagger-client/src/model/host.ts delete mode 100644 projects/swagger-client/src/model/levelOneResponse.ts delete mode 100644 projects/swagger-client/src/model/location.ts delete mode 100644 projects/swagger-client/src/model/measurement.ts delete mode 100644 projects/swagger-client/src/model/models.ts delete mode 100644 projects/swagger-client/src/model/readingPayload.ts delete mode 100644 projects/swagger-client/src/model/readingValue.ts delete mode 100644 projects/swagger-client/src/model/role.ts delete mode 100644 projects/swagger-client/src/model/sensor.ts delete mode 100644 projects/swagger-client/src/model/sensorGroup.ts delete mode 100644 projects/swagger-client/src/model/station.ts delete mode 100644 projects/swagger-client/src/model/sumOrAvg.ts delete mode 100644 projects/swagger-client/src/model/threePhaseDendrometer.ts delete mode 100644 projects/swagger-client/src/model/userLoginRequest.ts delete mode 100644 projects/swagger-client/src/model/userSignUpRequest.ts delete mode 100644 projects/swagger-client/src/model/valueWithTimestamp.ts delete mode 100644 projects/swagger-client/src/ng-package.json delete mode 100644 projects/swagger-client/src/public-api.ts delete mode 100644 projects/swagger-client/src/variables.ts delete mode 100644 projects/swagger-client/tsconfig.lib.json delete mode 100644 projects/swagger-client/tsconfig.lib.prod.json delete mode 100644 projects/swagger-client/tsconfig.spec.json delete mode 100644 src/app/core/service/level1/AvgMinMax.ts delete mode 100644 src/app/core/service/level1/Limit.ts delete mode 100644 src/app/core/service/level1/Lv1.ts delete mode 100644 src/app/core/service/level1/Readings.ts delete mode 100644 src/app/core/service/level1/SumOrAvg.ts delete mode 100644 src/app/core/service/level1/ThreePhaseDendrometer.ts create mode 100644 src/app/shared/unsubscribeOnDestroy.class.ts diff --git a/projects/swagger-client/README.md b/projects/swagger-client/README.md deleted file mode 100644 index b0a5665..0000000 --- a/projects/swagger-client/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# SwaggerClient - -This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.0.0. - -## Code scaffolding - -Run `ng generate component component-name --project swagger-client` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project swagger-client`. -> Note: Don't forget to add `--project swagger-client` or else it will be added to the default project in your `angular.json` file. - -## Build - -Run `ng build swagger-client` to build the project. The build artifacts will be stored in the `dist/` directory. - -## Publishing - -After building your library with `ng build swagger-client`, go to the dist folder `cd dist/swagger-client` and run `npm publish`. - -## Running unit tests - -Run `ng test swagger-client` to execute the unit tests via [Karma](https://karma-runner.github.io). - -## Further help - -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/projects/swagger-client/ng-package.json b/projects/swagger-client/ng-package.json deleted file mode 100644 index a322d7d..0000000 --- a/projects/swagger-client/ng-package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", - "dest": "../../dist/swagger-client", - "lib": { - "entryFile": "src/public-api.ts" - } -} \ No newline at end of file diff --git a/projects/swagger-client/package.json b/projects/swagger-client/package.json deleted file mode 100644 index 9ca4221..0000000 --- a/projects/swagger-client/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "swagger-client", - "version": "0.0.1", - "peerDependencies": { - "@angular/common": "^15.0.0", - "@angular/core": "^15.0.0" - }, - "dependencies": { - "tslib": "^2.3.0" - } -} \ No newline at end of file diff --git a/projects/swagger-client/src/.gitignore b/projects/swagger-client/src/.gitignore deleted file mode 100644 index 149b576..0000000 --- a/projects/swagger-client/src/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/projects/swagger-client/src/.npmignore b/projects/swagger-client/src/.npmignore deleted file mode 100644 index 7e981c4..0000000 --- a/projects/swagger-client/src/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -wwwroot/*.js -node -node_modules -typings -dist diff --git a/projects/swagger-client/src/.swagger-codegen-ignore b/projects/swagger-client/src/.swagger-codegen-ignore deleted file mode 100644 index c5fa491..0000000 --- a/projects/swagger-client/src/.swagger-codegen-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# Swagger Codegen Ignore -# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/projects/swagger-client/src/.swagger-codegen/VERSION b/projects/swagger-client/src/.swagger-codegen/VERSION deleted file mode 100644 index 3a460e6..0000000 --- a/projects/swagger-client/src/.swagger-codegen/VERSION +++ /dev/null @@ -1 +0,0 @@ -3.0.40 \ No newline at end of file diff --git a/projects/swagger-client/src/api.module.ts b/projects/swagger-client/src/api.module.ts deleted file mode 100644 index 0e58c02..0000000 --- a/projects/swagger-client/src/api.module.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { Configuration } from './configuration'; -import { HttpClient } from '@angular/common/http'; - - -import { ClientControllerService } from './api/clientController.service'; -import { HostControllerService } from './api/hostController.service'; -import { SensorControllerService } from './api/sensorController.service'; -import { SensorGroupControllerService } from './api/sensorGroupController.service'; -import { ServerControllerService } from './api/serverController.service'; -import { StationControllerService } from './api/stationController.service'; -import { UserControllerService } from './api/userController.service'; - -@NgModule({ - imports: [], - declarations: [], - exports: [], - providers: [ - ClientControllerService, - HostControllerService, - SensorControllerService, - SensorGroupControllerService, - ServerControllerService, - StationControllerService, - UserControllerService ] -}) -export class ApiModule { - public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> { - return { - ngModule: ApiModule, - providers: [ { provide: Configuration, useFactory: configurationFactory } ] - }; - } - - constructor( @Optional() @SkipSelf() parentModule: ApiModule, - @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error('You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575'); - } - } -} diff --git a/projects/swagger-client/src/api/api.ts b/projects/swagger-client/src/api/api.ts deleted file mode 100644 index 81af0e2..0000000 --- a/projects/swagger-client/src/api/api.ts +++ /dev/null @@ -1,15 +0,0 @@ -export * from './clientController.service'; -import { ClientControllerService } from './clientController.service'; -export * from './hostController.service'; -import { HostControllerService } from './hostController.service'; -export * from './sensorController.service'; -import { SensorControllerService } from './sensorController.service'; -export * from './sensorGroupController.service'; -import { SensorGroupControllerService } from './sensorGroupController.service'; -export * from './serverController.service'; -import { ServerControllerService } from './serverController.service'; -export * from './stationController.service'; -import { StationControllerService } from './stationController.service'; -export * from './userController.service'; -import { UserControllerService } from './userController.service'; -export const APIS = [ClientControllerService, HostControllerService, SensorControllerService, SensorGroupControllerService, ServerControllerService, StationControllerService, UserControllerService]; diff --git a/projects/swagger-client/src/api/clientController.service.ts b/projects/swagger-client/src/api/clientController.service.ts deleted file mode 100644 index 2cb64be..0000000 --- a/projects/swagger-client/src/api/clientController.service.ts +++ /dev/null @@ -1,352 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - *//* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs'; - -import { Client } from '../model/client'; - -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - -@Injectable() -export class ClientControllerService { - - protected basePath = 'http://localhost:8080'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteAllClients(observe?: 'body', reportProgress?: boolean): Observable<any>; - public deleteAllClients(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public deleteAllClients(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public deleteAllClients(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<any>('delete',`${this.basePath}/api/v1/client/delete/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteClient(id: string, observe?: 'body', reportProgress?: boolean): Observable<any>; - public deleteClient(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public deleteClient(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public deleteClient(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling deleteClient.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<any>('delete',`${this.basePath}/api/v1/client/delete/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getAllClients(observe?: 'body', reportProgress?: boolean): Observable<Array<Client>>; - public getAllClients(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Client>>>; - public getAllClients(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Client>>>; - public getAllClients(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Array<Client>>('get',`${this.basePath}/api/v1/client/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getClientById(id: string, observe?: 'body', reportProgress?: boolean): Observable<Client>; - public getClientById(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Client>>; - public getClientById(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Client>>; - public getClientById(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling getClientById.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Client>('get',`${this.basePath}/api/v1/client/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param name - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getClientByName(name: string, observe?: 'body', reportProgress?: boolean): Observable<Client>; - public getClientByName(name: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Client>>; - public getClientByName(name: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Client>>; - public getClientByName(name: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling getClientByName.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Client>('get',`${this.basePath}/api/v1/client/name/${encodeURIComponent(String(name))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public saveClient(body: Client, observe?: 'body', reportProgress?: boolean): Observable<Client>; - public saveClient(body: Client, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Client>>; - public saveClient(body: Client, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Client>>; - public saveClient(body: Client, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling saveClient.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<Client>('post',`${this.basePath}/api/v1/client/add`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updateClient(body: Client, id: string, observe?: 'body', reportProgress?: boolean): Observable<Client>; - public updateClient(body: Client, id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Client>>; - public updateClient(body: Client, id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Client>>; - public updateClient(body: Client, id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updateClient.'); - } - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling updateClient.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<Client>('put',`${this.basePath}/api/v1/client/update/${encodeURIComponent(String(id))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/projects/swagger-client/src/api/hostController.service.ts b/projects/swagger-client/src/api/hostController.service.ts deleted file mode 100644 index 9cc3886..0000000 --- a/projects/swagger-client/src/api/hostController.service.ts +++ /dev/null @@ -1,352 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - *//* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs'; - -import { Host } from '../model/host'; - -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - -@Injectable() -export class HostControllerService { - - protected basePath = 'http://localhost:8080'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public delete1(id: string, observe?: 'body', reportProgress?: boolean): Observable<string>; - public delete1(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>; - public delete1(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>; - public delete1(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling delete1.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<string>('delete',`${this.basePath}/api/v1/host/delete/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteAll1(observe?: 'body', reportProgress?: boolean): Observable<string>; - public deleteAll1(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>; - public deleteAll1(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>; - public deleteAll1(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<string>('delete',`${this.basePath}/api/v1/host/delete/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getAll1(observe?: 'body', reportProgress?: boolean): Observable<Array<Host>>; - public getAll1(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Host>>>; - public getAll1(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Host>>>; - public getAll1(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Array<Host>>('get',`${this.basePath}/api/v1/host/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getById1(id: string, observe?: 'body', reportProgress?: boolean): Observable<Host>; - public getById1(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Host>>; - public getById1(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Host>>; - public getById1(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling getById1.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Host>('get',`${this.basePath}/api/v1/host/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param name - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getByName1(name: string, observe?: 'body', reportProgress?: boolean): Observable<Host>; - public getByName1(name: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Host>>; - public getByName1(name: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Host>>; - public getByName1(name: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling getByName1.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Host>('get',`${this.basePath}/api/v1/host/name/${encodeURIComponent(String(name))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public save1(body: Host, observe?: 'body', reportProgress?: boolean): Observable<Host>; - public save1(body: Host, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Host>>; - public save1(body: Host, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Host>>; - public save1(body: Host, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling save1.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<Host>('post',`${this.basePath}/api/v1/host/add`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public update1(body: Host, id: string, observe?: 'body', reportProgress?: boolean): Observable<Host>; - public update1(body: Host, id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Host>>; - public update1(body: Host, id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Host>>; - public update1(body: Host, id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling update1.'); - } - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling update1.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<Host>('put',`${this.basePath}/api/v1/host/update/${encodeURIComponent(String(id))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/projects/swagger-client/src/api/sensorController.service.ts b/projects/swagger-client/src/api/sensorController.service.ts deleted file mode 100644 index 12c0eb7..0000000 --- a/projects/swagger-client/src/api/sensorController.service.ts +++ /dev/null @@ -1,311 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - *//* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs'; - -import { Sensor } from '../model/sensor'; - -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - -@Injectable() -export class SensorControllerService { - - protected basePath = 'http://localhost:8080'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - - /** - * - * - * @param body - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public addSensor(body: Sensor, observe?: 'body', reportProgress?: boolean): Observable<any>; - public addSensor(body: Sensor, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public addSensor(body: Sensor, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public addSensor(body: Sensor, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addSensor.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<any>('post',`${this.basePath}/api/v1/sensor/add`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteAllSensors(observe?: 'body', reportProgress?: boolean): Observable<any>; - public deleteAllSensors(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public deleteAllSensors(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public deleteAllSensors(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<any>('delete',`${this.basePath}/api/v1/sensor/delete/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteSensor(id: string, observe?: 'body', reportProgress?: boolean): Observable<any>; - public deleteSensor(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public deleteSensor(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public deleteSensor(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling deleteSensor.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<any>('delete',`${this.basePath}/api/v1/sensor/delete/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getAllSensors(observe?: 'body', reportProgress?: boolean): Observable<Array<Sensor>>; - public getAllSensors(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Sensor>>>; - public getAllSensors(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Sensor>>>; - public getAllSensors(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Array<Sensor>>('get',`${this.basePath}/api/v1/sensor/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getSensorById(id: string, observe?: 'body', reportProgress?: boolean): Observable<Sensor>; - public getSensorById(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Sensor>>; - public getSensorById(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Sensor>>; - public getSensorById(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling getSensorById.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Sensor>('get',`${this.basePath}/api/v1/sensor/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updateSensor(body: Sensor, id: string, observe?: 'body', reportProgress?: boolean): Observable<any>; - public updateSensor(body: Sensor, id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public updateSensor(body: Sensor, id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public updateSensor(body: Sensor, id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updateSensor.'); - } - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling updateSensor.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<any>('put',`${this.basePath}/api/v1/sensor/update/${encodeURIComponent(String(id))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/projects/swagger-client/src/api/sensorGroupController.service.ts b/projects/swagger-client/src/api/sensorGroupController.service.ts deleted file mode 100644 index 0332c12..0000000 --- a/projects/swagger-client/src/api/sensorGroupController.service.ts +++ /dev/null @@ -1,352 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - *//* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs'; - -import { SensorGroup } from '../model/sensorGroup'; - -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - -@Injectable() -export class SensorGroupControllerService { - - protected basePath = 'http://localhost:8080'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - - /** - * - * - * @param body - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public addSensorGroup(body: SensorGroup, observe?: 'body', reportProgress?: boolean): Observable<any>; - public addSensorGroup(body: SensorGroup, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public addSensorGroup(body: SensorGroup, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public addSensorGroup(body: SensorGroup, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addSensorGroup.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<any>('post',`${this.basePath}/api/v1/sensor/group/add`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteAllSensorGroups(observe?: 'body', reportProgress?: boolean): Observable<any>; - public deleteAllSensorGroups(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public deleteAllSensorGroups(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public deleteAllSensorGroups(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<any>('delete',`${this.basePath}/api/v1/sensor/group/delete/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteSensorGroup(id: string, observe?: 'body', reportProgress?: boolean): Observable<any>; - public deleteSensorGroup(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public deleteSensorGroup(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public deleteSensorGroup(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling deleteSensorGroup.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<any>('delete',`${this.basePath}/api/v1/sensor/group/delete/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getAllSensorGroups(observe?: 'body', reportProgress?: boolean): Observable<Array<SensorGroup>>; - public getAllSensorGroups(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<SensorGroup>>>; - public getAllSensorGroups(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<SensorGroup>>>; - public getAllSensorGroups(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Array<SensorGroup>>('get',`${this.basePath}/api/v1/sensor/group/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getSensorGroupById(id: string, observe?: 'body', reportProgress?: boolean): Observable<SensorGroup>; - public getSensorGroupById(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<SensorGroup>>; - public getSensorGroupById(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<SensorGroup>>; - public getSensorGroupById(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling getSensorGroupById.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<SensorGroup>('get',`${this.basePath}/api/v1/sensor/group/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param name - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getSensorGroupByName(name: string, observe?: 'body', reportProgress?: boolean): Observable<SensorGroup>; - public getSensorGroupByName(name: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<SensorGroup>>; - public getSensorGroupByName(name: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<SensorGroup>>; - public getSensorGroupByName(name: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling getSensorGroupByName.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<SensorGroup>('get',`${this.basePath}/api/v1/sensor/group/name/${encodeURIComponent(String(name))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updateSensorGroup(body: SensorGroup, id: string, observe?: 'body', reportProgress?: boolean): Observable<any>; - public updateSensorGroup(body: SensorGroup, id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public updateSensorGroup(body: SensorGroup, id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public updateSensorGroup(body: SensorGroup, id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updateSensorGroup.'); - } - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling updateSensorGroup.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<any>('put',`${this.basePath}/api/v1/sensor/group/update/${encodeURIComponent(String(id))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/projects/swagger-client/src/api/serverController.service.ts b/projects/swagger-client/src/api/serverController.service.ts deleted file mode 100644 index 197714b..0000000 --- a/projects/swagger-client/src/api/serverController.service.ts +++ /dev/null @@ -1,329 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - *//* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs'; - -import { Document } from '../model/document'; -import { LevelOneResponse } from '../model/levelOneResponse'; -import { ReadingPayload } from '../model/readingPayload'; - -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - -@Injectable() -export class ServerControllerService { - - protected basePath = 'http://localhost:8080'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - - /** - * Add a reading to the database - * - * @param body - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public addReading(body: ReadingPayload, observe?: 'body', reportProgress?: boolean): Observable<string>; - public addReading(body: ReadingPayload, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>; - public addReading(body: ReadingPayload, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>; - public addReading(body: ReadingPayload, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addReading.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<string>('post',`${this.basePath}/api/v1/server/add`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Delete all readings from database - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteAllReadings(observe?: 'body', reportProgress?: boolean): Observable<string>; - public deleteAllReadings(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>; - public deleteAllReadings(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>; - public deleteAllReadings(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<string>('delete',`${this.basePath}/api/v1/server/delete/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Get level one response for a group id and a time range - * - * @param station - * @param date - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getLevelOneResponseForGroupAndTimeRange(station: string, date: Date, observe?: 'body', reportProgress?: boolean): Observable<LevelOneResponse>; - public getLevelOneResponseForGroupAndTimeRange(station: string, date: Date, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<LevelOneResponse>>; - public getLevelOneResponseForGroupAndTimeRange(station: string, date: Date, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<LevelOneResponse>>; - public getLevelOneResponseForGroupAndTimeRange(station: string, date: Date, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (station === null || station === undefined) { - throw new Error('Required parameter station was null or undefined when calling getLevelOneResponseForGroupAndTimeRange.'); - } - - if (date === null || date === undefined) { - throw new Error('Required parameter date was null or undefined when calling getLevelOneResponseForGroupAndTimeRange.'); - } - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (date !== undefined && date !== null) { - queryParameters = queryParameters.set('date', <any>date.toISOString()); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<LevelOneResponse>('get',`${this.basePath}/api/v1/server/get/lvl1/${encodeURIComponent(String(station))}`, - { - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Get readings by sensor name and error type and time range - * - * @param sensorId - * @param errorType - * @param from - * @param to - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getReadingsBySensorIdAndErrorTypeAndTimeRange(sensorId: string, errorType: string, from: Date, to: Date, observe?: 'body', reportProgress?: boolean): Observable<Array<Document>>; - public getReadingsBySensorIdAndErrorTypeAndTimeRange(sensorId: string, errorType: string, from: Date, to: Date, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Document>>>; - public getReadingsBySensorIdAndErrorTypeAndTimeRange(sensorId: string, errorType: string, from: Date, to: Date, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Document>>>; - public getReadingsBySensorIdAndErrorTypeAndTimeRange(sensorId: string, errorType: string, from: Date, to: Date, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (sensorId === null || sensorId === undefined) { - throw new Error('Required parameter sensorId was null or undefined when calling getReadingsBySensorIdAndErrorTypeAndTimeRange.'); - } - - if (errorType === null || errorType === undefined) { - throw new Error('Required parameter errorType was null or undefined when calling getReadingsBySensorIdAndErrorTypeAndTimeRange.'); - } - - if (from === null || from === undefined) { - throw new Error('Required parameter from was null or undefined when calling getReadingsBySensorIdAndErrorTypeAndTimeRange.'); - } - - if (to === null || to === undefined) { - throw new Error('Required parameter to was null or undefined when calling getReadingsBySensorIdAndErrorTypeAndTimeRange.'); - } - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (sensorId !== undefined && sensorId !== null) { - queryParameters = queryParameters.set('sensorId', <any>sensorId); - } - if (errorType !== undefined && errorType !== null) { - queryParameters = queryParameters.set('errorType', <any>errorType); - } - if (from !== undefined && from !== null) { - queryParameters = queryParameters.set('from', <any>from.toISOString()); - } - if (to !== undefined && to !== null) { - queryParameters = queryParameters.set('to', <any>to.toISOString()); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Array<Document>>('get',`${this.basePath}/api/v1/server/get/sensor/error/range`, - { - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * Get readings by sensor name and time range - * - * @param sensorId - * @param from - * @param to - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getReadingsBySensorIdAndTimeRange(sensorId: string, from: string, to: string, observe?: 'body', reportProgress?: boolean): Observable<Array<Document>>; - public getReadingsBySensorIdAndTimeRange(sensorId: string, from: string, to: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Document>>>; - public getReadingsBySensorIdAndTimeRange(sensorId: string, from: string, to: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Document>>>; - public getReadingsBySensorIdAndTimeRange(sensorId: string, from: string, to: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (sensorId === null || sensorId === undefined) { - throw new Error('Required parameter sensorId was null or undefined when calling getReadingsBySensorIdAndTimeRange.'); - } - - if (from === null || from === undefined) { - throw new Error('Required parameter from was null or undefined when calling getReadingsBySensorIdAndTimeRange.'); - } - - if (to === null || to === undefined) { - throw new Error('Required parameter to was null or undefined when calling getReadingsBySensorIdAndTimeRange.'); - } - - let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); - if (sensorId !== undefined && sensorId !== null) { - queryParameters = queryParameters.set('sensorId', <any>sensorId); - } - if (from !== undefined && from !== null) { - queryParameters = queryParameters.set('from', <any>from); - } - if (to !== undefined && to !== null) { - queryParameters = queryParameters.set('to', <any>to); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Array<Document>>('get',`${this.basePath}/api/v1/server/get/sensor/range`, - { - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/projects/swagger-client/src/api/stationController.service.ts b/projects/swagger-client/src/api/stationController.service.ts deleted file mode 100644 index 6377251..0000000 --- a/projects/swagger-client/src/api/stationController.service.ts +++ /dev/null @@ -1,352 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - *//* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs'; - -import { Station } from '../model/station'; - -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - -@Injectable() -export class StationControllerService { - - protected basePath = 'http://localhost:8080'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public _delete(id: string, observe?: 'body', reportProgress?: boolean): Observable<string>; - public _delete(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>; - public _delete(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>; - public _delete(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling _delete.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<string>('delete',`${this.basePath}/api/v1/station/delete/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteAll(observe?: 'body', reportProgress?: boolean): Observable<string>; - public deleteAll(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>; - public deleteAll(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>; - public deleteAll(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<string>('delete',`${this.basePath}/api/v1/station/delete/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getAll(observe?: 'body', reportProgress?: boolean): Observable<Array<Station>>; - public getAll(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Station>>>; - public getAll(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Station>>>; - public getAll(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Array<Station>>('get',`${this.basePath}/api/v1/station/all`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getById(id: string, observe?: 'body', reportProgress?: boolean): Observable<Station>; - public getById(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Station>>; - public getById(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Station>>; - public getById(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling getById.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Station>('get',`${this.basePath}/api/v1/station/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param name - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getByName(name: string, observe?: 'body', reportProgress?: boolean): Observable<Station>; - public getByName(name: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Station>>; - public getByName(name: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Station>>; - public getByName(name: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling getByName.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<Station>('get',`${this.basePath}/api/v1/station/name/${encodeURIComponent(String(name))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public save(body: Station, observe?: 'body', reportProgress?: boolean): Observable<Station>; - public save(body: Station, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Station>>; - public save(body: Station, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Station>>; - public save(body: Station, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling save.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<Station>('post',`${this.basePath}/api/v1/station/add`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public update(body: Station, id: string, observe?: 'body', reportProgress?: boolean): Observable<Station>; - public update(body: Station, id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Station>>; - public update(body: Station, id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Station>>; - public update(body: Station, id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling update.'); - } - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling update.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<Station>('put',`${this.basePath}/api/v1/station/update/${encodeURIComponent(String(id))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/projects/swagger-client/src/api/userController.service.ts b/projects/swagger-client/src/api/userController.service.ts deleted file mode 100644 index 21455a2..0000000 --- a/projects/swagger-client/src/api/userController.service.ts +++ /dev/null @@ -1,330 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - *//* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; - -import { Observable } from 'rxjs'; - -import { Role } from '../model/role'; -import { UserLoginRequest } from '../model/userLoginRequest'; -import { UserSignUpRequest } from '../model/userSignUpRequest'; - -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; - - -@Injectable() -export class UserControllerService { - - protected basePath = 'http://localhost:8080'; - public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); - - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (basePath) { - this.basePath = basePath; - } - if (configuration) { - this.configuration = configuration; - this.basePath = basePath || configuration.basePath || this.basePath; - } - } - - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - - /** - * - * - * @param body - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public addRole(body: Role, observe?: 'body', reportProgress?: boolean): Observable<any>; - public addRole(body: Role, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public addRole(body: Role, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public addRole(body: Role, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addRole.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<any>('post',`${this.basePath}/api/v1/auth/add/role`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public authenticateUser(body: UserLoginRequest, observe?: 'body', reportProgress?: boolean): Observable<any>; - public authenticateUser(body: UserLoginRequest, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public authenticateUser(body: UserLoginRequest, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public authenticateUser(body: UserLoginRequest, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling authenticateUser.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<any>('post',`${this.basePath}/api/v1/auth/login`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteUser(id: string, observe?: 'body', reportProgress?: boolean): Observable<any>; - public deleteUser(id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public deleteUser(id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public deleteUser(id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling deleteUser.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<any>('delete',`${this.basePath}/api/v1/auth/user/delete/${encodeURIComponent(String(id))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getAllUsers(observe?: 'body', reportProgress?: boolean): Observable<any>; - public getAllUsers(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public getAllUsers(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public getAllUsers(observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - ]; - - return this.httpClient.request<any>('get',`${this.basePath}/api/v1/auth/users`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public registerUser(body: UserSignUpRequest, observe?: 'body', reportProgress?: boolean): Observable<any>; - public registerUser(body: UserSignUpRequest, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public registerUser(body: UserSignUpRequest, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public registerUser(body: UserSignUpRequest, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling registerUser.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<any>('post',`${this.basePath}/api/v1/auth/signup`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - - /** - * - * - * @param body - * @param id - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updateUser(body: UserSignUpRequest, id: string, observe?: 'body', reportProgress?: boolean): Observable<any>; - public updateUser(body: UserSignUpRequest, id: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>; - public updateUser(body: UserSignUpRequest, id: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>; - public updateUser(body: UserSignUpRequest, id: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { - - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling updateUser.'); - } - - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling updateUser.'); - } - - let headers = this.defaultHeaders; - - // to determine the Accept header - let httpHeaderAccepts: string[] = [ - '*/*' - ]; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); - if (httpHeaderAcceptSelected != undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected != undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request<any>('put',`${this.basePath}/api/v1/auth/user/update/${encodeURIComponent(String(id))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - -} diff --git a/projects/swagger-client/src/configuration.ts b/projects/swagger-client/src/configuration.ts deleted file mode 100644 index 82e8458..0000000 --- a/projects/swagger-client/src/configuration.ts +++ /dev/null @@ -1,79 +0,0 @@ -export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; -} - -export class Configuration { - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or <code>undefined</code> if no selection could be made. - */ - public selectHeaderContentType (contentTypes: string[]): string | undefined { - if (contentTypes.length == 0) { - return undefined; - } - - let type = contentTypes.find(x => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } - - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or <code>undefined</code> if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length == 0) { - return undefined; - } - - let type = accepts.find(x => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; - } - return type; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } -} diff --git a/projects/swagger-client/src/encoder.ts b/projects/swagger-client/src/encoder.ts deleted file mode 100644 index 4999a79..0000000 --- a/projects/swagger-client/src/encoder.ts +++ /dev/null @@ -1,19 +0,0 @@ - import { HttpUrlEncodingCodec } from '@angular/common/http'; - -/** -* CustomHttpUrlEncodingCodec -* Fix plus sign (+) not encoding, so sent as blank space -* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318 -*/ -export class CustomHttpUrlEncodingCodec extends HttpUrlEncodingCodec { - override encodeKey(k: string): string { - k = super.encodeKey(k); - return k.replace(/\+/gi, '%2B'); - } - - override encodeValue(v: string): string { - v = super.encodeValue(v); - return v.replace(/\+/gi, '%2B'); - } -} - diff --git a/projects/swagger-client/src/git_push.sh b/projects/swagger-client/src/git_push.sh deleted file mode 100644 index ae01b18..0000000 --- a/projects/swagger-client/src/git_push.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/projects/swagger-client/src/index.ts b/projects/swagger-client/src/index.ts deleted file mode 100644 index c312b70..0000000 --- a/projects/swagger-client/src/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './api/api'; -export * from './model/models'; -export * from './variables'; -export * from './configuration'; -export * from './api.module'; \ No newline at end of file diff --git a/projects/swagger-client/src/lib/swagger-client.component.spec.ts b/projects/swagger-client/src/lib/swagger-client.component.spec.ts deleted file mode 100644 index 96c45ef..0000000 --- a/projects/swagger-client/src/lib/swagger-client.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SwaggerClientComponent } from './swagger-client.component'; - -describe('SwaggerClientComponent', () => { - let component: SwaggerClientComponent; - let fixture: ComponentFixture<SwaggerClientComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ SwaggerClientComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(SwaggerClientComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/swagger-client/src/lib/swagger-client.component.ts b/projects/swagger-client/src/lib/swagger-client.component.ts deleted file mode 100644 index bba34b7..0000000 --- a/projects/swagger-client/src/lib/swagger-client.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'lib-swagger-client', - template: ` - <p> - swagger-client works! - </p> - `, - styles: [ - ] -}) -export class SwaggerClientComponent { - -} diff --git a/projects/swagger-client/src/lib/swagger-client.module.ts b/projects/swagger-client/src/lib/swagger-client.module.ts deleted file mode 100644 index 04de4f8..0000000 --- a/projects/swagger-client/src/lib/swagger-client.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { SwaggerClientComponent } from './swagger-client.component'; - - - -@NgModule({ - declarations: [ - SwaggerClientComponent - ], - imports: [ - ], - exports: [ - SwaggerClientComponent - ] -}) -export class SwaggerClientModule { } diff --git a/projects/swagger-client/src/lib/swagger-client.service.spec.ts b/projects/swagger-client/src/lib/swagger-client.service.spec.ts deleted file mode 100644 index 3b0bdd5..0000000 --- a/projects/swagger-client/src/lib/swagger-client.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { SwaggerClientService } from './swagger-client.service'; - -describe('SwaggerClientService', () => { - let service: SwaggerClientService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(SwaggerClientService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/projects/swagger-client/src/lib/swagger-client.service.ts b/projects/swagger-client/src/lib/swagger-client.service.ts deleted file mode 100644 index 313eada..0000000 --- a/projects/swagger-client/src/lib/swagger-client.service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ - providedIn: 'root' -}) -export class SwaggerClientService { - - constructor() { } -} diff --git a/projects/swagger-client/src/model/avgMinMax.ts b/projects/swagger-client/src/model/avgMinMax.ts deleted file mode 100644 index f88be65..0000000 --- a/projects/swagger-client/src/model/avgMinMax.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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 { ValueWithTimestamp } from './valueWithTimestamp'; - -export interface AvgMinMax { - name?: string; - min?: ValueWithTimestamp; - max?: ValueWithTimestamp; - avg?: number; - sensorType?: AvgMinMax.SensorTypeEnum; - isSensorGroup?: boolean; -} -export namespace AvgMinMax { - export type SensorTypeEnum = 'PRECIPITATION' | 'SOLAR_RADIATION' | 'SOIL_MOISTURE' | 'SOIL_TEMPERATURE' | 'AIR_HUMIDITY' | 'AIR_TEMPERATURE' | 'DENDROMETER'; - export const SensorTypeEnum = { - PRECIPITATION: 'PRECIPITATION' as SensorTypeEnum, - SOLARRADIATION: 'SOLAR_RADIATION' as SensorTypeEnum, - SOILMOISTURE: 'SOIL_MOISTURE' as SensorTypeEnum, - SOILTEMPERATURE: 'SOIL_TEMPERATURE' as SensorTypeEnum, - AIRHUMIDITY: 'AIR_HUMIDITY' as SensorTypeEnum, - AIRTEMPERATURE: 'AIR_TEMPERATURE' as SensorTypeEnum, - DENDROMETER: 'DENDROMETER' as SensorTypeEnum - }; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/client.ts b/projects/swagger-client/src/model/client.ts deleted file mode 100644 index ddbedf2..0000000 --- a/projects/swagger-client/src/model/client.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface Client { - id?: string; - name?: string; - mac?: string; - description?: string; - connectionType?: string; - sensors?: Array<string>; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/dendrometerValue.ts b/projects/swagger-client/src/model/dendrometerValue.ts deleted file mode 100644 index 10191f2..0000000 --- a/projects/swagger-client/src/model/dendrometerValue.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface DendrometerValue { - timestamp?: Date; - value?: number; - fluctuationType?: DendrometerValue.FluctuationTypeEnum; -} -export namespace DendrometerValue { - export type FluctuationTypeEnum = 'CONTRACTION' | 'EXPANSION' | 'STEM_RADIUS_INCREASE' | 'STEM_RADIUS_STABLE'; - export const FluctuationTypeEnum = { - CONTRACTION: 'CONTRACTION' as FluctuationTypeEnum, - EXPANSION: 'EXPANSION' as FluctuationTypeEnum, - STEMRADIUSINCREASE: 'STEM_RADIUS_INCREASE' as FluctuationTypeEnum, - STEMRADIUSSTABLE: 'STEM_RADIUS_STABLE' as FluctuationTypeEnum - }; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/document.ts b/projects/swagger-client/src/model/document.ts deleted file mode 100644 index 09ea815..0000000 --- a/projects/swagger-client/src/model/document.ts +++ /dev/null @@ -1,18 +0,0 @@ -// @ts-ignore -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ -// @ts-ignore -export interface Document extends null<String, any> { - [key: string]: any; - - -} diff --git a/projects/swagger-client/src/model/host.ts b/projects/swagger-client/src/model/host.ts deleted file mode 100644 index 90a9dfb..0000000 --- a/projects/swagger-client/src/model/host.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface Host { - id?: string; - name?: string; - simId?: string; - mac?: string; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/levelOneResponse.ts b/projects/swagger-client/src/model/levelOneResponse.ts deleted file mode 100644 index a64c291..0000000 --- a/projects/swagger-client/src/model/levelOneResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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 { AvgMinMax } from './avgMinMax'; -import { SumOrAvg } from './sumOrAvg'; -import { ThreePhaseDendrometer } from './threePhaseDendrometer'; - -export interface LevelOneResponse { - sumOrAvg?: Array<SumOrAvg>; - avgMinMax?: Array<AvgMinMax>; - threePhaseDendrometer?: Array<ThreePhaseDendrometer>; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/location.ts b/projects/swagger-client/src/model/location.ts deleted file mode 100644 index 5646ae6..0000000 --- a/projects/swagger-client/src/model/location.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface Location { - latitude?: number; - longitude?: number; - altitude?: number; - comment?: string; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/measurement.ts b/projects/swagger-client/src/model/measurement.ts deleted file mode 100644 index d40799e..0000000 --- a/projects/swagger-client/src/model/measurement.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface Measurement { - name?: string; - type?: string; - maxValue?: number; - minValue?: number; - unit?: string; - comment?: string; - precision?: number; - maxReadoutDifference?: number; - maxFrozenTimeInSeconds?: number; - maxRateOfChange?: number; - minVariationCoefficient?: number; - latitude?: number; - longitude?: number; - standardMeridianLongitude?: number; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/models.ts b/projects/swagger-client/src/model/models.ts deleted file mode 100644 index b5590a7..0000000 --- a/projects/swagger-client/src/model/models.ts +++ /dev/null @@ -1,19 +0,0 @@ -export * from './avgMinMax'; -export * from './client'; -export * from './dendrometerValue'; -export * from './document'; -export * from './host'; -export * from './levelOneResponse'; -export * from './location'; -export * from './measurement'; -export * from './readingPayload'; -export * from './readingValue'; -export * from './role'; -export * from './sensor'; -export * from './sensorGroup'; -export * from './station'; -export * from './sumOrAvg'; -export * from './threePhaseDendrometer'; -export * from './userLoginRequest'; -export * from './userSignUpRequest'; -export * from './valueWithTimestamp'; diff --git a/projects/swagger-client/src/model/readingPayload.ts b/projects/swagger-client/src/model/readingPayload.ts deleted file mode 100644 index 51f7edc..0000000 --- a/projects/swagger-client/src/model/readingPayload.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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 { ReadingValue } from './readingValue'; - -export interface ReadingPayload { - host?: string; - client?: string; - sensorProtocol?: string; - protocolAddress?: string; - hardwareName?: string; - readings?: Array<ReadingValue>; - timestamp?: number; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/readingValue.ts b/projects/swagger-client/src/model/readingValue.ts deleted file mode 100644 index e489fad..0000000 --- a/projects/swagger-client/src/model/readingValue.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface ReadingValue { - name?: ReadingValue.NameEnum; - value?: number; -} -export namespace ReadingValue { - export type NameEnum = 'PRECIPITATION' | 'SOLAR_RADIATION' | 'SOIL_MOISTURE' | 'SOIL_TEMPERATURE' | 'AIR_HUMIDITY' | 'AIR_TEMPERATURE' | 'DENDROMETER'; - export const NameEnum = { - PRECIPITATION: 'PRECIPITATION' as NameEnum, - SOLARRADIATION: 'SOLAR_RADIATION' as NameEnum, - SOILMOISTURE: 'SOIL_MOISTURE' as NameEnum, - SOILTEMPERATURE: 'SOIL_TEMPERATURE' as NameEnum, - AIRHUMIDITY: 'AIR_HUMIDITY' as NameEnum, - AIRTEMPERATURE: 'AIR_TEMPERATURE' as NameEnum, - DENDROMETER: 'DENDROMETER' as NameEnum - }; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/role.ts b/projects/swagger-client/src/model/role.ts deleted file mode 100644 index 4386c65..0000000 --- a/projects/swagger-client/src/model/role.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface Role { - id?: string; - name?: Role.NameEnum; -} -export namespace Role { - export type NameEnum = 'ROLE_USER' | 'ROLE_MANAGER' | 'ROLE_ADMIN'; - export const NameEnum = { - USER: 'ROLE_USER' as NameEnum, - MANAGER: 'ROLE_MANAGER' as NameEnum, - ADMIN: 'ROLE_ADMIN' as NameEnum - }; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/sensor.ts b/projects/swagger-client/src/model/sensor.ts deleted file mode 100644 index a3a2146..0000000 --- a/projects/swagger-client/src/model/sensor.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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 { Measurement } from './measurement'; - -export interface Sensor { - id?: string; - name?: string; - protocol?: string; - protocolAddress?: string; - hardwareName?: string; - uniqueHardwareName?: string; - description?: string; - measurements?: Array<Measurement>; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/sensorGroup.ts b/projects/swagger-client/src/model/sensorGroup.ts deleted file mode 100644 index f2075c6..0000000 --- a/projects/swagger-client/src/model/sensorGroup.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface SensorGroup { - id?: string; - name?: string; - sensors?: Array<string>; - station?: string; - sensorType?: SensorGroup.SensorTypeEnum; -} -export namespace SensorGroup { - export type SensorTypeEnum = 'PRECIPITATION' | 'SOLAR_RADIATION' | 'SOIL_MOISTURE' | 'SOIL_TEMPERATURE' | 'AIR_HUMIDITY' | 'AIR_TEMPERATURE' | 'DENDROMETER'; - export const SensorTypeEnum = { - PRECIPITATION: 'PRECIPITATION' as SensorTypeEnum, - SOLARRADIATION: 'SOLAR_RADIATION' as SensorTypeEnum, - SOILMOISTURE: 'SOIL_MOISTURE' as SensorTypeEnum, - SOILTEMPERATURE: 'SOIL_TEMPERATURE' as SensorTypeEnum, - AIRHUMIDITY: 'AIR_HUMIDITY' as SensorTypeEnum, - AIRTEMPERATURE: 'AIR_TEMPERATURE' as SensorTypeEnum, - DENDROMETER: 'DENDROMETER' as SensorTypeEnum - }; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/station.ts b/projects/swagger-client/src/model/station.ts deleted file mode 100644 index 5889acb..0000000 --- a/projects/swagger-client/src/model/station.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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 { Location } from './location'; - -export interface Station { - id?: string; - name?: string; - location?: Location; - createdDate?: Date; - updatedDate?: Date; - host?: string; - clients?: Array<string>; - diary?: string; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/sumOrAvg.ts b/projects/swagger-client/src/model/sumOrAvg.ts deleted file mode 100644 index 8fcb0b2..0000000 --- a/projects/swagger-client/src/model/sumOrAvg.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface SumOrAvg { - type?: SumOrAvg.TypeEnum; - name?: string; - value?: number; - sensorType?: SumOrAvg.SensorTypeEnum; - isSensorGroup?: boolean; -} -export namespace SumOrAvg { - export type TypeEnum = 'SUM' | 'AVG'; - export const TypeEnum = { - SUM: 'SUM' as TypeEnum, - AVG: 'AVG' as TypeEnum - }; - export type SensorTypeEnum = 'PRECIPITATION' | 'SOLAR_RADIATION' | 'SOIL_MOISTURE' | 'SOIL_TEMPERATURE' | 'AIR_HUMIDITY' | 'AIR_TEMPERATURE' | 'DENDROMETER'; - export const SensorTypeEnum = { - PRECIPITATION: 'PRECIPITATION' as SensorTypeEnum, - SOLARRADIATION: 'SOLAR_RADIATION' as SensorTypeEnum, - SOILMOISTURE: 'SOIL_MOISTURE' as SensorTypeEnum, - SOILTEMPERATURE: 'SOIL_TEMPERATURE' as SensorTypeEnum, - AIRHUMIDITY: 'AIR_HUMIDITY' as SensorTypeEnum, - AIRTEMPERATURE: 'AIR_TEMPERATURE' as SensorTypeEnum, - DENDROMETER: 'DENDROMETER' as SensorTypeEnum - }; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/threePhaseDendrometer.ts b/projects/swagger-client/src/model/threePhaseDendrometer.ts deleted file mode 100644 index c38d745..0000000 --- a/projects/swagger-client/src/model/threePhaseDendrometer.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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 { DendrometerValue } from './dendrometerValue'; - -export interface ThreePhaseDendrometer { - name?: string; - readings?: Array<DendrometerValue>; - isSensorGroup?: boolean; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/userLoginRequest.ts b/projects/swagger-client/src/model/userLoginRequest.ts deleted file mode 100644 index 3a5f441..0000000 --- a/projects/swagger-client/src/model/userLoginRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface UserLoginRequest { - username: string; - password: string; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/userSignUpRequest.ts b/projects/swagger-client/src/model/userSignUpRequest.ts deleted file mode 100644 index 15c8ee7..0000000 --- a/projects/swagger-client/src/model/userSignUpRequest.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface UserSignUpRequest { - username: string; - email: string; - password: string; - roles?: Array<string>; -} \ No newline at end of file diff --git a/projects/swagger-client/src/model/valueWithTimestamp.ts b/projects/swagger-client/src/model/valueWithTimestamp.ts deleted file mode 100644 index 52e03b3..0000000 --- a/projects/swagger-client/src/model/valueWithTimestamp.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * 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. - */ - -export interface ValueWithTimestamp { - value?: number; - timestamp?: Date; -} \ No newline at end of file diff --git a/projects/swagger-client/src/ng-package.json b/projects/swagger-client/src/ng-package.json deleted file mode 100644 index 3b17900..0000000 --- a/projects/swagger-client/src/ng-package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "./node_modules/ng-packagr/ng-package.schema.json", - "lib": { - "entryFile": "index.ts" - } -} diff --git a/projects/swagger-client/src/public-api.ts b/projects/swagger-client/src/public-api.ts deleted file mode 100644 index 65fc998..0000000 --- a/projects/swagger-client/src/public-api.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Public API Surface of swagger-client - */ - -export * from './lib/swagger-client.service'; -export * from './lib/swagger-client.component'; -export * from './lib/swagger-client.module'; diff --git a/projects/swagger-client/src/variables.ts b/projects/swagger-client/src/variables.ts deleted file mode 100644 index 6fe5854..0000000 --- a/projects/swagger-client/src/variables.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { InjectionToken } from '@angular/core'; - -export const BASE_PATH = new InjectionToken<string>('basePath'); -export const COLLECTION_FORMATS = { - 'csv': ',', - 'tsv': ' ', - 'ssv': ' ', - 'pipes': '|' -} diff --git a/projects/swagger-client/tsconfig.lib.json b/projects/swagger-client/tsconfig.lib.json deleted file mode 100644 index 543fd47..0000000 --- a/projects/swagger-client/tsconfig.lib.json +++ /dev/null @@ -1,14 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/lib", - "declaration": true, - "declarationMap": true, - "inlineSources": true, - "types": [] - }, - "exclude": [ - "**/*.spec.ts" - ] -} diff --git a/projects/swagger-client/tsconfig.lib.prod.json b/projects/swagger-client/tsconfig.lib.prod.json deleted file mode 100644 index 06de549..0000000 --- a/projects/swagger-client/tsconfig.lib.prod.json +++ /dev/null @@ -1,10 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "./tsconfig.lib.json", - "compilerOptions": { - "declarationMap": false - }, - "angularCompilerOptions": { - "compilationMode": "partial" - } -} diff --git a/projects/swagger-client/tsconfig.spec.json b/projects/swagger-client/tsconfig.spec.json deleted file mode 100644 index ce7048b..0000000 --- a/projects/swagger-client/tsconfig.spec.json +++ /dev/null @@ -1,14 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": [ - "jasmine" - ] - }, - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -} diff --git a/src/app/app.component.html b/src/app/app.component.html index 8f1fd9f..70e3b6e 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,2 +1,2 @@ -<router-outlet name="main"></router-outlet> +<app-pro-view></app-pro-view> diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 56e3c9a..5f44497 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -3,7 +3,6 @@ import {Router} from "@angular/router"; import { NavigationEnd } from '@angular/router'; import {AuthService} from "./shared/auth/auth.service"; import {EventEmitterService} from "./shared/event.emitter.service"; -import {UserControllerService} from "../../projects/swagger-client/src"; @Component({ selector: 'app-root', diff --git a/src/app/app.module.ts b/src/app/app.module.ts index f1cbc19..d1dd9c7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -31,19 +31,18 @@ import {CjsTimline} from "./module/components/charts/Cjs-timeline/light-chart.co import { ProViewComponent } from './module/components/pro-view/pro-view.component'; import {MatAutocompleteModule} from "@angular/material/autocomplete"; import {MatCheckboxModule} from "@angular/material/checkbox"; -import {ApiModule} from "../../projects/swagger-client/src"; import { InterceptorService } from './shared/auth/interceptor.service'; import {CjsTimelineMultiple} from "./module/components/charts/Cjs-timeline-multiple/light-chart.component"; import {MatButtonModule} from "@angular/material/button"; import { ThermometerComponent } from './module/components/customUX/thermometer/thermometer.component'; import { HomeComponent } from './module/pages/home/home.component'; -import {ServerControllerService} from "../../projects/generated-api/src"; import { LoginTailwindcssComponent } from './module/pages/login/login.component'; import { SummaryList } from './module/components/summaryList/summaryList'; import {FontAwesomeModule} from "@fortawesome/angular-fontawesome"; import { SliderComponent } from './module/components/customUX/slider/slider.component'; import {MatSliderModule} from "@angular/material/slider"; import {MatCardModule} from "@angular/material/card"; +import {ApiModule} from "../../projects/generated-api/src"; @NgModule({ declarations: [ @@ -87,13 +86,14 @@ import {MatCardModule} from "@angular/material/card"; MatNativeDateModule, MatAutocompleteModule, MatCheckboxModule, - ApiModule, MatButtonModule, + ApiModule, FontAwesomeModule, MatSliderModule, MatCardModule, ], - providers: [EventEmitterService,{provide:HTTP_INTERCEPTORS,useClass:InterceptorService,multi:true},ServerControllerService], + //Todo remove old swagger client + providers: [EventEmitterService,{provide:HTTP_INTERCEPTORS,useClass:InterceptorService,multi:true}], bootstrap: [AppComponent], }) export class AppModule { diff --git a/src/app/core/service/level1/AvgMinMax.ts b/src/app/core/service/level1/AvgMinMax.ts deleted file mode 100644 index 83817cd..0000000 --- a/src/app/core/service/level1/AvgMinMax.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {Limit} from "./Limit"; - -export interface AvgMinMax{ - "name": String, - "min": Limit, - "max": Limit, - "avg": 0, - "sensorType": String, - "isSensorGroup": boolean -} diff --git a/src/app/core/service/level1/Limit.ts b/src/app/core/service/level1/Limit.ts deleted file mode 100644 index ce18fb8..0000000 --- a/src/app/core/service/level1/Limit.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface Limit{ - "value":Number, - "timestamp":String -} diff --git a/src/app/core/service/level1/Lv1.ts b/src/app/core/service/level1/Lv1.ts deleted file mode 100644 index b04c87e..0000000 --- a/src/app/core/service/level1/Lv1.ts +++ /dev/null @@ -1,9 +0,0 @@ -import {SumOrAvg} from "./SumOrAvg"; -import {AvgMinMax} from "./AvgMinMax"; -import {ThreePhaseDendrometer} from "./ThreePhaseDendrometer"; - -export interface Lv1{ - sumOrAvg:SumOrAvg[], - avgMinMax:AvgMinMax[] - threePhaseDendrometer:ThreePhaseDendrometer -} diff --git a/src/app/core/service/level1/Readings.ts b/src/app/core/service/level1/Readings.ts deleted file mode 100644 index 5a25f76..0000000 --- a/src/app/core/service/level1/Readings.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface Readings{ - timestamp: Date, - value: Number, - fluctuationType: String -} diff --git a/src/app/core/service/level1/SumOrAvg.ts b/src/app/core/service/level1/SumOrAvg.ts deleted file mode 100644 index 01efe61..0000000 --- a/src/app/core/service/level1/SumOrAvg.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface SumOrAvg{ - "type": String, - "name": String, - "value": Number, - "sensorType": String, - "isSensorGroup": boolean -} diff --git a/src/app/core/service/level1/ThreePhaseDendrometer.ts b/src/app/core/service/level1/ThreePhaseDendrometer.ts deleted file mode 100644 index 0ec33fe..0000000 --- a/src/app/core/service/level1/ThreePhaseDendrometer.ts +++ /dev/null @@ -1,6 +0,0 @@ -import {Readings} from "./Readings"; - -export interface ThreePhaseDendrometer{ - name: String, - readings:Readings[] -} diff --git a/src/app/module/components/charts/Cjs-timeline/light-chart.component.ts b/src/app/module/components/charts/Cjs-timeline/light-chart.component.ts index 73be206..63dd9dc 100644 --- a/src/app/module/components/charts/Cjs-timeline/light-chart.component.ts +++ b/src/app/module/components/charts/Cjs-timeline/light-chart.component.ts @@ -1,6 +1,6 @@ import {Component, ElementRef, Input, OnChanges, OnInit, ViewChild} from '@angular/core'; import {Chart} from "chart.js/auto"; -import {ThreePhaseDendrometer} from "../../../../core/service/level1/ThreePhaseDendrometer"; +import {ThreePhaseDendrometer} from "../../../../../../projects/generated-api/src" import {DatePipe} from "@angular/common"; import {LogLevel, MyLoggerServiceService} from "../../../../shared/service/my-logger-service.service"; diff --git a/src/app/module/components/pro-view/pro-view.component.html b/src/app/module/components/pro-view/pro-view.component.html index ef86952..2ef9cd2 100644 --- a/src/app/module/components/pro-view/pro-view.component.html +++ b/src/app/module/components/pro-view/pro-view.component.html @@ -11,8 +11,7 @@ aria-label="Number" matInput [formControl]="stationControl" - [matAutocomplete]="auto1" - (ngModelChange)="checkSelect(stationControl,$event)"> + [matAutocomplete]="auto1"> <mat-error *ngIf="stationControl.hasError('invalid')">This Station does not exists</mat-error> <mat-autocomplete #auto1="matAutocomplete"> @@ -32,7 +31,7 @@ <mat-form-field> <mat-select placeholder="Sensors" [formControl]="sensorControl" multiple - (selectionChange)="onSelectionChange2($event.value)"> + (selectionChange)="onSelectionChangeSensor()"> <mat-option *ngFor="let topping of availableSensors" [value]="topping">{{topping}} </mat-option> </mat-select> </mat-form-field> @@ -56,7 +55,7 @@ <div class=""> <section class=" h-full w-full flex items-center rounded-2xl"> - <button class="w-full h-full" mat-raised-button color="primary" (click)="downloadCSV4()">Download Data + <button class="w-full h-full" mat-raised-button color="primary" (click)="downloadCSV()">Download Data <mat-icon>download</mat-icon> </button> </section> diff --git a/src/app/module/components/pro-view/pro-view.component.ts b/src/app/module/components/pro-view/pro-view.component.ts index 9e78848..6c727d4 100644 --- a/src/app/module/components/pro-view/pro-view.component.ts +++ b/src/app/module/components/pro-view/pro-view.component.ts @@ -1,18 +1,16 @@ -import {Component, ElementRef} from '@angular/core'; +import {Component, OnDestroy, OnInit} from '@angular/core'; import {FormControl, FormGroup} from '@angular/forms'; -import {Observable} from 'rxjs'; +import { Observable, takeUntil} from 'rxjs'; import {map, startWith} from 'rxjs/operators'; -import { - ClientControllerService, - HostControllerService, SensorControllerService, - Station, - StationControllerService -} from "../../../../../projects/swagger-client/src"; import {DatePipe} from "@angular/common"; import {LogLevel, MyLoggerServiceService} from "../../../shared/service/my-logger-service.service"; -import {ThreePhaseDendrometer} from "../../../core/service/level1/ThreePhaseDendrometer"; + import {HttpClient} from "@angular/common/http"; +import {ClientControllerService,HostControllerService, SensorControllerService, + Station, + StationControllerService,ThreePhaseDendrometer} from "../../../../../projects/generated-api/src"; +import {UnsubscribeOnDestroy} from "../../../shared/unsubscribeOnDestroy.class"; @Component({ selector: 'app-pro-view', @@ -20,57 +18,32 @@ import {HttpClient} from "@angular/common/http"; styleUrls: ['./pro-view.component.scss'], providers: [DatePipe] }) -export class ProViewComponent { +export class ProViewComponent extends UnsubscribeOnDestroy implements OnInit,OnDestroy{ + //Naming the chart for Chart.js to be able to find it chartId_dendrometer:string="dendrometer" chartId_chartAll:string="chartAll" + + //Form Controls stationControl = new FormControl(''); - availableStation: string[] = ['One', 'Two', 'Three']; - availableSensors: string[] = []; - filteredStation!: Observable<string[]>; sensorControl = new FormControl(); hostClientControl = new FormControl(); - availableHostClients: string[] = ['host','station']; - availableHostClientsO:checkHostsStation[]=[] - - isDendrometer:boolean=false; - threePhaseDendromete!:ThreePhaseDendrometer - selected: string[] = [] - - selectedHostClient:string[]=[] - - - t_string:string[]=['Apple','Banana','Ribisel'] - t_control= new FormControl(); - t_filterdString!: Observable<string[]>; -t_bool:boolean=true - t_control2=new FormControl; - isFocused = false; - menuOpen=false; - onFocus() { - this.isFocused = true; - } - - onBlur() { - setTimeout(() => { - // this.isFocused = false; - }, 9000); - } - - onBlurDropdown(){ - this.menuOpen=false; - alert("hsjd"); - } - range = new FormGroup({ start: new FormControl<Date | null>(null), end: new FormControl<Date | null>(null), }) + //Variables to Store Data + availableStation: string[] = ['no Station Available']; + availableSensors: string[] = []; + filteredStation!: Observable<string[]>; + availableHostClientsO:checkHostsStation[]=[] + isDendrometer:boolean=false; + threePhaseDendromete!:ThreePhaseDendrometer sensorData:SensorData[]=[] sensorDataArray:[SensorData[]]=[[]] - showDendrometer:boolean=this.isDendrometer&&this.sensorControl.value?.length==1 station!: Observable<Array<Station>>; + constructor(private stationControllerService: StationControllerService,private hostControllerService:HostControllerService, private clientControllerService:ClientControllerService, private sensorControllerService:SensorControllerService, @@ -78,187 +51,192 @@ t_bool:boolean=true private logger:MyLoggerServiceService, private http:HttpClient ) { + super() //have to call super() to call the constructor of the parent class this.logger.setLevel(LogLevel.LOG) this.logger.setTopic("ProViewInputParent") } ngOnInit() { - //If Date Input changes than call Selected Method - this.range.valueChanges.subscribe((value) => { - this.onSelectionChange2([]) - }) - - - this.station = this.stationControllerService.getAll() - this.station.subscribe(x => { - this.logger.info('available station', x); - this.availableStation=x.map(x=>x.id!==undefined ?x.id:"No station avalable") - this.filteredStation = this.stationControl.valueChanges.pipe( - startWith(''), - map(value => this._filterS(this.availableStation,value || '')), - ); - }); + //GET all available stations + this.stationControllerService.getAll().pipe(takeUntil(this.unsubscribe$)) //unsubscribe from all subscriptions when component is destroyed + .subscribe({ + next: data => { //data assign to availableStation + this.logger.info('available station', data); + this.availableStation = data.map(x => x.id !== undefined ? x.id : "No station avalable"); + }, + complete: () => { //when complete, create a filter for the station input + this.filteredStation = this.stationControl.valueChanges.pipe( + startWith(''), + map(value => this._filterS(this.availableStation, value || '')), + );} + }); - this.t_filterdString=this.t_control.valueChanges.pipe( - startWith(''), - map(value => this._filterS(this.t_string,value || '')), - ) + //Subscribe: to Date Input ,if any change call onSelectionChange2 + this.range.valueChanges.pipe(takeUntil(this.unsubscribe$)).subscribe(() => { + this.onSelectionChangeSensor() + }) - this.stationControl.valueChanges.subscribe( + //Subscribe: to Station Input ,if any change call API to get all available clientsHosts for this station + this.stationControl.valueChanges.pipe(takeUntil(this.unsubscribe$)).subscribe( x=> { - this.logger.debug("StationInput new value", x) + //GET all available HostsClients for this station + this.stationControllerService.getById(x ?? "").subscribe({ + next: (response) => { + response.clients?.forEach((client) => + this.availableHostClientsO.push({ isHost: false, value: client }) + ); + }, + error: () => { + this.logger.info("StationInput error", this.availableHostClientsO = []); + }, + }); + + this.logger.debug("StationInput new value", x) + this.logger.debug("Available HostClients", this.availableHostClientsO) - this.stationControllerService.getById(x??"").subscribe( - x => x.clients?.forEach(x=>this.availableHostClientsO.push({isHost:false,value:x})), - error => this.logger.info("StationInput error",this.availableHostClientsO=[]), - ) }) + } + //**********************Helper-FUNCTIONS******************************************************************************************************************** + //create a filter for the station input field, "a" => "a","ab" ,"abc" + private _filterS(opt:string[],value: string): string[] { + const filterValue = value.toLowerCase(); //current value of the input field to lower case + return opt.filter(option => option.toLowerCase().includes(filterValue)); //return all options that include the current value + } - } - - - private _filterS(opt:string[],value: string): string[] { - const filterValue = value.toLowerCase(); - return opt.filter(option => option.toLowerCase().includes(filterValue)); - } - - checkSelect(formControl:FormControl ,value: string) { - if (!this.availableStation.includes(value)) { - formControl.setErrors({'invalid': true}); - } else { - formControl.setErrors(null); - } - } - - convertToCSV(data: any[]){ - const rows = []; - - // Create the header row - const header = Object.keys(data[0]).join(','); - rows.push(header); - - // Create the data rows - data.forEach(item => { - const row = Object.values(item).join(','); - rows.push(row); - }); - const csv = rows.join('\n'); + convertToCSV(data: any[]){ + const rows = []; - return csv; - } + // Create the header row + //[{timestamp:timestamp, sensorname1:value1,sensorname2:value2},{timestamp:12:01, Tsoil_12:23,Temp_2:31},...] + //=>Just get the keys timestamp,sensorname1,sensorname2 ,timestamp, Tsoil_12,Temp_2 + const header = Object.keys(data[0]).join(','); + rows.push(header); - downloadCSV4() { - // Use the first timestamp in each array of sensorDataArray as the timestamp for each rowss - const timestamps = this.sensorDataArray.at(1)?.map(data => data.timestamp?? '')??[]; - this.logger.debug("timestamp csv4",timestamps) - const sensorData: any[] = []; - this.sensorDataArray.forEach((sD)=>{ - sensorData.push( sD.map(data => ({ - timestamp: data.timestamp, - [data.sensorName]: data.readings.map(reading => reading.value), - })) ); - }) - this.logger.debug("sensodata csv",sensorData) - let transformedData = timestamps.map((timestamp) => ({ - timestamp: timestamp - })); - for (let i = 1; i < sensorData.length; i++) { - transformedData= transformedData.map((obj, ii) => { - return { ...obj, ...sensorData[i][ii] }; - }); - } + // Create the data rows + //=>Just get the values timestamp,value1,value2 ,timestamp, 23,31 + data.forEach(item => { + const row = Object.values(item).join(','); + rows.push(row); + }); + const csv = rows.join('\n'); - this.logger.debug("transformedData/merged timestamo<->Sensordata",transformedData) - const csv = this.convertToCSV(transformedData); - const blob = new Blob([csv], { type: 'text/csv' }); - const url = window.URL.createObjectURL(blob); - // Create a link element and click it to trigger the download - const a = document.createElement('a'); - a.style.display = 'none'; - a.href = url; - a.download = 'forte-sensor-data.csv'; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - } + return csv; + } + downloadCSV() { + // Use the first timestamp in each array of sensorDataArray as the timestamp for each rows [12:00, 12:01, 12:02, ...] + const timestamps = this.sensorDataArray.at(1)?.map(data => data.timestamp?? '')??[]; + this.logger.debug("timestamp csv4",timestamps) + const sensorData: any[] = []; + //Get the selected sensorData and map it to the csv format [],[{timestamp:timestamp, sensorname:value}],[{timestamp:12:01, sensorname:Tsoil_12}] + this.sensorDataArray.forEach((sD)=>{ + sensorData.push( sD.map(data => ({ + timestamp: data.timestamp, + [data.sensorName]: data.readings.map(reading => reading.value), + })) ); + }) + this.logger.debug("sensodata csv",sensorData) + //Build it together 1) add timestamp each row [{timestamp:12:00},{timestamp:12:01},{timestamp:12:02},...] + let transformedData = timestamps.map((timestamp) => ({ + timestamp: timestamp + })); + //Build it together 2) Merge each row timestamp + ...sensorname:value [{timestamp:timestamp, sensorname:value,sensorname:value},{timestamp:12:01, Tsoil_12:23,Temp_2:31},...] + this.logger.debug("transformedData/merged timestamp",transformedData) + for (let i = 1; i < sensorData.length; i++) { + transformedData= transformedData.map((obj, ii) => { + return { ...obj, ...sensorData[i][ii] }; + }); + } + this.logger.debug("transformedData/merged timestamo<->Sensordata",transformedData) + const csv = this.convertToCSV(transformedData); + const blob = new Blob([csv], { type: 'text/csv' }); + const url = window.URL.createObjectURL(blob); + // Create a link element and click it to trigger the download + const a = document.createElement('a'); + a.style.display = 'none'; + a.href = url; + a.download = 'forte-sensor-data.csv'; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + } - onSelectionChangeClientHostInput(event: checkHostsStation[]) { - //set all available Sensors to none - this.availableSensors=[] - //GET the available sensors from the selected Client/Host Input - if (event && event.length >= 1) { - event.forEach(x=>{ - if(x.isHost){} - //if it is not a host it has to be a client - else{ - this.clientControllerService.getClientById(x.value??'').subscribe( - s=>{ - //save the available sensors in an array which will be displayed in the sensorInput - this.availableSensors=[...this.availableSensors,...s.sensors??""] - } - ) + onSelectionChangeClientHostInput(event: checkHostsStation[]) { + //set all available Sensors to none + this.availableSensors=[] + + //GET the available sensors from the selected Client/Host Input + if (event && event.length >= 1) { + event.forEach(x=>{ + if(x.isHost){} + //if it is not a host it has to be a client + else{ + this.clientControllerService.getClientById(x.value??'').subscribe( + s=>{ + //save the available sensors in an array which will be displayed in the sensorInput + this.availableSensors=[...this.availableSensors,...s.sensors??""] + } + ) + } + this.logger.info("Client/Host Input all available Sensors",this.availableSensors) + }) + } } - this.logger.info("Client/Host Input all available Sensors",this.availableSensors) - }) - } - } - onSelectionChange2(event: string[]) { - //set all data for each selection to emtpy - this.sensorData=[] - this.sensorDataArray=[[]] - let sensor_dend:String="ddm_id_1" - //convert the inputDate to Date for API - let datePipe = new DatePipe('en-US'); - let dateStart = datePipe.transform(this.range.value.start, 'dd-MM-yyyyTHH:mm:ss'); - let dateEnd = datePipe.transform(this.range.value.end, 'dd-MM-yyyyTHH:mm:ss'); - this.logger.info("DatenInptut",dateStart,"to",dateEnd) - this.isDendrometer=false; - //just call the api if at least 1 client is selected - if (this.sensorControl.value && this.sensorControl.value.length >= 1) { - console.log("sensors",this.sensorControl.value) - let s_id:String=this.sensorControl.value[0] - this.sensorControllerService.getSensorById(s_id+"").subscribe( - s=>{ - this.logger.info("GET sensorsssssssssssssssss",s) - this.logger.info("GET sensor type",s.measurements?.at(0)?.type) - if (s.measurements?.at(0)?.type=="CIRCUMFERENCE_INCREMENT"){ - this.isDendrometer=true - sensor_dend=s_id - console.log("is dendrometer hereeeeeeeeeee",sensor_dend) - this.http.get("http://localhost:8080/api/v1/server/get/dendrometer/range?"+ - "sensorId="+sensor_dend+ - "&from="+dateStart+ - "&to="+dateEnd).subscribe( - // @ts-ignore - x=>this.logger.info("dendrometersssssssssssssssss",this.threePhaseDendromete=x)) + onSelectionChangeSensor() { + //set all data for each selection to emtpy + this.sensorData=[] + this.sensorDataArray=[[]] + let sensor_dend:String="ddm_id_1" + //convert the inputDate to Date for API + let datePipe = new DatePipe('en-US'); + let dateStart = datePipe.transform(this.range.value.start, 'dd-MM-yyyyTHH:mm:ss'); + let dateEnd = datePipe.transform(this.range.value.end, 'dd-MM-yyyyTHH:mm:ss'); + this.logger.info("DatenInptut",dateStart,"to",dateEnd) + this.isDendrometer=false; + //just call the api if at least 1 client is selected + if (this.sensorControl.value && this.sensorControl.value.length >= 1) { + console.log("sensors",this.sensorControl.value) + let s_id:String=this.sensorControl.value[0] + this.sensorControllerService.getSensorById(s_id+"").subscribe( + s=>{ + this.logger.info("GET sensor type",s.measurements?.at(0)?.type) + if (s.measurements?.at(0)?.type=="CIRCUMFERENCE_INCREMENT"){ + this.isDendrometer=true + sensor_dend=s_id + this.http.get("http://localhost:8080/api/v1/server/get/dendrometer/range?"+ + "sensorId="+sensor_dend+ + "&from="+dateStart+ + "&to="+dateEnd).subscribe( + // @ts-ignore + x=>this.logger.info("dendrometer values",this.threePhaseDendromete=x)) + } + }) + console.log("s_id",s_id) + //save the data from the API in sensorDataArry=>passed to child element + used for visualisation + this.sensorControl.value.forEach((sensor:string)=> + // this.serverControllerService.getReadingsBySensorIdAndTimeRange(sensor, dateStart + "", dateEnd + "").subscribe( + this.http.get("http://localhost:8080/api/v1/server/get/sensor/range?sensorId="+sensor + +"&from="+dateStart + +"&to="+ dateEnd).subscribe({ + next: (response) => { + console.log(response) + // @ts-ignore + this.sensorData = response + this.sensorDataArray.push(this.sensorData) + this.logger.info("GET array sensor Data", this.sensorDataArray) + }, + error: () => this.logger.error("Get sensordata error") + }) + ) } - }) - console.log("s_id",s_id) - //save the data from the API in sensorDataArry=>passed to child element + used for visualisation - this.sensorControl.value.forEach((sensor:string)=> - // this.serverControllerService.getReadingsBySensorIdAndTimeRange(sensor, dateStart + "", dateEnd + "").subscribe( - this.http.get("http://localhost:8080/api/v1/server/get/sensor/range?sensorId="+sensor - +"&from="+dateStart - +"&to="+ dateEnd).subscribe( - s => { - console.log(s) - // @ts-ignore - this.sensorData=s - this.sensorDataArray.push(this.sensorData) - this.logger.info("GET array sensor Data",this.sensorDataArray) - }, - error => this.logger.error("Get sensordata error") - ) - ) - } - } + } } +//Interface for Data to work with before downloading export interface checkHostsStation{ isHost:boolean value:string diff --git a/src/app/module/components/summaryIcons/summaryIcons.component.ts b/src/app/module/components/summaryIcons/summaryIcons.component.ts index ea999a3..9519c8b 100644 --- a/src/app/module/components/summaryIcons/summaryIcons.component.ts +++ b/src/app/module/components/summaryIcons/summaryIcons.component.ts @@ -2,15 +2,15 @@ import {Component} from '@angular/core'; import {ApiService} from "../../../shared/api.service"; import {FormControl, FormGroup} from "@angular/forms"; import {DatePipe} from "@angular/common"; -import {ThreePhaseDendrometer} from "../../../core/service/level1/ThreePhaseDendrometer"; import { AvgMinMax, DendrometerDailyValue, LevelOneResponse, ServerControllerService, - SumOrAvg + SumOrAvg, + StationControllerService, + ThreePhaseDendrometer } from "../../../../../projects/generated-api/src"; -import { StationControllerService } from 'projects/swagger-client/src'; import {Router} from "@angular/router"; import {SharedService} from "../../../shared/shared-service.service"; diff --git a/src/app/module/components/summaryList/summaryList.ts b/src/app/module/components/summaryList/summaryList.ts index 3349ae0..dc710b3 100644 --- a/src/app/module/components/summaryList/summaryList.ts +++ b/src/app/module/components/summaryList/summaryList.ts @@ -3,22 +3,22 @@ import {ApiService} from "../../../shared/api.service"; import { faChevronLeft, faChevronRight, faLongArrowAltUp, faLongArrowAltDown } from '@fortawesome/free-solid-svg-icons'; import {FormControl, FormGroup} from "@angular/forms"; import {DatePipe} from "@angular/common"; -import {ThreePhaseDendrometer} from "../../../core/service/level1/ThreePhaseDendrometer"; import { AvgMinMax, DendrometerDailyValue, LevelOneResponse, ServerControllerService, - SumOrAvg + SumOrAvg, + StationControllerService, + ThreePhaseDendrometer } from "../../../../../projects/generated-api/src"; -import { StationControllerService } from 'projects/swagger-client/src'; import {SharedService} from "../../../shared/shared-service.service"; @Component({ - selector: 'app-lev0Ver3', + selector: 'app-summaryList', templateUrl: './summaryList.html', styleUrls: ['./summaryList.scss'] }) diff --git a/src/app/shared/unsubscribeOnDestroy.class.ts b/src/app/shared/unsubscribeOnDestroy.class.ts new file mode 100644 index 0000000..38ef49d --- /dev/null +++ b/src/app/shared/unsubscribeOnDestroy.class.ts @@ -0,0 +1,11 @@ +import {Injectable, OnDestroy} from '@angular/core'; +import { Subject } from 'rxjs'; +@Injectable() +export abstract class UnsubscribeOnDestroy implements OnDestroy { + protected unsubscribe$ = new Subject<void>(); + + ngOnDestroy(): void { + this.unsubscribe$.next(); + this.unsubscribe$.complete(); + } +} -- GitLab