forked from lthn/blockchain
Introduces a new Angular client SDK for the Lethean Blockchain API, generated via OpenAPI Generator. Includes all necessary Angular service, model, configuration, and packaging files, and updates the Makefile to support the 'angular' target for SDK generation.
147 lines
7.2 KiB
TypeScript
Generated
147 lines
7.2 KiB
TypeScript
Generated
/**
|
|
* Lethean Blockchain API
|
|
*
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* 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, HttpParameterCodec, HttpContext
|
|
} from '@angular/common/http';
|
|
import { CustomHttpParameterCodec } from '../encoder';
|
|
import { Observable } from 'rxjs';
|
|
|
|
// @ts-ignore
|
|
import { InfoModel } from '../model/infoModel';
|
|
// @ts-ignore
|
|
import { VersionModel } from '../model/versionModel';
|
|
|
|
// @ts-ignore
|
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
import { lthnConfiguration } from '../configuration';
|
|
import { BaseService } from '../api.base.service';
|
|
|
|
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class InfoService extends BaseService {
|
|
|
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: lthnConfiguration) {
|
|
super(basePath, configuration);
|
|
}
|
|
|
|
/**
|
|
* Get detailed information about the blockchain and daemon state
|
|
* @param flags Possible values: net_time_delta_median, current_network_hashrate_50, current_network_hashrate_350, seconds_for_10_blocks, seconds_for_30_blocks, transactions_daily_stat, last_pos_timestamp, last_pow_timestamp, total_coins, last_block_size, tx_count_in_last_block, pos_sequence_factor, pow_sequence_factor, pos_difficulty, performance, outs_stat, expirations_median.
|
|
* @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 getInfo(flags?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InfoModel>;
|
|
public getInfo(flags?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InfoModel>>;
|
|
public getInfo(flags?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InfoModel>>;
|
|
public getInfo(flags?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
|
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
<any>flags, 'flags');
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
'application/json'
|
|
]);
|
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
}
|
|
|
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
|
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
|
|
|
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
if (localVarHttpHeaderAcceptSelected) {
|
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
responseType_ = 'text';
|
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
responseType_ = 'json';
|
|
} else {
|
|
responseType_ = 'blob';
|
|
}
|
|
}
|
|
|
|
let localVarPath = `/info`;
|
|
const { basePath, withCredentials } = this.configuration;
|
|
return this.httpClient.request<InfoModel>('get', `${basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
params: localVarQueryParameters,
|
|
responseType: <any>responseType_,
|
|
...(withCredentials ? { withCredentials } : {}),
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
transferCache: localVarTransferCache,
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get API version
|
|
* Returns the current version of the API.
|
|
* @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 version(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<VersionModel>;
|
|
public version(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<VersionModel>>;
|
|
public version(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<VersionModel>>;
|
|
public version(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
'application/json'
|
|
]);
|
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
}
|
|
|
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
|
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
|
|
|
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
if (localVarHttpHeaderAcceptSelected) {
|
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
responseType_ = 'text';
|
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
responseType_ = 'json';
|
|
} else {
|
|
responseType_ = 'blob';
|
|
}
|
|
}
|
|
|
|
let localVarPath = `/info/version`;
|
|
const { basePath, withCredentials } = this.configuration;
|
|
return this.httpClient.request<VersionModel>('get', `${basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
responseType: <any>responseType_,
|
|
...(withCredentials ? { withCredentials } : {}),
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
transferCache: localVarTransferCache,
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
}
|