Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 9c85f0ec

Přidáno uživatelem Jakub Hlaváč před více než 3 roky(ů)

Re #8467 - Definice Open API 3.0

+ new Open API endpoints definitions

Zobrazit rozdíly:

src/app/shared/api/endpoints/models/observation.ts
1
/* tslint:disable */
2
/* eslint-disable */
3
export interface Observation {
4
  gid?: number;
5
  time?: string;
6
  value?: number;
7
}
src/app/shared/api/endpoints/services/observation.service.ts
1
/* tslint:disable */
2
/* eslint-disable */
3
import { Injectable } from '@angular/core';
4
import { HttpClient, HttpResponse } from '@angular/common/http';
5
import { BaseService } from '../base-service';
6
import { ApiConfiguration } from '../api-configuration';
7
import { StrictHttpResponse } from '../strict-http-response';
8
import { RequestBuilder } from '../request-builder';
9
import { Observable } from 'rxjs';
10
import { map, filter } from 'rxjs/operators';
11

  
12
import { Observation } from '../models/observation';
13

  
14
@Injectable({
15
  providedIn: 'root',
16
})
17
export class ObservationService extends BaseService {
18
  constructor(
19
    config: ApiConfiguration,
20
    http: HttpClient
21
  ) {
22
    super(config, http);
23
  }
24

  
25
  /**
26
   * Path part for operation getObservation
27
   */
28
  static readonly GetObservationPath = '/senslog1/SensorService?Operation=GetObservations';
29

  
30
  /**
31
   * Get observation.
32
   *
33
   *
34
   *
35
   * This method provides access to the full `HttpResponse`, allowing access to response headers.
36
   * To access only the response body, use `getObservation()` instead.
37
   *
38
   * This method doesn't expect any request body.
39
   */
40
  getObservation$Response(params: {
41
    unit_id: number;
42
    sensor_id: number;
43
    from?: string;
44
    to?: string;
45
  }): Observable<StrictHttpResponse<Array<Observation>>> {
46

  
47
    const rb = new RequestBuilder(this.rootUrl, ObservationService.GetObservationPath, 'get');
48
    if (params) {
49
      rb.query('unit_id', params.unit_id, {});
50
      rb.query('sensor_id', params.sensor_id, {});
51
      rb.query('from', params.from, {});
52
      rb.query('to', params.to, {});
53
    }
54

  
55
    return this.http.request(rb.build({
56
      responseType: 'json',
57
      accept: 'application/json'
58
    })).pipe(
59
      filter((r: any) => r instanceof HttpResponse),
60
      map((r: HttpResponse<any>) => {
61
        return r as StrictHttpResponse<Array<Observation>>;
62
      })
63
    );
64
  }
65

  
66
  /**
67
   * Get observation.
68
   *
69
   *
70
   *
71
   * This method provides access to only to the response body.
72
   * To access the full response (for headers, for example), `getObservation$Response()` instead.
73
   *
74
   * This method doesn't expect any request body.
75
   */
76
  getObservation(params: {
77
    unit_id: number;
78
    sensor_id: number;
79
    from?: string;
80
    to?: string;
81
  }): Observable<Array<Observation>> {
82

  
83
    return this.getObservation$Response(params).pipe(
84
      map((r: StrictHttpResponse<Array<Observation>>) => r.body as Array<Observation>)
85
    );
86
  }
87

  
88
}

Také k dispozici: Unified diff