@devlearning/swagger-generator 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +12 -0
- package/autogeneration/output/api.autogenerated.ts +748 -0
- package/autogeneration/output/model.autogenerated.ts +728 -0
- package/dist/generator.js +1 -0
- package/dist/index.js +264 -0
- package/dist/models/swagger.js +1 -0
- package/dist/output/api.autogenerated.js +392 -0
- package/dist/output/model.autogenerated.js +354 -0
- package/dist/swagger-downloader.js +14 -0
- package/package.json +20 -0
- package/src/generator.ts +0 -0
- package/src/index.ts +383 -0
- package/src/models/swagger.ts +63 -0
- package/src/swagger-downloader.ts +11 -0
- package/tsconfig.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import fetch from 'node-fetch';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
const settings = { method: "Get" };
|
|
4
|
+
const apiUrl = "http://localhost:5208";
|
|
5
|
+
const version = "1";
|
|
6
|
+
const swaggerJsonUrl = `${apiUrl}/swagger/v${version}/swagger.json`;
|
|
7
|
+
const contentType = 'application/json';
|
|
8
|
+
export class SwaggerDownloader {
|
|
9
|
+
async download() {
|
|
10
|
+
let response = await fetch(swaggerJsonUrl, settings);
|
|
11
|
+
let json = await response.json();
|
|
12
|
+
return json;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class Generator {
|
|
16
|
+
_swagger;
|
|
17
|
+
constructor(swagger) {
|
|
18
|
+
this._swagger = swagger;
|
|
19
|
+
}
|
|
20
|
+
generateApi() {
|
|
21
|
+
console.debug(`Start autogeneration Apis`);
|
|
22
|
+
let apiMethods = ``;
|
|
23
|
+
for (let index = 0; index < Object.getOwnPropertyNames(this._swagger.paths).length; index++) {
|
|
24
|
+
const apiName = Object.getOwnPropertyNames(this._swagger.paths)[index];
|
|
25
|
+
const swaggerMethod = this._swagger.paths[apiName];
|
|
26
|
+
const method = Object.getOwnPropertyNames(swaggerMethod)[0];
|
|
27
|
+
const swaggerMethodInfo = swaggerMethod[method];
|
|
28
|
+
console.debug(`\tAPI - ${apiName} - ${method}`);
|
|
29
|
+
let parametersString = this.retrieveParameters(swaggerMethodInfo);
|
|
30
|
+
let queryParameters = this.retrieveQueryParameters(swaggerMethodInfo);
|
|
31
|
+
let returnTypeString = this.retrieveReturnType(swaggerMethodInfo);
|
|
32
|
+
if (returnTypeString == null)
|
|
33
|
+
returnTypeString = 'void';
|
|
34
|
+
let prepareRequestString = ``; //request = this._handleRequest(request);
|
|
35
|
+
let haveRequest = swaggerMethodInfo.requestBody != null;
|
|
36
|
+
if (haveRequest) {
|
|
37
|
+
prepareRequestString = `request = this._handleRequest(request);
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
apiMethods +=
|
|
41
|
+
`
|
|
42
|
+
public ${apiName.replace('/api/v{version}/', '').replaceAll('/', '_')}(${parametersString}): Observable<${returnTypeString}>{
|
|
43
|
+
${prepareRequestString}return this._http.${method}<${returnTypeString}>(\`\${environment.BASE_URL}${apiName.replace('{version}', '1')}${queryParameters}\`${haveRequest ? ', request' : ''}, httpOptions)
|
|
44
|
+
.pipe(
|
|
45
|
+
map(x => this._handleResponse(x)),
|
|
46
|
+
catchError((err, obs) => {
|
|
47
|
+
return this._handleError(err, <Observable<any>>obs);
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
fs.writeFileSync("autogeneration/output/api.autogenerated.ts", `${apiPre}
|
|
54
|
+
${apiMethods}
|
|
55
|
+
${apiPost}`);
|
|
56
|
+
}
|
|
57
|
+
generateModel() {
|
|
58
|
+
let usedTypes = [];
|
|
59
|
+
for (let index = 0; index < Object.getOwnPropertyNames(this._swagger.paths).length; index++) {
|
|
60
|
+
const apiName = Object.getOwnPropertyNames(this._swagger.paths)[index];
|
|
61
|
+
const swaggerMethod = this._swagger.paths[apiName];
|
|
62
|
+
const method = Object.getOwnPropertyNames(swaggerMethod)[0];
|
|
63
|
+
const swaggerMethodInfo = swaggerMethod[method];
|
|
64
|
+
let parametersRefType = swaggerMethodInfo.parameters.filter(x => x.in == 'query' && x.schema?.$ref != null).map(x => x.schema.$ref.replace('#/components/schemas/', ''));
|
|
65
|
+
usedTypes = usedTypes.concat(parametersRefType);
|
|
66
|
+
if (swaggerMethodInfo.responses[200].content[contentType].schema.$ref != null) {
|
|
67
|
+
usedTypes.push(swaggerMethodInfo.responses[200].content[contentType].schema.$ref.replace('#/components/schemas/', ''));
|
|
68
|
+
}
|
|
69
|
+
if (swaggerMethodInfo.requestBody?.content[contentType]?.schema?.$ref) {
|
|
70
|
+
usedTypes.push(swaggerMethodInfo.requestBody?.content[contentType]?.schema?.$ref.replace('#/components/schemas/', ''));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// usedTypes.forEach(element => {
|
|
74
|
+
// console.debug(element);
|
|
75
|
+
// });
|
|
76
|
+
console.debug(`Start autogeneration Models`);
|
|
77
|
+
let models = ``;
|
|
78
|
+
for (let index = 0; index < Object.getOwnPropertyNames(this._swagger.components.schemas).length; index++) {
|
|
79
|
+
const modelName = Object.getOwnPropertyNames(this._swagger.components.schemas)[index];
|
|
80
|
+
if (usedTypes.indexOf(modelName) < 0) {
|
|
81
|
+
console.debug(`\tModel SKIP - ${modelName}`);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
;
|
|
85
|
+
const swaggerCopmponent = this._swagger.components.schemas[modelName];
|
|
86
|
+
console.debug(`\tModel - ${modelName}`);
|
|
87
|
+
let type = swaggerCopmponent.type == 'integer' ? 'enum' : 'class';
|
|
88
|
+
let content = this.retrieveObjectContent(swaggerCopmponent);
|
|
89
|
+
models +=
|
|
90
|
+
`
|
|
91
|
+
export ${type} ${modelName} {${content}
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
fs.writeFileSync("autogeneration/output/model.autogenerated.ts", `${modelPre}
|
|
96
|
+
${models}
|
|
97
|
+
${modelPost}`);
|
|
98
|
+
}
|
|
99
|
+
retrieveParameters(swaggerMethodInfo) {
|
|
100
|
+
if (swaggerMethodInfo.requestBody != null) {
|
|
101
|
+
return `request: ${swaggerMethodInfo.requestBody.content[contentType].schema.$ref.replace('#/components/schemas/', '')}`;
|
|
102
|
+
}
|
|
103
|
+
let parameters = ``;
|
|
104
|
+
swaggerMethodInfo.parameters.filter(x => x.in == 'query').forEach(parameter => {
|
|
105
|
+
if (parameter.schema.$ref != null) {
|
|
106
|
+
parameters += `${parameter.name}: ${parameter.schema.$ref.replace('#/components/schemas/', '')}, `;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
parameters += `${parameter.name}: ${this.getNativeType(parameter.schema)}, `;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
if (parameters.length > 2)
|
|
113
|
+
parameters = parameters.substring(0, parameters.length - 2);
|
|
114
|
+
return parameters;
|
|
115
|
+
}
|
|
116
|
+
retrieveQueryParameters(swaggerMethodInfo) {
|
|
117
|
+
if (swaggerMethodInfo.requestBody != null)
|
|
118
|
+
return ``;
|
|
119
|
+
let filteredParameters = swaggerMethodInfo.parameters.filter(x => x.in == 'query');
|
|
120
|
+
if (filteredParameters.length == 0)
|
|
121
|
+
return ``;
|
|
122
|
+
let parameters = `?`;
|
|
123
|
+
filteredParameters.forEach(parameter => {
|
|
124
|
+
if (parameter.schema.$ref != null) {
|
|
125
|
+
this.parametrizeObject(parameter.schema.$ref);
|
|
126
|
+
//parameters += `${parameter.name}: ${parameter.schema.$ref.replace('#/components/schemas/', '')}&`;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
parameters += `${this.lowercaseFirstLetter(parameter.name)}=\${` + this.lowercaseFirstLetter(parameter.name) + `}&`;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
if (parameters.length > 1)
|
|
133
|
+
parameters = parameters.substring(0, parameters.length - 1);
|
|
134
|
+
return parameters;
|
|
135
|
+
}
|
|
136
|
+
retrieveReturnType(swaggerMethodInfo) {
|
|
137
|
+
if (swaggerMethodInfo.responses[200] == null)
|
|
138
|
+
return 'void';
|
|
139
|
+
if (swaggerMethodInfo.responses[200].content[contentType].schema.$ref != null)
|
|
140
|
+
return swaggerMethodInfo.responses[200]?.content[contentType].schema.$ref.replace('#/components/schemas/', '');
|
|
141
|
+
if (swaggerMethodInfo.responses[200]?.content[contentType].schema.type != null)
|
|
142
|
+
return this.getNativeType(swaggerMethodInfo.responses[200]?.content[contentType].schema);
|
|
143
|
+
console.error("unmanaged swaggerMethodInfo", swaggerMethodInfo);
|
|
144
|
+
throw new Error("unmanaged swaggerMethodInfo");
|
|
145
|
+
}
|
|
146
|
+
retrieveType(swaggerComponentProperty) {
|
|
147
|
+
if (swaggerComponentProperty.$ref != null)
|
|
148
|
+
return swaggerComponentProperty.$ref.replace('#/components/schemas/', '');
|
|
149
|
+
if (swaggerComponentProperty.type != null && swaggerComponentProperty.type == 'array')
|
|
150
|
+
if (swaggerComponentProperty.items.$ref != null)
|
|
151
|
+
return swaggerComponentProperty.items.$ref.replace('#/components/schemas/', '');
|
|
152
|
+
else
|
|
153
|
+
return this.getNativeType(swaggerComponentProperty);
|
|
154
|
+
if (swaggerComponentProperty.type != null)
|
|
155
|
+
return this.getNativeType(swaggerComponentProperty);
|
|
156
|
+
console.error("unmanaged swaggerMethodInfo", swaggerComponentProperty);
|
|
157
|
+
throw new Error("unmanaged swaggerMethodInfo");
|
|
158
|
+
}
|
|
159
|
+
parametrizeObject(objectName) {
|
|
160
|
+
let component = this._swagger.components.schemas[objectName.replace('#/components/schemas/', '')];
|
|
161
|
+
if (component == null || component.properties == null)
|
|
162
|
+
return ``;
|
|
163
|
+
console.debug(component.properties);
|
|
164
|
+
return ``;
|
|
165
|
+
}
|
|
166
|
+
retrieveObjectContent(swaggerComponent) {
|
|
167
|
+
if (swaggerComponent.type == 'object')
|
|
168
|
+
return this.retrieveObjectProperties(swaggerComponent);
|
|
169
|
+
else if (swaggerComponent.type == 'integer')
|
|
170
|
+
return this.retrieveEnumValues(swaggerComponent);
|
|
171
|
+
}
|
|
172
|
+
retrieveObjectProperties(swaggerCopmponent) {
|
|
173
|
+
if (swaggerCopmponent.properties == null)
|
|
174
|
+
return ``;
|
|
175
|
+
// console.debug(`\t\t${Object.getOwnPropertyNames(swaggerCopmponent.properties).length}`);
|
|
176
|
+
let properties = ``;
|
|
177
|
+
for (let index = 0; index < Object.getOwnPropertyNames(swaggerCopmponent.properties).length; index++) {
|
|
178
|
+
const propertyName = Object.getOwnPropertyNames(swaggerCopmponent.properties)[index];
|
|
179
|
+
properties +=
|
|
180
|
+
`
|
|
181
|
+
${propertyName}: ${this.retrieveType(swaggerCopmponent.properties[propertyName])} | undefined;`;
|
|
182
|
+
}
|
|
183
|
+
return properties;
|
|
184
|
+
}
|
|
185
|
+
retrieveEnumValues(swaggerCopmponent) {
|
|
186
|
+
}
|
|
187
|
+
retrieveNestedObjects(tmp) {
|
|
188
|
+
let usedTypes = [];
|
|
189
|
+
for (let i = 0; i < tmp.length; i++) {
|
|
190
|
+
const swaggerCopmponent = this._swagger.components.schemas['#/components/schemas/' + tmp[i]];
|
|
191
|
+
this.retrieveNestedObjects2(swaggerCopmponent);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
retrieveNestedObjects2(swaggerCopmponent) {
|
|
195
|
+
for (let j = 0; j < Object.getOwnPropertyNames(swaggerCopmponent.properties).length; j++) {
|
|
196
|
+
const propertyName = Object.getOwnPropertyNames(swaggerCopmponent.properties)[j];
|
|
197
|
+
if (swaggerCopmponent.properties[propertyName].$ref != null) {
|
|
198
|
+
swaggerCopmponent.properties[propertyName].$ref.replace('#/components/schemas/', '');
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
getNativeType(schema) {
|
|
203
|
+
if (schema.type == 'integer')
|
|
204
|
+
return 'number';
|
|
205
|
+
if (schema.type == 'string' && schema.format == null)
|
|
206
|
+
return 'string';
|
|
207
|
+
if (schema.type == 'string' && schema.format == 'date-time')
|
|
208
|
+
return 'moment.Moment';
|
|
209
|
+
if (schema.type == 'string' && schema.format == 'uuid')
|
|
210
|
+
return 'string';
|
|
211
|
+
if (schema.type == 'number')
|
|
212
|
+
return 'number';
|
|
213
|
+
if (schema.type == 'array')
|
|
214
|
+
return '[]';
|
|
215
|
+
if (schema.type == 'boolean')
|
|
216
|
+
return 'boolean';
|
|
217
|
+
console.error("unmanaged schema type", schema);
|
|
218
|
+
throw new Error("unmanaged schema");
|
|
219
|
+
}
|
|
220
|
+
lowercaseFirstLetter(value) {
|
|
221
|
+
return value.charAt(0).toLowerCase() + value.slice(1);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const swaggerDownloader = new SwaggerDownloader();
|
|
225
|
+
const apiPre = `import { HttpClient } from '@angular/common/http';
|
|
226
|
+
import { Injectable } from '@angular/core';
|
|
227
|
+
import { Observable, catchError, map } from 'rxjs';
|
|
228
|
+
import { httpOptions } from 'src/app/core/utils/http-options';
|
|
229
|
+
import { DatiUtenteTestataResponse } from '../models/dati-utente-testata-response';
|
|
230
|
+
import { LanguageCultureListQueryResponse } from '../models/language-culture';
|
|
231
|
+
import { API_AIRLINE_COMPANY, API_LANGUAGE_CULTURE, API_TEST, API_USER, API_VOUCHER_SNACK } from '../utils/constants';
|
|
232
|
+
import { ApiBase } from './../utils/api-base';
|
|
233
|
+
import { DialogMessageService } from './dialog-message.service';
|
|
234
|
+
import * as moment from 'moment-timezone';
|
|
235
|
+
import { VoucherSnackResponse } from '../models/api/voucher-snack-response.models';
|
|
236
|
+
import { VoucherSnackRequest } from '../models/api/voucher-snack-request.models';
|
|
237
|
+
import { ActivatedSnackVoucherResponse, SnackType } from 'src/app/ticket/models/richiesta-servizio-snack.models';
|
|
238
|
+
import { VoucherSnackRequestEmission } from '../models/api/voucher-snack-request-emission';
|
|
239
|
+
import { ActivateSnackVoucherResponse } from '../models/api/activate-snack-voucher-response.models';
|
|
240
|
+
import { VoucherActivationRequest } from '../models/api/voucher-activation-request.model';
|
|
241
|
+
import { Utente } from '../models/utente';
|
|
242
|
+
import { AirlineCompany } from 'src/app/sharedmodules/dialog-compagnie-aeree/compagnia-aerea.model';
|
|
243
|
+
|
|
244
|
+
@Injectable({
|
|
245
|
+
providedIn: 'root',
|
|
246
|
+
})
|
|
247
|
+
export class ApiService extends ApiBase {
|
|
248
|
+
constructor(
|
|
249
|
+
private _http: HttpClient,
|
|
250
|
+
_dialogMessage: DialogMessageService
|
|
251
|
+
) {
|
|
252
|
+
super(_dialogMessage);
|
|
253
|
+
}
|
|
254
|
+
`;
|
|
255
|
+
const apiPost = `}`;
|
|
256
|
+
const modelPre = `
|
|
257
|
+
`;
|
|
258
|
+
const modelPost = `
|
|
259
|
+
`;
|
|
260
|
+
swaggerDownloader.download()
|
|
261
|
+
.then(swaggerDoc => {
|
|
262
|
+
return new Generator(swaggerDoc);
|
|
263
|
+
})
|
|
264
|
+
.then(generator => { generator.generateApi(); generator.generateModel(); });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { Injectable } from '@angular/core';
|
|
36
|
+
import { catchError, map } from 'rxjs';
|
|
37
|
+
import { httpOptions } from 'src/app/core/utils/http-options';
|
|
38
|
+
import { ApiBase } from './../utils/api-base';
|
|
39
|
+
export let ApiService = (() => {
|
|
40
|
+
let _classDecorators = [Injectable({
|
|
41
|
+
providedIn: 'root',
|
|
42
|
+
})];
|
|
43
|
+
let _classDescriptor;
|
|
44
|
+
let _classExtraInitializers = [];
|
|
45
|
+
let _classThis;
|
|
46
|
+
var ApiService = class extends ApiBase {
|
|
47
|
+
static {
|
|
48
|
+
__esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers);
|
|
49
|
+
ApiService = _classThis = _classDescriptor.value;
|
|
50
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
51
|
+
}
|
|
52
|
+
_http;
|
|
53
|
+
constructor(_http, _dialogMessage) {
|
|
54
|
+
super(_dialogMessage);
|
|
55
|
+
this._http = _http;
|
|
56
|
+
}
|
|
57
|
+
AirlineCompany_Create(request) {
|
|
58
|
+
request = this._handleRequest(request);
|
|
59
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/AirlineCompany/Create`, request, httpOptions)
|
|
60
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
61
|
+
return this._handleError(err, obs);
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
AirlineCompany_Update(request) {
|
|
65
|
+
request = this._handleRequest(request);
|
|
66
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/AirlineCompany/Update`, request, httpOptions)
|
|
67
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
68
|
+
return this._handleError(err, obs);
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
AirlineCompany_List(Filter) {
|
|
72
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/AirlineCompany/List?filter=${filter}`, httpOptions)
|
|
73
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
74
|
+
return this._handleError(err, obs);
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
Airport_Read(IdAirport) {
|
|
78
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/Airport/Read?idAirport=${idAirport}`, httpOptions)
|
|
79
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
80
|
+
return this._handleError(err, obs);
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
Airport_ReadByIdUser() {
|
|
84
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/Airport/ReadByIdUser`, httpOptions)
|
|
85
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
86
|
+
return this._handleError(err, obs);
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
Airport_List(Filter) {
|
|
90
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/Airport/List?filter=${filter}`, httpOptions)
|
|
91
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
92
|
+
return this._handleError(err, obs);
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
Airport_ListManaged(request) {
|
|
96
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/Airport/ListManaged?`, httpOptions)
|
|
97
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
98
|
+
return this._handleError(err, obs);
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
Auth_token(request) {
|
|
102
|
+
request = this._handleRequest(request);
|
|
103
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/Auth/token`, request, httpOptions)
|
|
104
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
105
|
+
return this._handleError(err, obs);
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
Auth_refreshToken(request) {
|
|
109
|
+
request = this._handleRequest(request);
|
|
110
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/Auth/refreshToken`, request, httpOptions)
|
|
111
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
112
|
+
return this._handleError(err, obs);
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
Hotel_List(request) {
|
|
116
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/Hotel/List?`, httpOptions)
|
|
117
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
118
|
+
return this._handleError(err, obs);
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
HotelAvailabilities_GetAvailabilityByIdAeroporto(idAirport) {
|
|
122
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/HotelAvailabilities/GetAvailabilityByIdAeroporto?idAirport=${idAirport}`, httpOptions)
|
|
123
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
124
|
+
return this._handleError(err, obs);
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
LanguageCulture_List() {
|
|
128
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/LanguageCulture/List`, httpOptions)
|
|
129
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
130
|
+
return this._handleError(err, obs);
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
PassengerGroup_Read(idPassengerGroup) {
|
|
134
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/PassengerGroup/Read?idPassengerGroup=${idPassengerGroup}`, httpOptions)
|
|
135
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
136
|
+
return this._handleError(err, obs);
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
PassengerGroup_Create(request) {
|
|
140
|
+
request = this._handleRequest(request);
|
|
141
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/PassengerGroup/Create`, request, httpOptions)
|
|
142
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
143
|
+
return this._handleError(err, obs);
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
PassengerGroup_Update(request) {
|
|
147
|
+
request = this._handleRequest(request);
|
|
148
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/PassengerGroup/Update`, request, httpOptions)
|
|
149
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
150
|
+
return this._handleError(err, obs);
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
PassengerGroup_Delete(idPassengerGroup) {
|
|
154
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/PassengerGroup/Delete?idPassengerGroup=${idPassengerGroup}`, httpOptions)
|
|
155
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
156
|
+
return this._handleError(err, obs);
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
PassengerGroup_List(idTicket) {
|
|
160
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/PassengerGroup/List?idTicket=${idTicket}`, httpOptions)
|
|
161
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
162
|
+
return this._handleError(err, obs);
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
ServiceRequest_Read(idServiceRequest) {
|
|
166
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/ServiceRequest/Read?idServiceRequest=${idServiceRequest}`, httpOptions)
|
|
167
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
168
|
+
return this._handleError(err, obs);
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
ServiceRequest_List(idTicket) {
|
|
172
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/ServiceRequest/List?idTicket=${idTicket}`, httpOptions)
|
|
173
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
174
|
+
return this._handleError(err, obs);
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
ServiceRequest_Update(request) {
|
|
178
|
+
request = this._handleRequest(request);
|
|
179
|
+
return this._http.put(`${environment.BASE_URL}/api/v1/ServiceRequest/Update`, request, httpOptions)
|
|
180
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
181
|
+
return this._handleError(err, obs);
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
ServiceRequestAirportToAirport_Read(idServiceRequestAirportToAirport) {
|
|
185
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/ServiceRequestAirportToAirport/Read?idServiceRequestAirportToAirport=${idServiceRequestAirportToAirport}`, httpOptions)
|
|
186
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
187
|
+
return this._handleError(err, obs);
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
ServiceRequestAirportToAirport_List(idTicket) {
|
|
191
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/ServiceRequestAirportToAirport/List?idTicket=${idTicket}`, httpOptions)
|
|
192
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
193
|
+
return this._handleError(err, obs);
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
ServiceRequestAirportToAirport_Create(request) {
|
|
197
|
+
request = this._handleRequest(request);
|
|
198
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/ServiceRequestAirportToAirport/Create`, request, httpOptions)
|
|
199
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
200
|
+
return this._handleError(err, obs);
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
ServiceRequestAirportToAirport_Update(request) {
|
|
204
|
+
request = this._handleRequest(request);
|
|
205
|
+
return this._http.put(`${environment.BASE_URL}/api/v1/ServiceRequestAirportToAirport/Update`, request, httpOptions)
|
|
206
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
207
|
+
return this._handleError(err, obs);
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
ServiceRequestAirportToAirport_Delete(idServiceRequestAirportToAirport) {
|
|
211
|
+
return this._http.delete(`${environment.BASE_URL}/api/v1/ServiceRequestAirportToAirport/Delete?idServiceRequestAirportToAirport=${idServiceRequestAirportToAirport}`, httpOptions)
|
|
212
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
213
|
+
return this._handleError(err, obs);
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
ServiceRequestAirportToAirport_Transport(IdServiceRequestAirportToAirport) {
|
|
217
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/ServiceRequestAirportToAirport/Transport?idServiceRequestAirportToAirport=${idServiceRequestAirportToAirport}`, httpOptions)
|
|
218
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
219
|
+
return this._handleError(err, obs);
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
ServiceRequestSnack_Create(request) {
|
|
223
|
+
request = this._handleRequest(request);
|
|
224
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/ServiceRequestSnack/Create`, request, httpOptions)
|
|
225
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
226
|
+
return this._handleError(err, obs);
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
ServiceRequestSnack_Read(idServiceRequestSnack) {
|
|
230
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/ServiceRequestSnack/Read?idServiceRequestSnack=${idServiceRequestSnack}`, httpOptions)
|
|
231
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
232
|
+
return this._handleError(err, obs);
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
235
|
+
ServiceRequestSnack_List(idTicket) {
|
|
236
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/ServiceRequestSnack/List?idTicket=${idTicket}`, httpOptions)
|
|
237
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
238
|
+
return this._handleError(err, obs);
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
ServiceRequestSnack_Update(request) {
|
|
242
|
+
request = this._handleRequest(request);
|
|
243
|
+
return this._http.put(`${environment.BASE_URL}/api/v1/ServiceRequestSnack/Update`, request, httpOptions)
|
|
244
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
245
|
+
return this._handleError(err, obs);
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
ServiceRequestSnack_Delete(idServiceRequestSnack) {
|
|
249
|
+
return this._http.delete(`${environment.BASE_URL}/api/v1/ServiceRequestSnack/Delete?idServiceRequestSnack=${idServiceRequestSnack}`, httpOptions)
|
|
250
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
251
|
+
return this._handleError(err, obs);
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
ServiceRequestSnack_Undo(idServiceRequestSnack) {
|
|
255
|
+
return this._http.delete(`${environment.BASE_URL}/api/v1/ServiceRequestSnack/Undo?idServiceRequestSnack=${idServiceRequestSnack}`, httpOptions)
|
|
256
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
257
|
+
return this._handleError(err, obs);
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
ServiceRequestSnack_ListSnackTypes(idAirlineCompany) {
|
|
261
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/ServiceRequestSnack/ListSnackTypes?idAirlineCompany=${idAirlineCompany}`, httpOptions)
|
|
262
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
263
|
+
return this._handleError(err, obs);
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
Ticket_Read(idTicket) {
|
|
267
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/Ticket/Read?idTicket=${idTicket}`, httpOptions)
|
|
268
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
269
|
+
return this._handleError(err, obs);
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
Ticket_Create(request) {
|
|
273
|
+
request = this._handleRequest(request);
|
|
274
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/Ticket/Create`, request, httpOptions)
|
|
275
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
276
|
+
return this._handleError(err, obs);
|
|
277
|
+
}));
|
|
278
|
+
}
|
|
279
|
+
Ticket_Update(request) {
|
|
280
|
+
request = this._handleRequest(request);
|
|
281
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/Ticket/Update`, request, httpOptions)
|
|
282
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
283
|
+
return this._handleError(err, obs);
|
|
284
|
+
}));
|
|
285
|
+
}
|
|
286
|
+
Ticket_List(request) {
|
|
287
|
+
request = this._handleRequest(request);
|
|
288
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/Ticket/List`, request, httpOptions)
|
|
289
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
290
|
+
return this._handleError(err, obs);
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
Ticket_DetailRead(idTicket) {
|
|
294
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/Ticket/DetailRead?idTicket=${idTicket}`, httpOptions)
|
|
295
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
296
|
+
return this._handleError(err, obs);
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
299
|
+
Ticket_UpdateNote(request) {
|
|
300
|
+
request = this._handleRequest(request);
|
|
301
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/Ticket/UpdateNote`, request, httpOptions)
|
|
302
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
303
|
+
return this._handleError(err, obs);
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
Transport_Create(request) {
|
|
307
|
+
request = this._handleRequest(request);
|
|
308
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/Transport/Create`, request, httpOptions)
|
|
309
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
310
|
+
return this._handleError(err, obs);
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
Transport_Update(request) {
|
|
314
|
+
request = this._handleRequest(request);
|
|
315
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/Transport/Update`, request, httpOptions)
|
|
316
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
317
|
+
return this._handleError(err, obs);
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
Transport_Delete(request) {
|
|
321
|
+
request = this._handleRequest(request);
|
|
322
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/Transport/Delete`, request, httpOptions)
|
|
323
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
324
|
+
return this._handleError(err, obs);
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
Transport_List() {
|
|
328
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/Transport/List`, httpOptions)
|
|
329
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
330
|
+
return this._handleError(err, obs);
|
|
331
|
+
}));
|
|
332
|
+
}
|
|
333
|
+
Transport_ReadByIdUser(idUser) {
|
|
334
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/Transport/ReadByIdUser?idUser=${idUser}`, httpOptions)
|
|
335
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
336
|
+
return this._handleError(err, obs);
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
339
|
+
TransportOrderItem_Create(request) {
|
|
340
|
+
request = this._handleRequest(request);
|
|
341
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/TransportOrderItem/Create`, request, httpOptions)
|
|
342
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
343
|
+
return this._handleError(err, obs);
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
TransportOrderItem_Update(request) {
|
|
347
|
+
request = this._handleRequest(request);
|
|
348
|
+
return this._http.put(`${environment.BASE_URL}/api/v1/TransportOrderItem/Update`, request, httpOptions)
|
|
349
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
350
|
+
return this._handleError(err, obs);
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
TransportOrderItem_Delete(IdTransportOrderItem) {
|
|
354
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/TransportOrderItem/Delete?idTransportOrderItem=${idTransportOrderItem}`, httpOptions)
|
|
355
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
356
|
+
return this._handleError(err, obs);
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
User_Create(request) {
|
|
360
|
+
request = this._handleRequest(request);
|
|
361
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/User/Create`, request, httpOptions)
|
|
362
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
363
|
+
return this._handleError(err, obs);
|
|
364
|
+
}));
|
|
365
|
+
}
|
|
366
|
+
User_UpdateLanguageCulture(IdLanguageCulture) {
|
|
367
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/User/UpdateLanguageCulture?idLanguageCulture=${idLanguageCulture}`, httpOptions)
|
|
368
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
369
|
+
return this._handleError(err, obs);
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
372
|
+
User_ReadUserInfo() {
|
|
373
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/User/ReadUserInfo`, httpOptions)
|
|
374
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
375
|
+
return this._handleError(err, obs);
|
|
376
|
+
}));
|
|
377
|
+
}
|
|
378
|
+
User_CreateUserInTransportCompanyByIdUser(IdUser, IdTransportCompany) {
|
|
379
|
+
return this._http.post(`${environment.BASE_URL}/api/v1/User/CreateUserInTransportCompanyByIdUser?idUser=${idUser}&idTransportCompany=${idTransportCompany}`, httpOptions)
|
|
380
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
381
|
+
return this._handleError(err, obs);
|
|
382
|
+
}));
|
|
383
|
+
}
|
|
384
|
+
VoucherSnack_ActivatedList(idServiceRequestSnack) {
|
|
385
|
+
return this._http.get(`${environment.BASE_URL}/api/v1/VoucherSnack/ActivatedList?idServiceRequestSnack=${idServiceRequestSnack}`, httpOptions)
|
|
386
|
+
.pipe(map(x => this._handleResponse(x)), catchError((err, obs) => {
|
|
387
|
+
return this._handleError(err, obs);
|
|
388
|
+
}));
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
return ApiService = _classThis;
|
|
392
|
+
})();
|