You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dashboard/frontend/src/app/shared/service-proxies/service-proxies.ts

815 lines
28 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v13.14.0.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------
// ReSharper disable InconsistentNaming
import { mergeMap as _observableMergeMap, catchError as _observableCatch } from 'rxjs/operators';
import { Observable, throwError as _observableThrow, of as _observableOf } from 'rxjs';
import { Injectable, Inject, Optional, InjectionToken } from '@angular/core';
import { HttpClient, HttpHeaders, HttpResponse, HttpResponseBase } from '@angular/common/http';
export const API_BASE_URL = new InjectionToken<string>('API_BASE_URL');
@Injectable()
export class AccountServiceProxy {
private http: HttpClient;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
this.http = http;
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "localhost:4000/";
}
/**
* @param input request
* @return success
*/
login(input: LoginRequest) : Observable<LoginResponse> {
let url_ = this.baseUrl + "/api/login";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(input);
let options_ : any = {
body: content_,
observe: "response",
responseType: "blob",
headers: new HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return this.http.request("post", url_, options_).pipe(_observableMergeMap((response_ : any) => {
return this.processLogin(response_);
})).pipe(_observableCatch((response_: any) => {
if (response_ instanceof HttpResponseBase) {
try {
return this.processLogin(<any>response_);
} catch (e) {
return <Observable<LoginResponse>><any>_observableThrow(e);
}
} else
return <Observable<LoginResponse>><any>_observableThrow(response_);
}));
}
protected processLogin(response: HttpResponseBase): Observable<LoginResponse> {
const status = response.status;
const responseBlob =
response instanceof HttpResponse ? response.body :
(<any>response).error instanceof Blob ? (<any>response).error : undefined;
let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}
if (status === 200) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = LoginResponse.fromJS(resultData200);
return _observableOf(result200);
}));
} else if (status === 400) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result400: any = null;
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result400 = resultData400 !== undefined ? resultData400 : <any>null;
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
} else if (status === 401) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result401: any = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : <any>null;
return throwException("Unauthorized", status, _responseText, _headers, result401);
}));
} else if (status === 500) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result500: any = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : <any>null;
return throwException("Internal Server Error", status, _responseText, _headers, result500);
}));
} else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return _observableOf<LoginResponse>(<any>null);
}
}
@Injectable()
export class RegistryServiceProxy {
private http: HttpClient;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
this.http = http;
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "localhost:4000/";
}
/**
* @return OK
*/
getServices() : Observable<GetServiceListResponse> {
let url_ = this.baseUrl + "/api/registry/services";
url_ = url_.replace(/[?&]$/, "");
let options_ : any = {
observe: "response",
responseType: "blob",
headers: new HttpHeaders({
"Accept": "application/json"
})
};
return this.http.request("get", url_, options_).pipe(_observableMergeMap((response_ : any) => {
return this.processGetServices(response_);
})).pipe(_observableCatch((response_: any) => {
if (response_ instanceof HttpResponseBase) {
try {
return this.processGetServices(<any>response_);
} catch (e) {
return <Observable<GetServiceListResponse>><any>_observableThrow(e);
}
} else
return <Observable<GetServiceListResponse>><any>_observableThrow(response_);
}));
}
protected processGetServices(response: HttpResponseBase): Observable<GetServiceListResponse> {
const status = response.status;
const responseBlob =
response instanceof HttpResponse ? response.body :
(<any>response).error instanceof Blob ? (<any>response).error : undefined;
let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}
if (status === 200) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = GetServiceListResponse.fromJS(resultData200);
return _observableOf(result200);
}));
} else if (status === 400) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result400: any = null;
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result400 = resultData400 !== undefined ? resultData400 : <any>null;
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
} else if (status === 401) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result401: any = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : <any>null;
return throwException("Unauthorized", status, _responseText, _headers, result401);
}));
} else if (status === 500) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result500: any = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : <any>null;
return throwException("Internal Server Error", status, _responseText, _headers, result500);
}));
} else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return _observableOf<GetServiceListResponse>(<any>null);
}
}
@Injectable()
export class StatisticsServiceProxy {
private http: HttpClient;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
this.http = http;
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : "localhost:4000/";
}
/**
* @return OK
*/
getSummary() : Observable<GetSummaryResponse> {
let url_ = this.baseUrl + "/api/summary";
url_ = url_.replace(/[?&]$/, "");
let options_ : any = {
observe: "response",
responseType: "blob",
headers: new HttpHeaders({
"Accept": "application/json"
})
};
return this.http.request("get", url_, options_).pipe(_observableMergeMap((response_ : any) => {
return this.processGetSummary(response_);
})).pipe(_observableCatch((response_: any) => {
if (response_ instanceof HttpResponseBase) {
try {
return this.processGetSummary(<any>response_);
} catch (e) {
return <Observable<GetSummaryResponse>><any>_observableThrow(e);
}
} else
return <Observable<GetSummaryResponse>><any>_observableThrow(response_);
}));
}
protected processGetSummary(response: HttpResponseBase): Observable<GetSummaryResponse> {
const status = response.status;
const responseBlob =
response instanceof HttpResponse ? response.body :
(<any>response).error instanceof Blob ? (<any>response).error : undefined;
let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }}
if (status === 200) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = GetSummaryResponse.fromJS(resultData200);
return _observableOf(result200);
}));
} else if (status === 400) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result400: any = null;
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result400 = resultData400 !== undefined ? resultData400 : <any>null;
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
} else if (status === 401) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result401: any = null;
let resultData401 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result401 = resultData401 !== undefined ? resultData401 : <any>null;
return throwException("Unauthorized", status, _responseText, _headers, result401);
}));
} else if (status === 500) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
let result500: any = null;
let resultData500 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result500 = resultData500 !== undefined ? resultData500 : <any>null;
return throwException("Internal Server Error", status, _responseText, _headers, result500);
}));
} else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(_observableMergeMap(_responseText => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return _observableOf<GetSummaryResponse>(<any>null);
}
}
export class LoginRequest implements ILoginRequest {
password!: string;
username!: string;
constructor(data?: ILoginRequest) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.password = _data["password"];
this.username = _data["username"];
}
}
static fromJS(data: any): LoginRequest {
data = typeof data === 'object' ? data : {};
let result = new LoginRequest();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["password"] = this.password;
data["username"] = this.username;
return data;
}
}
export interface ILoginRequest {
password: string;
username: string;
}
export class LoginResponse implements ILoginResponse {
token?: string | undefined;
constructor(data?: ILoginResponse) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.token = _data["token"];
}
}
static fromJS(data: any): LoginResponse {
data = typeof data === 'object' ? data : {};
let result = new LoginResponse();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["token"] = this.token;
return data;
}
}
export interface ILoginResponse {
token?: string | undefined;
}
export class GetServiceListResponse implements IGetServiceListResponse {
services?: RegistryService[] | undefined;
constructor(data?: IGetServiceListResponse) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
if (Array.isArray(_data["services"])) {
this.services = [] as any;
for (let item of _data["services"])
this.services!.push(RegistryService.fromJS(item));
}
}
}
static fromJS(data: any): GetServiceListResponse {
data = typeof data === 'object' ? data : {};
let result = new GetServiceListResponse();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
if (Array.isArray(this.services)) {
data["services"] = [];
for (let item of this.services)
data["services"].push(item.toJSON());
}
return data;
}
}
export interface IGetServiceListResponse {
services?: RegistryService[] | undefined;
}
export class RegistryEndpoint implements IRegistryEndpoint {
metadata?: { [key: string]: string; } | undefined;
name?: string | undefined;
request?: RegistryValue | undefined;
response?: RegistryValue | undefined;
constructor(data?: IRegistryEndpoint) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
if (_data["metadata"]) {
this.metadata = {} as any;
for (let key in _data["metadata"]) {
if (_data["metadata"].hasOwnProperty(key))
(<any>this.metadata)![key] = _data["metadata"][key];
}
}
this.name = _data["name"];
this.request = _data["request"] ? RegistryValue.fromJS(_data["request"]) : <any>undefined;
this.response = _data["response"] ? RegistryValue.fromJS(_data["response"]) : <any>undefined;
}
}
static fromJS(data: any): RegistryEndpoint {
data = typeof data === 'object' ? data : {};
let result = new RegistryEndpoint();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
if (this.metadata) {
data["metadata"] = {};
for (let key in this.metadata) {
if (this.metadata.hasOwnProperty(key))
(<any>data["metadata"])[key] = this.metadata[key];
}
}
data["name"] = this.name;
data["request"] = this.request ? this.request.toJSON() : <any>undefined;
data["response"] = this.response ? this.response.toJSON() : <any>undefined;
return data;
}
}
export interface IRegistryEndpoint {
metadata?: { [key: string]: string; } | undefined;
name?: string | undefined;
request?: RegistryValue | undefined;
response?: RegistryValue | undefined;
}
export class RegistryNode implements IRegistryNode {
address?: string | undefined;
id?: string | undefined;
metadata?: { [key: string]: string; } | undefined;
constructor(data?: IRegistryNode) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.address = _data["address"];
this.id = _data["id"];
if (_data["metadata"]) {
this.metadata = {} as any;
for (let key in _data["metadata"]) {
if (_data["metadata"].hasOwnProperty(key))
(<any>this.metadata)![key] = _data["metadata"][key];
}
}
}
}
static fromJS(data: any): RegistryNode {
data = typeof data === 'object' ? data : {};
let result = new RegistryNode();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["address"] = this.address;
data["id"] = this.id;
if (this.metadata) {
data["metadata"] = {};
for (let key in this.metadata) {
if (this.metadata.hasOwnProperty(key))
(<any>data["metadata"])[key] = this.metadata[key];
}
}
return data;
}
}
export interface IRegistryNode {
address?: string | undefined;
id?: string | undefined;
metadata?: { [key: string]: string; } | undefined;
}
export class RegistryService implements IRegistryService {
endpoints?: RegistryEndpoint[] | undefined;
metadata?: { [key: string]: string; } | undefined;
name?: string | undefined;
nodes?: RegistryNode[] | undefined;
version?: string | undefined;
constructor(data?: IRegistryService) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
if (Array.isArray(_data["endpoints"])) {
this.endpoints = [] as any;
for (let item of _data["endpoints"])
this.endpoints!.push(RegistryEndpoint.fromJS(item));
}
if (_data["metadata"]) {
this.metadata = {} as any;
for (let key in _data["metadata"]) {
if (_data["metadata"].hasOwnProperty(key))
(<any>this.metadata)![key] = _data["metadata"][key];
}
}
this.name = _data["name"];
if (Array.isArray(_data["nodes"])) {
this.nodes = [] as any;
for (let item of _data["nodes"])
this.nodes!.push(RegistryNode.fromJS(item));
}
this.version = _data["version"];
}
}
static fromJS(data: any): RegistryService {
data = typeof data === 'object' ? data : {};
let result = new RegistryService();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
if (Array.isArray(this.endpoints)) {
data["endpoints"] = [];
for (let item of this.endpoints)
data["endpoints"].push(item.toJSON());
}
if (this.metadata) {
data["metadata"] = {};
for (let key in this.metadata) {
if (this.metadata.hasOwnProperty(key))
(<any>data["metadata"])[key] = this.metadata[key];
}
}
data["name"] = this.name;
if (Array.isArray(this.nodes)) {
data["nodes"] = [];
for (let item of this.nodes)
data["nodes"].push(item.toJSON());
}
data["version"] = this.version;
return data;
}
}
export interface IRegistryService {
endpoints?: RegistryEndpoint[] | undefined;
metadata?: { [key: string]: string; } | undefined;
name?: string | undefined;
nodes?: RegistryNode[] | undefined;
version?: string | undefined;
}
export class RegistryValue implements IRegistryValue {
name?: string | undefined;
type?: string | undefined;
values?: RegistryValue[] | undefined;
constructor(data?: IRegistryValue) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.name = _data["name"];
this.type = _data["type"];
if (Array.isArray(_data["values"])) {
this.values = [] as any;
for (let item of _data["values"])
this.values!.push(RegistryValue.fromJS(item));
}
}
}
static fromJS(data: any): RegistryValue {
data = typeof data === 'object' ? data : {};
let result = new RegistryValue();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
data["type"] = this.type;
if (Array.isArray(this.values)) {
data["values"] = [];
for (let item of this.values)
data["values"].push(item.toJSON());
}
return data;
}
}
export interface IRegistryValue {
name?: string | undefined;
type?: string | undefined;
values?: RegistryValue[] | undefined;
}
export class GetSummaryResponse implements IGetSummaryResponse {
registry?: RegistrySummary | undefined;
services?: ServicesSummary | undefined;
constructor(data?: IGetSummaryResponse) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.registry = _data["registry"] ? RegistrySummary.fromJS(_data["registry"]) : <any>undefined;
this.services = _data["services"] ? ServicesSummary.fromJS(_data["services"]) : <any>undefined;
}
}
static fromJS(data: any): GetSummaryResponse {
data = typeof data === 'object' ? data : {};
let result = new GetSummaryResponse();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["registry"] = this.registry ? this.registry.toJSON() : <any>undefined;
data["services"] = this.services ? this.services.toJSON() : <any>undefined;
return data;
}
}
export interface IGetSummaryResponse {
registry?: RegistrySummary | undefined;
services?: ServicesSummary | undefined;
}
export class RegistrySummary implements IRegistrySummary {
addrs?: string[] | undefined;
type?: string | undefined;
constructor(data?: IRegistrySummary) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
if (Array.isArray(_data["addrs"])) {
this.addrs = [] as any;
for (let item of _data["addrs"])
this.addrs!.push(item);
}
this.type = _data["type"];
}
}
static fromJS(data: any): RegistrySummary {
data = typeof data === 'object' ? data : {};
let result = new RegistrySummary();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
if (Array.isArray(this.addrs)) {
data["addrs"] = [];
for (let item of this.addrs)
data["addrs"].push(item);
}
data["type"] = this.type;
return data;
}
}
export interface IRegistrySummary {
addrs?: string[] | undefined;
type?: string | undefined;
}
export class ServicesSummary implements IServicesSummary {
count?: number | undefined;
nodes_count?: number | undefined;
constructor(data?: IServicesSummary) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.count = _data["count"];
this.nodes_count = _data["nodes_count"];
}
}
static fromJS(data: any): ServicesSummary {
data = typeof data === 'object' ? data : {};
let result = new ServicesSummary();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["count"] = this.count;
data["nodes_count"] = this.nodes_count;
return data;
}
}
export interface IServicesSummary {
count?: number | undefined;
nodes_count?: number | undefined;
}
export class ApiException extends Error {
message: string;
status: number;
response: string;
headers: { [key: string]: any; };
result: any;
constructor(message: string, status: number, response: string, headers: { [key: string]: any; }, result: any) {
super();
this.message = message;
this.status = status;
this.response = response;
this.headers = headers;
this.result = result;
}
protected isApiException = true;
static isApiException(obj: any): obj is ApiException {
return obj.isApiException === true;
}
}
function throwException(message: string, status: number, response: string, headers: { [key: string]: any; }, result?: any): Observable<any> {
if (result !== null && result !== undefined)
return _observableThrow(result);
else
return _observableThrow(new ApiException(message, status, response, headers, null));
}
function blobToText(blob: any): Observable<string> {
return new Observable<string>((observer: any) => {
if (!blob) {
observer.next("");
observer.complete();
} else {
let reader = new FileReader();
reader.onload = event => {
observer.next((<any>event.target).result);
observer.complete();
};
reader.readAsText(blob);
}
});
}