forked from loafle/openapi-generator-original
[typescript-angular] refactor service classes for reduced bundle sizes. (#20681)
This reduces bundle sizes of ESM bundles on the order of 20%.
This commit is contained in:
parent
9537a7fb46
commit
5f92de4785
@ -182,6 +182,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
|||||||
supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts"));
|
supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts"));
|
||||||
supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts"));
|
supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts"));
|
||||||
supportingFiles.add(new SupportingFile("configuration.mustache", getIndexDirectory(), "configuration.ts"));
|
supportingFiles.add(new SupportingFile("configuration.mustache", getIndexDirectory(), "configuration.ts"));
|
||||||
|
supportingFiles.add(new SupportingFile("api.base.service.mustache", getIndexDirectory(), "api.base.service.ts"));
|
||||||
supportingFiles.add(new SupportingFile("variables.mustache", getIndexDirectory(), "variables.ts"));
|
supportingFiles.add(new SupportingFile("variables.mustache", getIndexDirectory(), "variables.ts"));
|
||||||
supportingFiles.add(new SupportingFile("encoder.mustache", getIndexDirectory(), "encoder.ts"));
|
supportingFiles.add(new SupportingFile("encoder.mustache", getIndexDirectory(), "encoder.ts"));
|
||||||
supportingFiles.add(new SupportingFile("param.mustache", getIndexDirectory(), "param.ts"));
|
supportingFiles.add(new SupportingFile("param.mustache", getIndexDirectory(), "param.ts"));
|
||||||
@ -411,7 +412,10 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
|||||||
hasSomeFormParams = true;
|
hasSomeFormParams = true;
|
||||||
}
|
}
|
||||||
op.httpMethod = op.httpMethod.toLowerCase(Locale.ENGLISH);
|
op.httpMethod = op.httpMethod.toLowerCase(Locale.ENGLISH);
|
||||||
|
// deduplicate auth methods by name (as they will lead to duplicate code):
|
||||||
|
op.authMethods =
|
||||||
|
op.authMethods != null ? op.authMethods.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(x -> x.name))), ArrayList::new))
|
||||||
|
: null;
|
||||||
|
|
||||||
// Prep a string buffer where we're going to set up our new version of the string.
|
// Prep a string buffer where we're going to set up our new version of the string.
|
||||||
StringBuilder pathBuffer = new StringBuilder();
|
StringBuilder pathBuffer = new StringBuilder();
|
||||||
|
69
modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache
vendored
Normal file
69
modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { {{configurationClassName}} } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: {{configurationClassName}};
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: {{configurationClassName}}) {
|
||||||
|
this.configuration = configuration || new {{configurationClassName}}();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,7 @@ import { {{ classname }} } from '{{ filename }}';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { {{configurationClassName}} } from '../configuration';
|
import { {{configurationClassName}} } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
{{#withInterfaces}}
|
{{#withInterfaces}}
|
||||||
import {
|
import {
|
||||||
{{classname}}Interface{{#useSingleRequestParameter}}{{#operations}}{{#operation}}{{#allParams.0}},
|
{{classname}}Interface{{#useSingleRequestParameter}}{{#operations}}{{#operation}}{{#allParams.0}},
|
||||||
@ -55,99 +56,14 @@ export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterIn
|
|||||||
})
|
})
|
||||||
{{/isProvidedInNone}}
|
{{/isProvidedInNone}}
|
||||||
{{#withInterfaces}}
|
{{#withInterfaces}}
|
||||||
export class {{classname}} implements {{classname}}Interface {
|
export class {{classname}} extends BaseService implements {{classname}}Interface {
|
||||||
{{/withInterfaces}}
|
{{/withInterfaces}}
|
||||||
{{^withInterfaces}}
|
{{^withInterfaces}}
|
||||||
export class {{classname}} {
|
export class {{classname}} extends BaseService {
|
||||||
{{/withInterfaces}}
|
{{/withInterfaces}}
|
||||||
|
|
||||||
protected basePath = '{{{basePath}}}';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: {{configurationClassName}}) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new {{configurationClassName}}();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: {{configurationClassName}}) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
{{#hasSomeFormParams}}
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
{{/hasSomeFormParams}}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
{{#isQueryParamObjectFormatJson}}
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
{{/isQueryParamObjectFormatJson}}
|
|
||||||
{{^isQueryParamObjectFormatJson}}
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
{{/isQueryParamObjectFormatJson}}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
{{#isQueryParamObjectFormatJson}}
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, JSON.stringify(value));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is a QueryParamObject");
|
|
||||||
}
|
|
||||||
{{/isQueryParamObjectFormatJson}}
|
|
||||||
{{^isQueryParamObjectFormatJson}}
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString(){{^isDateTime}}.substring(0, 10){{/isDateTime}});
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}{{#isQueryParamObjectFormatDot}}.{{/isQueryParamObjectFormatDot}}{{#isQueryParamObjectFormatKey}}[{{/isQueryParamObjectFormatKey}}${k}{{#isQueryParamObjectFormatKey}}]{{/isQueryParamObjectFormatKey}}` : k));
|
|
||||||
}
|
|
||||||
{{/isQueryParamObjectFormatJson}}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
@ -213,10 +129,8 @@ export class {{classname}} {
|
|||||||
}
|
}
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{^isArray}}
|
{{^isArray}}
|
||||||
if ({{paramName}} !== undefined && {{paramName}} !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>{{paramName}}, '{{baseName}}');
|
||||||
<any>{{paramName}}, '{{baseName}}');
|
|
||||||
}
|
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
|
|
||||||
@ -236,60 +150,43 @@ export class {{classname}} {
|
|||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
|
|
||||||
{{#authMethods}}
|
{{#authMethods}}
|
||||||
{{#-first}}
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
{{/-first}}
|
|
||||||
// authentication ({{name}}) required
|
// authentication ({{name}}) required
|
||||||
localVarCredential = this.configuration.lookupCredential('{{name}}');
|
|
||||||
if (localVarCredential) {
|
|
||||||
{{#isApiKey}}
|
{{#isApiKey}}
|
||||||
{{#isKeyInHeader}}
|
{{#isKeyInHeader}}
|
||||||
localVarHeaders = localVarHeaders.set('{{keyParamName}}', localVarCredential);
|
localVarHeaders = this.configuration.addCredentialToHeaders('{{name}}', '{{keyParamName}}', localVarHeaders);
|
||||||
{{/isKeyInHeader}}
|
{{/isKeyInHeader}}
|
||||||
{{#isKeyInQuery}}
|
{{#isKeyInQuery}}
|
||||||
localVarQueryParameters = localVarQueryParameters.set('{{keyParamName}}', localVarCredential);
|
localVarQueryParameters = this.configuration.addCredentialToQuery('{{name}}', '{{keyParamName}}', localVarQueryParameters);
|
||||||
{{/isKeyInQuery}}
|
{{/isKeyInQuery}}
|
||||||
{{/isApiKey}}
|
{{/isApiKey}}
|
||||||
{{#isBasic}}
|
{{#isBasic}}
|
||||||
{{#isBasicBasic}}
|
{{#isBasicBasic}}
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Basic ' + localVarCredential);
|
localVarHeaders = this.configuration.addCredentialToHeaders('{{name}}', 'Authorization', localVarHeaders, 'Basic ');
|
||||||
{{/isBasicBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isBasicBearer}}
|
{{#isBasicBearer}}
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
localVarHeaders = this.configuration.addCredentialToHeaders('{{name}}', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
{{/isBasicBearer}}
|
{{/isBasicBearer}}
|
||||||
{{/isBasic}}
|
{{/isBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
localVarHeaders = this.configuration.addCredentialToHeaders('{{name}}', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
{{/isOAuth}}
|
{{/isOAuth}}
|
||||||
}
|
|
||||||
|
|
||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
{{#produces}}
|
||||||
// to determine the Accept header
|
'{{{mediaType}}}'{{^-last}},{{/-last}}
|
||||||
const httpHeaderAccepts: string[] = [
|
{{/produces}}
|
||||||
{{#produces}}
|
]);
|
||||||
'{{{mediaType}}}'{{^-last}},{{/-last}}
|
|
||||||
{{/produces}}
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#httpContextInOptions}}
|
{{#httpContextInOptions}}
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
{{/httpContextInOptions}}
|
{{/httpContextInOptions}}
|
||||||
{{#httpTransferCacheInOptions}}
|
{{#httpTransferCacheInOptions}}
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
{{/httpTransferCacheInOptions}}
|
{{/httpTransferCacheInOptions}}
|
||||||
|
|
||||||
{{#bodyParam}}
|
{{#bodyParam}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface {{configurationParametersInterfaceName}} {
|
export interface {{configurationParametersInterfaceName}} {
|
||||||
@ -187,6 +187,20 @@ export class {{configurationClassName}} {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -16,6 +16,7 @@ import org.testng.Assert;
|
|||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -390,4 +391,28 @@ public class TypeScriptAngularClientCodegenTest {
|
|||||||
assertThat(codegen.additionalProperties()).containsEntry("ngPackagrVersion", "19.0.0");
|
assertThat(codegen.additionalProperties()).containsEntry("ngPackagrVersion", "19.0.0");
|
||||||
assertThat(codegen.additionalProperties()).containsEntry("zonejsVersion", "0.15.0");
|
assertThat(codegen.additionalProperties()).containsEntry("zonejsVersion", "0.15.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNoDuplicateAuthentication() throws IOException {
|
||||||
|
// GIVEN
|
||||||
|
final String specPath = "src/test/resources/3_0/spring/petstore-auth.yaml";
|
||||||
|
|
||||||
|
File output = Files.createTempDirectory("test").toFile();
|
||||||
|
output.deleteOnExit();
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||||
|
.setGeneratorName("typescript-angular")
|
||||||
|
.setInputSpec(specPath)
|
||||||
|
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||||
|
|
||||||
|
final ClientOptInput clientOptInput = configurator.toClientOptInput();
|
||||||
|
|
||||||
|
Generator generator = new DefaultGenerator();
|
||||||
|
generator.opts(clientOptInput).generate();
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
final String fileContents = Files.readString(Paths.get(output + "/api/default.service.ts"));
|
||||||
|
assertThat(fileContents).containsOnlyOnce("localVarHeaders = this.configuration.addCredentialToHeaders('OAuth2', 'Authorization', localVarHeaders, 'Bearer ');");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -22,72 +22,17 @@ import { PetWithMappedDiscriminatorModel } from '../model/petWithMappedDiscrimin
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://api.example.xyz/v1';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,27 +46,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -148,6 +148,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -22,72 +22,17 @@ import { PetWithMappedDiscriminatorModel } from '../model/petWithMappedDiscrimin
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://api.example.xyz/v1';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,27 +46,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -148,6 +148,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/default.service.ts
|
api/default.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -22,72 +22,17 @@ import { Fruit } from '../model/fruit';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class DefaultService {
|
export class DefaultService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://localhost';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,22 +46,14 @@ export class DefaultService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -155,21 +92,13 @@ export class DefaultService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -148,6 +148,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'any'
|
providedIn: 'any'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,28 +53,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -200,28 +120,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -271,30 +179,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -346,30 +242,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -414,30 +298,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -480,28 +352,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -557,28 +417,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -646,29 +494,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'any'
|
providedIn: 'any'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -161,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -227,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -286,23 +203,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'any'
|
providedIn: 'any'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -173,21 +110,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -239,21 +168,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -306,21 +227,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -363,23 +276,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -425,34 +330,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -492,21 +385,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -554,21 +439,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,28 +53,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -200,28 +120,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -271,30 +179,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -346,30 +242,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -414,30 +298,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -480,28 +352,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -557,28 +417,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -646,29 +494,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -161,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -227,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -286,23 +203,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -173,21 +110,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -239,21 +168,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -306,21 +227,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -363,23 +276,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -425,34 +330,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -492,21 +385,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -554,21 +439,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,28 +53,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -200,28 +120,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -271,30 +179,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -346,30 +242,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -414,30 +298,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -480,28 +352,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -557,28 +417,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -646,29 +494,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -161,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -227,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -286,23 +203,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -173,21 +110,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -239,21 +168,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -306,21 +227,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -363,23 +276,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -425,34 +330,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -492,21 +385,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -554,21 +439,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/default.service.ts
|
api/default.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -22,72 +22,17 @@ import { Fruit } from '../model/fruit';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class DefaultService {
|
export class DefaultService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://localhost';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,22 +46,14 @@ export class DefaultService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -155,21 +92,13 @@ export class DefaultService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -148,6 +148,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'any'
|
providedIn: 'any'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,28 +53,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -200,28 +120,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -271,30 +179,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -346,30 +242,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -414,30 +298,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -480,28 +352,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -557,28 +417,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -646,29 +494,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'any'
|
providedIn: 'any'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -161,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -227,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -286,23 +203,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'any'
|
providedIn: 'any'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -173,21 +110,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -239,21 +168,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -306,21 +227,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -363,23 +276,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -425,34 +330,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -492,21 +385,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -554,21 +439,13 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,30 +54,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -204,28 +124,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -275,30 +183,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -350,30 +246,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -418,30 +302,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -485,30 +357,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -565,28 +425,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -655,29 +503,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -161,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -227,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -287,23 +204,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,28 +52,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -182,28 +115,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -257,28 +178,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -332,28 +241,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -397,23 +294,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -460,34 +349,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -528,28 +405,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -597,28 +462,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,30 +54,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -204,28 +124,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -275,30 +183,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -350,30 +246,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -418,30 +302,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -485,30 +357,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -565,28 +425,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -655,29 +503,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -161,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -227,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -287,23 +204,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,28 +52,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -182,28 +115,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -257,28 +178,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -332,28 +241,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -397,23 +294,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -460,34 +349,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -528,28 +405,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -597,28 +462,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,30 +54,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -204,28 +124,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -275,30 +183,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -350,30 +246,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -418,30 +302,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -485,30 +357,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -565,28 +425,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -655,29 +503,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -161,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -227,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -287,23 +204,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,28 +52,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -182,28 +115,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -257,28 +178,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -332,28 +241,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -397,23 +294,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -460,34 +349,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -528,28 +405,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -597,28 +462,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,74 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, JSON.stringify(value));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is a QueryParamObject");
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,30 +54,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -193,28 +124,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -264,30 +183,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -339,30 +246,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -407,30 +302,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -474,30 +357,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -554,28 +425,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -644,29 +503,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,61 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, JSON.stringify(value));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is a QueryParamObject");
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -150,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -216,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -276,23 +204,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,61 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, JSON.stringify(value));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is a QueryParamObject");
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,28 +52,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -171,28 +115,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -246,28 +178,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -321,28 +241,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -386,23 +294,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -449,34 +349,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -517,28 +405,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -586,28 +462,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,30 +54,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -204,28 +124,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -275,30 +183,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -350,30 +246,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -418,30 +302,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -485,30 +357,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -565,28 +425,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -655,29 +503,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -161,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -227,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -287,23 +204,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,28 +52,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -182,28 +115,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -257,28 +178,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -332,28 +241,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -397,23 +294,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -460,34 +349,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -528,28 +405,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -597,28 +462,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,30 +54,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -204,28 +124,16 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -275,30 +183,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -350,30 +246,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -418,30 +302,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -485,30 +357,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -565,28 +425,16 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -655,29 +503,17 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +52,13 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -161,29 +98,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -227,23 +152,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -287,23 +204,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,28 +52,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -182,28 +115,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -257,28 +178,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -332,28 +241,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -397,23 +294,15 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -460,34 +349,22 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -528,28 +405,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -597,28 +462,16 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,35 +54,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -210,33 +127,18 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -287,35 +189,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -368,35 +255,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -442,35 +314,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -515,35 +372,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -601,33 +443,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -697,34 +524,19 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,26 +52,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -167,34 +101,19 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -239,28 +158,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -305,28 +213,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,33 +52,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -188,33 +118,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -269,33 +184,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -350,33 +250,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -421,28 +306,17 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -490,39 +364,24 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -564,33 +423,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -639,33 +483,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,35 +54,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -210,33 +127,18 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -287,35 +189,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -368,35 +255,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -442,35 +314,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -515,35 +372,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -601,33 +443,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -697,34 +524,19 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,26 +52,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -167,34 +101,19 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -239,28 +158,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -305,28 +213,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,33 +52,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -188,33 +118,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -269,33 +184,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -350,33 +250,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -421,28 +306,17 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -490,39 +364,24 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -564,33 +423,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -639,33 +483,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from './encoder';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
|
||||||
|
export class BaseService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration: Configuration;
|
||||||
|
public encoder: HttpParameterCodec;
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, basePath?: string|string[], configuration?: Configuration) {
|
||||||
|
this.configuration = configuration || new Configuration();
|
||||||
|
if (typeof this.configuration.basePath !== 'string') {
|
||||||
|
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||||
|
if (firstBasePath != undefined) {
|
||||||
|
basePath = firstBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof basePath !== 'string') {
|
||||||
|
basePath = this.basePath;
|
||||||
|
}
|
||||||
|
this.configuration.basePath = basePath;
|
||||||
|
}
|
||||||
|
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected canConsumeForm(consumes: string[]): boolean {
|
||||||
|
return consumes.indexOf('multipart/form-data') !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
// If the value is an object (but not a Date), recursively add its keys.
|
||||||
|
if (typeof value === 'object' && !(value instanceof Date)) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
// If JSON format is preferred, key must be provided.
|
||||||
|
if (key != null) {
|
||||||
|
return httpParams.append(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
// Otherwise, if it's an array, add each element.
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||||
|
} else if (value instanceof Date) {
|
||||||
|
if (key != null) {
|
||||||
|
httpParams = httpParams.append(key, value.toISOString());
|
||||||
|
} else {
|
||||||
|
throw Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Object.keys(value).forEach(k => {
|
||||||
|
const paramKey = key ? `${key}.${k}` : k;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return httpParams;
|
||||||
|
} else if (key != null) {
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
throw Error("key may not be null if value is not object or array");
|
||||||
|
}
|
||||||
|
}
|
@ -24,85 +24,17 @@ import { Pet } from '../model/pet';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PetService {
|
export class PetService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,35 +54,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -210,33 +127,18 @@ export class PetService {
|
|||||||
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
localVarHeaders = localVarHeaders.set('api_key', String(apiKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -287,35 +189,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -368,35 +255,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -442,35 +314,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -515,35 +372,20 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -601,33 +443,18 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
@ -697,34 +524,19 @@ export class PetService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
localVarCredential = this.configuration.lookupCredential('petstore_auth');
|
localVarHeaders = this.configuration.addCredentialToHeaders('petstore_auth', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
const consumes: string[] = [
|
const consumes: string[] = [
|
||||||
|
@ -22,72 +22,17 @@ import { Order } from '../model/order';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class StoreService {
|
export class StoreService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,26 +52,15 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -167,34 +101,19 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/json'
|
||||||
// to determine the Accept header
|
]);
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -239,28 +158,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -305,28 +213,17 @@ export class StoreService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -22,72 +22,17 @@ import { User } from '../model/user';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService extends BaseService {
|
||||||
|
|
||||||
protected basePath = 'http://petstore.swagger.io/v2';
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
public defaultHeaders = new HttpHeaders();
|
super(httpClient, basePath, configuration);
|
||||||
public configuration = new Configuration();
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) {
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
}
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
|
||||||
if (typeof value === "object" && value instanceof Date === false) {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
|
||||||
} else {
|
|
||||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
|
||||||
if (value == null) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === "object") {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, (value as Date).toISOString().substring(0, 10));
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is Date");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
|
||||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
|
||||||
}
|
|
||||||
} else if (key != null) {
|
|
||||||
httpParams = httpParams.append(key, value);
|
|
||||||
} else {
|
|
||||||
throw Error("key may not be null if value is not object or array");
|
|
||||||
}
|
|
||||||
return httpParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,33 +52,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -188,33 +118,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -269,33 +184,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
@ -350,33 +250,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -421,28 +306,17 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -490,39 +364,24 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (username !== undefined && username !== null) {
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
<any>username, 'username');
|
||||||
<any>username, 'username');
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
}
|
<any>password, 'password');
|
||||||
if (password !== undefined && password !== null) {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>password, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
'application/xml',
|
||||||
// to determine the Accept header
|
'application/json'
|
||||||
const httpHeaderAccepts: string[] = [
|
]);
|
||||||
'application/xml',
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -564,33 +423,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
@ -639,33 +483,18 @@ export class UserService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
let localVarCredential: string | undefined;
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
localVarCredential = this.configuration.lookupCredential('api_key');
|
localVarHeaders = this.configuration.addCredentialToHeaders('api_key', 'api_key', localVarHeaders);
|
||||||
if (localVarCredential) {
|
|
||||||
localVarHeaders = localVarHeaders.set('api_key', localVarCredential);
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
]);
|
||||||
// to determine the Accept header
|
|
||||||
const httpHeaderAccepts: string[] = [
|
|
||||||
];
|
|
||||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
||||||
}
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
if (localVarHttpContext === undefined) {
|
|
||||||
localVarHttpContext = new HttpContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarTransferCache: boolean | undefined = options && options.transferCache;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (localVarTransferCache === undefined) {
|
|
||||||
localVarTransferCache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||||
import { Param } from './param';
|
import { Param } from './param';
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
export interface ConfigurationParameters {
|
||||||
@ -168,6 +168,20 @@ export class Configuration {
|
|||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? headers.set(headerName, (prefix ?? '') + value)
|
||||||
|
: headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams {
|
||||||
|
const value = this.lookupCredential(credentialKey);
|
||||||
|
return value
|
||||||
|
? query.set(paramName, value)
|
||||||
|
: query;
|
||||||
|
}
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
private defaultEncodeParam(param: Param): string {
|
||||||
// This implementation exists as fallback for missing configuration
|
// This implementation exists as fallback for missing configuration
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
// and for backwards compatibility to older typescript-angular generator versions.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
|
api.base.service.ts
|
||||||
api.module.ts
|
api.module.ts
|
||||||
api/api.ts
|
api/api.ts
|
||||||
api/pet.service.ts
|
api/pet.service.ts
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user