red-ui/libs/red-ui-http/src/lib/api/statusController.service.ts
2020-09-21 18:39:22 +03:00

108 lines
4.1 KiB
TypeScript

/**
* Api Documentation
* Api Documentation
*
* 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, HttpHeaders, HttpParams,
HttpResponse, HttpEvent } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
import { Observable } from 'rxjs';
import { FileStatus } from '../model/fileStatus';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class StatusControllerService {
protected basePath = '';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
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;
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
/**
* Gets the status for all files in a project.
* None
* @param projectId The id of the project you want the status for.
* @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 getProjectStatus(projectId: string, observe?: 'body', reportProgress?: boolean): Observable<Array<FileStatus>>;
public getProjectStatus(projectId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<FileStatus>>>;
public getProjectStatus(projectId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<FileStatus>>>;
public getProjectStatus(projectId: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (projectId === null || projectId === undefined) {
throw new Error('Required parameter projectId was null or undefined when calling getProjectStatus.');
}
let headers = this.defaultHeaders;
// authentication (GIN-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
let 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[] = [
];
return this.httpClient.request<Array<FileStatus>>('get',`${this.basePath}/status/${encodeURIComponent(String(projectId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
}