| /** |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| |
| /* |
| * 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, HttpContext |
| } from '@angular/common/http'; |
| import { Observable } from 'rxjs'; |
| import { OpenApiHttpParams, QueryParamStyle } from '../query.params'; |
| |
| // @ts-ignore |
| import { PostAuthenticationRequest } from '../model/postAuthenticationRequest'; |
| // @ts-ignore |
| import { PostAuthenticationResponse } from '../model/postAuthenticationResponse'; |
| |
| // @ts-ignore |
| import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; |
| import { Configuration } from '../configuration'; |
| import { BaseService } from '../api.base.service'; |
| |
| |
| |
| @Injectable({ |
| providedIn: 'root' |
| }) |
| export class AuthenticationHTTPBasicService extends BaseService { |
| |
| constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { |
| super(basePath, configuration); |
| } |
| |
| /** |
| * Verify authentication |
| * Authenticates the credentials provided and returns the set roles and permissions allowed. |
| * @endpoint post /v1/authentication |
| * @param postAuthenticationRequest |
| * @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. |
| * @param options additional options |
| */ |
| public postAuthentication(postAuthenticationRequest: PostAuthenticationRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PostAuthenticationResponse>; |
| public postAuthentication(postAuthenticationRequest: PostAuthenticationRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PostAuthenticationResponse>>; |
| public postAuthentication(postAuthenticationRequest: PostAuthenticationRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PostAuthenticationResponse>>; |
| public postAuthentication(postAuthenticationRequest: PostAuthenticationRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { |
| if (postAuthenticationRequest === null || postAuthenticationRequest === undefined) { |
| throw new Error('Required parameter postAuthenticationRequest was null or undefined when calling postAuthentication.'); |
| } |
| |
| let localVarHeaders = this.defaultHeaders; |
| |
| // authentication (basicAuth) required |
| localVarHeaders = this.configuration.addCredentialToHeaders('basicAuth', 'Authorization', localVarHeaders, 'Basic '); |
| |
| // authentication (tenantid) required |
| localVarHeaders = this.configuration.addCredentialToHeaders('tenantid', 'fineract-platform-tenantid', localVarHeaders); |
| |
| 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; |
| |
| |
| // to determine the Content-Type header |
| const consumes: string[] = [ |
| 'application/json' |
| ]; |
| const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); |
| if (httpContentTypeSelected !== undefined) { |
| localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); |
| } |
| |
| 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 = `/v1/authentication`; |
| const { basePath, withCredentials } = this.configuration; |
| return this.httpClient.request<PostAuthenticationResponse>('post', `${basePath}${localVarPath}`, |
| { |
| context: localVarHttpContext, |
| body: postAuthenticationRequest, |
| responseType: <any>responseType_, |
| ...(withCredentials ? { withCredentials } : {}), |
| headers: localVarHeaders, |
| observe: observe, |
| ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), |
| reportProgress: reportProgress |
| } |
| ); |
| } |
| |
| } |