forked from loafle/openapi-generator-original
[typescript-nestjs] Accept async function for fetching access token (#18190)
* feat: starts accepting async function for fetching access token in typescript-nestjs * fix: adds Provider in the import to fix build error * chore: deletes package lock * chore: deletes package lock for v6 * fix: switches to switchMap for map
This commit is contained in:
parent
406d00fe9b
commit
c64d569a7d
@ -3,7 +3,7 @@ import { DynamicModule, Module, Global, Provider } from '@nestjs/common';
|
||||
import { HttpModule, HttpService } from '@nestjs/axios';
|
||||
{{/useAxiosHttpModule}}
|
||||
{{^useAxiosHttpModule}}
|
||||
import { DynamicModule, HttpService, HttpModule, Module, Global } from '@nestjs/common';
|
||||
import { DynamicModule, HttpService, HttpModule, Module, Global, Provider } from '@nestjs/common';
|
||||
{{/useAxiosHttpModule}}
|
||||
import { AsyncConfiguration, Configuration, ConfigurationFactory } from './configuration';
|
||||
|
||||
|
@ -9,11 +9,12 @@ import { HttpService } from '@nestjs/axios';
|
||||
import { HttpService, Inject, Injectable, Optional } from '@nestjs/common';
|
||||
{{/useAxiosHttpModule}}
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, from, of, switchMap } from 'rxjs';
|
||||
{{#imports}}
|
||||
import { {{classname}} } from '../{{filename}}';
|
||||
{{/imports}}
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
{{#withInterfaces}}
|
||||
import { {{classname}}Interface } from './{{classFilename}}Interface';
|
||||
{{/withInterfaces}}
|
||||
@ -117,6 +118,8 @@ export class {{classname}} {
|
||||
{{/isArray}}
|
||||
{{/headerParams}}
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
{{#authMethods}}
|
||||
// authentication ({{name}}) required
|
||||
{{#isApiKey}}
|
||||
@ -144,17 +147,16 @@ export class {{classname}} {
|
||||
{{/isBasicBasic}}
|
||||
{{#isBasicBearer}}
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headers['Authorization'] = `Bearer ${this.configuration.accessToken()}`;
|
||||
accessTokenObservable = from(Promise.resolve(this.configuration.accessToken()));
|
||||
} else if (this.configuration.accessToken) {
|
||||
headers['Authorization'] = `Bearer ${this.configuration.accessToken}`;
|
||||
accessTokenObservable = from(Promise.resolve(this.configuration.accessToken));
|
||||
}
|
||||
{{/isBasicBearer}}
|
||||
{{#isOAuth}}
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
{{/isOAuth}}
|
||||
@ -224,18 +226,26 @@ export class {{classname}} {
|
||||
{{/formParams}}
|
||||
|
||||
{{/hasFormParams}}
|
||||
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}}
|
||||
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams!.toString() : formParams!{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}}
|
||||
{
|
||||
{{#hasQueryParams}}
|
||||
params: queryParameters,
|
||||
{{/hasQueryParams}}
|
||||
{{#isResponseFile}}
|
||||
responseType: "blob",
|
||||
{{/isResponseFile}}
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}}
|
||||
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams!.toString() : formParams!{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}}
|
||||
{
|
||||
{{#hasQueryParams}}
|
||||
params: queryParameters,
|
||||
{{/hasQueryParams}}
|
||||
{{#isResponseFile}}
|
||||
responseType: "blob",
|
||||
{{/isResponseFile}}
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
{{/operation}}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { DynamicModule, HttpService, HttpModule, Module, Global } from '@nestjs/common';
|
||||
import { DynamicModule, HttpService, HttpModule, Module, Global, Provider } from '@nestjs/common';
|
||||
import { AsyncConfiguration, Configuration, ConfigurationFactory } from './configuration';
|
||||
|
||||
import { PetService } from './api/pet.service';
|
||||
|
@ -13,10 +13,11 @@
|
||||
|
||||
import { HttpService, Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, from, of, switchMap } from 'rxjs';
|
||||
import { ApiResponse } from '../model/apiResponse';
|
||||
import { Pet } from '../model/pet';
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -56,12 +57,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -83,12 +85,20 @@ export class PetService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -112,12 +122,13 @@ export class PetService {
|
||||
headers['api_key'] = String(apiKey);
|
||||
}
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -131,11 +142,19 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -159,12 +178,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -180,12 +200,20 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -209,12 +237,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -230,12 +259,20 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -254,6 +291,8 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -272,11 +311,19 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -295,12 +342,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -322,12 +370,20 @@ export class PetService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.put<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.put<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -350,12 +406,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -390,12 +447,20 @@ export class PetService {
|
||||
formParams!.append('status', <any>status);
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
convertFormParamsToString ? formParams!.toString() : formParams!,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
convertFormParamsToString ? formParams!.toString() : formParams!,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -418,12 +483,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -463,12 +529,20 @@ export class PetService {
|
||||
formParams!.append('file', <any>file);
|
||||
}
|
||||
|
||||
return this.httpClient.post<ApiResponse>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
|
||||
convertFormParamsToString ? formParams!.toString() : formParams!,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<ApiResponse>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
|
||||
convertFormParamsToString ? formParams!.toString() : formParams!,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,10 @@
|
||||
|
||||
import { HttpService, Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, from, of, switchMap } from 'rxjs';
|
||||
import { Order } from '../model/order';
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -55,6 +56,8 @@ export class StoreService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
];
|
||||
@ -66,11 +69,19 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -84,6 +95,8 @@ export class StoreService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -101,11 +114,19 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -124,6 +145,8 @@ export class StoreService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml',
|
||||
@ -137,11 +160,19 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -160,6 +191,8 @@ export class StoreService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml',
|
||||
@ -178,12 +211,20 @@ export class StoreService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
|
||||
order,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
|
||||
order,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,10 @@
|
||||
|
||||
import { HttpService, Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, from, of, switchMap } from 'rxjs';
|
||||
import { User } from '../model/user';
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -55,6 +56,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -76,12 +79,20 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<any>(`${this.basePath}/user`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -100,6 +111,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -121,12 +134,20 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -145,6 +166,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -166,12 +189,20 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -190,6 +221,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -206,11 +239,19 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -229,6 +270,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml',
|
||||
@ -242,11 +285,19 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -278,6 +329,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml',
|
||||
@ -291,12 +344,20 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<string>(`${this.basePath}/user/login`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<string>(`${this.basePath}/user/login`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -310,6 +371,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -326,11 +389,19 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -354,6 +425,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -375,12 +448,20 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,11 @@
|
||||
import { Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { HttpService } from '@nestjs/axios';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, from, of, switchMap } from 'rxjs';
|
||||
import { ApiResponse } from '../model/apiResponse';
|
||||
import { Pet } from '../model/pet';
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -57,12 +58,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -84,12 +86,20 @@ export class PetService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -113,12 +123,13 @@ export class PetService {
|
||||
headers['api_key'] = String(apiKey);
|
||||
}
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -132,11 +143,19 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -160,12 +179,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -181,12 +201,20 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -210,12 +238,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -231,12 +260,20 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -255,6 +292,8 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -273,11 +312,19 @@ export class PetService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -296,12 +343,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -323,12 +371,20 @@ export class PetService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.put<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.put<Pet>(`${this.basePath}/pet`,
|
||||
pet,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -351,12 +407,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -391,12 +448,20 @@ export class PetService {
|
||||
formParams!.append('status', <any>status);
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
convertFormParamsToString ? formParams!.toString() : formParams!,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
|
||||
convertFormParamsToString ? formParams!.toString() : formParams!,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -419,12 +484,13 @@ export class PetService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (petstore_auth) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers['Authorization'] = 'Bearer ' + accessToken;
|
||||
accessTokenObservable = typeof this.configuration.accessToken === 'function'
|
||||
? from(Promise.resolve(this.configuration.accessToken()))
|
||||
: from(Promise.resolve(this.configuration.accessToken))
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
@ -464,12 +530,20 @@ export class PetService {
|
||||
formParams!.append('file', <any>file);
|
||||
}
|
||||
|
||||
return this.httpClient.post<ApiResponse>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
|
||||
convertFormParamsToString ? formParams!.toString() : formParams!,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<ApiResponse>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
|
||||
convertFormParamsToString ? formParams!.toString() : formParams!,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,10 @@
|
||||
import { Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { HttpService } from '@nestjs/axios';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, from, of, switchMap } from 'rxjs';
|
||||
import { Order } from '../model/order';
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -56,6 +57,8 @@ export class StoreService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
];
|
||||
@ -67,11 +70,19 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -85,6 +96,8 @@ export class StoreService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -102,11 +115,19 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -125,6 +146,8 @@ export class StoreService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml',
|
||||
@ -138,11 +161,19 @@ export class StoreService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -161,6 +192,8 @@ export class StoreService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml',
|
||||
@ -179,12 +212,20 @@ export class StoreService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
|
||||
order,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
|
||||
order,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,10 @@
|
||||
import { Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { HttpService } from '@nestjs/axios';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, from, of, switchMap } from 'rxjs';
|
||||
import { User } from '../model/user';
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -56,6 +57,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -77,12 +80,20 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<any>(`${this.basePath}/user`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -101,6 +112,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -122,12 +135,20 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -146,6 +167,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -167,12 +190,20 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -191,6 +222,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -207,11 +240,19 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -230,6 +271,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml',
|
||||
@ -243,11 +286,19 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -279,6 +330,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// to determine the Accept header
|
||||
let httpHeaderAccepts: string[] = [
|
||||
'application/xml',
|
||||
@ -292,12 +345,20 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<string>(`${this.basePath}/user/login`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<string>(`${this.basePath}/user/login`,
|
||||
{
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -311,6 +372,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -327,11 +390,19 @@ export class UserService {
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
];
|
||||
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
@ -355,6 +426,8 @@ export class UserService {
|
||||
|
||||
let headers = {...this.defaultHeaders};
|
||||
|
||||
let accessTokenObservable: Observable<any> = of(null);
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKeys?.["api_key"]) {
|
||||
headers['api_key'] = this.configuration.apiKeys["api_key"];
|
||||
@ -376,12 +449,20 @@ export class UserService {
|
||||
if (httpContentTypeSelected != undefined) {
|
||||
headers['Content-Type'] = httpContentTypeSelected;
|
||||
}
|
||||
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
return accessTokenObservable.pipe(
|
||||
switchMap((accessToken) => {
|
||||
if (accessToken) {
|
||||
headers['Authorization'] = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
|
||||
user,
|
||||
{
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers
|
||||
}
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user