source: src/mapservice-webclient/src-gen/gnuboat-mapservice/api/tiles.service.ts@ 5071137

debian/bullseye
Last change on this file since 5071137 was d660d75, checked in by Joachim Langenbach <joachim.langenbach@…>, 6 years ago

Added all generated code to the soruce tree, to avoid generation during package build time

  • Property mode set to 100644
File size: 6.8 KB
Line 
1/**
2 * GNUBoat Mapservice API
3 * API to upload log files with water depth to GNUBoat server
4 *
5 * The version of the OpenAPI document: v1
6 * Contact: info@engsas.de
7 *
8 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9 * https://openapi-generator.tech
10 * Do not edit the class manually.
11 */
12/* tslint:disable:no-unused-variable member-ordering */
13
14import { Inject, Injectable, Optional } from '@angular/core';
15import { HttpClient, HttpHeaders, HttpParams,
16 HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
17import { CustomHttpParameterCodec } from '../encoder';
18import { Observable } from 'rxjs';
19
20import { HttpError } from '../model/models';
21
22import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
23import { Configuration } from '../configuration';
24
25
26
27@Injectable({
28 providedIn: 'root'
29})
30export class TilesService {
31
32 protected basePath = 'https://gnuboat.engsas.com/mapservice/v1';
33 public defaultHeaders = new HttpHeaders();
34 public configuration = new Configuration();
35 public encoder: HttpParameterCodec;
36
37 constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
38 if (configuration) {
39 this.configuration = configuration;
40 }
41 if (typeof this.configuration.basePath !== 'string') {
42 if (typeof basePath !== 'string') {
43 basePath = this.basePath;
44 }
45 this.configuration.basePath = basePath;
46 }
47 this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
48 }
49
50
51
52 private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
53 if (typeof value === "object" && value instanceof Date === false) {
54 httpParams = this.addToHttpParamsRecursive(httpParams, value);
55 } else {
56 httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
57 }
58 return httpParams;
59 }
60
61 private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
62 if (value == null) {
63 return httpParams;
64 }
65
66 if (typeof value === "object") {
67 if (Array.isArray(value)) {
68 (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
69 } else if (value instanceof Date) {
70 if (key != null) {
71 httpParams = httpParams.append(key,
72 (value as Date).toISOString().substr(0, 10));
73 } else {
74 throw Error("key may not be null if value is Date");
75 }
76 } else {
77 Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
78 httpParams, value[k], key != null ? `${key}.${k}` : k));
79 }
80 } else if (key != null) {
81 httpParams = httpParams.append(key, value);
82 } else {
83 throw Error("key may not be null if value is not object or array");
84 }
85 return httpParams;
86 }
87
88 /**
89 * Represents a tile
90 * Returns the map tile x_tile, y_tile at Zoomlevel zoom
91 * @param accuracy Accuracy of generated tiles
92 * @param resolution Resolution of the tiles
93 * @param zoom Zoomlevel
94 * @param xTile Number of the tile in x dimension
95 * @param yTile Number of the tile in y dimension
96 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
97 * @param reportProgress flag to report request and response progress.
98 */
99 public tilesTileGet(accuracy: 'high' | 'low', resolution: 256 | 512, zoom: number, xTile: number, yTile: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'image/_*' | 'application/problem+json'}): Observable<Blob>;
100 public tilesTileGet(accuracy: 'high' | 'low', resolution: 256 | 512, zoom: number, xTile: number, yTile: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'image/_*' | 'application/problem+json'}): Observable<HttpResponse<Blob>>;
101 public tilesTileGet(accuracy: 'high' | 'low', resolution: 256 | 512, zoom: number, xTile: number, yTile: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'image/_*' | 'application/problem+json'}): Observable<HttpEvent<Blob>>;
102 public tilesTileGet(accuracy: 'high' | 'low', resolution: 256 | 512, zoom: number, xTile: number, yTile: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'image/_*' | 'application/problem+json'}): Observable<any> {
103 if (accuracy === null || accuracy === undefined) {
104 throw new Error('Required parameter accuracy was null or undefined when calling tilesTileGet.');
105 }
106 if (resolution === null || resolution === undefined) {
107 throw new Error('Required parameter resolution was null or undefined when calling tilesTileGet.');
108 }
109 if (zoom === null || zoom === undefined) {
110 throw new Error('Required parameter zoom was null or undefined when calling tilesTileGet.');
111 }
112 if (xTile === null || xTile === undefined) {
113 throw new Error('Required parameter xTile was null or undefined when calling tilesTileGet.');
114 }
115 if (yTile === null || yTile === undefined) {
116 throw new Error('Required parameter yTile was null or undefined when calling tilesTileGet.');
117 }
118
119 let headers = this.defaultHeaders;
120
121 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
122 if (httpHeaderAcceptSelected === undefined) {
123 // to determine the Accept header
124 const httpHeaderAccepts: string[] = [
125 'image/_*',
126 'application/problem+json'
127 ];
128 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
129 }
130 if (httpHeaderAcceptSelected !== undefined) {
131 headers = headers.set('Accept', httpHeaderAcceptSelected);
132 }
133
134
135 return this.httpClient.get(`${this.configuration.basePath}/tiles/gnuboat/${encodeURIComponent(String(accuracy))}/${encodeURIComponent(String(resolution))}/${encodeURIComponent(String(zoom))}/${encodeURIComponent(String(xTile))}/${encodeURIComponent(String(yTile))}.png`,
136 {
137 responseType: "blob",
138 withCredentials: this.configuration.withCredentials,
139 headers: headers,
140 observe: observe,
141 reportProgress: reportProgress
142 }
143 );
144 }
145
146}
Note: See TracBrowser for help on using the repository browser.