red-ui/libs/red-ui-http/src/lib/api/licenseReportController.service.ts
2021-07-19 16:44:55 +03:00

130 lines
4.5 KiB
TypeScript

/**
* API Documentation for Redaction Gateway
* Description for redaction
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/ /* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
import { Observable } from 'rxjs';
import { LicenseReport } from '../model/licenseReport';
import { LicenseReportRequest } from '../model/licenseReportRequest';
import { BASE_PATH } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class LicenseReportControllerService {
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
protected basePath = '';
constructor(
protected httpClient: HttpClient,
@Optional() @Inject(BASE_PATH) basePath: string,
@Optional() configuration: Configuration
) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
}
}
/**
* Creates and serves license report.
* None
* @param body reportRequest
* @param limit limit
* @param offset offset
* @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 licenseReport(
body: LicenseReportRequest,
limit?: number,
offset?: number,
observe?: 'body',
reportProgress?: boolean
): Observable<LicenseReport>;
public licenseReport(
body: LicenseReportRequest,
limit?: number,
offset?: number,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<LicenseReport>>;
public licenseReport(
body: LicenseReportRequest,
limit?: number,
offset?: number,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<LicenseReport>>;
public licenseReport(
body: LicenseReportRequest,
limit?: number,
offset?: number,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling licenseReport.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
if (limit !== undefined && limit !== null) {
queryParameters = queryParameters.set('limit', <any>limit);
}
if (offset !== undefined && offset !== null) {
queryParameters = queryParameters.set('offset', <any>offset);
}
let headers = this.defaultHeaders;
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = ['application/json'];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<LicenseReport>('post', `${this.basePath}/report/license`, {
body: body,
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
}