diff --git a/README.md b/README.md index 4766e6d..cb94b50 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ An OpenAPI 3 code generator for Angular ## Overview This package generates interfaces and services from an [OpenApi 3 specification](https://www.openapis.org/). -The generated artifacts follow the [Angular style guide](https://angular.io/guide/styleguide) and are compatible with Angular 7+. +The generated artifacts follow the [Angular style guide](https://angular.io/guide/styleguide) and are compatible with Angular 12+. This project is built on top of [ng-openapi-gen](https://github.com/cyclosproject/ng-openapi-gen) and features a lot of improvements listed below. diff --git a/packages/ng-openapi-gen/src/lib/generator.ts b/packages/ng-openapi-gen/src/lib/generator.ts index dbd2034..dba4af5 100644 --- a/packages/ng-openapi-gen/src/lib/generator.ts +++ b/packages/ng-openapi-gen/src/lib/generator.ts @@ -27,7 +27,10 @@ export class Generator { protected outDir: string; protected tempDir: string; - constructor(public openApi: OpenAPIObject, public options: Options) { + constructor( + public openApi: OpenAPIObject, + public options: Options, + ) { this.outDir = trimTrailingSlash(options.output); this.tempDir = this.outDir + '$'; } diff --git a/packages/ng-openapi-gen/src/lib/oa-request-body.ts b/packages/ng-openapi-gen/src/lib/oa-request-body.ts index 547fed4..40b6455 100644 --- a/packages/ng-openapi-gen/src/lib/oa-request-body.ts +++ b/packages/ng-openapi-gen/src/lib/oa-request-body.ts @@ -8,7 +8,11 @@ export class OaRequestBody { public required: boolean; public tsComments: string; - constructor(public spec: RequestBodyObject, public content: OaContent[], public options: Options) { + constructor( + public spec: RequestBodyObject, + public content: OaContent[], + public options: Options, + ) { this.required = spec.required === true; this.tsComments = tsComments(spec.description, 2); } diff --git a/packages/ng-openapi-gen/src/lib/oa-security.ts b/packages/ng-openapi-gen/src/lib/oa-security.ts index 8d1f011..f7940ce 100644 --- a/packages/ng-openapi-gen/src/lib/oa-security.ts +++ b/packages/ng-openapi-gen/src/lib/oa-security.ts @@ -15,7 +15,11 @@ export class OaSecurity { public in: string; public type: string; - constructor(key: string, public spec: SecuritySchemeObject, public scope: string[] = []) { + constructor( + key: string, + public spec: SecuritySchemeObject, + public scope: string[] = [], + ) { this.name = spec.name || ''; this.var = methodName(key); this.tsComments = tsComments(spec.description || '', 2); diff --git a/packages/ng-openapi-gen/src/lib/oa-service.ts b/packages/ng-openapi-gen/src/lib/oa-service.ts index 3aafa61..d77e756 100644 --- a/packages/ng-openapi-gen/src/lib/oa-service.ts +++ b/packages/ng-openapi-gen/src/lib/oa-service.ts @@ -8,7 +8,11 @@ import { serviceClass } from './utils/open-api.js'; import { tsComments } from './utils/string.js'; export class OaService extends OaBase { - constructor(tag: TagObject, public readonly operations: OaOperation[], options: Options) { + constructor( + tag: TagObject, + public readonly operations: OaOperation[], + options: Options, + ) { super(tag.name, options, serviceClass); this.fileName = this.fileName.replace(/-service$/, '.service'); diff --git a/packages/ng-openapi-gen/src/lib/templates.ts b/packages/ng-openapi-gen/src/lib/templates.ts index a8a0833..d84d30a 100644 --- a/packages/ng-openapi-gen/src/lib/templates.ts +++ b/packages/ng-openapi-gen/src/lib/templates.ts @@ -11,7 +11,12 @@ export class Templates { protected templates: Record = {}; protected globals: Record = {}; - constructor(builtInDir: string, customDir: string, globals: Globals, protected handlebars: typeof Handlebars) { + constructor( + builtInDir: string, + customDir: string, + globals: Globals, + protected handlebars: typeof Handlebars, + ) { const customTemplates = customDir ? readdirSync(customDir) : []; for (const file of customTemplates) { this.loadTemplate(customDir, file); diff --git a/packages/ng-openapi-gen/src/templates/operationBody.handlebars b/packages/ng-openapi-gen/src/templates/operationBody.handlebars index 8c36331..6f2dcad 100644 --- a/packages/ng-openapi-gen/src/templates/operationBody.handlebars +++ b/packages/ng-openapi-gen/src/templates/operationBody.handlebars @@ -1,5 +1,5 @@ {{{bodyMethodTsComments}}}public {{methodName}}({{>operationParameters}}): Observable<{{{resultType}}}> { - return this.{{responseMethodName}}(params).pipe( + return this.{{responseMethodName}}(params, context).pipe( map((r: {{@root.responseClass}}<{{{resultType}}}>) => r.body as {{{resultType}}}), ); } diff --git a/packages/ng-openapi-gen/src/templates/operationParameters.handlebars b/packages/ng-openapi-gen/src/templates/operationParameters.handlebars index 6683273..ade4a58 100644 --- a/packages/ng-openapi-gen/src/templates/operationParameters.handlebars +++ b/packages/ng-openapi-gen/src/templates/operationParameters.handlebars @@ -6,4 +6,5 @@ params{{^operation.parametersRequired}}?{{/operation.parametersRequired}}: { {{{../operation.requestBody.tsComments}}}body{{^../operation.requestBody.required}}?{{/../operation.requestBody.required }}: {{{reIndent type 2}}}; {{/requestBody}} - } \ No newline at end of file + }, + context?: HttpContext \ No newline at end of file diff --git a/packages/ng-openapi-gen/src/templates/operationResponse.handlebars b/packages/ng-openapi-gen/src/templates/operationResponse.handlebars index 00bace4..e71ba07 100644 --- a/packages/ng-openapi-gen/src/templates/operationResponse.handlebars +++ b/packages/ng-openapi-gen/src/templates/operationResponse.handlebars @@ -13,6 +13,7 @@ return this.http.request(rb.build({ responseType: '{{responseType}}', accept: '{{accept}}', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => diff --git a/packages/ng-openapi-gen/src/templates/requestBuilder.handlebars b/packages/ng-openapi-gen/src/templates/requestBuilder.handlebars index 6b30aa6..ce23a85 100644 --- a/packages/ng-openapi-gen/src/templates/requestBuilder.handlebars +++ b/packages/ng-openapi-gen/src/templates/requestBuilder.handlebars @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ {{autoGenerationNotice}} -import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse, HttpContext } from '@angular/common/http'; /** Constrains the HTTP response body to be non-null */ export type {{responseClass}} = HttpResponse & { readonly body: T }; @@ -308,6 +308,9 @@ export class {{requestBuilderClass}} { /** Whether to report progress on uploads / downloads */ reportProgress?: boolean; + + /** Allow passing HttpContext for HttpClient */ + context?: HttpContext; }): HttpRequest { options = options || {}; @@ -346,6 +349,7 @@ export class {{requestBuilderClass}} { headers: httpHeaders, responseType: options.responseType, reportProgress: options.reportProgress, + context: options.context, }); } } diff --git a/packages/ng-openapi-gen/src/templates/service.handlebars b/packages/ng-openapi-gen/src/templates/service.handlebars index c199418..f4d9cd6 100644 --- a/packages/ng-openapi-gen/src/templates/service.handlebars +++ b/packages/ng-openapi-gen/src/templates/service.handlebars @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ {{autoGenerationNotice}} -import { HttpClient, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/api-configuration.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/api-configuration.ts deleted file mode 100644 index d72abdb..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/api-configuration.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; - -/** - * Global configuration - */ -@Injectable({ - providedIn: 'root', -}) -export class ApiConfiguration { - rootUrl: string = '/api/1.0'; -} - -/** - * Parameters for `ApiModule.forRoot()` - */ -export interface ApiConfigurationParams { - rootUrl?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/api.module.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/api.module.ts deleted file mode 100644 index c182c49..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/api.module.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration, ApiConfigurationParams } from './api-configuration'; - -import { Tag1Service } from './services/tag-1.service'; -import { Tag2Service } from './services/tag-2.service'; -import { NoTagService } from './services/no-tag.service'; -import { TagTag2Tag3Tag4Tag5Service } from './services/tag/tag2/tag3/tag4/tag-tag-2-tag-3-tag-4-tag-5.service'; - -/** - * Module that provides all services and configuration. - */ -@NgModule({ - imports: [], - exports: [], - declarations: [], - providers: [Tag1Service, Tag2Service, NoTagService, TagTag2Tag3Tag4Tag5Service, ApiConfiguration], -}) -export class ApiModule { - static forRoot(params: ApiConfigurationParams): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ - { - provide: ApiConfiguration, - useValue: params, - }, - ], - }; - } - - constructor(@Optional() @SkipSelf() parentModule: ApiModule, @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error( - 'You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575', - ); - } - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/base-service.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/base-service.ts deleted file mode 100644 index 545b2d6..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/base-service.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration } from './api-configuration'; - -/** - * Base class for services - */ -@Injectable() -export class BaseService { - constructor(protected config: ApiConfiguration, protected http: HttpClient) {} - - private _rootUrl: string = ''; - - /** - * Returns the root url for all operations in this service. If not set directly in this - * service, will fallback to `ApiConfiguration.rootUrl`. - */ - get rootUrl(): string { - return this._rootUrl || this.config.rootUrl; - } - - /** - * Sets the root URL for API operations in this service. - */ - set rootUrl(rootUrl: string) { - this._rootUrl = rootUrl; - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/models.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/models.ts deleted file mode 100644 index 4b7d820..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/models.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { Error } from './models/error'; -export { RefObject } from './models/ref-object'; -export { RefString } from './models/ref-string'; diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/models/error.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/models/error.ts deleted file mode 100644 index 1b553d8..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/models/error.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface Error { - code?: number; - message?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/models/ref-object.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/models/ref-object.ts deleted file mode 100644 index 7c1f8dc..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/models/ref-object.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface RefObject { - [key: string]: any; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/models/ref-string.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/models/ref-string.ts deleted file mode 100644 index 550bb76..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/models/ref-string.ts +++ /dev/null @@ -1,3 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export type RefString = string; diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/request-builder.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/request-builder.ts deleted file mode 100644 index a08af28..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/request-builder.ts +++ /dev/null @@ -1,369 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders } from '@angular/common/http'; - -/** - * Custom parameter codec to correctly handle the plus sign in parameter - * values. See https://github.com/angular/angular/issues/18261 - */ -class ParameterCodec implements HttpParameterCodec { - encodeKey(key: string): string { - return encodeURIComponent(key); - } - - encodeValue(value: string): string { - return encodeURIComponent(value); - } - - decodeKey(key: string): string { - return decodeURIComponent(key); - } - - decodeValue(value: string): string { - return decodeURIComponent(value); - } -} -const ParameterCodecInstance = new ParameterCodec(); - -/** - * Defines the options for appending a parameter - */ -interface ParameterOptions { - style?: string; - explode?: boolean; -} - -/** - * Base class for a parameter - */ -abstract class Parameter { - constructor( - public name: string, - public value: any, - public options: ParameterOptions, - defaultStyle: string, - defaultExplode: boolean, - ) { - this.options = options || {}; - if (this.options.style === null || this.options.style === undefined) { - this.options.style = defaultStyle; - } - if (this.options.explode === null || this.options.explode === undefined) { - this.options.explode = defaultExplode; - } - } - - serializeValue(value: any, separator = ','): string { - if (value === null || value === undefined) { - return ''; - } else if (value instanceof Array) { - return value - .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))) - .join(separator); - } else if (typeof value === 'object') { - const array: string[] = []; - for (const key of Object.keys(value)) { - let propVal = value[key]; - if (propVal !== null && propVal !== undefined) { - propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator)); - if (this.options.explode) { - array.push(`${key}=${propVal}`); - } else { - array.push(key); - array.push(propVal); - } - } - } - return array.join(separator); - } else { - return String(value); - } - } -} - -/** - * A parameter in the operation path - */ -class PathParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(path: string): string { - let value = this.value; - if (value === null || value === undefined) { - value = ''; - } - let prefix = this.options.style === 'label' ? '.' : ''; - let separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ','; - let alreadySerialized = false; - if (this.options.style === 'matrix') { - // The parameter name is just used as prefix, except in some cases... - prefix = `;${this.name}=`; - if (this.options.explode && typeof value === 'object') { - prefix = ';'; - if (value instanceof Array) { - // For arrays we have to repeat the name for each element - value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`); - value = value.join(';'); - alreadySerialized = true; - } else { - // For objects we have to put each the key / value pairs - value = this.serializeValue(value, ';'); - alreadySerialized = true; - } - } - } - value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator)); - // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account - path = path.replace(`{${this.name}}`, value); - path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value); - return path; - } - - // @ts-ignore - serializeValue(value: any, separator = ','): string { - var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); - return result; - } -} - -/** - * A parameter in the query - */ -class QueryParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'form', true); - } - - append(params: HttpParams): HttpParams { - if (this.value instanceof Array) { - // Array serialization - if (this.options.explode) { - for (const v of this.value) { - params = params.append(this.name, this.serializeValue(v)); - } - } else { - const separator = - this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ','; - return params.append(this.name, this.serializeValue(this.value, separator)); - } - } else if (this.value !== null && typeof this.value === 'object') { - // Object serialization - if (this.options.style === 'deepObject') { - // Append a parameter for each key, in the form `name[key]` - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal)); - } - } - } else if (this.options.explode) { - // Append a parameter for each key without using the parameter name - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(key, this.serializeValue(propVal)); - } - } - } else { - // Append a single parameter whose values are a comma-separated list of key,value,key,value... - const array: any[] = []; - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - array.push(key); - array.push(propVal); - } - } - params = params.append(this.name, this.serializeValue(array)); - } - } else if (this.value !== null && this.value !== undefined) { - // Plain value - params = params.append(this.name, this.serializeValue(this.value)); - } - return params; - } -} - -/** - * A parameter in the HTTP request header - */ -class HeaderParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(headers: HttpHeaders): HttpHeaders { - if (this.value !== null && this.value !== undefined) { - if (this.value instanceof Array) { - for (const v of this.value) { - headers = headers.append(this.name, this.serializeValue(v)); - } - } else { - headers = headers.append(this.name, this.serializeValue(this.value)); - } - } - return headers; - } -} - -/** - * Helper to build http requests from parameters - */ -export class RequestBuilder { - private _path = new Map(); - private _query = new Map(); - private _header = new Map(); - _bodyContent: any | null; - _bodyContentType?: string; - - constructor(public rootUrl: string, public operationPath: string, public method: string) {} - - /** - * Sets a path parameter - */ - path(name: string, value: any, options?: ParameterOptions): void { - this._path.set(name, new PathParameter(name, value, options || {})); - } - - /** - * Sets a query parameter - */ - query(name: string, value: any, options?: ParameterOptions): void { - this._query.set(name, new QueryParameter(name, value, options || {})); - } - - /** - * Sets a header parameter - */ - header(name: string, value: any, options?: ParameterOptions): void { - this._header.set(name, new HeaderParameter(name, value, options || {})); - } - - /** - * Sets the body content, along with the content type - */ - body(value: any, contentType = 'application/json'): void { - if (value instanceof Blob) { - this._bodyContentType = value.type; - } else { - this._bodyContentType = contentType; - } - if ( - this._bodyContentType === 'application/x-www-form-urlencoded' && - value !== null && - typeof value === 'object' - ) { - // Handle URL-encoded data - const pairs: Array<[string, string]> = []; - for (const key of Object.keys(value)) { - let val = value[key]; - if (!(val instanceof Array)) { - val = [val]; - } - for (const v of val) { - const formValue = this.formDataValue(v); - if (formValue !== null) { - pairs.push([key, formValue]); - } - } - } - this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&'); - } else if (this._bodyContentType === 'multipart/form-data') { - // Handle multipart form data - const formData = new FormData(); - if (value !== null && value !== undefined) { - for (const key of Object.keys(value)) { - const val = value[key]; - if (val instanceof Array) { - for (const v of val) { - const toAppend = this.formDataValue(v); - if (toAppend !== null) { - formData.append(key, toAppend); - } - } - } else { - const toAppend = this.formDataValue(val); - if (toAppend !== null) { - formData.set(key, toAppend); - } - } - } - } - this._bodyContent = formData; - } else { - // The body is the plain content - this._bodyContent = value; - } - } - - private formDataValue(value: any): any { - if (value === null || value === undefined) { - return null; - } - if (value instanceof Blob) { - return value; - } - if (typeof value === 'object') { - return JSON.stringify(value); - } - return String(value); - } - - /** - * Builds the request with the current set parameters - */ - build(options?: { - /** Which content types to accept */ - accept?: string; - - /** The expected response type */ - responseType?: 'json' | 'text' | 'blob' | 'arraybuffer'; - - /** Whether to report progress on uploads / downloads */ - reportProgress?: boolean; - }): HttpRequest { - options = options || {}; - - // Path parameters - let path = this.operationPath; - for (const pathParam of this._path.values()) { - path = pathParam.append(path); - } - const url = this.rootUrl + path; - - // Query parameters - let httpParams = new HttpParams({ - encoder: ParameterCodecInstance, - }); - for (const queryParam of this._query.values()) { - httpParams = queryParam.append(httpParams); - } - - // Header parameters - let httpHeaders = new HttpHeaders(); - if (options.accept) { - httpHeaders = httpHeaders.append('Accept', options.accept); - } - for (const headerParam of this._header.values()) { - httpHeaders = headerParam.append(httpHeaders); - } - - // Request content headers - if (this._bodyContentType && !(this._bodyContent instanceof FormData)) { - httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType); - } - - // Perform the request - return new HttpRequest(this.method.toUpperCase(), url, this._bodyContent, { - params: httpParams, - headers: httpHeaders, - responseType: options.responseType, - reportProgress: options.reportProgress, - }); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/services.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/services.ts deleted file mode 100644 index 5ab48b7..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/services.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { NoTagService } from './services/no-tag.service'; -export { TagTag2Tag3Tag4Tag5Service } from './services/tag/tag2/tag3/tag4/tag-tag-2-tag-3-tag-4-tag-5.service'; -export { Tag1Service } from './services/tag-1.service'; -export { Tag2Service } from './services/tag-2.service'; diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/services/no-tag.service.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/services/no-tag.service.ts deleted file mode 100644 index 258fe98..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/services/no-tag.service.ts +++ /dev/null @@ -1,503 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse } from '@angular/common/http'; -import { BaseService } from '../base-service'; -import { ApiConfiguration } from '../api-configuration'; -import { StrictHttpResponse } from '../strict-http-response'; -import { RequestBuilder } from '../request-builder'; -import { Observable } from 'rxjs'; -import { map, filter } from 'rxjs/operators'; - -import { RefObject } from '../models/ref-object'; - -@Injectable({ - providedIn: 'root', -}) -export class NoTagService extends BaseService { - constructor(config: ApiConfiguration, http: HttpClient) { - super(config, http); - } - - /** - * Path part for operation path3Del - */ - static readonly Path3DelPath = '/path3/{id}'; - - /** - * DELETE on path3. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path3Del()` instead. - * - * This method doesn't expect any request body. - */ - path3Del$Response(params: { id: number }): Observable>> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path3DelPath, 'delete'); - if (params) { - rb.path('id', params.id, {}); - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/*+json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse>; - }), - ); - } - - /** - * DELETE on path3. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path3Del$Response()` instead. - * - * This method doesn't expect any request body. - */ - path3Del(params: { id: number }): Observable> { - return this.path3Del$Response(params).pipe( - map((r: StrictHttpResponse>) => r.body as Array), - ); - } - - /** - * Path part for operation path4Put - */ - static readonly Path4PutPath = '/path4'; - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path4Put$Json$Plain()` instead. - * - * This method sends `application/json` and handles request body of type `application/json`. - */ - path4Put$Json$Plain$Response(params?: { body?: RefObject }): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); - if (params) { - rb.body(params.body, 'application/json'); - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: 'text/plain', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path4Put$Json$Plain$Response()` instead. - * - * This method sends `application/json` and handles request body of type `application/json`. - */ - path4Put$Json$Plain(params?: { body?: RefObject }): Observable { - return this.path4Put$Json$Plain$Response(params).pipe(map((r: StrictHttpResponse) => r.body as string)); - } - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path4Put$Json$Binary()` instead. - * - * This method sends `application/json` and handles request body of type `application/json`. - */ - path4Put$Json$Binary$Response(params?: { body?: RefObject }): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); - if (params) { - rb.body(params.body, 'application/json'); - } - - return this.http - .request( - rb.build({ - responseType: 'blob', - accept: 'text/binary', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path4Put$Json$Binary$Response()` instead. - * - * This method sends `application/json` and handles request body of type `application/json`. - */ - path4Put$Json$Binary(params?: { body?: RefObject }): Observable { - return this.path4Put$Json$Binary$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Blob)); - } - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path4Put$Json$Image()` instead. - * - * This method sends `application/json` and handles request body of type `application/json`. - */ - path4Put$Json$Image$Response(params?: { body?: RefObject }): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); - if (params) { - rb.body(params.body, 'application/json'); - } - - return this.http - .request( - rb.build({ - responseType: 'blob', - accept: 'image/*', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path4Put$Json$Image$Response()` instead. - * - * This method sends `application/json` and handles request body of type `application/json`. - */ - path4Put$Json$Image(params?: { body?: RefObject }): Observable { - return this.path4Put$Json$Image$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Blob)); - } - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path4Put$Plain$Plain()` instead. - * - * This method sends `text/plain` and handles request body of type `text/plain`. - */ - path4Put$Plain$Plain$Response(params?: { body?: string }): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); - if (params) { - rb.body(params.body, 'text/plain'); - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: 'text/plain', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path4Put$Plain$Plain$Response()` instead. - * - * This method sends `text/plain` and handles request body of type `text/plain`. - */ - path4Put$Plain$Plain(params?: { body?: string }): Observable { - return this.path4Put$Plain$Plain$Response(params).pipe( - map((r: StrictHttpResponse) => r.body as string), - ); - } - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path4Put$Plain$Binary()` instead. - * - * This method sends `text/plain` and handles request body of type `text/plain`. - */ - path4Put$Plain$Binary$Response(params?: { body?: string }): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); - if (params) { - rb.body(params.body, 'text/plain'); - } - - return this.http - .request( - rb.build({ - responseType: 'blob', - accept: 'text/binary', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path4Put$Plain$Binary$Response()` instead. - * - * This method sends `text/plain` and handles request body of type `text/plain`. - */ - path4Put$Plain$Binary(params?: { body?: string }): Observable { - return this.path4Put$Plain$Binary$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Blob)); - } - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path4Put$Plain$Image()` instead. - * - * This method sends `text/plain` and handles request body of type `text/plain`. - */ - path4Put$Plain$Image$Response(params?: { body?: string }): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); - if (params) { - rb.body(params.body, 'text/plain'); - } - - return this.http - .request( - rb.build({ - responseType: 'blob', - accept: 'image/*', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path4Put$Plain$Image$Response()` instead. - * - * This method sends `text/plain` and handles request body of type `text/plain`. - */ - path4Put$Plain$Image(params?: { body?: string }): Observable { - return this.path4Put$Plain$Image$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Blob)); - } - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path4Put$Any$Plain()` instead. - * - * This method sends `* / *` and handles request body of type `* / *`. - */ - path4Put$Any$Plain$Response(params?: { body?: Blob }): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); - if (params) { - rb.body(params.body, '*/*'); - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: 'text/plain', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path4Put$Any$Plain$Response()` instead. - * - * This method sends `* / *` and handles request body of type `* / *`. - */ - path4Put$Any$Plain(params?: { body?: Blob }): Observable { - return this.path4Put$Any$Plain$Response(params).pipe(map((r: StrictHttpResponse) => r.body as string)); - } - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path4Put$Any$Binary()` instead. - * - * This method sends `* / *` and handles request body of type `* / *`. - */ - path4Put$Any$Binary$Response(params?: { body?: Blob }): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); - if (params) { - rb.body(params.body, '*/*'); - } - - return this.http - .request( - rb.build({ - responseType: 'blob', - accept: 'text/binary', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path4Put$Any$Binary$Response()` instead. - * - * This method sends `* / *` and handles request body of type `* / *`. - */ - path4Put$Any$Binary(params?: { body?: Blob }): Observable { - return this.path4Put$Any$Binary$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Blob)); - } - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path4Put$Any$Image()` instead. - * - * This method sends `* / *` and handles request body of type `* / *`. - */ - path4Put$Any$Image$Response(params?: { body?: Blob }): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); - if (params) { - rb.body(params.body, '*/*'); - } - - return this.http - .request( - rb.build({ - responseType: 'blob', - accept: 'image/*', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path4Put$Any$Image$Response()` instead. - * - * This method sends `* / *` and handles request body of type `* / *`. - */ - path4Put$Any$Image(params?: { body?: Blob }): Observable { - return this.path4Put$Any$Image$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Blob)); - } - - /** - * Path part for operation pathWithQuotesGet - */ - static readonly PathWithQuotesGetPath = "/path'with'quotes"; - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `withQuotes()` instead. - * - * This method doesn't expect any request body. - */ - withQuotes$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.PathWithQuotesGetPath, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: 'text/plain', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `withQuotes$Response()` instead. - * - * This method doesn't expect any request body. - */ - withQuotes(params?: {}): Observable { - return this.withQuotes$Response(params).pipe(map((r: StrictHttpResponse) => r.body as string)); - } - - /** - * Path part for operation path6Get - */ - static readonly Path6GetPath = '/path6'; - - /** - * This path will return binary by using responseType:"arraybuffer" in generated service. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path6Get()` instead. - * - * This method doesn't expect any request body. - */ - path6Get$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, NoTagService.Path6GetPath, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'blob', - accept: '*/*', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This path will return binary by using responseType:"arraybuffer" in generated service. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path6Get$Response()` instead. - * - * This method doesn't expect any request body. - */ - path6Get(params?: {}): Observable { - return this.path6Get$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Blob)); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/services/tag-1.service.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/services/tag-1.service.ts deleted file mode 100644 index eac2f6a..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/services/tag-1.service.ts +++ /dev/null @@ -1,384 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse } from '@angular/common/http'; -import { BaseService } from '../base-service'; -import { ApiConfiguration } from '../api-configuration'; -import { StrictHttpResponse } from '../strict-http-response'; -import { RequestBuilder } from '../request-builder'; -import { Observable } from 'rxjs'; -import { map, filter } from 'rxjs/operators'; - -import { RefObject } from '../models/ref-object'; -import { RefString } from '../models/ref-string'; - -/** - * Description of tag1 - */ -@Injectable({ - providedIn: 'root', -}) -export class Tag1Service extends BaseService { - constructor(config: ApiConfiguration, http: HttpClient) { - super(config, http); - } - - /** - * Path part for operation path1Get - */ - static readonly Path1GetPath = '/path1'; - - /** - * Path 1 GET description - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path1Get$Json()` instead. - * - * This method doesn't expect any request body. - */ - path1Get$Json$Response(params: { - /** - * Common param 1 - */ - common1?: RefString; - - /** - * Common param 2 - */ - common2: RefObject; - - /** - * GET param 1 - */ - get1?: RefString; - - /** - * GET param 2 - */ - get2?: number; - - /** - * GET param 3 - */ - get3?: boolean; - - /** - * GET param 4 - */ - get4?: Array; - - /** - * Should be escaped - */ - '='?: string; - - /** - * Should be escaped - */ - '123'?: string; - - /** - * Should be escaped - */ - 'a-b'?: string; - }): Observable> { - const rb = new RequestBuilder(this.rootUrl, Tag1Service.Path1GetPath, 'get'); - if (params) { - rb.query('common1', params.common1, {}); - rb.header('common2', params.common2, { style: 'form', explode: true }); - rb.query('get1', params.get1, {}); - rb.query('get2', params.get2, {}); - rb.query('get3', params.get3, {}); - rb.query('get4', params.get4, { style: 'form', explode: false }); - rb.query('=', params['='], {}); - rb.query('123', params['123'], {}); - rb.query('a-b', params['a-b'], {}); - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'text/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * Path 1 GET description - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path1Get$Json$Response()` instead. - * - * This method doesn't expect any request body. - */ - path1Get$Json(params: { - /** - * Common param 1 - */ - common1?: RefString; - - /** - * Common param 2 - */ - common2: RefObject; - - /** - * GET param 1 - */ - get1?: RefString; - - /** - * GET param 2 - */ - get2?: number; - - /** - * GET param 3 - */ - get3?: boolean; - - /** - * GET param 4 - */ - get4?: Array; - - /** - * Should be escaped - */ - '='?: string; - - /** - * Should be escaped - */ - '123'?: string; - - /** - * Should be escaped - */ - 'a-b'?: string; - }): Observable { - return this.path1Get$Json$Response(params).pipe(map((r: StrictHttpResponse) => r.body as RefObject)); - } - - /** - * Path 1 GET description - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path1Get$Image()` instead. - * - * This method doesn't expect any request body. - */ - path1Get$Image$Response(params: { - /** - * Common param 1 - */ - common1?: RefString; - - /** - * Common param 2 - */ - common2: RefObject; - - /** - * GET param 1 - */ - get1?: RefString; - - /** - * GET param 2 - */ - get2?: number; - - /** - * GET param 3 - */ - get3?: boolean; - - /** - * GET param 4 - */ - get4?: Array; - - /** - * Should be escaped - */ - '='?: string; - - /** - * Should be escaped - */ - '123'?: string; - - /** - * Should be escaped - */ - 'a-b'?: string; - }): Observable> { - const rb = new RequestBuilder(this.rootUrl, Tag1Service.Path1GetPath, 'get'); - if (params) { - rb.query('common1', params.common1, {}); - rb.header('common2', params.common2, { style: 'form', explode: true }); - rb.query('get1', params.get1, {}); - rb.query('get2', params.get2, {}); - rb.query('get3', params.get3, {}); - rb.query('get4', params.get4, { style: 'form', explode: false }); - rb.query('=', params['='], {}); - rb.query('123', params['123'], {}); - rb.query('a-b', params['a-b'], {}); - } - - return this.http - .request( - rb.build({ - responseType: 'blob', - accept: 'image/*', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * Path 1 GET description - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path1Get$Image$Response()` instead. - * - * This method doesn't expect any request body. - */ - path1Get$Image(params: { - /** - * Common param 1 - */ - common1?: RefString; - - /** - * Common param 2 - */ - common2: RefObject; - - /** - * GET param 1 - */ - get1?: RefString; - - /** - * GET param 2 - */ - get2?: number; - - /** - * GET param 3 - */ - get3?: boolean; - - /** - * GET param 4 - */ - get4?: Array; - - /** - * Should be escaped - */ - '='?: string; - - /** - * Should be escaped - */ - '123'?: string; - - /** - * Should be escaped - */ - 'a-b'?: string; - }): Observable { - return this.path1Get$Image$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Blob)); - } - - /** - * Path part for operation path2Get - */ - static readonly Path2GetPath = '/path2/{id}'; - - /** - * GET on path2. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path2Get()` instead. - * - * This method doesn't expect any request body. - */ - path2Get$Response(params: { - id: number; - - /** - * Query param - */ - param1?: RefString; - - /** - * Header param - */ - param2?: string; - }): Observable> { - const rb = new RequestBuilder(this.rootUrl, Tag1Service.Path2GetPath, 'get'); - if (params) { - rb.path('id', params.id, {}); - rb.query('param1', params.param1, {}); - rb.header('param2', params.param2, {}); - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: '*/*', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return (r as HttpResponse).clone({ body: undefined }) as StrictHttpResponse; - }), - ); - } - - /** - * GET on path2. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path2Get$Response()` instead. - * - * This method doesn't expect any request body. - */ - path2Get(params: { - id: number; - - /** - * Query param - */ - param1?: RefString; - - /** - * Header param - */ - param2?: string; - }): Observable { - return this.path2Get$Response(params).pipe(map((r: StrictHttpResponse) => r.body as void)); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/services/tag-2.service.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/services/tag-2.service.ts deleted file mode 100644 index 32d4e14..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/services/tag-2.service.ts +++ /dev/null @@ -1,187 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse } from '@angular/common/http'; -import { BaseService } from '../base-service'; -import { ApiConfiguration } from '../api-configuration'; -import { StrictHttpResponse } from '../strict-http-response'; -import { RequestBuilder } from '../request-builder'; -import { Observable } from 'rxjs'; -import { map, filter } from 'rxjs/operators'; - -import { RefObject } from '../models/ref-object'; -import { RefString } from '../models/ref-string'; - -@Injectable({ - providedIn: 'root', -}) -export class Tag2Service extends BaseService { - constructor(config: ApiConfiguration, http: HttpClient) { - super(config, http); - } - - /** - * Path part for operation path1Post - */ - static readonly Path1PostPath = '/path1'; - - /** - * POST on path1. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path1Post$Json()` instead. - * - * This method sends `application/json` and handles request body of type `application/json`. - */ - path1Post$Json$Response(params: { - /** - * Common param 1 - */ - common1?: RefString; - - /** - * Common param 2 - */ - common2: RefObject; - - /** - * POST param 1 - */ - post1?: number; - body: RefObject; - }): Observable> { - const rb = new RequestBuilder(this.rootUrl, Tag2Service.Path1PostPath, 'post'); - if (params) { - rb.query('common1', params.common1, {}); - rb.header('common2', params.common2, { style: 'form', explode: true }); - rb.query('post1', params.post1, {}); - rb.body(params.body, 'application/json'); - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: '*/*', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return (r as HttpResponse).clone({ body: undefined }) as StrictHttpResponse; - }), - ); - } - - /** - * POST on path1. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path1Post$Json$Response()` instead. - * - * This method sends `application/json` and handles request body of type `application/json`. - */ - path1Post$Json(params: { - /** - * Common param 1 - */ - common1?: RefString; - - /** - * Common param 2 - */ - common2: RefObject; - - /** - * POST param 1 - */ - post1?: number; - body: RefObject; - }): Observable { - return this.path1Post$Json$Response(params).pipe(map((r: StrictHttpResponse) => r.body as void)); - } - - /** - * POST on path1. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path1Post$Plain()` instead. - * - * This method sends `text/plain` and handles request body of type `text/plain`. - */ - path1Post$Plain$Response(params: { - /** - * Common param 1 - */ - common1?: RefString; - - /** - * Common param 2 - */ - common2: RefObject; - - /** - * POST param 1 - */ - post1?: number; - body: string; - }): Observable> { - const rb = new RequestBuilder(this.rootUrl, Tag2Service.Path1PostPath, 'post'); - if (params) { - rb.query('common1', params.common1, {}); - rb.header('common2', params.common2, { style: 'form', explode: true }); - rb.query('post1', params.post1, {}); - rb.body(params.body, 'text/plain'); - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: '*/*', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return (r as HttpResponse).clone({ body: undefined }) as StrictHttpResponse; - }), - ); - } - - /** - * POST on path1. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path1Post$Plain$Response()` instead. - * - * This method sends `text/plain` and handles request body of type `text/plain`. - */ - path1Post$Plain(params: { - /** - * Common param 1 - */ - common1?: RefString; - - /** - * Common param 2 - */ - common2: RefObject; - - /** - * POST param 1 - */ - post1?: number; - body: string; - }): Observable { - return this.path1Post$Plain$Response(params).pipe(map((r: StrictHttpResponse) => r.body as void)); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/services/tag/tag2/tag3/tag4/tag-tag-2-tag-3-tag-4-tag-5.service.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/services/tag/tag2/tag3/tag4/tag-tag-2-tag-3-tag-4-tag-5.service.ts deleted file mode 100644 index f49af38..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/services/tag/tag2/tag3/tag4/tag-tag-2-tag-3-tag-4-tag-5.service.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse } from '@angular/common/http'; -import { BaseService } from '../base-service'; -import { ApiConfiguration } from '../api-configuration'; -import { StrictHttpResponse } from '../strict-http-response'; -import { RequestBuilder } from '../request-builder'; -import { Observable } from 'rxjs'; -import { map, filter } from 'rxjs/operators'; - -@Injectable({ - providedIn: 'root', -}) -export class TagTag2Tag3Tag4Tag5Service extends BaseService { - constructor(config: ApiConfiguration, http: HttpClient) { - super(config, http); - } - - /** - * Path part for operation path5Get - */ - static readonly Path5GetPath = '/path5'; - - /** - * A path that contains a reference to response objects. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `path5Get()` instead. - * - * This method doesn't expect any request body. - */ - path5Get$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, TagTag2Tag3Tag4Tag5Service.Path5GetPath, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse<{}>; - }), - ); - } - - /** - * A path that contains a reference to response objects. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `path5Get$Response()` instead. - * - * This method doesn't expect any request body. - */ - path5Get(params?: {}): Observable<{}> { - return this.path5Get$Response(params).pipe(map((r: StrictHttpResponse<{}>) => r.body as {})); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-operations/strict-http-response.ts b/tools/executors/pseudo-test/original-results.v1/all-operations/strict-http-response.ts deleted file mode 100644 index aaa5dae..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-operations/strict-http-response.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpResponse } from '@angular/common/http'; - -/** - * Constrains the http response to not have the body defined as `T | null`, but `T` only. - */ -export type StrictHttpResponse = HttpResponse & { - readonly body: T; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/api-configuration.ts b/tools/executors/pseudo-test/original-results.v1/all-types/api-configuration.ts deleted file mode 100644 index 97cdb32..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/api-configuration.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; - -/** - * Global configuration - */ -@Injectable({ - providedIn: 'root', -}) -export class ApiConfiguration { - rootUrl: string = ''; -} - -/** - * Parameters for `ApiModule.forRoot()` - */ -export interface ApiConfigurationParams { - rootUrl?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/api.module.ts b/tools/executors/pseudo-test/original-results.v1/all-types/api.module.ts deleted file mode 100644 index eaf0a5b..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/api.module.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration, ApiConfigurationParams } from './api-configuration'; - -import { ApiService } from './services/api.service'; - -/** - * Module that provides all services and configuration. - */ -@NgModule({ - imports: [], - exports: [], - declarations: [], - providers: [ApiService, ApiConfiguration], -}) -export class ApiModule { - static forRoot(params: ApiConfigurationParams): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ - { - provide: ApiConfiguration, - useValue: params, - }, - ], - }; - } - - constructor(@Optional() @SkipSelf() parentModule: ApiModule, @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error( - 'You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575', - ); - } - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/base-service.ts b/tools/executors/pseudo-test/original-results.v1/all-types/base-service.ts deleted file mode 100644 index 545b2d6..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/base-service.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration } from './api-configuration'; - -/** - * Base class for services - */ -@Injectable() -export class BaseService { - constructor(protected config: ApiConfiguration, protected http: HttpClient) {} - - private _rootUrl: string = ''; - - /** - * Returns the root url for all operations in this service. If not set directly in this - * service, will fallback to `ApiConfiguration.rootUrl`. - */ - get rootUrl(): string { - return this._rootUrl || this.config.rootUrl; - } - - /** - * Sets the root URL for API operations in this service. - */ - set rootUrl(rootUrl: string) { - this._rootUrl = rootUrl; - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models.ts deleted file mode 100644 index 8ab1710..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models.ts +++ /dev/null @@ -1,22 +0,0 @@ -export { RefObject as ABRefObject } from './models/a/b/ref-object'; -export { AdditionalProperties } from './models/additional-properties'; -export { AuditCdr } from './models/audit-cdr'; -export { AuditLog } from './models/audit-log'; -export { Container } from './models/container'; -export { Containers } from './models/containers'; -export { Disjunct } from './models/disjunct'; -export { EscapedProperties } from './models/escaped-properties'; -export { InlineObject } from './models/inline-object'; -export { NullableObject } from './models/nullable-object'; -export { Nullables } from './models/nullables'; -export { RefEnum } from './models/ref-enum'; -export { RefIntEnum } from './models/ref-int-enum'; -export { RefNamedIntEnum } from './models/ref-named-int-enum'; -export { ReferencedInNullableOneOf } from './models/referenced-in-nullable-one-of'; -export { ReferencedInOneOf } from './models/referenced-in-one-of'; -export { ReferencedInParamOneOf1 } from './models/referenced-in-param-one-of-1'; -export { ReferencedInParamOneOf2 } from './models/referenced-in-param-one-of-2'; -export { ReferencedInServiceOneOf1 } from './models/referenced-in-service-one-of-1'; -export { ReferencedInServiceOneOf2 } from './models/referenced-in-service-one-of-2'; -export { Union } from './models/union'; -export { RefObject as XYRefObject } from './models/x/y/ref-object'; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/a/b/ref-object.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/a/b/ref-object.ts deleted file mode 100644 index 600663b..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/a/b/ref-object.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface RefObject { - id: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/additional-properties.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/additional-properties.ts deleted file mode 100644 index c880bda..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/additional-properties.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { RefObject as ABRefObject } from './a/b/ref-object'; -export interface AdditionalProperties { - age?: null | number; - description?: string; - name: string; - - [key: string]: ABRefObject | null | number | string | undefined; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/audit-cdr.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/audit-cdr.ts deleted file mode 100644 index ecc7275..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/audit-cdr.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { AuditLog } from './audit-log'; -export type AuditCdr = AuditLog & { - callFrom?: string; - callTo?: string; - callStartDate?: string; - callEndDate?: string; -} & {}; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/audit-log.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/audit-log.ts deleted file mode 100644 index e167930..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/audit-log.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface AuditLog { - date?: string; - id?: number; - text?: string; - type: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/container.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/container.ts deleted file mode 100644 index f568fc0..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/container.ts +++ /dev/null @@ -1,106 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NullableObject } from './nullable-object'; -import { RefEnum } from './ref-enum'; -import { RefObject as ABRefObject } from './a/b/ref-object'; -import { Disjunct } from './disjunct'; -import { Union } from './union'; -import { RefObject as XYRefObject } from './x/y/ref-object'; -export type Container = { - /** - * Property of type string - */ - stringProp?: string; - - /** - * Property of type integer - */ - integerProp?: number; - - /** - * Property of type number - */ - numberProp: number; - - /** - * Property of type boolean - */ - booleanProp?: boolean; - - /** - * Property of type any - */ - anyProp?: any; -} & ABRefObject & { - nullableObject?: null | NullableObject; - - /** - * Property which references an enumerated string - */ - refEnumProp: RefEnum; - - /** - * Property which references an object - */ - refObjectProp: ABRefObject; - - /** - * Property which references an union object - */ - unionProp?: Union; - disjunctProp?: Disjunct; - - /** - * Property which references another container - */ - containerProp?: Container; - - /** - * Property of type array of string - */ - arrayOfStringsProp?: Array; - - /** - * Property of type array of integers - */ - arrayOfIntegersProp?: Array; - - /** - * Property of type array of numbers - */ - arrayOfNumbersProp?: Array; - - /** - * Property of type array of booleans - */ - arrayOfBooleansProp?: Array; - - /** - * Property of type array of enums - */ - arrayOfRefEnumsProp?: Array; - - /** - * Property of type array of references an object - */ - arrayOfABRefObjectsProp?: Array; - - /** - * Property of type array of any type - */ - arrayOfAnyProp?: Array; - dynamic?: { - [key: string]: XYRefObject; - }; - stringEnumProp?: 'a' | 'b' | 'c'; - intEnumProp?: 1 | 2 | 3; - boolEnumProp?: false; - nestedObject?: { - p1?: string; - p2?: number; - deeper?: { - d1: ABRefObject; - d2?: string | Array | number; - }; - }; - }; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/containers.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/containers.ts deleted file mode 100644 index f7059a7..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/containers.ts +++ /dev/null @@ -1,4 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Container } from './container'; -export type Containers = Array; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/disjunct.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/disjunct.ts deleted file mode 100644 index e6dbc56..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/disjunct.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { EscapedProperties } from './escaped-properties'; -import { ReferencedInNullableOneOf } from './referenced-in-nullable-one-of'; -import { ReferencedInOneOf } from './referenced-in-one-of'; -import { RefObject as ABRefObject } from './a/b/ref-object'; -import { RefObject as XYRefObject } from './x/y/ref-object'; -export type Disjunct = - | { - ref?: ReferencedInNullableOneOf | null; - } - | ABRefObject - | XYRefObject - | ReferencedInOneOf - | EscapedProperties; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/escaped-properties.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/escaped-properties.ts deleted file mode 100644 index 1c5d357..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/escaped-properties.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface EscapedProperties { - '123'?: string; - '='?: string; - 'a-b'?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/inline-object.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/inline-object.ts deleted file mode 100644 index 90e4556..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/inline-object.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { RefEnum } from './ref-enum'; -export interface InlineObject { - object?: { - string?: string; - nullableString?: string | null; - ref?: RefEnum; - nullableRef?: RefEnum | null; - }; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/nullable-object.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/nullable-object.ts deleted file mode 100644 index 0a03f4d..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/nullable-object.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export type NullableObject = { - name?: string; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/nullables.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/nullables.ts deleted file mode 100644 index 4d98b1e..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/nullables.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NullableObject } from './nullable-object'; -export interface Nullables { - inlinedNullableObject: null | { - someProperty: string; - }; - nullableObject: null | NullableObject; - withNullableProperty: { - someProperty: null | NullableObject; - }; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/ref-enum.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/ref-enum.ts deleted file mode 100644 index d015942..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/ref-enum.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export enum RefEnum { - ValueA = "value'A", - ValueB = "value'B", - ValueC = "value'C", - _ = '', -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/ref-int-enum.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/ref-int-enum.ts deleted file mode 100644 index 4b36b81..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/ref-int-enum.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export enum RefIntEnum { - $100 = 100, - $200 = 200, - $300 = 300, -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/ref-named-int-enum.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/ref-named-int-enum.ts deleted file mode 100644 index 00b1261..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/ref-named-int-enum.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export enum RefNamedIntEnum { - first = 100, - second = 200, - third = 300, -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-nullable-one-of.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-nullable-one-of.ts deleted file mode 100644 index 8f43ad3..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-nullable-one-of.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface ReferencedInNullableOneOf { - name?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-one-of.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-one-of.ts deleted file mode 100644 index d77113a..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-one-of.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface ReferencedInOneOf { - name?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-param-one-of-1.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-param-one-of-1.ts deleted file mode 100644 index 712f8cd..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-param-one-of-1.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface ReferencedInParamOneOf1 { - name?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-param-one-of-2.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-param-one-of-2.ts deleted file mode 100644 index 4e5d877..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-param-one-of-2.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface ReferencedInParamOneOf2 { - name?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-service-one-of-1.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-service-one-of-1.ts deleted file mode 100644 index 93f5ec0..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-service-one-of-1.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface ReferencedInServiceOneOf1 { - name?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-service-one-of-2.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-service-one-of-2.ts deleted file mode 100644 index 66855f4..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/referenced-in-service-one-of-2.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface ReferencedInServiceOneOf2 { - name?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/union.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/union.ts deleted file mode 100644 index f576996..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/union.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Container } from './container'; -import { RefEnum } from './ref-enum'; -import { RefIntEnum } from './ref-int-enum'; -import { RefNamedIntEnum } from './ref-named-int-enum'; -export type Union = - | { - [key: string]: any; - } - | RefEnum - | RefIntEnum - | RefNamedIntEnum - | Container; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/models/x/y/ref-object.ts b/tools/executors/pseudo-test/original-results.v1/all-types/models/x/y/ref-object.ts deleted file mode 100644 index c5c3cb3..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/models/x/y/ref-object.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { RefObject as ABRefObject } from '../../a/b/ref-object'; -export type RefObject = ABRefObject & { - [key: string]: any; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/request-builder.ts b/tools/executors/pseudo-test/original-results.v1/all-types/request-builder.ts deleted file mode 100644 index a08af28..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/request-builder.ts +++ /dev/null @@ -1,369 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders } from '@angular/common/http'; - -/** - * Custom parameter codec to correctly handle the plus sign in parameter - * values. See https://github.com/angular/angular/issues/18261 - */ -class ParameterCodec implements HttpParameterCodec { - encodeKey(key: string): string { - return encodeURIComponent(key); - } - - encodeValue(value: string): string { - return encodeURIComponent(value); - } - - decodeKey(key: string): string { - return decodeURIComponent(key); - } - - decodeValue(value: string): string { - return decodeURIComponent(value); - } -} -const ParameterCodecInstance = new ParameterCodec(); - -/** - * Defines the options for appending a parameter - */ -interface ParameterOptions { - style?: string; - explode?: boolean; -} - -/** - * Base class for a parameter - */ -abstract class Parameter { - constructor( - public name: string, - public value: any, - public options: ParameterOptions, - defaultStyle: string, - defaultExplode: boolean, - ) { - this.options = options || {}; - if (this.options.style === null || this.options.style === undefined) { - this.options.style = defaultStyle; - } - if (this.options.explode === null || this.options.explode === undefined) { - this.options.explode = defaultExplode; - } - } - - serializeValue(value: any, separator = ','): string { - if (value === null || value === undefined) { - return ''; - } else if (value instanceof Array) { - return value - .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))) - .join(separator); - } else if (typeof value === 'object') { - const array: string[] = []; - for (const key of Object.keys(value)) { - let propVal = value[key]; - if (propVal !== null && propVal !== undefined) { - propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator)); - if (this.options.explode) { - array.push(`${key}=${propVal}`); - } else { - array.push(key); - array.push(propVal); - } - } - } - return array.join(separator); - } else { - return String(value); - } - } -} - -/** - * A parameter in the operation path - */ -class PathParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(path: string): string { - let value = this.value; - if (value === null || value === undefined) { - value = ''; - } - let prefix = this.options.style === 'label' ? '.' : ''; - let separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ','; - let alreadySerialized = false; - if (this.options.style === 'matrix') { - // The parameter name is just used as prefix, except in some cases... - prefix = `;${this.name}=`; - if (this.options.explode && typeof value === 'object') { - prefix = ';'; - if (value instanceof Array) { - // For arrays we have to repeat the name for each element - value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`); - value = value.join(';'); - alreadySerialized = true; - } else { - // For objects we have to put each the key / value pairs - value = this.serializeValue(value, ';'); - alreadySerialized = true; - } - } - } - value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator)); - // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account - path = path.replace(`{${this.name}}`, value); - path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value); - return path; - } - - // @ts-ignore - serializeValue(value: any, separator = ','): string { - var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); - return result; - } -} - -/** - * A parameter in the query - */ -class QueryParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'form', true); - } - - append(params: HttpParams): HttpParams { - if (this.value instanceof Array) { - // Array serialization - if (this.options.explode) { - for (const v of this.value) { - params = params.append(this.name, this.serializeValue(v)); - } - } else { - const separator = - this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ','; - return params.append(this.name, this.serializeValue(this.value, separator)); - } - } else if (this.value !== null && typeof this.value === 'object') { - // Object serialization - if (this.options.style === 'deepObject') { - // Append a parameter for each key, in the form `name[key]` - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal)); - } - } - } else if (this.options.explode) { - // Append a parameter for each key without using the parameter name - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(key, this.serializeValue(propVal)); - } - } - } else { - // Append a single parameter whose values are a comma-separated list of key,value,key,value... - const array: any[] = []; - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - array.push(key); - array.push(propVal); - } - } - params = params.append(this.name, this.serializeValue(array)); - } - } else if (this.value !== null && this.value !== undefined) { - // Plain value - params = params.append(this.name, this.serializeValue(this.value)); - } - return params; - } -} - -/** - * A parameter in the HTTP request header - */ -class HeaderParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(headers: HttpHeaders): HttpHeaders { - if (this.value !== null && this.value !== undefined) { - if (this.value instanceof Array) { - for (const v of this.value) { - headers = headers.append(this.name, this.serializeValue(v)); - } - } else { - headers = headers.append(this.name, this.serializeValue(this.value)); - } - } - return headers; - } -} - -/** - * Helper to build http requests from parameters - */ -export class RequestBuilder { - private _path = new Map(); - private _query = new Map(); - private _header = new Map(); - _bodyContent: any | null; - _bodyContentType?: string; - - constructor(public rootUrl: string, public operationPath: string, public method: string) {} - - /** - * Sets a path parameter - */ - path(name: string, value: any, options?: ParameterOptions): void { - this._path.set(name, new PathParameter(name, value, options || {})); - } - - /** - * Sets a query parameter - */ - query(name: string, value: any, options?: ParameterOptions): void { - this._query.set(name, new QueryParameter(name, value, options || {})); - } - - /** - * Sets a header parameter - */ - header(name: string, value: any, options?: ParameterOptions): void { - this._header.set(name, new HeaderParameter(name, value, options || {})); - } - - /** - * Sets the body content, along with the content type - */ - body(value: any, contentType = 'application/json'): void { - if (value instanceof Blob) { - this._bodyContentType = value.type; - } else { - this._bodyContentType = contentType; - } - if ( - this._bodyContentType === 'application/x-www-form-urlencoded' && - value !== null && - typeof value === 'object' - ) { - // Handle URL-encoded data - const pairs: Array<[string, string]> = []; - for (const key of Object.keys(value)) { - let val = value[key]; - if (!(val instanceof Array)) { - val = [val]; - } - for (const v of val) { - const formValue = this.formDataValue(v); - if (formValue !== null) { - pairs.push([key, formValue]); - } - } - } - this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&'); - } else if (this._bodyContentType === 'multipart/form-data') { - // Handle multipart form data - const formData = new FormData(); - if (value !== null && value !== undefined) { - for (const key of Object.keys(value)) { - const val = value[key]; - if (val instanceof Array) { - for (const v of val) { - const toAppend = this.formDataValue(v); - if (toAppend !== null) { - formData.append(key, toAppend); - } - } - } else { - const toAppend = this.formDataValue(val); - if (toAppend !== null) { - formData.set(key, toAppend); - } - } - } - } - this._bodyContent = formData; - } else { - // The body is the plain content - this._bodyContent = value; - } - } - - private formDataValue(value: any): any { - if (value === null || value === undefined) { - return null; - } - if (value instanceof Blob) { - return value; - } - if (typeof value === 'object') { - return JSON.stringify(value); - } - return String(value); - } - - /** - * Builds the request with the current set parameters - */ - build(options?: { - /** Which content types to accept */ - accept?: string; - - /** The expected response type */ - responseType?: 'json' | 'text' | 'blob' | 'arraybuffer'; - - /** Whether to report progress on uploads / downloads */ - reportProgress?: boolean; - }): HttpRequest { - options = options || {}; - - // Path parameters - let path = this.operationPath; - for (const pathParam of this._path.values()) { - path = pathParam.append(path); - } - const url = this.rootUrl + path; - - // Query parameters - let httpParams = new HttpParams({ - encoder: ParameterCodecInstance, - }); - for (const queryParam of this._query.values()) { - httpParams = queryParam.append(httpParams); - } - - // Header parameters - let httpHeaders = new HttpHeaders(); - if (options.accept) { - httpHeaders = httpHeaders.append('Accept', options.accept); - } - for (const headerParam of this._header.values()) { - httpHeaders = headerParam.append(httpHeaders); - } - - // Request content headers - if (this._bodyContentType && !(this._bodyContent instanceof FormData)) { - httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType); - } - - // Perform the request - return new HttpRequest(this.method.toUpperCase(), url, this._bodyContent, { - params: httpParams, - headers: httpHeaders, - responseType: options.responseType, - reportProgress: options.reportProgress, - }); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/services.ts b/tools/executors/pseudo-test/original-results.v1/all-types/services.ts deleted file mode 100644 index 7935001..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/services.ts +++ /dev/null @@ -1 +0,0 @@ -export { ApiService } from './services/api.service'; diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/services/api.service.ts b/tools/executors/pseudo-test/original-results.v1/all-types/services/api.service.ts deleted file mode 100644 index 811c7cb..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/services/api.service.ts +++ /dev/null @@ -1,178 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse } from '@angular/common/http'; -import { BaseService } from '../base-service'; -import { ApiConfiguration } from '../api-configuration'; -import { StrictHttpResponse } from '../strict-http-response'; -import { RequestBuilder } from '../request-builder'; -import { Observable } from 'rxjs'; -import { map, filter } from 'rxjs/operators'; - -import { AdditionalProperties } from '../models/additional-properties'; -import { AuditCdr } from '../models/audit-cdr'; -import { Containers } from '../models/containers'; -import { InlineObject } from '../models/inline-object'; -import { Nullables } from '../models/nullables'; -import { ReferencedInParamOneOf1 } from '../models/referenced-in-param-one-of-1'; -import { ReferencedInParamOneOf2 } from '../models/referenced-in-param-one-of-2'; -import { ReferencedInServiceOneOf1 } from '../models/referenced-in-service-one-of-1'; -import { ReferencedInServiceOneOf2 } from '../models/referenced-in-service-one-of-2'; -import { RefObject as ABRefObject } from '../models/a/b/ref-object'; -import { Disjunct } from '../models/disjunct'; - -@Injectable({ - providedIn: 'root', -}) -export class ApiService extends BaseService { - constructor(config: ApiConfiguration, http: HttpClient) { - super(config, http); - } - - /** - * Path part for operation fooGet - */ - static readonly FooGetPath = '/foo'; - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `fooGet()` instead. - * - * This method doesn't expect any request body. - */ - fooGet$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, ApiService.FooGetPath, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `fooGet$Response()` instead. - * - * This method doesn't expect any request body. - */ - fooGet(params?: {}): Observable { - return this.fooGet$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Containers)); - } - - /** - * Path part for operation barGet - */ - static readonly BarGetPath = '/bar'; - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `barGet()` instead. - * - * This method doesn't expect any request body. - */ - barGet$Response(params?: { - param?: - | ReferencedInParamOneOf1 - | ReferencedInParamOneOf2 - | ABRefObject - | AdditionalProperties - | Nullables - | InlineObject - | AuditCdr; - }): Observable> { - const rb = new RequestBuilder(this.rootUrl, ApiService.BarGetPath, 'get'); - if (params) { - rb.query('param', params.param, {}); - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `barGet$Response()` instead. - * - * This method doesn't expect any request body. - */ - barGet(params?: { - param?: - | ReferencedInParamOneOf1 - | ReferencedInParamOneOf2 - | ABRefObject - | AdditionalProperties - | Nullables - | InlineObject - | AuditCdr; - }): Observable { - return this.barGet$Response(params).pipe( - map( - (r: StrictHttpResponse) => - r.body as ReferencedInServiceOneOf1 | ReferencedInServiceOneOf2, - ), - ); - } - - /** - * Path part for operation bazGet - */ - static readonly BazGetPath = '/baz'; - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `bazGet()` instead. - * - * This method doesn't expect any request body. - */ - bazGet$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, ApiService.BazGetPath, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `bazGet$Response()` instead. - * - * This method doesn't expect any request body. - */ - bazGet(params?: {}): Observable { - return this.bazGet$Response(params).pipe(map((r: StrictHttpResponse) => r.body as Disjunct)); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/all-types/strict-http-response.ts b/tools/executors/pseudo-test/original-results.v1/all-types/strict-http-response.ts deleted file mode 100644 index aaa5dae..0000000 --- a/tools/executors/pseudo-test/original-results.v1/all-types/strict-http-response.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpResponse } from '@angular/common/http'; - -/** - * Constrains the http response to not have the body defined as `T | null`, but `T` only. - */ -export type StrictHttpResponse = HttpResponse & { - readonly body: T; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/default-success-response/api-configuration.ts b/tools/executors/pseudo-test/original-results.v1/default-success-response/api-configuration.ts deleted file mode 100644 index 3f4499f..0000000 --- a/tools/executors/pseudo-test/original-results.v1/default-success-response/api-configuration.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; - -/** - * Global configuration - */ -@Injectable({ - providedIn: 'root', -}) -export class ApiConfiguration { - rootUrl: string = 'http://localhost:3000'; -} - -/** - * Parameters for `ApiModule.forRoot()` - */ -export interface ApiConfigurationParams { - rootUrl?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/default-success-response/api.module.ts b/tools/executors/pseudo-test/original-results.v1/default-success-response/api.module.ts deleted file mode 100644 index eaf0a5b..0000000 --- a/tools/executors/pseudo-test/original-results.v1/default-success-response/api.module.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration, ApiConfigurationParams } from './api-configuration'; - -import { ApiService } from './services/api.service'; - -/** - * Module that provides all services and configuration. - */ -@NgModule({ - imports: [], - exports: [], - declarations: [], - providers: [ApiService, ApiConfiguration], -}) -export class ApiModule { - static forRoot(params: ApiConfigurationParams): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ - { - provide: ApiConfiguration, - useValue: params, - }, - ], - }; - } - - constructor(@Optional() @SkipSelf() parentModule: ApiModule, @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error( - 'You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575', - ); - } - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/default-success-response/base-service.ts b/tools/executors/pseudo-test/original-results.v1/default-success-response/base-service.ts deleted file mode 100644 index 545b2d6..0000000 --- a/tools/executors/pseudo-test/original-results.v1/default-success-response/base-service.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration } from './api-configuration'; - -/** - * Base class for services - */ -@Injectable() -export class BaseService { - constructor(protected config: ApiConfiguration, protected http: HttpClient) {} - - private _rootUrl: string = ''; - - /** - * Returns the root url for all operations in this service. If not set directly in this - * service, will fallback to `ApiConfiguration.rootUrl`. - */ - get rootUrl(): string { - return this._rootUrl || this.config.rootUrl; - } - - /** - * Sets the root URL for API operations in this service. - */ - set rootUrl(rootUrl: string) { - this._rootUrl = rootUrl; - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/default-success-response/models.ts b/tools/executors/pseudo-test/original-results.v1/default-success-response/models.ts deleted file mode 100644 index e69de29..0000000 diff --git a/tools/executors/pseudo-test/original-results.v1/default-success-response/request-builder.ts b/tools/executors/pseudo-test/original-results.v1/default-success-response/request-builder.ts deleted file mode 100644 index a08af28..0000000 --- a/tools/executors/pseudo-test/original-results.v1/default-success-response/request-builder.ts +++ /dev/null @@ -1,369 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders } from '@angular/common/http'; - -/** - * Custom parameter codec to correctly handle the plus sign in parameter - * values. See https://github.com/angular/angular/issues/18261 - */ -class ParameterCodec implements HttpParameterCodec { - encodeKey(key: string): string { - return encodeURIComponent(key); - } - - encodeValue(value: string): string { - return encodeURIComponent(value); - } - - decodeKey(key: string): string { - return decodeURIComponent(key); - } - - decodeValue(value: string): string { - return decodeURIComponent(value); - } -} -const ParameterCodecInstance = new ParameterCodec(); - -/** - * Defines the options for appending a parameter - */ -interface ParameterOptions { - style?: string; - explode?: boolean; -} - -/** - * Base class for a parameter - */ -abstract class Parameter { - constructor( - public name: string, - public value: any, - public options: ParameterOptions, - defaultStyle: string, - defaultExplode: boolean, - ) { - this.options = options || {}; - if (this.options.style === null || this.options.style === undefined) { - this.options.style = defaultStyle; - } - if (this.options.explode === null || this.options.explode === undefined) { - this.options.explode = defaultExplode; - } - } - - serializeValue(value: any, separator = ','): string { - if (value === null || value === undefined) { - return ''; - } else if (value instanceof Array) { - return value - .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))) - .join(separator); - } else if (typeof value === 'object') { - const array: string[] = []; - for (const key of Object.keys(value)) { - let propVal = value[key]; - if (propVal !== null && propVal !== undefined) { - propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator)); - if (this.options.explode) { - array.push(`${key}=${propVal}`); - } else { - array.push(key); - array.push(propVal); - } - } - } - return array.join(separator); - } else { - return String(value); - } - } -} - -/** - * A parameter in the operation path - */ -class PathParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(path: string): string { - let value = this.value; - if (value === null || value === undefined) { - value = ''; - } - let prefix = this.options.style === 'label' ? '.' : ''; - let separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ','; - let alreadySerialized = false; - if (this.options.style === 'matrix') { - // The parameter name is just used as prefix, except in some cases... - prefix = `;${this.name}=`; - if (this.options.explode && typeof value === 'object') { - prefix = ';'; - if (value instanceof Array) { - // For arrays we have to repeat the name for each element - value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`); - value = value.join(';'); - alreadySerialized = true; - } else { - // For objects we have to put each the key / value pairs - value = this.serializeValue(value, ';'); - alreadySerialized = true; - } - } - } - value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator)); - // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account - path = path.replace(`{${this.name}}`, value); - path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value); - return path; - } - - // @ts-ignore - serializeValue(value: any, separator = ','): string { - var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); - return result; - } -} - -/** - * A parameter in the query - */ -class QueryParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'form', true); - } - - append(params: HttpParams): HttpParams { - if (this.value instanceof Array) { - // Array serialization - if (this.options.explode) { - for (const v of this.value) { - params = params.append(this.name, this.serializeValue(v)); - } - } else { - const separator = - this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ','; - return params.append(this.name, this.serializeValue(this.value, separator)); - } - } else if (this.value !== null && typeof this.value === 'object') { - // Object serialization - if (this.options.style === 'deepObject') { - // Append a parameter for each key, in the form `name[key]` - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal)); - } - } - } else if (this.options.explode) { - // Append a parameter for each key without using the parameter name - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(key, this.serializeValue(propVal)); - } - } - } else { - // Append a single parameter whose values are a comma-separated list of key,value,key,value... - const array: any[] = []; - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - array.push(key); - array.push(propVal); - } - } - params = params.append(this.name, this.serializeValue(array)); - } - } else if (this.value !== null && this.value !== undefined) { - // Plain value - params = params.append(this.name, this.serializeValue(this.value)); - } - return params; - } -} - -/** - * A parameter in the HTTP request header - */ -class HeaderParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(headers: HttpHeaders): HttpHeaders { - if (this.value !== null && this.value !== undefined) { - if (this.value instanceof Array) { - for (const v of this.value) { - headers = headers.append(this.name, this.serializeValue(v)); - } - } else { - headers = headers.append(this.name, this.serializeValue(this.value)); - } - } - return headers; - } -} - -/** - * Helper to build http requests from parameters - */ -export class RequestBuilder { - private _path = new Map(); - private _query = new Map(); - private _header = new Map(); - _bodyContent: any | null; - _bodyContentType?: string; - - constructor(public rootUrl: string, public operationPath: string, public method: string) {} - - /** - * Sets a path parameter - */ - path(name: string, value: any, options?: ParameterOptions): void { - this._path.set(name, new PathParameter(name, value, options || {})); - } - - /** - * Sets a query parameter - */ - query(name: string, value: any, options?: ParameterOptions): void { - this._query.set(name, new QueryParameter(name, value, options || {})); - } - - /** - * Sets a header parameter - */ - header(name: string, value: any, options?: ParameterOptions): void { - this._header.set(name, new HeaderParameter(name, value, options || {})); - } - - /** - * Sets the body content, along with the content type - */ - body(value: any, contentType = 'application/json'): void { - if (value instanceof Blob) { - this._bodyContentType = value.type; - } else { - this._bodyContentType = contentType; - } - if ( - this._bodyContentType === 'application/x-www-form-urlencoded' && - value !== null && - typeof value === 'object' - ) { - // Handle URL-encoded data - const pairs: Array<[string, string]> = []; - for (const key of Object.keys(value)) { - let val = value[key]; - if (!(val instanceof Array)) { - val = [val]; - } - for (const v of val) { - const formValue = this.formDataValue(v); - if (formValue !== null) { - pairs.push([key, formValue]); - } - } - } - this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&'); - } else if (this._bodyContentType === 'multipart/form-data') { - // Handle multipart form data - const formData = new FormData(); - if (value !== null && value !== undefined) { - for (const key of Object.keys(value)) { - const val = value[key]; - if (val instanceof Array) { - for (const v of val) { - const toAppend = this.formDataValue(v); - if (toAppend !== null) { - formData.append(key, toAppend); - } - } - } else { - const toAppend = this.formDataValue(val); - if (toAppend !== null) { - formData.set(key, toAppend); - } - } - } - } - this._bodyContent = formData; - } else { - // The body is the plain content - this._bodyContent = value; - } - } - - private formDataValue(value: any): any { - if (value === null || value === undefined) { - return null; - } - if (value instanceof Blob) { - return value; - } - if (typeof value === 'object') { - return JSON.stringify(value); - } - return String(value); - } - - /** - * Builds the request with the current set parameters - */ - build(options?: { - /** Which content types to accept */ - accept?: string; - - /** The expected response type */ - responseType?: 'json' | 'text' | 'blob' | 'arraybuffer'; - - /** Whether to report progress on uploads / downloads */ - reportProgress?: boolean; - }): HttpRequest { - options = options || {}; - - // Path parameters - let path = this.operationPath; - for (const pathParam of this._path.values()) { - path = pathParam.append(path); - } - const url = this.rootUrl + path; - - // Query parameters - let httpParams = new HttpParams({ - encoder: ParameterCodecInstance, - }); - for (const queryParam of this._query.values()) { - httpParams = queryParam.append(httpParams); - } - - // Header parameters - let httpHeaders = new HttpHeaders(); - if (options.accept) { - httpHeaders = httpHeaders.append('Accept', options.accept); - } - for (const headerParam of this._header.values()) { - httpHeaders = headerParam.append(httpHeaders); - } - - // Request content headers - if (this._bodyContentType && !(this._bodyContent instanceof FormData)) { - httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType); - } - - // Perform the request - return new HttpRequest(this.method.toUpperCase(), url, this._bodyContent, { - params: httpParams, - headers: httpHeaders, - responseType: options.responseType, - reportProgress: options.reportProgress, - }); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/default-success-response/services.ts b/tools/executors/pseudo-test/original-results.v1/default-success-response/services.ts deleted file mode 100644 index 7935001..0000000 --- a/tools/executors/pseudo-test/original-results.v1/default-success-response/services.ts +++ /dev/null @@ -1 +0,0 @@ -export { ApiService } from './services/api.service'; diff --git a/tools/executors/pseudo-test/original-results.v1/default-success-response/services/api.service.ts b/tools/executors/pseudo-test/original-results.v1/default-success-response/services/api.service.ts deleted file mode 100644 index db0d878..0000000 --- a/tools/executors/pseudo-test/original-results.v1/default-success-response/services/api.service.ts +++ /dev/null @@ -1,119 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse } from '@angular/common/http'; -import { BaseService } from '../base-service'; -import { ApiConfiguration } from '../api-configuration'; -import { StrictHttpResponse } from '../strict-http-response'; -import { RequestBuilder } from '../request-builder'; -import { Observable } from 'rxjs'; -import { map, filter } from 'rxjs/operators'; - -@Injectable({ - providedIn: 'root', -}) -export class ApiService extends BaseService { - constructor(config: ApiConfiguration, http: HttpClient) { - super(config, http); - } - - /** - * Path part for operation getPath1 - */ - static readonly GetPath1Path = '/path1'; - - /** - * Get a default string response. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `getPath1()` instead. - * - * This method doesn't expect any request body. - */ - getPath1$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, ApiService.GetPath1Path, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * Get a default string response. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `getPath1$Response()` instead. - * - * This method doesn't expect any request body. - */ - getPath1(params?: {}): Observable { - return this.getPath1$Response(params).pipe(map((r: StrictHttpResponse) => r.body as string)); - } - - /** - * Path part for operation getPath2 - */ - static readonly GetPath2Path = '/path2'; - - /** - * Get a default number response. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `getPath2()` instead. - * - * This method doesn't expect any request body. - */ - getPath2$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, ApiService.GetPath2Path, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return (r as HttpResponse).clone({ - body: parseFloat(String((r as HttpResponse).body)), - }) as StrictHttpResponse; - }), - ); - } - - /** - * Get a default number response. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `getPath2$Response()` instead. - * - * This method doesn't expect any request body. - */ - getPath2(params?: {}): Observable { - return this.getPath2$Response(params).pipe(map((r: StrictHttpResponse) => r.body as number)); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/default-success-response/strict-http-response.ts b/tools/executors/pseudo-test/original-results.v1/default-success-response/strict-http-response.ts deleted file mode 100644 index aaa5dae..0000000 --- a/tools/executors/pseudo-test/original-results.v1/default-success-response/strict-http-response.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpResponse } from '@angular/common/http'; - -/** - * Constrains the http response to not have the body defined as `T | null`, but `T` only. - */ -export type StrictHttpResponse = HttpResponse & { - readonly body: T; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/api-configuration.ts b/tools/executors/pseudo-test/original-results.v1/person-place/api-configuration.ts deleted file mode 100644 index 97cdb32..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/api-configuration.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; - -/** - * Global configuration - */ -@Injectable({ - providedIn: 'root', -}) -export class ApiConfiguration { - rootUrl: string = ''; -} - -/** - * Parameters for `ApiModule.forRoot()` - */ -export interface ApiConfigurationParams { - rootUrl?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/api.module.ts b/tools/executors/pseudo-test/original-results.v1/person-place/api.module.ts deleted file mode 100644 index c771d89..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/api.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration, ApiConfigurationParams } from './api-configuration'; - -/** - * Module that provides all services and configuration. - */ -@NgModule({ - imports: [], - exports: [], - declarations: [], - providers: [ApiConfiguration], -}) -export class ApiModule { - static forRoot(params: ApiConfigurationParams): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ - { - provide: ApiConfiguration, - useValue: params, - }, - ], - }; - } - - constructor(@Optional() @SkipSelf() parentModule: ApiModule, @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error( - 'You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575', - ); - } - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/base-service.ts b/tools/executors/pseudo-test/original-results.v1/person-place/base-service.ts deleted file mode 100644 index 545b2d6..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/base-service.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration } from './api-configuration'; - -/** - * Base class for services - */ -@Injectable() -export class BaseService { - constructor(protected config: ApiConfiguration, protected http: HttpClient) {} - - private _rootUrl: string = ''; - - /** - * Returns the root url for all operations in this service. If not set directly in this - * service, will fallback to `ApiConfiguration.rootUrl`. - */ - get rootUrl(): string { - return this._rootUrl || this.config.rootUrl; - } - - /** - * Sets the root URL for API operations in this service. - */ - set rootUrl(rootUrl: string) { - this._rootUrl = rootUrl; - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/models.ts b/tools/executors/pseudo-test/original-results.v1/person-place/models.ts deleted file mode 100644 index c84970c..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/models.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { PPEntityModel } from './models/pp-entity-model'; -export { PPGpsLocationModel } from './models/pp-gps-location-model'; -export { PPIdModel } from './models/pp-id-model'; -export { PPPersonModel } from './models/pp-person-model'; -export { PPPersonPlaceModel } from './models/pp-person-place-model'; -export { PPPlaceModel } from './models/pp-place-model'; diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-entity-model.ts b/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-entity-model.ts deleted file mode 100644 index a8546a3..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-entity-model.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { PPIdModel } from './pp-id-model'; -export interface PPEntityModel { - id?: PPIdModel; -} diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-gps-location-model.ts b/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-gps-location-model.ts deleted file mode 100644 index 20fad3d..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-gps-location-model.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface PPGpsLocationModel { - /** - * GPS coordinates - */ - gps?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-id-model.ts b/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-id-model.ts deleted file mode 100644 index b917491..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-id-model.ts +++ /dev/null @@ -1,3 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export type PPIdModel = string; diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-person-model.ts b/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-person-model.ts deleted file mode 100644 index de0e5d1..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-person-model.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { PPEntityModel } from './pp-entity-model'; -import { PPPersonPlaceModel } from './pp-person-place-model'; -export type PPPersonModel = PPEntityModel & { - name?: string; - places?: Array; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-person-place-model.ts b/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-person-place-model.ts deleted file mode 100644 index 927f4e3..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-person-place-model.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { PPPlaceModel } from './pp-place-model'; -export interface PPPersonPlaceModel { - place?: PPPlaceModel; - - /** - * The date this place was assigned to the person - */ - since?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-place-model.ts b/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-place-model.ts deleted file mode 100644 index 3e18308..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/models/pp-place-model.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { PPEntityModel } from './pp-entity-model'; -import { PPGpsLocationModel } from './pp-gps-location-model'; -export type PPPlaceModel = PPEntityModel & - ( - | PPGpsLocationModel - | { - /** - * Street address - */ - address?: string; - } - ) & { - description?: string; - [key: string]: string; - }; diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/request-builder.ts b/tools/executors/pseudo-test/original-results.v1/person-place/request-builder.ts deleted file mode 100644 index a08af28..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/request-builder.ts +++ /dev/null @@ -1,369 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders } from '@angular/common/http'; - -/** - * Custom parameter codec to correctly handle the plus sign in parameter - * values. See https://github.com/angular/angular/issues/18261 - */ -class ParameterCodec implements HttpParameterCodec { - encodeKey(key: string): string { - return encodeURIComponent(key); - } - - encodeValue(value: string): string { - return encodeURIComponent(value); - } - - decodeKey(key: string): string { - return decodeURIComponent(key); - } - - decodeValue(value: string): string { - return decodeURIComponent(value); - } -} -const ParameterCodecInstance = new ParameterCodec(); - -/** - * Defines the options for appending a parameter - */ -interface ParameterOptions { - style?: string; - explode?: boolean; -} - -/** - * Base class for a parameter - */ -abstract class Parameter { - constructor( - public name: string, - public value: any, - public options: ParameterOptions, - defaultStyle: string, - defaultExplode: boolean, - ) { - this.options = options || {}; - if (this.options.style === null || this.options.style === undefined) { - this.options.style = defaultStyle; - } - if (this.options.explode === null || this.options.explode === undefined) { - this.options.explode = defaultExplode; - } - } - - serializeValue(value: any, separator = ','): string { - if (value === null || value === undefined) { - return ''; - } else if (value instanceof Array) { - return value - .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))) - .join(separator); - } else if (typeof value === 'object') { - const array: string[] = []; - for (const key of Object.keys(value)) { - let propVal = value[key]; - if (propVal !== null && propVal !== undefined) { - propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator)); - if (this.options.explode) { - array.push(`${key}=${propVal}`); - } else { - array.push(key); - array.push(propVal); - } - } - } - return array.join(separator); - } else { - return String(value); - } - } -} - -/** - * A parameter in the operation path - */ -class PathParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(path: string): string { - let value = this.value; - if (value === null || value === undefined) { - value = ''; - } - let prefix = this.options.style === 'label' ? '.' : ''; - let separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ','; - let alreadySerialized = false; - if (this.options.style === 'matrix') { - // The parameter name is just used as prefix, except in some cases... - prefix = `;${this.name}=`; - if (this.options.explode && typeof value === 'object') { - prefix = ';'; - if (value instanceof Array) { - // For arrays we have to repeat the name for each element - value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`); - value = value.join(';'); - alreadySerialized = true; - } else { - // For objects we have to put each the key / value pairs - value = this.serializeValue(value, ';'); - alreadySerialized = true; - } - } - } - value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator)); - // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account - path = path.replace(`{${this.name}}`, value); - path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value); - return path; - } - - // @ts-ignore - serializeValue(value: any, separator = ','): string { - var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); - return result; - } -} - -/** - * A parameter in the query - */ -class QueryParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'form', true); - } - - append(params: HttpParams): HttpParams { - if (this.value instanceof Array) { - // Array serialization - if (this.options.explode) { - for (const v of this.value) { - params = params.append(this.name, this.serializeValue(v)); - } - } else { - const separator = - this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ','; - return params.append(this.name, this.serializeValue(this.value, separator)); - } - } else if (this.value !== null && typeof this.value === 'object') { - // Object serialization - if (this.options.style === 'deepObject') { - // Append a parameter for each key, in the form `name[key]` - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal)); - } - } - } else if (this.options.explode) { - // Append a parameter for each key without using the parameter name - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(key, this.serializeValue(propVal)); - } - } - } else { - // Append a single parameter whose values are a comma-separated list of key,value,key,value... - const array: any[] = []; - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - array.push(key); - array.push(propVal); - } - } - params = params.append(this.name, this.serializeValue(array)); - } - } else if (this.value !== null && this.value !== undefined) { - // Plain value - params = params.append(this.name, this.serializeValue(this.value)); - } - return params; - } -} - -/** - * A parameter in the HTTP request header - */ -class HeaderParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(headers: HttpHeaders): HttpHeaders { - if (this.value !== null && this.value !== undefined) { - if (this.value instanceof Array) { - for (const v of this.value) { - headers = headers.append(this.name, this.serializeValue(v)); - } - } else { - headers = headers.append(this.name, this.serializeValue(this.value)); - } - } - return headers; - } -} - -/** - * Helper to build http requests from parameters - */ -export class RequestBuilder { - private _path = new Map(); - private _query = new Map(); - private _header = new Map(); - _bodyContent: any | null; - _bodyContentType?: string; - - constructor(public rootUrl: string, public operationPath: string, public method: string) {} - - /** - * Sets a path parameter - */ - path(name: string, value: any, options?: ParameterOptions): void { - this._path.set(name, new PathParameter(name, value, options || {})); - } - - /** - * Sets a query parameter - */ - query(name: string, value: any, options?: ParameterOptions): void { - this._query.set(name, new QueryParameter(name, value, options || {})); - } - - /** - * Sets a header parameter - */ - header(name: string, value: any, options?: ParameterOptions): void { - this._header.set(name, new HeaderParameter(name, value, options || {})); - } - - /** - * Sets the body content, along with the content type - */ - body(value: any, contentType = 'application/json'): void { - if (value instanceof Blob) { - this._bodyContentType = value.type; - } else { - this._bodyContentType = contentType; - } - if ( - this._bodyContentType === 'application/x-www-form-urlencoded' && - value !== null && - typeof value === 'object' - ) { - // Handle URL-encoded data - const pairs: Array<[string, string]> = []; - for (const key of Object.keys(value)) { - let val = value[key]; - if (!(val instanceof Array)) { - val = [val]; - } - for (const v of val) { - const formValue = this.formDataValue(v); - if (formValue !== null) { - pairs.push([key, formValue]); - } - } - } - this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&'); - } else if (this._bodyContentType === 'multipart/form-data') { - // Handle multipart form data - const formData = new FormData(); - if (value !== null && value !== undefined) { - for (const key of Object.keys(value)) { - const val = value[key]; - if (val instanceof Array) { - for (const v of val) { - const toAppend = this.formDataValue(v); - if (toAppend !== null) { - formData.append(key, toAppend); - } - } - } else { - const toAppend = this.formDataValue(val); - if (toAppend !== null) { - formData.set(key, toAppend); - } - } - } - } - this._bodyContent = formData; - } else { - // The body is the plain content - this._bodyContent = value; - } - } - - private formDataValue(value: any): any { - if (value === null || value === undefined) { - return null; - } - if (value instanceof Blob) { - return value; - } - if (typeof value === 'object') { - return JSON.stringify(value); - } - return String(value); - } - - /** - * Builds the request with the current set parameters - */ - build(options?: { - /** Which content types to accept */ - accept?: string; - - /** The expected response type */ - responseType?: 'json' | 'text' | 'blob' | 'arraybuffer'; - - /** Whether to report progress on uploads / downloads */ - reportProgress?: boolean; - }): HttpRequest { - options = options || {}; - - // Path parameters - let path = this.operationPath; - for (const pathParam of this._path.values()) { - path = pathParam.append(path); - } - const url = this.rootUrl + path; - - // Query parameters - let httpParams = new HttpParams({ - encoder: ParameterCodecInstance, - }); - for (const queryParam of this._query.values()) { - httpParams = queryParam.append(httpParams); - } - - // Header parameters - let httpHeaders = new HttpHeaders(); - if (options.accept) { - httpHeaders = httpHeaders.append('Accept', options.accept); - } - for (const headerParam of this._header.values()) { - httpHeaders = headerParam.append(httpHeaders); - } - - // Request content headers - if (this._bodyContentType && !(this._bodyContent instanceof FormData)) { - httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType); - } - - // Perform the request - return new HttpRequest(this.method.toUpperCase(), url, this._bodyContent, { - params: httpParams, - headers: httpHeaders, - responseType: options.responseType, - reportProgress: options.reportProgress, - }); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/services.ts b/tools/executors/pseudo-test/original-results.v1/person-place/services.ts deleted file mode 100644 index e69de29..0000000 diff --git a/tools/executors/pseudo-test/original-results.v1/person-place/strict-http-response.ts b/tools/executors/pseudo-test/original-results.v1/person-place/strict-http-response.ts deleted file mode 100644 index aaa5dae..0000000 --- a/tools/executors/pseudo-test/original-results.v1/person-place/strict-http-response.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpResponse } from '@angular/common/http'; - -/** - * Constrains the http response to not have the body defined as `T | null`, but `T` only. - */ -export type StrictHttpResponse = HttpResponse & { - readonly body: T; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/api-configuration.ts b/tools/executors/pseudo-test/original-results.v1/petstore/api-configuration.ts deleted file mode 100644 index 8189e4c..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/api-configuration.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; - -/** - * Global configuration - */ -@Injectable({ - providedIn: 'root', -}) -export class ApiConfiguration { - rootUrl: string = 'http://petstore.swagger.io/v1'; -} - -/** - * Parameters for `ApiModule.forRoot()` - */ -export interface ApiConfigurationParams { - rootUrl?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/api.module.ts b/tools/executors/pseudo-test/original-results.v1/petstore/api.module.ts deleted file mode 100644 index 48e29ac..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/api.module.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration, ApiConfigurationParams } from './api-configuration'; - -import { PetsService } from './services/pets.service'; - -/** - * Module that provides all services and configuration. - */ -@NgModule({ - imports: [], - exports: [], - declarations: [], - providers: [PetsService, ApiConfiguration], -}) -export class ApiModule { - static forRoot(params: ApiConfigurationParams): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ - { - provide: ApiConfiguration, - useValue: params, - }, - ], - }; - } - - constructor(@Optional() @SkipSelf() parentModule: ApiModule, @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error( - 'You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575', - ); - } - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/base-service.ts b/tools/executors/pseudo-test/original-results.v1/petstore/base-service.ts deleted file mode 100644 index 545b2d6..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/base-service.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration } from './api-configuration'; - -/** - * Base class for services - */ -@Injectable() -export class BaseService { - constructor(protected config: ApiConfiguration, protected http: HttpClient) {} - - private _rootUrl: string = ''; - - /** - * Returns the root url for all operations in this service. If not set directly in this - * service, will fallback to `ApiConfiguration.rootUrl`. - */ - get rootUrl(): string { - return this._rootUrl || this.config.rootUrl; - } - - /** - * Sets the root URL for API operations in this service. - */ - set rootUrl(rootUrl: string) { - this._rootUrl = rootUrl; - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/models.ts b/tools/executors/pseudo-test/original-results.v1/petstore/models.ts deleted file mode 100644 index ad31c81..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/models.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { PetstoreErrorModel } from './models/petstore-error-model'; -export { PetstorePetModel } from './models/petstore-pet-model'; -export { PetstorePetsModel } from './models/petstore-pets-model'; diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/models/petstore-error-model.ts b/tools/executors/pseudo-test/original-results.v1/petstore/models/petstore-error-model.ts deleted file mode 100644 index 8ff9b20..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/models/petstore-error-model.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface PetstoreErrorModel { - code: number; - message: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/models/petstore-pet-model.ts b/tools/executors/pseudo-test/original-results.v1/petstore/models/petstore-pet-model.ts deleted file mode 100644 index 5968948..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/models/petstore-pet-model.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface PetstorePetModel { - id: number; - name: string; - tag?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/models/petstore-pets-model.ts b/tools/executors/pseudo-test/original-results.v1/petstore/models/petstore-pets-model.ts deleted file mode 100644 index 8e4bc57..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/models/petstore-pets-model.ts +++ /dev/null @@ -1,4 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { PetstorePetModel } from './petstore-pet-model'; -export type PetstorePetsModel = Array; diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/request-builder.ts b/tools/executors/pseudo-test/original-results.v1/petstore/request-builder.ts deleted file mode 100644 index a08af28..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/request-builder.ts +++ /dev/null @@ -1,369 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders } from '@angular/common/http'; - -/** - * Custom parameter codec to correctly handle the plus sign in parameter - * values. See https://github.com/angular/angular/issues/18261 - */ -class ParameterCodec implements HttpParameterCodec { - encodeKey(key: string): string { - return encodeURIComponent(key); - } - - encodeValue(value: string): string { - return encodeURIComponent(value); - } - - decodeKey(key: string): string { - return decodeURIComponent(key); - } - - decodeValue(value: string): string { - return decodeURIComponent(value); - } -} -const ParameterCodecInstance = new ParameterCodec(); - -/** - * Defines the options for appending a parameter - */ -interface ParameterOptions { - style?: string; - explode?: boolean; -} - -/** - * Base class for a parameter - */ -abstract class Parameter { - constructor( - public name: string, - public value: any, - public options: ParameterOptions, - defaultStyle: string, - defaultExplode: boolean, - ) { - this.options = options || {}; - if (this.options.style === null || this.options.style === undefined) { - this.options.style = defaultStyle; - } - if (this.options.explode === null || this.options.explode === undefined) { - this.options.explode = defaultExplode; - } - } - - serializeValue(value: any, separator = ','): string { - if (value === null || value === undefined) { - return ''; - } else if (value instanceof Array) { - return value - .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))) - .join(separator); - } else if (typeof value === 'object') { - const array: string[] = []; - for (const key of Object.keys(value)) { - let propVal = value[key]; - if (propVal !== null && propVal !== undefined) { - propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator)); - if (this.options.explode) { - array.push(`${key}=${propVal}`); - } else { - array.push(key); - array.push(propVal); - } - } - } - return array.join(separator); - } else { - return String(value); - } - } -} - -/** - * A parameter in the operation path - */ -class PathParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(path: string): string { - let value = this.value; - if (value === null || value === undefined) { - value = ''; - } - let prefix = this.options.style === 'label' ? '.' : ''; - let separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ','; - let alreadySerialized = false; - if (this.options.style === 'matrix') { - // The parameter name is just used as prefix, except in some cases... - prefix = `;${this.name}=`; - if (this.options.explode && typeof value === 'object') { - prefix = ';'; - if (value instanceof Array) { - // For arrays we have to repeat the name for each element - value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`); - value = value.join(';'); - alreadySerialized = true; - } else { - // For objects we have to put each the key / value pairs - value = this.serializeValue(value, ';'); - alreadySerialized = true; - } - } - } - value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator)); - // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account - path = path.replace(`{${this.name}}`, value); - path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value); - return path; - } - - // @ts-ignore - serializeValue(value: any, separator = ','): string { - var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); - return result; - } -} - -/** - * A parameter in the query - */ -class QueryParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'form', true); - } - - append(params: HttpParams): HttpParams { - if (this.value instanceof Array) { - // Array serialization - if (this.options.explode) { - for (const v of this.value) { - params = params.append(this.name, this.serializeValue(v)); - } - } else { - const separator = - this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ','; - return params.append(this.name, this.serializeValue(this.value, separator)); - } - } else if (this.value !== null && typeof this.value === 'object') { - // Object serialization - if (this.options.style === 'deepObject') { - // Append a parameter for each key, in the form `name[key]` - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal)); - } - } - } else if (this.options.explode) { - // Append a parameter for each key without using the parameter name - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(key, this.serializeValue(propVal)); - } - } - } else { - // Append a single parameter whose values are a comma-separated list of key,value,key,value... - const array: any[] = []; - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - array.push(key); - array.push(propVal); - } - } - params = params.append(this.name, this.serializeValue(array)); - } - } else if (this.value !== null && this.value !== undefined) { - // Plain value - params = params.append(this.name, this.serializeValue(this.value)); - } - return params; - } -} - -/** - * A parameter in the HTTP request header - */ -class HeaderParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(headers: HttpHeaders): HttpHeaders { - if (this.value !== null && this.value !== undefined) { - if (this.value instanceof Array) { - for (const v of this.value) { - headers = headers.append(this.name, this.serializeValue(v)); - } - } else { - headers = headers.append(this.name, this.serializeValue(this.value)); - } - } - return headers; - } -} - -/** - * Helper to build http requests from parameters - */ -export class RequestBuilder { - private _path = new Map(); - private _query = new Map(); - private _header = new Map(); - _bodyContent: any | null; - _bodyContentType?: string; - - constructor(public rootUrl: string, public operationPath: string, public method: string) {} - - /** - * Sets a path parameter - */ - path(name: string, value: any, options?: ParameterOptions): void { - this._path.set(name, new PathParameter(name, value, options || {})); - } - - /** - * Sets a query parameter - */ - query(name: string, value: any, options?: ParameterOptions): void { - this._query.set(name, new QueryParameter(name, value, options || {})); - } - - /** - * Sets a header parameter - */ - header(name: string, value: any, options?: ParameterOptions): void { - this._header.set(name, new HeaderParameter(name, value, options || {})); - } - - /** - * Sets the body content, along with the content type - */ - body(value: any, contentType = 'application/json'): void { - if (value instanceof Blob) { - this._bodyContentType = value.type; - } else { - this._bodyContentType = contentType; - } - if ( - this._bodyContentType === 'application/x-www-form-urlencoded' && - value !== null && - typeof value === 'object' - ) { - // Handle URL-encoded data - const pairs: Array<[string, string]> = []; - for (const key of Object.keys(value)) { - let val = value[key]; - if (!(val instanceof Array)) { - val = [val]; - } - for (const v of val) { - const formValue = this.formDataValue(v); - if (formValue !== null) { - pairs.push([key, formValue]); - } - } - } - this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&'); - } else if (this._bodyContentType === 'multipart/form-data') { - // Handle multipart form data - const formData = new FormData(); - if (value !== null && value !== undefined) { - for (const key of Object.keys(value)) { - const val = value[key]; - if (val instanceof Array) { - for (const v of val) { - const toAppend = this.formDataValue(v); - if (toAppend !== null) { - formData.append(key, toAppend); - } - } - } else { - const toAppend = this.formDataValue(val); - if (toAppend !== null) { - formData.set(key, toAppend); - } - } - } - } - this._bodyContent = formData; - } else { - // The body is the plain content - this._bodyContent = value; - } - } - - private formDataValue(value: any): any { - if (value === null || value === undefined) { - return null; - } - if (value instanceof Blob) { - return value; - } - if (typeof value === 'object') { - return JSON.stringify(value); - } - return String(value); - } - - /** - * Builds the request with the current set parameters - */ - build(options?: { - /** Which content types to accept */ - accept?: string; - - /** The expected response type */ - responseType?: 'json' | 'text' | 'blob' | 'arraybuffer'; - - /** Whether to report progress on uploads / downloads */ - reportProgress?: boolean; - }): HttpRequest { - options = options || {}; - - // Path parameters - let path = this.operationPath; - for (const pathParam of this._path.values()) { - path = pathParam.append(path); - } - const url = this.rootUrl + path; - - // Query parameters - let httpParams = new HttpParams({ - encoder: ParameterCodecInstance, - }); - for (const queryParam of this._query.values()) { - httpParams = queryParam.append(httpParams); - } - - // Header parameters - let httpHeaders = new HttpHeaders(); - if (options.accept) { - httpHeaders = httpHeaders.append('Accept', options.accept); - } - for (const headerParam of this._header.values()) { - httpHeaders = headerParam.append(httpHeaders); - } - - // Request content headers - if (this._bodyContentType && !(this._bodyContent instanceof FormData)) { - httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType); - } - - // Perform the request - return new HttpRequest(this.method.toUpperCase(), url, this._bodyContent, { - params: httpParams, - headers: httpHeaders, - responseType: options.responseType, - reportProgress: options.reportProgress, - }); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/services.ts b/tools/executors/pseudo-test/original-results.v1/petstore/services.ts deleted file mode 100644 index 026b7d6..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/services.ts +++ /dev/null @@ -1 +0,0 @@ -export { PetsService } from './services/pets.service'; diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/services/pets.service.ts b/tools/executors/pseudo-test/original-results.v1/petstore/services/pets.service.ts deleted file mode 100644 index 7bf506d..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/services/pets.service.ts +++ /dev/null @@ -1,194 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse } from '@angular/common/http'; -import { BaseService } from '../base-service'; -import { ApiConfiguration } from '../api-configuration'; -import { StrictHttpResponse } from '../strict-http-response'; -import { RequestBuilder } from '../request-builder'; -import { Observable } from 'rxjs'; -import { map, filter } from 'rxjs/operators'; - -import { PetstorePetsModel } from '../models/petstore-pets-model'; - -@Injectable({ - providedIn: 'root', -}) -export class PetsService extends BaseService { - constructor(config: ApiConfiguration, http: HttpClient) { - super(config, http); - } - - /** - * Path part for operation listPets - */ - static readonly ListPetsPath = '/pets'; - - /** - * List all pets. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `listPets()` instead. - * - * This method doesn't expect any request body. - */ - listPets$Response(params?: { - /** - * How many items to return at one time (max 100) - */ - limit?: number; - }): Observable> { - const rb = new RequestBuilder(this.rootUrl, PetsService.ListPetsPath, 'get'); - if (params) { - rb.query('limit', params.limit, {}); - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * List all pets. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `listPets$Response()` instead. - * - * This method doesn't expect any request body. - */ - listPets(params?: { - /** - * How many items to return at one time (max 100) - */ - limit?: number; - }): Observable { - return this.listPets$Response(params).pipe( - map((r: StrictHttpResponse) => r.body as PetstorePetsModel), - ); - } - - /** - * Path part for operation createPets - */ - static readonly CreatePetsPath = '/pets'; - - /** - * Create a pet. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `createPets()` instead. - * - * This method doesn't expect any request body. - */ - createPets$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, PetsService.CreatePetsPath, 'post'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: '*/*', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return (r as HttpResponse).clone({ body: undefined }) as StrictHttpResponse; - }), - ); - } - - /** - * Create a pet. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `createPets$Response()` instead. - * - * This method doesn't expect any request body. - */ - createPets(params?: {}): Observable { - return this.createPets$Response(params).pipe(map((r: StrictHttpResponse) => r.body as void)); - } - - /** - * Path part for operation showPetById - */ - static readonly ShowPetByIdPath = '/pets/{petId}'; - - /** - * Info for a specific pet. - * - * - * - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `showPetById()` instead. - * - * This method doesn't expect any request body. - */ - showPetById$Response(params: { - /** - * The id of the pet to retrieve - */ - petId: string; - }): Observable> { - const rb = new RequestBuilder(this.rootUrl, PetsService.ShowPetByIdPath, 'get'); - if (params) { - rb.path('petId', params.petId, {}); - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * Info for a specific pet. - * - * - * - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `showPetById$Response()` instead. - * - * This method doesn't expect any request body. - */ - showPetById(params: { - /** - * The id of the pet to retrieve - */ - petId: string; - }): Observable { - return this.showPetById$Response(params).pipe( - map((r: StrictHttpResponse) => r.body as PetstorePetsModel), - ); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/petstore/strict-http-response.ts b/tools/executors/pseudo-test/original-results.v1/petstore/strict-http-response.ts deleted file mode 100644 index aaa5dae..0000000 --- a/tools/executors/pseudo-test/original-results.v1/petstore/strict-http-response.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpResponse } from '@angular/common/http'; - -/** - * Constrains the http response to not have the body defined as `T | null`, but `T` only. - */ -export type StrictHttpResponse = HttpResponse & { - readonly body: T; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/api-configuration.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/api-configuration.ts deleted file mode 100644 index 97cdb32..0000000 --- a/tools/executors/pseudo-test/original-results.v1/polymorphic/api-configuration.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; - -/** - * Global configuration - */ -@Injectable({ - providedIn: 'root', -}) -export class ApiConfiguration { - rootUrl: string = ''; -} - -/** - * Parameters for `ApiModule.forRoot()` - */ -export interface ApiConfigurationParams { - rootUrl?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/api.module.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/api.module.ts deleted file mode 100644 index c771d89..0000000 --- a/tools/executors/pseudo-test/original-results.v1/polymorphic/api.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration, ApiConfigurationParams } from './api-configuration'; - -/** - * Module that provides all services and configuration. - */ -@NgModule({ - imports: [], - exports: [], - declarations: [], - providers: [ApiConfiguration], -}) -export class ApiModule { - static forRoot(params: ApiConfigurationParams): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ - { - provide: ApiConfiguration, - useValue: params, - }, - ], - }; - } - - constructor(@Optional() @SkipSelf() parentModule: ApiModule, @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error( - 'You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575', - ); - } - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/base-service.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/base-service.ts deleted file mode 100644 index 545b2d6..0000000 --- a/tools/executors/pseudo-test/original-results.v1/polymorphic/base-service.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration } from './api-configuration'; - -/** - * Base class for services - */ -@Injectable() -export class BaseService { - constructor(protected config: ApiConfiguration, protected http: HttpClient) {} - - private _rootUrl: string = ''; - - /** - * Returns the root url for all operations in this service. If not set directly in this - * service, will fallback to `ApiConfiguration.rootUrl`. - */ - get rootUrl(): string { - return this._rootUrl || this.config.rootUrl; - } - - /** - * Sets the root URL for API operations in this service. - */ - set rootUrl(rootUrl: string) { - this._rootUrl = rootUrl; - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/models.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/models.ts deleted file mode 100644 index fcedbfd..0000000 --- a/tools/executors/pseudo-test/original-results.v1/polymorphic/models.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { Dooz as FooBarDooz } from './models/Foo/Bar/dooz'; -export { Tazk as FooBarTazk } from './models/Foo/Bar/tazk'; -export { TazkBase as FooBarTazkBase } from './models/Foo/Bar/tazk-base'; diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/models/Foo/Bar/dooz.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/models/Foo/Bar/dooz.ts deleted file mode 100644 index 8646b4c..0000000 --- a/tools/executors/pseudo-test/original-results.v1/polymorphic/models/Foo/Bar/dooz.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Tazk as FooBarTazk } from '../../Foo/Bar/tazk'; -export interface Dooz { - doozObject?: FooBarTazk & { - doozNumber?: number; - }; -} diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/models/Foo/Bar/tazk-base.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/models/Foo/Bar/tazk-base.ts deleted file mode 100644 index a539c27..0000000 --- a/tools/executors/pseudo-test/original-results.v1/polymorphic/models/Foo/Bar/tazk-base.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface TazkBase { - description?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/models/Foo/Bar/tazk.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/models/Foo/Bar/tazk.ts deleted file mode 100644 index 59ba12c..0000000 --- a/tools/executors/pseudo-test/original-results.v1/polymorphic/models/Foo/Bar/tazk.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { TazkBase as FooBarTazkBase } from '../../Foo/Bar/tazk-base'; -export type Tazk = FooBarTazkBase & { - taskNumber?: number; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/request-builder.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/request-builder.ts deleted file mode 100644 index a08af28..0000000 --- a/tools/executors/pseudo-test/original-results.v1/polymorphic/request-builder.ts +++ /dev/null @@ -1,369 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders } from '@angular/common/http'; - -/** - * Custom parameter codec to correctly handle the plus sign in parameter - * values. See https://github.com/angular/angular/issues/18261 - */ -class ParameterCodec implements HttpParameterCodec { - encodeKey(key: string): string { - return encodeURIComponent(key); - } - - encodeValue(value: string): string { - return encodeURIComponent(value); - } - - decodeKey(key: string): string { - return decodeURIComponent(key); - } - - decodeValue(value: string): string { - return decodeURIComponent(value); - } -} -const ParameterCodecInstance = new ParameterCodec(); - -/** - * Defines the options for appending a parameter - */ -interface ParameterOptions { - style?: string; - explode?: boolean; -} - -/** - * Base class for a parameter - */ -abstract class Parameter { - constructor( - public name: string, - public value: any, - public options: ParameterOptions, - defaultStyle: string, - defaultExplode: boolean, - ) { - this.options = options || {}; - if (this.options.style === null || this.options.style === undefined) { - this.options.style = defaultStyle; - } - if (this.options.explode === null || this.options.explode === undefined) { - this.options.explode = defaultExplode; - } - } - - serializeValue(value: any, separator = ','): string { - if (value === null || value === undefined) { - return ''; - } else if (value instanceof Array) { - return value - .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))) - .join(separator); - } else if (typeof value === 'object') { - const array: string[] = []; - for (const key of Object.keys(value)) { - let propVal = value[key]; - if (propVal !== null && propVal !== undefined) { - propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator)); - if (this.options.explode) { - array.push(`${key}=${propVal}`); - } else { - array.push(key); - array.push(propVal); - } - } - } - return array.join(separator); - } else { - return String(value); - } - } -} - -/** - * A parameter in the operation path - */ -class PathParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(path: string): string { - let value = this.value; - if (value === null || value === undefined) { - value = ''; - } - let prefix = this.options.style === 'label' ? '.' : ''; - let separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ','; - let alreadySerialized = false; - if (this.options.style === 'matrix') { - // The parameter name is just used as prefix, except in some cases... - prefix = `;${this.name}=`; - if (this.options.explode && typeof value === 'object') { - prefix = ';'; - if (value instanceof Array) { - // For arrays we have to repeat the name for each element - value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`); - value = value.join(';'); - alreadySerialized = true; - } else { - // For objects we have to put each the key / value pairs - value = this.serializeValue(value, ';'); - alreadySerialized = true; - } - } - } - value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator)); - // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account - path = path.replace(`{${this.name}}`, value); - path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value); - return path; - } - - // @ts-ignore - serializeValue(value: any, separator = ','): string { - var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); - return result; - } -} - -/** - * A parameter in the query - */ -class QueryParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'form', true); - } - - append(params: HttpParams): HttpParams { - if (this.value instanceof Array) { - // Array serialization - if (this.options.explode) { - for (const v of this.value) { - params = params.append(this.name, this.serializeValue(v)); - } - } else { - const separator = - this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ','; - return params.append(this.name, this.serializeValue(this.value, separator)); - } - } else if (this.value !== null && typeof this.value === 'object') { - // Object serialization - if (this.options.style === 'deepObject') { - // Append a parameter for each key, in the form `name[key]` - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal)); - } - } - } else if (this.options.explode) { - // Append a parameter for each key without using the parameter name - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(key, this.serializeValue(propVal)); - } - } - } else { - // Append a single parameter whose values are a comma-separated list of key,value,key,value... - const array: any[] = []; - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - array.push(key); - array.push(propVal); - } - } - params = params.append(this.name, this.serializeValue(array)); - } - } else if (this.value !== null && this.value !== undefined) { - // Plain value - params = params.append(this.name, this.serializeValue(this.value)); - } - return params; - } -} - -/** - * A parameter in the HTTP request header - */ -class HeaderParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(headers: HttpHeaders): HttpHeaders { - if (this.value !== null && this.value !== undefined) { - if (this.value instanceof Array) { - for (const v of this.value) { - headers = headers.append(this.name, this.serializeValue(v)); - } - } else { - headers = headers.append(this.name, this.serializeValue(this.value)); - } - } - return headers; - } -} - -/** - * Helper to build http requests from parameters - */ -export class RequestBuilder { - private _path = new Map(); - private _query = new Map(); - private _header = new Map(); - _bodyContent: any | null; - _bodyContentType?: string; - - constructor(public rootUrl: string, public operationPath: string, public method: string) {} - - /** - * Sets a path parameter - */ - path(name: string, value: any, options?: ParameterOptions): void { - this._path.set(name, new PathParameter(name, value, options || {})); - } - - /** - * Sets a query parameter - */ - query(name: string, value: any, options?: ParameterOptions): void { - this._query.set(name, new QueryParameter(name, value, options || {})); - } - - /** - * Sets a header parameter - */ - header(name: string, value: any, options?: ParameterOptions): void { - this._header.set(name, new HeaderParameter(name, value, options || {})); - } - - /** - * Sets the body content, along with the content type - */ - body(value: any, contentType = 'application/json'): void { - if (value instanceof Blob) { - this._bodyContentType = value.type; - } else { - this._bodyContentType = contentType; - } - if ( - this._bodyContentType === 'application/x-www-form-urlencoded' && - value !== null && - typeof value === 'object' - ) { - // Handle URL-encoded data - const pairs: Array<[string, string]> = []; - for (const key of Object.keys(value)) { - let val = value[key]; - if (!(val instanceof Array)) { - val = [val]; - } - for (const v of val) { - const formValue = this.formDataValue(v); - if (formValue !== null) { - pairs.push([key, formValue]); - } - } - } - this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&'); - } else if (this._bodyContentType === 'multipart/form-data') { - // Handle multipart form data - const formData = new FormData(); - if (value !== null && value !== undefined) { - for (const key of Object.keys(value)) { - const val = value[key]; - if (val instanceof Array) { - for (const v of val) { - const toAppend = this.formDataValue(v); - if (toAppend !== null) { - formData.append(key, toAppend); - } - } - } else { - const toAppend = this.formDataValue(val); - if (toAppend !== null) { - formData.set(key, toAppend); - } - } - } - } - this._bodyContent = formData; - } else { - // The body is the plain content - this._bodyContent = value; - } - } - - private formDataValue(value: any): any { - if (value === null || value === undefined) { - return null; - } - if (value instanceof Blob) { - return value; - } - if (typeof value === 'object') { - return JSON.stringify(value); - } - return String(value); - } - - /** - * Builds the request with the current set parameters - */ - build(options?: { - /** Which content types to accept */ - accept?: string; - - /** The expected response type */ - responseType?: 'json' | 'text' | 'blob' | 'arraybuffer'; - - /** Whether to report progress on uploads / downloads */ - reportProgress?: boolean; - }): HttpRequest { - options = options || {}; - - // Path parameters - let path = this.operationPath; - for (const pathParam of this._path.values()) { - path = pathParam.append(path); - } - const url = this.rootUrl + path; - - // Query parameters - let httpParams = new HttpParams({ - encoder: ParameterCodecInstance, - }); - for (const queryParam of this._query.values()) { - httpParams = queryParam.append(httpParams); - } - - // Header parameters - let httpHeaders = new HttpHeaders(); - if (options.accept) { - httpHeaders = httpHeaders.append('Accept', options.accept); - } - for (const headerParam of this._header.values()) { - httpHeaders = headerParam.append(httpHeaders); - } - - // Request content headers - if (this._bodyContentType && !(this._bodyContent instanceof FormData)) { - httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType); - } - - // Perform the request - return new HttpRequest(this.method.toUpperCase(), url, this._bodyContent, { - params: httpParams, - headers: httpHeaders, - responseType: options.responseType, - reportProgress: options.reportProgress, - }); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/services.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/services.ts deleted file mode 100644 index e69de29..0000000 diff --git a/tools/executors/pseudo-test/original-results.v1/polymorphic/strict-http-response.ts b/tools/executors/pseudo-test/original-results.v1/polymorphic/strict-http-response.ts deleted file mode 100644 index aaa5dae..0000000 --- a/tools/executors/pseudo-test/original-results.v1/polymorphic/strict-http-response.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpResponse } from '@angular/common/http'; - -/** - * Constrains the http response to not have the body defined as `T | null`, but `T` only. - */ -export type StrictHttpResponse = HttpResponse & { - readonly body: T; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/self-ref/api-configuration.ts b/tools/executors/pseudo-test/original-results.v1/self-ref/api-configuration.ts deleted file mode 100644 index 97cdb32..0000000 --- a/tools/executors/pseudo-test/original-results.v1/self-ref/api-configuration.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; - -/** - * Global configuration - */ -@Injectable({ - providedIn: 'root', -}) -export class ApiConfiguration { - rootUrl: string = ''; -} - -/** - * Parameters for `ApiModule.forRoot()` - */ -export interface ApiConfigurationParams { - rootUrl?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/self-ref/api.module.ts b/tools/executors/pseudo-test/original-results.v1/self-ref/api.module.ts deleted file mode 100644 index c771d89..0000000 --- a/tools/executors/pseudo-test/original-results.v1/self-ref/api.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration, ApiConfigurationParams } from './api-configuration'; - -/** - * Module that provides all services and configuration. - */ -@NgModule({ - imports: [], - exports: [], - declarations: [], - providers: [ApiConfiguration], -}) -export class ApiModule { - static forRoot(params: ApiConfigurationParams): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ - { - provide: ApiConfiguration, - useValue: params, - }, - ], - }; - } - - constructor(@Optional() @SkipSelf() parentModule: ApiModule, @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error( - 'You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575', - ); - } - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/self-ref/base-service.ts b/tools/executors/pseudo-test/original-results.v1/self-ref/base-service.ts deleted file mode 100644 index 545b2d6..0000000 --- a/tools/executors/pseudo-test/original-results.v1/self-ref/base-service.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration } from './api-configuration'; - -/** - * Base class for services - */ -@Injectable() -export class BaseService { - constructor(protected config: ApiConfiguration, protected http: HttpClient) {} - - private _rootUrl: string = ''; - - /** - * Returns the root url for all operations in this service. If not set directly in this - * service, will fallback to `ApiConfiguration.rootUrl`. - */ - get rootUrl(): string { - return this._rootUrl || this.config.rootUrl; - } - - /** - * Sets the root URL for API operations in this service. - */ - set rootUrl(rootUrl: string) { - this._rootUrl = rootUrl; - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/self-ref/models.ts b/tools/executors/pseudo-test/original-results.v1/self-ref/models.ts deleted file mode 100644 index 13cbecb..0000000 --- a/tools/executors/pseudo-test/original-results.v1/self-ref/models.ts +++ /dev/null @@ -1 +0,0 @@ -export { Baz as FooBarBaz } from './models/Foo/Bar/baz'; diff --git a/tools/executors/pseudo-test/original-results.v1/self-ref/models/Foo/Bar/baz.ts b/tools/executors/pseudo-test/original-results.v1/self-ref/models/Foo/Bar/baz.ts deleted file mode 100644 index f9b339e..0000000 --- a/tools/executors/pseudo-test/original-results.v1/self-ref/models/Foo/Bar/baz.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export interface Baz { - arrayProperty: Array; - objectProperty?: { - nestedArray: Array; - nestedRef: Baz; - }; - refProperty?: Baz; -} diff --git a/tools/executors/pseudo-test/original-results.v1/self-ref/request-builder.ts b/tools/executors/pseudo-test/original-results.v1/self-ref/request-builder.ts deleted file mode 100644 index a08af28..0000000 --- a/tools/executors/pseudo-test/original-results.v1/self-ref/request-builder.ts +++ /dev/null @@ -1,369 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders } from '@angular/common/http'; - -/** - * Custom parameter codec to correctly handle the plus sign in parameter - * values. See https://github.com/angular/angular/issues/18261 - */ -class ParameterCodec implements HttpParameterCodec { - encodeKey(key: string): string { - return encodeURIComponent(key); - } - - encodeValue(value: string): string { - return encodeURIComponent(value); - } - - decodeKey(key: string): string { - return decodeURIComponent(key); - } - - decodeValue(value: string): string { - return decodeURIComponent(value); - } -} -const ParameterCodecInstance = new ParameterCodec(); - -/** - * Defines the options for appending a parameter - */ -interface ParameterOptions { - style?: string; - explode?: boolean; -} - -/** - * Base class for a parameter - */ -abstract class Parameter { - constructor( - public name: string, - public value: any, - public options: ParameterOptions, - defaultStyle: string, - defaultExplode: boolean, - ) { - this.options = options || {}; - if (this.options.style === null || this.options.style === undefined) { - this.options.style = defaultStyle; - } - if (this.options.explode === null || this.options.explode === undefined) { - this.options.explode = defaultExplode; - } - } - - serializeValue(value: any, separator = ','): string { - if (value === null || value === undefined) { - return ''; - } else if (value instanceof Array) { - return value - .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))) - .join(separator); - } else if (typeof value === 'object') { - const array: string[] = []; - for (const key of Object.keys(value)) { - let propVal = value[key]; - if (propVal !== null && propVal !== undefined) { - propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator)); - if (this.options.explode) { - array.push(`${key}=${propVal}`); - } else { - array.push(key); - array.push(propVal); - } - } - } - return array.join(separator); - } else { - return String(value); - } - } -} - -/** - * A parameter in the operation path - */ -class PathParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(path: string): string { - let value = this.value; - if (value === null || value === undefined) { - value = ''; - } - let prefix = this.options.style === 'label' ? '.' : ''; - let separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ','; - let alreadySerialized = false; - if (this.options.style === 'matrix') { - // The parameter name is just used as prefix, except in some cases... - prefix = `;${this.name}=`; - if (this.options.explode && typeof value === 'object') { - prefix = ';'; - if (value instanceof Array) { - // For arrays we have to repeat the name for each element - value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`); - value = value.join(';'); - alreadySerialized = true; - } else { - // For objects we have to put each the key / value pairs - value = this.serializeValue(value, ';'); - alreadySerialized = true; - } - } - } - value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator)); - // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account - path = path.replace(`{${this.name}}`, value); - path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value); - return path; - } - - // @ts-ignore - serializeValue(value: any, separator = ','): string { - var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); - return result; - } -} - -/** - * A parameter in the query - */ -class QueryParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'form', true); - } - - append(params: HttpParams): HttpParams { - if (this.value instanceof Array) { - // Array serialization - if (this.options.explode) { - for (const v of this.value) { - params = params.append(this.name, this.serializeValue(v)); - } - } else { - const separator = - this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ','; - return params.append(this.name, this.serializeValue(this.value, separator)); - } - } else if (this.value !== null && typeof this.value === 'object') { - // Object serialization - if (this.options.style === 'deepObject') { - // Append a parameter for each key, in the form `name[key]` - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal)); - } - } - } else if (this.options.explode) { - // Append a parameter for each key without using the parameter name - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(key, this.serializeValue(propVal)); - } - } - } else { - // Append a single parameter whose values are a comma-separated list of key,value,key,value... - const array: any[] = []; - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - array.push(key); - array.push(propVal); - } - } - params = params.append(this.name, this.serializeValue(array)); - } - } else if (this.value !== null && this.value !== undefined) { - // Plain value - params = params.append(this.name, this.serializeValue(this.value)); - } - return params; - } -} - -/** - * A parameter in the HTTP request header - */ -class HeaderParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(headers: HttpHeaders): HttpHeaders { - if (this.value !== null && this.value !== undefined) { - if (this.value instanceof Array) { - for (const v of this.value) { - headers = headers.append(this.name, this.serializeValue(v)); - } - } else { - headers = headers.append(this.name, this.serializeValue(this.value)); - } - } - return headers; - } -} - -/** - * Helper to build http requests from parameters - */ -export class RequestBuilder { - private _path = new Map(); - private _query = new Map(); - private _header = new Map(); - _bodyContent: any | null; - _bodyContentType?: string; - - constructor(public rootUrl: string, public operationPath: string, public method: string) {} - - /** - * Sets a path parameter - */ - path(name: string, value: any, options?: ParameterOptions): void { - this._path.set(name, new PathParameter(name, value, options || {})); - } - - /** - * Sets a query parameter - */ - query(name: string, value: any, options?: ParameterOptions): void { - this._query.set(name, new QueryParameter(name, value, options || {})); - } - - /** - * Sets a header parameter - */ - header(name: string, value: any, options?: ParameterOptions): void { - this._header.set(name, new HeaderParameter(name, value, options || {})); - } - - /** - * Sets the body content, along with the content type - */ - body(value: any, contentType = 'application/json'): void { - if (value instanceof Blob) { - this._bodyContentType = value.type; - } else { - this._bodyContentType = contentType; - } - if ( - this._bodyContentType === 'application/x-www-form-urlencoded' && - value !== null && - typeof value === 'object' - ) { - // Handle URL-encoded data - const pairs: Array<[string, string]> = []; - for (const key of Object.keys(value)) { - let val = value[key]; - if (!(val instanceof Array)) { - val = [val]; - } - for (const v of val) { - const formValue = this.formDataValue(v); - if (formValue !== null) { - pairs.push([key, formValue]); - } - } - } - this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&'); - } else if (this._bodyContentType === 'multipart/form-data') { - // Handle multipart form data - const formData = new FormData(); - if (value !== null && value !== undefined) { - for (const key of Object.keys(value)) { - const val = value[key]; - if (val instanceof Array) { - for (const v of val) { - const toAppend = this.formDataValue(v); - if (toAppend !== null) { - formData.append(key, toAppend); - } - } - } else { - const toAppend = this.formDataValue(val); - if (toAppend !== null) { - formData.set(key, toAppend); - } - } - } - } - this._bodyContent = formData; - } else { - // The body is the plain content - this._bodyContent = value; - } - } - - private formDataValue(value: any): any { - if (value === null || value === undefined) { - return null; - } - if (value instanceof Blob) { - return value; - } - if (typeof value === 'object') { - return JSON.stringify(value); - } - return String(value); - } - - /** - * Builds the request with the current set parameters - */ - build(options?: { - /** Which content types to accept */ - accept?: string; - - /** The expected response type */ - responseType?: 'json' | 'text' | 'blob' | 'arraybuffer'; - - /** Whether to report progress on uploads / downloads */ - reportProgress?: boolean; - }): HttpRequest { - options = options || {}; - - // Path parameters - let path = this.operationPath; - for (const pathParam of this._path.values()) { - path = pathParam.append(path); - } - const url = this.rootUrl + path; - - // Query parameters - let httpParams = new HttpParams({ - encoder: ParameterCodecInstance, - }); - for (const queryParam of this._query.values()) { - httpParams = queryParam.append(httpParams); - } - - // Header parameters - let httpHeaders = new HttpHeaders(); - if (options.accept) { - httpHeaders = httpHeaders.append('Accept', options.accept); - } - for (const headerParam of this._header.values()) { - httpHeaders = headerParam.append(httpHeaders); - } - - // Request content headers - if (this._bodyContentType && !(this._bodyContent instanceof FormData)) { - httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType); - } - - // Perform the request - return new HttpRequest(this.method.toUpperCase(), url, this._bodyContent, { - params: httpParams, - headers: httpHeaders, - responseType: options.responseType, - reportProgress: options.reportProgress, - }); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/self-ref/services.ts b/tools/executors/pseudo-test/original-results.v1/self-ref/services.ts deleted file mode 100644 index e69de29..0000000 diff --git a/tools/executors/pseudo-test/original-results.v1/self-ref/strict-http-response.ts b/tools/executors/pseudo-test/original-results.v1/self-ref/strict-http-response.ts deleted file mode 100644 index aaa5dae..0000000 --- a/tools/executors/pseudo-test/original-results.v1/self-ref/strict-http-response.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpResponse } from '@angular/common/http'; - -/** - * Constrains the http response to not have the body defined as `T | null`, but `T` only. - */ -export type StrictHttpResponse = HttpResponse & { - readonly body: T; -}; diff --git a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/api-configuration.ts b/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/api-configuration.ts deleted file mode 100644 index 97cdb32..0000000 --- a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/api-configuration.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; - -/** - * Global configuration - */ -@Injectable({ - providedIn: 'root', -}) -export class ApiConfiguration { - rootUrl: string = ''; -} - -/** - * Parameters for `ApiModule.forRoot()` - */ -export interface ApiConfigurationParams { - rootUrl?: string; -} diff --git a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/api.module.ts b/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/api.module.ts deleted file mode 100644 index eaf0a5b..0000000 --- a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/api.module.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration, ApiConfigurationParams } from './api-configuration'; - -import { ApiService } from './services/api.service'; - -/** - * Module that provides all services and configuration. - */ -@NgModule({ - imports: [], - exports: [], - declarations: [], - providers: [ApiService, ApiConfiguration], -}) -export class ApiModule { - static forRoot(params: ApiConfigurationParams): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [ - { - provide: ApiConfiguration, - useValue: params, - }, - ], - }; - } - - constructor(@Optional() @SkipSelf() parentModule: ApiModule, @Optional() http: HttpClient) { - if (parentModule) { - throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); - } - if (!http) { - throw new Error( - 'You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575', - ); - } - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/base-service.ts b/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/base-service.ts deleted file mode 100644 index 545b2d6..0000000 --- a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/base-service.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { ApiConfiguration } from './api-configuration'; - -/** - * Base class for services - */ -@Injectable() -export class BaseService { - constructor(protected config: ApiConfiguration, protected http: HttpClient) {} - - private _rootUrl: string = ''; - - /** - * Returns the root url for all operations in this service. If not set directly in this - * service, will fallback to `ApiConfiguration.rootUrl`. - */ - get rootUrl(): string { - return this._rootUrl || this.config.rootUrl; - } - - /** - * Sets the root URL for API operations in this service. - */ - set rootUrl(rootUrl: string) { - this._rootUrl = rootUrl; - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/models.ts b/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/models.ts deleted file mode 100644 index e69de29..0000000 diff --git a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/request-builder.ts b/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/request-builder.ts deleted file mode 100644 index a08af28..0000000 --- a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/request-builder.ts +++ /dev/null @@ -1,369 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders } from '@angular/common/http'; - -/** - * Custom parameter codec to correctly handle the plus sign in parameter - * values. See https://github.com/angular/angular/issues/18261 - */ -class ParameterCodec implements HttpParameterCodec { - encodeKey(key: string): string { - return encodeURIComponent(key); - } - - encodeValue(value: string): string { - return encodeURIComponent(value); - } - - decodeKey(key: string): string { - return decodeURIComponent(key); - } - - decodeValue(value: string): string { - return decodeURIComponent(value); - } -} -const ParameterCodecInstance = new ParameterCodec(); - -/** - * Defines the options for appending a parameter - */ -interface ParameterOptions { - style?: string; - explode?: boolean; -} - -/** - * Base class for a parameter - */ -abstract class Parameter { - constructor( - public name: string, - public value: any, - public options: ParameterOptions, - defaultStyle: string, - defaultExplode: boolean, - ) { - this.options = options || {}; - if (this.options.style === null || this.options.style === undefined) { - this.options.style = defaultStyle; - } - if (this.options.explode === null || this.options.explode === undefined) { - this.options.explode = defaultExplode; - } - } - - serializeValue(value: any, separator = ','): string { - if (value === null || value === undefined) { - return ''; - } else if (value instanceof Array) { - return value - .map((v) => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))) - .join(separator); - } else if (typeof value === 'object') { - const array: string[] = []; - for (const key of Object.keys(value)) { - let propVal = value[key]; - if (propVal !== null && propVal !== undefined) { - propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator)); - if (this.options.explode) { - array.push(`${key}=${propVal}`); - } else { - array.push(key); - array.push(propVal); - } - } - } - return array.join(separator); - } else { - return String(value); - } - } -} - -/** - * A parameter in the operation path - */ -class PathParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(path: string): string { - let value = this.value; - if (value === null || value === undefined) { - value = ''; - } - let prefix = this.options.style === 'label' ? '.' : ''; - let separator = this.options.explode ? (prefix === '' ? ',' : prefix) : ','; - let alreadySerialized = false; - if (this.options.style === 'matrix') { - // The parameter name is just used as prefix, except in some cases... - prefix = `;${this.name}=`; - if (this.options.explode && typeof value === 'object') { - prefix = ';'; - if (value instanceof Array) { - // For arrays we have to repeat the name for each element - value = value.map((v) => `${this.name}=${this.serializeValue(v, ';')}`); - value = value.join(';'); - alreadySerialized = true; - } else { - // For objects we have to put each the key / value pairs - value = this.serializeValue(value, ';'); - alreadySerialized = true; - } - } - } - value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator)); - // Replace both the plain variable and the corresponding variant taking in the prefix and explode into account - path = path.replace(`{${this.name}}`, value); - path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value); - return path; - } - - // @ts-ignore - serializeValue(value: any, separator = ','): string { - var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); - return result; - } -} - -/** - * A parameter in the query - */ -class QueryParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'form', true); - } - - append(params: HttpParams): HttpParams { - if (this.value instanceof Array) { - // Array serialization - if (this.options.explode) { - for (const v of this.value) { - params = params.append(this.name, this.serializeValue(v)); - } - } else { - const separator = - this.options.style === 'spaceDelimited' ? ' ' : this.options.style === 'pipeDelimited' ? '|' : ','; - return params.append(this.name, this.serializeValue(this.value, separator)); - } - } else if (this.value !== null && typeof this.value === 'object') { - // Object serialization - if (this.options.style === 'deepObject') { - // Append a parameter for each key, in the form `name[key]` - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal)); - } - } - } else if (this.options.explode) { - // Append a parameter for each key without using the parameter name - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - params = params.append(key, this.serializeValue(propVal)); - } - } - } else { - // Append a single parameter whose values are a comma-separated list of key,value,key,value... - const array: any[] = []; - for (const key of Object.keys(this.value)) { - const propVal = this.value[key]; - if (propVal !== null && propVal !== undefined) { - array.push(key); - array.push(propVal); - } - } - params = params.append(this.name, this.serializeValue(array)); - } - } else if (this.value !== null && this.value !== undefined) { - // Plain value - params = params.append(this.name, this.serializeValue(this.value)); - } - return params; - } -} - -/** - * A parameter in the HTTP request header - */ -class HeaderParameter extends Parameter { - constructor(name: string, value: any, options: ParameterOptions) { - super(name, value, options, 'simple', false); - } - - append(headers: HttpHeaders): HttpHeaders { - if (this.value !== null && this.value !== undefined) { - if (this.value instanceof Array) { - for (const v of this.value) { - headers = headers.append(this.name, this.serializeValue(v)); - } - } else { - headers = headers.append(this.name, this.serializeValue(this.value)); - } - } - return headers; - } -} - -/** - * Helper to build http requests from parameters - */ -export class RequestBuilder { - private _path = new Map(); - private _query = new Map(); - private _header = new Map(); - _bodyContent: any | null; - _bodyContentType?: string; - - constructor(public rootUrl: string, public operationPath: string, public method: string) {} - - /** - * Sets a path parameter - */ - path(name: string, value: any, options?: ParameterOptions): void { - this._path.set(name, new PathParameter(name, value, options || {})); - } - - /** - * Sets a query parameter - */ - query(name: string, value: any, options?: ParameterOptions): void { - this._query.set(name, new QueryParameter(name, value, options || {})); - } - - /** - * Sets a header parameter - */ - header(name: string, value: any, options?: ParameterOptions): void { - this._header.set(name, new HeaderParameter(name, value, options || {})); - } - - /** - * Sets the body content, along with the content type - */ - body(value: any, contentType = 'application/json'): void { - if (value instanceof Blob) { - this._bodyContentType = value.type; - } else { - this._bodyContentType = contentType; - } - if ( - this._bodyContentType === 'application/x-www-form-urlencoded' && - value !== null && - typeof value === 'object' - ) { - // Handle URL-encoded data - const pairs: Array<[string, string]> = []; - for (const key of Object.keys(value)) { - let val = value[key]; - if (!(val instanceof Array)) { - val = [val]; - } - for (const v of val) { - const formValue = this.formDataValue(v); - if (formValue !== null) { - pairs.push([key, formValue]); - } - } - } - this._bodyContent = pairs.map((p) => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&'); - } else if (this._bodyContentType === 'multipart/form-data') { - // Handle multipart form data - const formData = new FormData(); - if (value !== null && value !== undefined) { - for (const key of Object.keys(value)) { - const val = value[key]; - if (val instanceof Array) { - for (const v of val) { - const toAppend = this.formDataValue(v); - if (toAppend !== null) { - formData.append(key, toAppend); - } - } - } else { - const toAppend = this.formDataValue(val); - if (toAppend !== null) { - formData.set(key, toAppend); - } - } - } - } - this._bodyContent = formData; - } else { - // The body is the plain content - this._bodyContent = value; - } - } - - private formDataValue(value: any): any { - if (value === null || value === undefined) { - return null; - } - if (value instanceof Blob) { - return value; - } - if (typeof value === 'object') { - return JSON.stringify(value); - } - return String(value); - } - - /** - * Builds the request with the current set parameters - */ - build(options?: { - /** Which content types to accept */ - accept?: string; - - /** The expected response type */ - responseType?: 'json' | 'text' | 'blob' | 'arraybuffer'; - - /** Whether to report progress on uploads / downloads */ - reportProgress?: boolean; - }): HttpRequest { - options = options || {}; - - // Path parameters - let path = this.operationPath; - for (const pathParam of this._path.values()) { - path = pathParam.append(path); - } - const url = this.rootUrl + path; - - // Query parameters - let httpParams = new HttpParams({ - encoder: ParameterCodecInstance, - }); - for (const queryParam of this._query.values()) { - httpParams = queryParam.append(httpParams); - } - - // Header parameters - let httpHeaders = new HttpHeaders(); - if (options.accept) { - httpHeaders = httpHeaders.append('Accept', options.accept); - } - for (const headerParam of this._header.values()) { - httpHeaders = headerParam.append(httpHeaders); - } - - // Request content headers - if (this._bodyContentType && !(this._bodyContent instanceof FormData)) { - httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType); - } - - // Perform the request - return new HttpRequest(this.method.toUpperCase(), url, this._bodyContent, { - params: httpParams, - headers: httpHeaders, - responseType: options.responseType, - reportProgress: options.reportProgress, - }); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/services.ts b/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/services.ts deleted file mode 100644 index 7935001..0000000 --- a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/services.ts +++ /dev/null @@ -1 +0,0 @@ -export { ApiService } from './services/api.service'; diff --git a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/services/api.service.ts b/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/services/api.service.ts deleted file mode 100644 index 89308a9..0000000 --- a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/services/api.service.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { Injectable } from '@angular/core'; -import { HttpClient, HttpResponse } from '@angular/common/http'; -import { BaseService } from '../base-service'; -import { ApiConfiguration } from '../api-configuration'; -import { StrictHttpResponse } from '../strict-http-response'; -import { RequestBuilder } from '../request-builder'; -import { Observable } from 'rxjs'; -import { map, filter } from 'rxjs/operators'; - -@Injectable({ - providedIn: 'root', -}) -export class ApiService extends BaseService { - constructor(config: ApiConfiguration, http: HttpClient) { - super(config, http); - } - - /** - * Path part for operation fooGet - */ - static readonly FooGetPath = '/foo'; - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `fooGet()` instead. - * - * This method doesn't expect any request body. - */ - fooGet$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, ApiService.FooGetPath, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'json', - accept: 'application/json', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `fooGet$Response()` instead. - * - * This method doesn't expect any request body. - */ - fooGet(params?: {}): Observable { - return this.fooGet$Response(params).pipe(map((r: StrictHttpResponse) => r.body as string)); - } - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `fooGet$Plain()` instead. - * - * This method doesn't expect any request body. - */ - fooGet$Plain$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, ApiService.FooGetPath, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: 'text/plain', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `fooGet$Plain$Response()` instead. - * - * This method doesn't expect any request body. - */ - fooGet$Plain(params?: {}): Observable { - return this.fooGet$Plain$Response(params).pipe(map((r: StrictHttpResponse) => r.body as any)); - } - - /** - * Path part for operation barGet - */ - static readonly BarGetPath = '/bar'; - - /** - * This method provides access to the full `HttpResponse`, allowing access to response headers. - * To access only the response body, use `barGet()` instead. - * - * This method doesn't expect any request body. - */ - barGet$Response(params?: {}): Observable> { - const rb = new RequestBuilder(this.rootUrl, ApiService.BarGetPath, 'get'); - if (params) { - } - - return this.http - .request( - rb.build({ - responseType: 'text', - accept: 'text/plain', - }), - ) - .pipe( - filter((r: any) => r instanceof HttpResponse), - map((r: HttpResponse) => { - return r as StrictHttpResponse; - }), - ); - } - - /** - * This method provides access to only to the response body. - * To access the full response (for headers, for example), `barGet$Response()` instead. - * - * This method doesn't expect any request body. - */ - barGet(params?: {}): Observable { - return this.barGet$Response(params).pipe(map((r: StrictHttpResponse) => r.body as any)); - } -} diff --git a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/strict-http-response.ts b/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/strict-http-response.ts deleted file mode 100644 index aaa5dae..0000000 --- a/tools/executors/pseudo-test/original-results.v1/skipJsonSuffix/strict-http-response.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -import { HttpResponse } from '@angular/common/http'; - -/** - * Constrains the http response to not have the body defined as `T | null`, but `T` only. - */ -export type StrictHttpResponse = HttpResponse & { - readonly body: T; -}; diff --git a/tools/executors/pseudo-test/original-results/all-operations/request-builder.ts b/tools/executors/pseudo-test/original-results/all-operations/request-builder.ts index f1d700f..e6c1199 100644 --- a/tools/executors/pseudo-test/original-results/all-operations/request-builder.ts +++ b/tools/executors/pseudo-test/original-results/all-operations/request-builder.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse, HttpContext } from '@angular/common/http'; /** Constrains the HTTP response body to be non-null */ export type StrictHttpResponse = HttpResponse & { readonly body: T }; @@ -128,9 +128,9 @@ class PathParameter extends Parameter { // @ts-ignore serializeValue(value: any, separator = ','): string { var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); + result = result.replace(/%3D/g, '='); + result = result.replace(/%3B/g, ';'); + result = result.replace(/%2C/g, ','); return result; } } @@ -314,6 +314,9 @@ export class RequestBuilder { /** Whether to report progress on uploads / downloads */ reportProgress?: boolean; + + /** Allow passing HttpContext for HttpClient */ + context?: HttpContext; }): HttpRequest { options = options || {}; @@ -352,6 +355,7 @@ export class RequestBuilder { headers: httpHeaders, responseType: options.responseType, reportProgress: options.reportProgress, + context: options.context, }); } } diff --git a/tools/executors/pseudo-test/original-results/all-operations/services/no-tag.service.ts b/tools/executors/pseudo-test/original-results/all-operations/services/no-tag.service.ts index efb5605..d56e3d3 100644 --- a/tools/executors/pseudo-test/original-results/all-operations/services/no-tag.service.ts +++ b/tools/executors/pseudo-test/original-results/all-operations/services/no-tag.service.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpClient, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; @@ -37,7 +37,8 @@ export class NoTagService { */ public path3Del$Response(params: { id: number; - }): Observable>> { + }, + context?: HttpContext): Observable>> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path3DelPath, 'delete'); if (params) { @@ -47,6 +48,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'json', accept: 'application/*+json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -65,8 +67,9 @@ export class NoTagService { */ public path3Del(params: { id: number; - }): Observable> { - return this.path3Del$Response(params).pipe( + }, + context?: HttpContext): Observable> { + return this.path3Del$Response(params, context).pipe( map((r: StrictHttpResponse>) => r.body as Array), ); } @@ -82,7 +85,8 @@ export class NoTagService { */ public path4Put$Json$Plain$Response(params?: { body?: RefObject; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); if (params) { @@ -92,6 +96,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'text', accept: 'text/plain', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -108,8 +113,9 @@ export class NoTagService { */ public path4Put$Json$Plain(params?: { body?: RefObject; - }): Observable { - return this.path4Put$Json$Plain$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path4Put$Json$Plain$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as string), ); } @@ -122,7 +128,8 @@ export class NoTagService { */ public path4Put$Json$Binary$Response(params?: { body?: RefObject; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); if (params) { @@ -132,6 +139,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'blob', accept: 'text/binary', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -148,8 +156,9 @@ export class NoTagService { */ public path4Put$Json$Binary(params?: { body?: RefObject; - }): Observable { - return this.path4Put$Json$Binary$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path4Put$Json$Binary$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Blob), ); } @@ -162,7 +171,8 @@ export class NoTagService { */ public path4Put$Json$Image$Response(params?: { body?: RefObject; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); if (params) { @@ -172,6 +182,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'blob', accept: 'image/*', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -188,8 +199,9 @@ export class NoTagService { */ public path4Put$Json$Image(params?: { body?: RefObject; - }): Observable { - return this.path4Put$Json$Image$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path4Put$Json$Image$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Blob), ); } @@ -202,7 +214,8 @@ export class NoTagService { */ public path4Put$Plain$Plain$Response(params?: { body?: string; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); if (params) { @@ -212,6 +225,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'text', accept: 'text/plain', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -228,8 +242,9 @@ export class NoTagService { */ public path4Put$Plain$Plain(params?: { body?: string; - }): Observable { - return this.path4Put$Plain$Plain$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path4Put$Plain$Plain$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as string), ); } @@ -242,7 +257,8 @@ export class NoTagService { */ public path4Put$Plain$Binary$Response(params?: { body?: string; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); if (params) { @@ -252,6 +268,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'blob', accept: 'text/binary', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -268,8 +285,9 @@ export class NoTagService { */ public path4Put$Plain$Binary(params?: { body?: string; - }): Observable { - return this.path4Put$Plain$Binary$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path4Put$Plain$Binary$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Blob), ); } @@ -282,7 +300,8 @@ export class NoTagService { */ public path4Put$Plain$Image$Response(params?: { body?: string; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); if (params) { @@ -292,6 +311,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'blob', accept: 'image/*', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -308,8 +328,9 @@ export class NoTagService { */ public path4Put$Plain$Image(params?: { body?: string; - }): Observable { - return this.path4Put$Plain$Image$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path4Put$Plain$Image$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Blob), ); } @@ -322,7 +343,8 @@ export class NoTagService { */ public path4Put$Any$Plain$Response(params?: { body?: Blob; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); if (params) { @@ -332,6 +354,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'text', accept: 'text/plain', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -348,8 +371,9 @@ export class NoTagService { */ public path4Put$Any$Plain(params?: { body?: Blob; - }): Observable { - return this.path4Put$Any$Plain$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path4Put$Any$Plain$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as string), ); } @@ -362,7 +386,8 @@ export class NoTagService { */ public path4Put$Any$Binary$Response(params?: { body?: Blob; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); if (params) { @@ -372,6 +397,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'blob', accept: 'text/binary', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -388,8 +414,9 @@ export class NoTagService { */ public path4Put$Any$Binary(params?: { body?: Blob; - }): Observable { - return this.path4Put$Any$Binary$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path4Put$Any$Binary$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Blob), ); } @@ -402,7 +429,8 @@ export class NoTagService { */ public path4Put$Any$Image$Response(params?: { body?: Blob; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path4PutPath, 'put'); if (params) { @@ -412,6 +440,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'blob', accept: 'image/*', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -428,8 +457,9 @@ export class NoTagService { */ public path4Put$Any$Image(params?: { body?: Blob; - }): Observable { - return this.path4Put$Any$Image$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path4Put$Any$Image$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Blob), ); } @@ -444,7 +474,8 @@ export class NoTagService { * This method doesn't expect any request body. */ public withQuotes$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.PathWithQuotesGetPath, 'get'); if (params) { @@ -453,6 +484,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'text', accept: 'text/plain', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -468,8 +500,9 @@ export class NoTagService { * This method doesn't expect any request body. */ public withQuotes(params?: { - }): Observable { - return this.withQuotes$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.withQuotes$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as string), ); } @@ -486,7 +519,8 @@ export class NoTagService { * This method doesn't expect any request body. */ public path6Get$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, NoTagService.Path6GetPath, 'get'); if (params) { @@ -495,6 +529,7 @@ export class NoTagService { return this.http.request(rb.build({ responseType: 'blob', accept: '*/*', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -512,8 +547,9 @@ export class NoTagService { * This method doesn't expect any request body. */ public path6Get(params?: { - }): Observable { - return this.path6Get$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path6Get$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Blob), ); } diff --git a/tools/executors/pseudo-test/original-results/all-operations/services/tag-1.service.ts b/tools/executors/pseudo-test/original-results/all-operations/services/tag-1.service.ts index f916bf0..258e2b3 100644 --- a/tools/executors/pseudo-test/original-results/all-operations/services/tag-1.service.ts +++ b/tools/executors/pseudo-test/original-results/all-operations/services/tag-1.service.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpClient, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; @@ -86,7 +86,8 @@ export class Tag1Service { * Should be escaped */ 'a-b'?: string; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, Tag1Service.Path1GetPath, 'get'); if (params) { @@ -104,6 +105,7 @@ export class Tag1Service { return this.http.request(rb.build({ responseType: 'json', accept: 'text/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -166,8 +168,9 @@ export class Tag1Service { * Should be escaped */ 'a-b'?: string; - }): Observable { - return this.path1Get$Json$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path1Get$Json$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as RefObject), ); } @@ -226,7 +229,8 @@ export class Tag1Service { * Should be escaped */ 'a-b'?: string; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, Tag1Service.Path1GetPath, 'get'); if (params) { @@ -244,6 +248,7 @@ export class Tag1Service { return this.http.request(rb.build({ responseType: 'blob', accept: 'image/*', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -306,8 +311,9 @@ export class Tag1Service { * Should be escaped */ 'a-b'?: string; - }): Observable { - return this.path1Get$Image$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path1Get$Image$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Blob), ); } @@ -335,7 +341,8 @@ export class Tag1Service { * Header param */ param2?: string; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, Tag1Service.Path2GetPath, 'get'); if (params) { @@ -347,6 +354,7 @@ export class Tag1Service { return this.http.request(rb.build({ responseType: 'text', accept: '*/*', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -375,8 +383,9 @@ export class Tag1Service { * Header param */ param2?: string; - }): Observable { - return this.path2Get$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path2Get$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as void), ); } diff --git a/tools/executors/pseudo-test/original-results/all-operations/services/tag-2.service.ts b/tools/executors/pseudo-test/original-results/all-operations/services/tag-2.service.ts index 21d7c4b..5fc86e5 100644 --- a/tools/executors/pseudo-test/original-results/all-operations/services/tag-2.service.ts +++ b/tools/executors/pseudo-test/original-results/all-operations/services/tag-2.service.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpClient, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; @@ -53,7 +53,8 @@ export class Tag2Service { */ post1?: number; body: RefObject; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, Tag2Service.Path1PostPath, 'post'); if (params) { @@ -66,6 +67,7 @@ export class Tag2Service { return this.http.request(rb.build({ responseType: 'text', accept: '*/*', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -99,8 +101,9 @@ export class Tag2Service { */ post1?: number; body: RefObject; - }): Observable { - return this.path1Post$Json$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path1Post$Json$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as void), ); } @@ -130,7 +133,8 @@ export class Tag2Service { */ post1?: number; body: string; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, Tag2Service.Path1PostPath, 'post'); if (params) { @@ -143,6 +147,7 @@ export class Tag2Service { return this.http.request(rb.build({ responseType: 'text', accept: '*/*', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -176,8 +181,9 @@ export class Tag2Service { */ post1?: number; body: string; - }): Observable { - return this.path1Post$Plain$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.path1Post$Plain$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as void), ); } diff --git a/tools/executors/pseudo-test/original-results/all-operations/services/tag/tag2/tag3/tag4/tag-tag-2-tag-3-tag-4-tag-5.service.ts b/tools/executors/pseudo-test/original-results/all-operations/services/tag/tag2/tag3/tag4/tag-tag-2-tag-3-tag-4-tag-5.service.ts index ee86892..5f374a6 100644 --- a/tools/executors/pseudo-test/original-results/all-operations/services/tag/tag2/tag3/tag4/tag-tag-2-tag-3-tag-4-tag-5.service.ts +++ b/tools/executors/pseudo-test/original-results/all-operations/services/tag/tag2/tag3/tag4/tag-tag-2-tag-3-tag-4-tag-5.service.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpClient, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; @@ -35,7 +35,8 @@ export class TagTag2Tag3Tag4Tag5Service { * This method doesn't expect any request body. */ public path5Get$Response(params?: { - }): Observable> { const rb = new RequestBuilder(this.rootUrl, TagTag2Tag3Tag4Tag5Service.Path5GetPath, 'get'); @@ -45,6 +46,7 @@ export class TagTag2Tag3Tag4Tag5Service { return this.http.request(rb.build({ responseType: 'json', accept: 'application/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -63,9 +65,10 @@ export class TagTag2Tag3Tag4Tag5Service { * This method doesn't expect any request body. */ public path5Get(params?: { - }): Observable<{ + }, + context?: HttpContext): Observable<{ }> { - return this.path5Get$Response(params).pipe( + return this.path5Get$Response(params, context).pipe( map((r: StrictHttpResponse<{ }>) => r.body as { }), diff --git a/tools/executors/pseudo-test/original-results/all-types/request-builder.ts b/tools/executors/pseudo-test/original-results/all-types/request-builder.ts index f1d700f..e6c1199 100644 --- a/tools/executors/pseudo-test/original-results/all-types/request-builder.ts +++ b/tools/executors/pseudo-test/original-results/all-types/request-builder.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse, HttpContext } from '@angular/common/http'; /** Constrains the HTTP response body to be non-null */ export type StrictHttpResponse = HttpResponse & { readonly body: T }; @@ -128,9 +128,9 @@ class PathParameter extends Parameter { // @ts-ignore serializeValue(value: any, separator = ','): string { var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); + result = result.replace(/%3D/g, '='); + result = result.replace(/%3B/g, ';'); + result = result.replace(/%2C/g, ','); return result; } } @@ -314,6 +314,9 @@ export class RequestBuilder { /** Whether to report progress on uploads / downloads */ reportProgress?: boolean; + + /** Allow passing HttpContext for HttpClient */ + context?: HttpContext; }): HttpRequest { options = options || {}; @@ -352,6 +355,7 @@ export class RequestBuilder { headers: httpHeaders, responseType: options.responseType, reportProgress: options.reportProgress, + context: options.context, }); } } diff --git a/tools/executors/pseudo-test/original-results/all-types/services/api.service.ts b/tools/executors/pseudo-test/original-results/all-types/services/api.service.ts index dd4cd71..f8afbbb 100644 --- a/tools/executors/pseudo-test/original-results/all-types/services/api.service.ts +++ b/tools/executors/pseudo-test/original-results/all-types/services/api.service.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpClient, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; @@ -44,7 +44,8 @@ export class ApiService { * This method doesn't expect any request body. */ public fooGet$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, ApiService.FooGetPath, 'get'); if (params) { @@ -53,6 +54,7 @@ export class ApiService { return this.http.request(rb.build({ responseType: 'json', accept: 'application/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -68,8 +70,9 @@ export class ApiService { * This method doesn't expect any request body. */ public fooGet(params?: { - }): Observable { - return this.fooGet$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.fooGet$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Containers), ); } @@ -85,7 +88,8 @@ export class ApiService { */ public barGet$Response(params?: { param?: (ReferencedInParamOneOf1 | ReferencedInParamOneOf2 | RefObject | AdditionalProperties | Nullables | InlineObject | AuditCdr); - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, ApiService.BarGetPath, 'get'); if (params) { @@ -95,6 +99,7 @@ export class ApiService { return this.http.request(rb.build({ responseType: 'json', accept: 'application/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -111,8 +116,9 @@ export class ApiService { */ public barGet(params?: { param?: (ReferencedInParamOneOf1 | ReferencedInParamOneOf2 | RefObject | AdditionalProperties | Nullables | InlineObject | AuditCdr); - }): Observable<(ReferencedInServiceOneOf1 | ReferencedInServiceOneOf2)> { - return this.barGet$Response(params).pipe( + }, + context?: HttpContext): Observable<(ReferencedInServiceOneOf1 | ReferencedInServiceOneOf2)> { + return this.barGet$Response(params, context).pipe( map((r: StrictHttpResponse<(ReferencedInServiceOneOf1 | ReferencedInServiceOneOf2)>) => r.body as (ReferencedInServiceOneOf1 | ReferencedInServiceOneOf2)), ); } @@ -127,7 +133,8 @@ export class ApiService { * This method doesn't expect any request body. */ public bazGet$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, ApiService.BazGetPath, 'get'); if (params) { @@ -136,6 +143,7 @@ export class ApiService { return this.http.request(rb.build({ responseType: 'json', accept: 'application/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -151,8 +159,9 @@ export class ApiService { * This method doesn't expect any request body. */ public bazGet(params?: { - }): Observable { - return this.bazGet$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.bazGet$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as Disjunct), ); } diff --git a/tools/executors/pseudo-test/original-results/default-success-response/request-builder.ts b/tools/executors/pseudo-test/original-results/default-success-response/request-builder.ts index f1d700f..e6c1199 100644 --- a/tools/executors/pseudo-test/original-results/default-success-response/request-builder.ts +++ b/tools/executors/pseudo-test/original-results/default-success-response/request-builder.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse, HttpContext } from '@angular/common/http'; /** Constrains the HTTP response body to be non-null */ export type StrictHttpResponse = HttpResponse & { readonly body: T }; @@ -128,9 +128,9 @@ class PathParameter extends Parameter { // @ts-ignore serializeValue(value: any, separator = ','): string { var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); + result = result.replace(/%3D/g, '='); + result = result.replace(/%3B/g, ';'); + result = result.replace(/%2C/g, ','); return result; } } @@ -314,6 +314,9 @@ export class RequestBuilder { /** Whether to report progress on uploads / downloads */ reportProgress?: boolean; + + /** Allow passing HttpContext for HttpClient */ + context?: HttpContext; }): HttpRequest { options = options || {}; @@ -352,6 +355,7 @@ export class RequestBuilder { headers: httpHeaders, responseType: options.responseType, reportProgress: options.reportProgress, + context: options.context, }); } } diff --git a/tools/executors/pseudo-test/original-results/default-success-response/services/api.service.ts b/tools/executors/pseudo-test/original-results/default-success-response/services/api.service.ts index 0f29ef5..fc06bb9 100644 --- a/tools/executors/pseudo-test/original-results/default-success-response/services/api.service.ts +++ b/tools/executors/pseudo-test/original-results/default-success-response/services/api.service.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpClient, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; @@ -35,7 +35,8 @@ export class ApiService { * This method doesn't expect any request body. */ public getPath1$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, ApiService.GetPath1Path, 'get'); if (params) { @@ -44,6 +45,7 @@ export class ApiService { return this.http.request(rb.build({ responseType: 'json', accept: 'application/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -61,8 +63,9 @@ export class ApiService { * This method doesn't expect any request body. */ public getPath1(params?: { - }): Observable { - return this.getPath1$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.getPath1$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as string), ); } @@ -79,7 +82,8 @@ export class ApiService { * This method doesn't expect any request body. */ public getPath2$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, ApiService.GetPath2Path, 'get'); if (params) { @@ -88,6 +92,7 @@ export class ApiService { return this.http.request(rb.build({ responseType: 'json', accept: 'application/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -105,8 +110,9 @@ export class ApiService { * This method doesn't expect any request body. */ public getPath2(params?: { - }): Observable { - return this.getPath2$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.getPath2$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as number), ); } diff --git a/tools/executors/pseudo-test/original-results/person-place/request-builder.ts b/tools/executors/pseudo-test/original-results/person-place/request-builder.ts index f1d700f..e6c1199 100644 --- a/tools/executors/pseudo-test/original-results/person-place/request-builder.ts +++ b/tools/executors/pseudo-test/original-results/person-place/request-builder.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse, HttpContext } from '@angular/common/http'; /** Constrains the HTTP response body to be non-null */ export type StrictHttpResponse = HttpResponse & { readonly body: T }; @@ -128,9 +128,9 @@ class PathParameter extends Parameter { // @ts-ignore serializeValue(value: any, separator = ','): string { var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); + result = result.replace(/%3D/g, '='); + result = result.replace(/%3B/g, ';'); + result = result.replace(/%2C/g, ','); return result; } } @@ -314,6 +314,9 @@ export class RequestBuilder { /** Whether to report progress on uploads / downloads */ reportProgress?: boolean; + + /** Allow passing HttpContext for HttpClient */ + context?: HttpContext; }): HttpRequest { options = options || {}; @@ -352,6 +355,7 @@ export class RequestBuilder { headers: httpHeaders, responseType: options.responseType, reportProgress: options.reportProgress, + context: options.context, }); } } diff --git a/tools/executors/pseudo-test/original-results/petstore/request-builder.ts b/tools/executors/pseudo-test/original-results/petstore/request-builder.ts index f1d700f..e6c1199 100644 --- a/tools/executors/pseudo-test/original-results/petstore/request-builder.ts +++ b/tools/executors/pseudo-test/original-results/petstore/request-builder.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse, HttpContext } from '@angular/common/http'; /** Constrains the HTTP response body to be non-null */ export type StrictHttpResponse = HttpResponse & { readonly body: T }; @@ -128,9 +128,9 @@ class PathParameter extends Parameter { // @ts-ignore serializeValue(value: any, separator = ','): string { var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); + result = result.replace(/%3D/g, '='); + result = result.replace(/%3B/g, ';'); + result = result.replace(/%2C/g, ','); return result; } } @@ -314,6 +314,9 @@ export class RequestBuilder { /** Whether to report progress on uploads / downloads */ reportProgress?: boolean; + + /** Allow passing HttpContext for HttpClient */ + context?: HttpContext; }): HttpRequest { options = options || {}; @@ -352,6 +355,7 @@ export class RequestBuilder { headers: httpHeaders, responseType: options.responseType, reportProgress: options.reportProgress, + context: options.context, }); } } diff --git a/tools/executors/pseudo-test/original-results/petstore/services/pets.service.ts b/tools/executors/pseudo-test/original-results/petstore/services/pets.service.ts index f60bb43..d5c0fa0 100644 --- a/tools/executors/pseudo-test/original-results/petstore/services/pets.service.ts +++ b/tools/executors/pseudo-test/original-results/petstore/services/pets.service.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpClient, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; @@ -41,7 +41,8 @@ export class PetsService { * How many items to return at one time (max 100) */ limit?: number; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, PetsService.ListPetsPath, 'get'); if (params) { @@ -51,6 +52,7 @@ export class PetsService { return this.http.request(rb.build({ responseType: 'json', accept: 'application/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -73,8 +75,9 @@ export class PetsService { * How many items to return at one time (max 100) */ limit?: number; - }): Observable { - return this.listPets$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.listPets$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as PetstorePetsModel), ); } @@ -91,7 +94,8 @@ export class PetsService { * This method doesn't expect any request body. */ public createPets$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, PetsService.CreatePetsPath, 'post'); if (params) { @@ -100,6 +104,7 @@ export class PetsService { return this.http.request(rb.build({ responseType: 'text', accept: '*/*', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -117,8 +122,9 @@ export class PetsService { * This method doesn't expect any request body. */ public createPets(params?: { - }): Observable { - return this.createPets$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.createPets$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as void), ); } @@ -140,7 +146,8 @@ export class PetsService { * The id of the pet to retrieve */ petId: string; - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, PetsService.ShowPetByIdPath, 'get'); if (params) { @@ -150,6 +157,7 @@ export class PetsService { return this.http.request(rb.build({ responseType: 'json', accept: 'application/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -172,8 +180,9 @@ export class PetsService { * The id of the pet to retrieve */ petId: string; - }): Observable { - return this.showPetById$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.showPetById$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as PetstorePetsModel), ); } diff --git a/tools/executors/pseudo-test/original-results/polymorphic/request-builder.ts b/tools/executors/pseudo-test/original-results/polymorphic/request-builder.ts index f1d700f..e6c1199 100644 --- a/tools/executors/pseudo-test/original-results/polymorphic/request-builder.ts +++ b/tools/executors/pseudo-test/original-results/polymorphic/request-builder.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse, HttpContext } from '@angular/common/http'; /** Constrains the HTTP response body to be non-null */ export type StrictHttpResponse = HttpResponse & { readonly body: T }; @@ -128,9 +128,9 @@ class PathParameter extends Parameter { // @ts-ignore serializeValue(value: any, separator = ','): string { var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); + result = result.replace(/%3D/g, '='); + result = result.replace(/%3B/g, ';'); + result = result.replace(/%2C/g, ','); return result; } } @@ -314,6 +314,9 @@ export class RequestBuilder { /** Whether to report progress on uploads / downloads */ reportProgress?: boolean; + + /** Allow passing HttpContext for HttpClient */ + context?: HttpContext; }): HttpRequest { options = options || {}; @@ -352,6 +355,7 @@ export class RequestBuilder { headers: httpHeaders, responseType: options.responseType, reportProgress: options.reportProgress, + context: options.context, }); } } diff --git a/tools/executors/pseudo-test/original-results/self-ref/request-builder.ts b/tools/executors/pseudo-test/original-results/self-ref/request-builder.ts index f1d700f..e6c1199 100644 --- a/tools/executors/pseudo-test/original-results/self-ref/request-builder.ts +++ b/tools/executors/pseudo-test/original-results/self-ref/request-builder.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse, HttpContext } from '@angular/common/http'; /** Constrains the HTTP response body to be non-null */ export type StrictHttpResponse = HttpResponse & { readonly body: T }; @@ -128,9 +128,9 @@ class PathParameter extends Parameter { // @ts-ignore serializeValue(value: any, separator = ','): string { var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); + result = result.replace(/%3D/g, '='); + result = result.replace(/%3B/g, ';'); + result = result.replace(/%2C/g, ','); return result; } } @@ -314,6 +314,9 @@ export class RequestBuilder { /** Whether to report progress on uploads / downloads */ reportProgress?: boolean; + + /** Allow passing HttpContext for HttpClient */ + context?: HttpContext; }): HttpRequest { options = options || {}; @@ -352,6 +355,7 @@ export class RequestBuilder { headers: httpHeaders, responseType: options.responseType, reportProgress: options.reportProgress, + context: options.context, }); } } diff --git a/tools/executors/pseudo-test/original-results/skipJsonSuffix/request-builder.ts b/tools/executors/pseudo-test/original-results/skipJsonSuffix/request-builder.ts index f1d700f..e6c1199 100644 --- a/tools/executors/pseudo-test/original-results/skipJsonSuffix/request-builder.ts +++ b/tools/executors/pseudo-test/original-results/skipJsonSuffix/request-builder.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpParameterCodec, HttpParams, HttpRequest, HttpResponse, HttpContext } from '@angular/common/http'; /** Constrains the HTTP response body to be non-null */ export type StrictHttpResponse = HttpResponse & { readonly body: T }; @@ -128,9 +128,9 @@ class PathParameter extends Parameter { // @ts-ignore serializeValue(value: any, separator = ','): string { var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator); - result = result.replace('%3D', '='); - result = result.replace('%3B', ';'); - result = result.replace('%2C', ','); + result = result.replace(/%3D/g, '='); + result = result.replace(/%3B/g, ';'); + result = result.replace(/%2C/g, ','); return result; } } @@ -314,6 +314,9 @@ export class RequestBuilder { /** Whether to report progress on uploads / downloads */ reportProgress?: boolean; + + /** Allow passing HttpContext for HttpClient */ + context?: HttpContext; }): HttpRequest { options = options || {}; @@ -352,6 +355,7 @@ export class RequestBuilder { headers: httpHeaders, responseType: options.responseType, reportProgress: options.reportProgress, + context: options.context, }); } } diff --git a/tools/executors/pseudo-test/original-results/skipJsonSuffix/services/api.service.ts b/tools/executors/pseudo-test/original-results/skipJsonSuffix/services/api.service.ts index e37e3f4..6f3e6a4 100644 --- a/tools/executors/pseudo-test/original-results/skipJsonSuffix/services/api.service.ts +++ b/tools/executors/pseudo-test/original-results/skipJsonSuffix/services/api.service.ts @@ -7,7 +7,7 @@ * To update this file run the generation tool. */ -import { HttpClient, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse, HttpContext } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map } from 'rxjs/operators'; @@ -33,7 +33,8 @@ export class ApiService { * This method doesn't expect any request body. */ public fooGet$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, ApiService.FooGetPath, 'get'); if (params) { @@ -42,6 +43,7 @@ export class ApiService { return this.http.request(rb.build({ responseType: 'json', accept: 'application/json', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -57,8 +59,9 @@ export class ApiService { * This method doesn't expect any request body. */ public fooGet(params?: { - }): Observable { - return this.fooGet$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.fooGet$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as string), ); } @@ -70,7 +73,8 @@ export class ApiService { * This method doesn't expect any request body. */ public fooGet$Plain$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, ApiService.FooGetPath, 'get'); if (params) { @@ -79,6 +83,7 @@ export class ApiService { return this.http.request(rb.build({ responseType: 'text', accept: 'text/plain', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -94,8 +99,9 @@ export class ApiService { * This method doesn't expect any request body. */ public fooGet$Plain(params?: { - }): Observable { - return this.fooGet$Plain$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.fooGet$Plain$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as any), ); } @@ -110,7 +116,8 @@ export class ApiService { * This method doesn't expect any request body. */ public barGet$Response(params?: { - }): Observable> { + }, + context?: HttpContext): Observable> { const rb = new RequestBuilder(this.rootUrl, ApiService.BarGetPath, 'get'); if (params) { @@ -119,6 +126,7 @@ export class ApiService { return this.http.request(rb.build({ responseType: 'text', accept: 'text/plain', + context: context, })).pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => @@ -134,8 +142,9 @@ export class ApiService { * This method doesn't expect any request body. */ public barGet(params?: { - }): Observable { - return this.barGet$Response(params).pipe( + }, + context?: HttpContext): Observable { + return this.barGet$Response(params, context).pipe( map((r: StrictHttpResponse) => r.body as any), ); } diff --git a/tools/executors/schema-generator/types/prop-for-json.ts b/tools/executors/schema-generator/types/prop-for-json.ts index e001a5a..6f8ae3a 100644 --- a/tools/executors/schema-generator/types/prop-for-json.ts +++ b/tools/executors/schema-generator/types/prop-for-json.ts @@ -7,7 +7,10 @@ export class PropForJson { public defaultValueForDescription: unknown; public description: string; - constructor(public name: string, public prop: Property) { + constructor( + public name: string, + public prop: Property, + ) { this.defaultValueForSchema = this.getDefaultValueForSchema(); this.defaultValueForDescription = this.getDefaultValueForDescription(); this.description = this.getDescription(); diff --git a/tools/executors/schema-generator/types/prop-for-model.ts b/tools/executors/schema-generator/types/prop-for-model.ts index cc4fb90..7289d91 100644 --- a/tools/executors/schema-generator/types/prop-for-model.ts +++ b/tools/executors/schema-generator/types/prop-for-model.ts @@ -6,7 +6,10 @@ export class PropForModel { public typeDef: string; public comment: string; - constructor(public name: string, public prop: Property) { + constructor( + public name: string, + public prop: Property, + ) { this.defaulted = this.prop.default !== undefined; this.defaultValue = this.getDefaultValue(); this.typeDef = this.getTypeDef(this.name, this.prop);