diff --git a/src/app/openApis/geographicSiteManagement/api-configuration.ts b/src/app/openApis/geographicSiteManagement/api-configuration.ts index 63c5fb5cca33a3763469fbb21e7bf57b3af02f07..7072a70cefac64949083a6fbdce4b8fab0ccd35a 100644 --- a/src/app/openApis/geographicSiteManagement/api-configuration.ts +++ b/src/app/openApis/geographicSiteManagement/api-configuration.ts @@ -1,171 +1,186 @@ import { HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; +import { Injectable, Inject } from '@angular/core'; -export interface ConfigurationParameters { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Override the default method for encoding path parameters in various - * <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>. - * <p> - * See {@link README.md} for more details - * </p> - */ - encodeParam?: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials?: {[ key: string ]: string | (() => string | undefined)}; -} - -export class Configuration { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Encoding of various path parameter - * <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>. - * <p> - * See {@link README.md} for more details - * </p> - */ - encodeParam: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials: {[ key: string ]: string | (() => string | undefined)}; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - this.withCredentials = configurationParameters.withCredentials; - this.encoder = configurationParameters.encoder; - if (configurationParameters.encodeParam) { - this.encodeParam = configurationParameters.encodeParam; - } - else { - this.encodeParam = param => this.defaultEncodeParam(param); - } - if (configurationParameters.credentials) { - this.credentials = configurationParameters.credentials; - } - else { - this.credentials = {}; - } - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or <code>undefined</code> if no selection could be made. - */ - public selectHeaderContentType (contentTypes: string[]): string | undefined { - if (contentTypes.length === 0) { - return undefined; - } - - const type = contentTypes.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } - - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or <code>undefined</code> if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length === 0) { - return undefined; - } - const type = accepts.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; - } - return type; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } - - public lookupCredential(key: string): string | undefined { - const value = this.credentials[key]; - return typeof value === 'function' - ? value() - : value; - } - - private defaultEncodeParam(param: Param): string { - // This implementation exists as fallback for missing configuration - // and for backwards compatibility to older typescript-angular generator versions. - // It only works for the 'simple' parameter style. - // Date-handling only works for the 'date-time' format. - // All other styles and Date-formats are probably handled incorrectly. - // - // But: if that's all you need (i.e.: the most common use-case): no need for customization! - - const value = param.dataFormat === 'date-time' && param.value instanceof Date - ? (param.value as Date).toISOString() - : param.value; - - return encodeURIComponent(String(value)); - } +// export interface ConfigurationParameters { +// /** +// * @deprecated Since 5.0. Use credentials instead +// */ +// apiKeys?: {[ key: string ]: string}; +// username?: string; +// password?: string; +// /** +// * @deprecated Since 5.0. Use credentials instead +// */ +// accessToken?: string | (() => string); +// basePath?: string; +// withCredentials?: boolean; +// /** +// * Takes care of encoding query- and form-parameters. +// */ +// encoder?: HttpParameterCodec; +// /** +// * Override the default method for encoding path parameters in various +// * <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>. +// * <p> +// * See {@link README.md} for more details +// * </p> +// */ +// encodeParam?: (param: Param) => string; +// /** +// * The keys are the names in the securitySchemes section of the OpenAPI +// * document. They should map to the value used for authentication +// * minus any standard prefixes such as 'Basic' or 'Bearer'. +// */ +// credentials?: {[ key: string ]: string | (() => string | undefined)}; +// } +// +// @Injectable({ +// providedIn: 'root', +// }) +// export class ApiConfiguration { +// /** +// * @deprecated Since 5.0. Use credentials instead +// */ +// apiKeys?: {[ key: string ]: string}; +// username?: string; +// password?: string; +// /** +// * @deprecated Since 5.0. Use credentials instead +// */ +// accessToken?: string | (() => string); +// basePath?: string; +// withCredentials?: boolean; +// /** +// * Takes care of encoding query- and form-parameters. +// */ +// encoder?: HttpParameterCodec; +// /** +// * Encoding of various path parameter +// * <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>. +// * <p> +// * See {@link README.md} for more details +// * </p> +// */ +// encodeParam: (param: Param) => string; +// /** +// * The keys are the names in the securitySchemes section of the OpenAPI +// * document. They should map to the value used for authentication +// * minus any standard prefixes such as 'Basic' or 'Bearer'. +// */ +// credentials: {[ key: string ]: string | (() => string | undefined)}; +// +// constructor(configurationParameters: ConfigurationParameters = {}) { +// this.apiKeys = configurationParameters.apiKeys; +// this.username = configurationParameters.username; +// this.password = configurationParameters.password; +// this.accessToken = configurationParameters.accessToken; +// this.basePath = configurationParameters.basePath; +// this.withCredentials = configurationParameters.withCredentials; +// this.encoder = configurationParameters.encoder; +// if (configurationParameters.encodeParam) { +// this.encodeParam = configurationParameters.encodeParam; +// } +// else { +// this.encodeParam = param => this.defaultEncodeParam(param); +// } +// if (configurationParameters.credentials) { +// this.credentials = configurationParameters.credentials; +// } +// else { +// this.credentials = {}; +// } +// } +// +// /** +// * Select the correct content-type to use for a request. +// * Uses {@link Configuration#isJsonMime} to determine the correct content-type. +// * If no content type is found return the first found type if the contentTypes is not empty +// * @param contentTypes - the array of content types that are available for selection +// * @returns the selected content-type or <code>undefined</code> if no selection could be made. +// */ +// public selectHeaderContentType (contentTypes: string[]): string | undefined { +// if (contentTypes.length === 0) { +// return undefined; +// } +// +// const type = contentTypes.find((x: string) => this.isJsonMime(x)); +// if (type === undefined) { +// return contentTypes[0]; +// } +// return type; +// } +// +// /** +// * Select the correct accept content-type to use for a request. +// * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. +// * If no content type is found return the first found type if the contentTypes is not empty +// * @param accepts - the array of content types that are available for selection. +// * @returns the selected content-type or <code>undefined</code> if no selection could be made. +// */ +// public selectHeaderAccept(accepts: string[]): string | undefined { +// if (accepts.length === 0) { +// return undefined; +// } +// +// const type = accepts.find((x: string) => this.isJsonMime(x)); +// if (type === undefined) { +// return accepts[0]; +// } +// return type; +// } +// +// /** +// * Check if the given MIME is a JSON MIME. +// * JSON MIME examples: +// * application/json +// * application/json; charset=UTF8 +// * APPLICATION/JSON +// * application/vnd.company+json +// * @param mime - MIME (Multipurpose Internet Mail Extensions) +// * @return True if the given MIME is JSON, false otherwise. +// */ +// public isJsonMime(mime: string): boolean { +// const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); +// return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); +// } +// +// public lookupCredential(key: string): string | undefined { +// const value = this.credentials[key]; +// return typeof value === 'function' +// ? value() +// : value; +// } +// +// private defaultEncodeParam(param: Param): string { +// // This implementation exists as fallback for missing configuration +// // and for backwards compatibility to older typescript-angular generator versions. +// // It only works for the 'simple' parameter style. +// // Date-handling only works for the 'date-time' format. +// // All other styles and Date-formats are probably handled incorrectly. +// // +// // But: if that's all you need (i.e.: the most common use-case): no need for customization! +// +// const value = param.dataFormat === 'date-time' && param.value instanceof Date +// ? (param.value as Date).toISOString() +// : param.value; +// +// return encodeURIComponent(String(value)); +// } +// +// } + // export class ApiConfiguration { + // rootUrl: string = '//portal.openslice.io/osapi'; + // } +@Injectable({ + providedIn: 'root', +}) +export class ApiConfiguration { + rootUrl: string = '//portal.openslice.io/tmf-api'; } - export class ApiConfiguration { - rootUrl: string = '//portal.openslice.io/osapi'; - } +export interface ApiConfigurationInterface { + rootUrl?: string; +} diff --git a/src/app/openApis/geographicSiteManagement/api.module.ts b/src/app/openApis/geographicSiteManagement/api.module.ts index 58d341fbd2e5f5fc58ab8c5d5607d43e7b13c474..f555ac70e635416e78fbd44670fccd3dd457904a 100644 --- a/src/app/openApis/geographicSiteManagement/api.module.ts +++ b/src/app/openApis/geographicSiteManagement/api.module.ts @@ -1,30 +1,49 @@ -import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; -import { Configuration } from './configuration'; -import { HttpClient } from '@angular/common/http'; +import { NgModule, ModuleWithProviders} from '@angular/core'; +import { ApiConfiguration, ApiConfigurationInterface } from './api-configuration'; +import { HttpClientModule } from '@angular/common/http'; +import { EventsSubscriptionService } from './services/events-subscription.service'; +import { GeographicSiteService } from './services/geographicSite.service'; +import { NotificationListenerService } from './services/notificationListener.service'; @NgModule({ - imports: [], + imports: [HttpClientModule], declarations: [], - exports: [], - providers: [] + exports: [HttpClientModule], + providers: [ ApiConfiguration, + EventsSubscriptionService, + GeographicSiteService, + NotificationListenerService] }) export class ApiModule { - public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> { - return { - ngModule: ApiModule, - providers: [ { provide: Configuration, useFactory: configurationFactory } ] - }; - } - - 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'); + static forRoot(customParams: ApiConfigurationInterface): ModuleWithProviders<ApiModule> { + return { + ngModule: ApiModule, + providers: [ + { + provide: ApiConfiguration, + useValue: {rootUrl: customParams.rootUrl} } + ] } + } } +// export class ApiModule { +// public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> { +// return { +// ngModule: ApiModule, +// providers: [ { provide: Configuration, useFactory: configurationFactory } ] +// }; +// } +// +// 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/src/app/openApis/geographicSiteManagement/base-service.ts b/src/app/openApis/geographicSiteManagement/base-service.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee9c3ce51cadc80bb138dba6453530b73b2c006b --- /dev/null +++ b/src/app/openApis/geographicSiteManagement/base-service.ts @@ -0,0 +1,63 @@ +/* tslint:disable */ +import { HttpClient, HttpParameterCodec, HttpParams } from '@angular/common/http'; +import { ApiConfiguration } from './api-configuration'; + +/** + * 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 PARAMETER_CODEC = new ParameterCodec(); + +/** + * Base class for API services + */ +export class BaseService { + constructor( + protected config: ApiConfiguration, + protected http: HttpClient + ) { + } + + private _rootUrl: string = ''; + + /** + * Returns the root url for API operations. 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; + } + + /** + * Creates a new `HttpParams` with the correct codec + */ + protected newParams(): HttpParams { + return new HttpParams({ + encoder: PARAMETER_CODEC + }); + } +} diff --git a/src/app/openApis/geographicSiteManagement/model/geographicAddressValue.ts b/src/app/openApis/geographicSiteManagement/model/geographicAddressValue.ts index 707ed197ce25a88ba8ead5624cf2f0cfb3237281..181f7a150227e05fd709603ac04101fb76d3fe68 100644 --- a/src/app/openApis/geographicSiteManagement/model/geographicAddressValue.ts +++ b/src/app/openApis/geographicSiteManagement/model/geographicAddressValue.ts @@ -17,7 +17,7 @@ export interface GeographicAddressValue extends PlaceRefOrValue { /** * When sub-classing, this defines the sub-class Extensible name */ - type: string; + type?: string; /** * When sub-classing, this defines the super-class */ diff --git a/src/app/openApis/geographicSiteManagement/model/geographicSiteCreate.ts b/src/app/openApis/geographicSiteManagement/model/geographicSiteCreate.ts index bdc0f2a3cd5253342cfc9898fc7c90d0373157b1..ea69a95d4579f078886df8d5e75ddcbf86944832 100644 --- a/src/app/openApis/geographicSiteManagement/model/geographicSiteCreate.ts +++ b/src/app/openApis/geographicSiteManagement/model/geographicSiteCreate.ts @@ -20,7 +20,7 @@ export interface GeographicSiteCreate { /** * When sub-classing, this defines the sub-class Extensible name */ - type: string; + '@type'?: string; /** * When sub-classing, this defines the super-class */ diff --git a/src/app/openApis/geographicSiteManagement/model/geographicSiteUpdate.ts b/src/app/openApis/geographicSiteManagement/model/geographicSiteUpdate.ts index ee939bd316fddb1c6d6f63561f9b4fd2eda76b97..50507a7367bddbfec5a0da8e0d51ef51c02e3fc5 100644 --- a/src/app/openApis/geographicSiteManagement/model/geographicSiteUpdate.ts +++ b/src/app/openApis/geographicSiteManagement/model/geographicSiteUpdate.ts @@ -20,7 +20,7 @@ export interface GeographicSiteUpdate { /** * When sub-classing, this defines the sub-class Extensible name */ - type: string; + type?: string; /** * When sub-classing, this defines the super-class */ diff --git a/src/app/openApis/geographicSiteManagement/model/geographicSubAddressValue.ts b/src/app/openApis/geographicSiteManagement/model/geographicSubAddressValue.ts index f6ff941fea6c5c94ec5bbe84b086dfb872507053..24d6365976674b5cbfd8611def3f7bf100ceecb4 100644 --- a/src/app/openApis/geographicSiteManagement/model/geographicSubAddressValue.ts +++ b/src/app/openApis/geographicSiteManagement/model/geographicSubAddressValue.ts @@ -16,7 +16,7 @@ export interface GeographicSubAddressValue { /** * When sub-classing, this defines the sub-class Extensible name */ - type: string; + type?: string; /** * When sub-classing, this defines the super-class */ diff --git a/src/app/openApis/geographicSiteManagement/model/placeRef.ts b/src/app/openApis/geographicSiteManagement/model/placeRef.ts index cb5717366e6aac5b04659166683fdc7b4dfe2549..0db836f3c87f6f8fc4e7960dcf28e8bcfad15e2c 100644 --- a/src/app/openApis/geographicSiteManagement/model/placeRef.ts +++ b/src/app/openApis/geographicSiteManagement/model/placeRef.ts @@ -12,7 +12,7 @@ import { PlaceRefOrValue } from './placeRefOrValue'; -export interface PlaceRef extends PlaceRefOrValue { +export interface PlaceRef { /** * Identifier of the referred entity. */ diff --git a/src/app/openApis/geographicSiteManagement/model/placeRefOrValue.ts b/src/app/openApis/geographicSiteManagement/model/placeRefOrValue.ts index d860763a960a70ca5093071854fed9d9704d23be..31848555230fcbf6daf4734c6ed85ffa731a9f68 100644 --- a/src/app/openApis/geographicSiteManagement/model/placeRefOrValue.ts +++ b/src/app/openApis/geographicSiteManagement/model/placeRefOrValue.ts @@ -10,12 +10,14 @@ * Do not edit the class manually. */ +import { GeographicAddressValue } from "./geographicAddressValue"; + export interface PlaceRefOrValue { /** * When sub-classing, this defines the sub-class Extensible name */ - type: string; + type?: string; /** * When sub-classing, this defines the super-class */ @@ -24,5 +26,7 @@ export interface PlaceRefOrValue { * A URI to a JSON-Schema file that defines additional attributes and relationships */ schemaLocation?: string; + + geographicAddress?: GeographicAddressValue; } diff --git a/src/app/openApis/geographicSiteManagement/model/relatedParty.ts b/src/app/openApis/geographicSiteManagement/model/relatedParty.ts index 4a86c9609cbd1a8915a9e534dc7e622c8373c49a..b0c4f341a083fbbe05a1cbd659c582429b1b83e3 100644 --- a/src/app/openApis/geographicSiteManagement/model/relatedParty.ts +++ b/src/app/openApis/geographicSiteManagement/model/relatedParty.ts @@ -23,7 +23,7 @@ export interface RelatedParty { /** * The actual type of the target instance when needed for disambiguation. */ - referredType: string; + referredType?: string; /** * Hyperlink reference */ diff --git a/src/app/openApis/geographicSiteManagement/services.ts b/src/app/openApis/geographicSiteManagement/services.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a26c8b8e91b34b0711b42571859e915284cb85e --- /dev/null +++ b/src/app/openApis/geographicSiteManagement/services.ts @@ -0,0 +1 @@ +export { GeographicSiteService } from './services/geographicSite.service'; \ No newline at end of file diff --git a/src/app/openApis/geographicSiteManagement/services/eventsSubscription.service.ts b/src/app/openApis/geographicSiteManagement/services/eventsSubscription.service.ts index 2bf05ce9227cb41dfdee6eaeeba302d95f07928c..ac0b9ff0d07f71f5e6cfb02ea6caf3fe17e45743 100644 --- a/src/app/openApis/geographicSiteManagement/services/eventsSubscription.service.ts +++ b/src/app/openApis/geographicSiteManagement/services/eventsSubscription.service.ts @@ -25,7 +25,7 @@ import { EventSubscriptionInput } from '../model/eventSubscriptionInput'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { Configuration } from '../api-configuration'; @@ -100,10 +100,10 @@ export class EventsSubscriptionService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public registerListener(eventSubscriptionInput: EventSubscriptionInput, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json;charset=utf-8' | 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<EventSubscription>; - public registerListener(eventSubscriptionInput: EventSubscriptionInput, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json;charset=utf-8' | 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<EventSubscription>>; - public registerListener(eventSubscriptionInput: EventSubscriptionInput, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json;charset=utf-8' | 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<EventSubscription>>; - public registerListener(eventSubscriptionInput: EventSubscriptionInput, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json;charset=utf-8' | 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public registerListener(eventSubscriptionInput: EventSubscriptionInput, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json;charset=utf-8' | 'application/json', context?: HttpContext }): Observable<EventSubscription>; + public registerListener(eventSubscriptionInput: EventSubscriptionInput, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json;charset=utf-8' | 'application/json', context?: HttpContext}): Observable<HttpResponse<EventSubscription>>; + public registerListener(eventSubscriptionInput: EventSubscriptionInput, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json;charset=utf-8' | 'application/json', context?: HttpContext}): Observable<HttpEvent<EventSubscription>>; + public registerListener(eventSubscriptionInput: EventSubscriptionInput, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json;charset=utf-8' | 'application/json', context?: HttpContext}): Observable<any> { if (eventSubscriptionInput === null || eventSubscriptionInput === undefined) { throw new Error('Required parameter eventSubscriptionInput was null or undefined when calling registerListener.'); } @@ -128,10 +128,10 @@ export class EventsSubscriptionService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } // to determine the Content-Type header @@ -163,7 +163,7 @@ export class EventsSubscriptionService { withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, + // transferCache: localVarTransferCache, reportProgress: reportProgress } ); @@ -176,10 +176,10 @@ export class EventsSubscriptionService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public unregisterListener(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>; - public unregisterListener(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; - public unregisterListener(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; - public unregisterListener(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public unregisterListener(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any>; + public unregisterListener(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<any>>; + public unregisterListener(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<any>>; + public unregisterListener(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling unregisterListener.'); } @@ -203,10 +203,10 @@ export class EventsSubscriptionService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } let responseType_: 'text' | 'json' | 'blob' = 'json'; @@ -228,7 +228,7 @@ export class EventsSubscriptionService { withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, + // transferCache: localVarTransferCache, reportProgress: reportProgress } ); diff --git a/src/app/openApis/geographicSiteManagement/services/geographicSite.service.ts b/src/app/openApis/geographicSiteManagement/services/geographicSite.service.ts index 996182e79054933518199af60acd78bd244022ee..a0957e27294c6f21d48d4a5ecbbcc335201b9541 100644 --- a/src/app/openApis/geographicSiteManagement/services/geographicSite.service.ts +++ b/src/app/openApis/geographicSiteManagement/services/geographicSite.service.ts @@ -17,7 +17,7 @@ import { HttpClient, HttpHeaders, HttpParams, } from '@angular/common/http'; import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; - +import { BaseService } from '../base-service'; // @ts-ignore import { GeographicSite } from '../model/geographicSite'; // @ts-ignore @@ -31,7 +31,7 @@ import { PatchGeographicSite200Response } from '../model/patchGeographicSite200R // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { ApiConfiguration } from '../api-configuration'; @@ -42,14 +42,14 @@ export class GeographicSiteService { protected basePath = 'https://serverRoot'; public defaultHeaders = new HttpHeaders(); - public configuration = new Configuration(); + public configuration = new ApiConfiguration(); public encoder: HttpParameterCodec; - constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) { + constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: ApiConfiguration) { if (configuration) { this.configuration = configuration; } - if (typeof this.configuration.basePath !== 'string') { + if (typeof this.configuration.rootUrl !== 'string') { if (Array.isArray(basePath) && basePath.length > 0) { basePath = basePath[0]; } @@ -57,9 +57,9 @@ export class GeographicSiteService { if (typeof basePath !== 'string') { basePath = this.basePath; } - this.configuration.basePath = basePath; + this.configuration.rootUrl = basePath; } - this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); + this.encoder = new CustomHttpParameterCodec(); } @@ -106,10 +106,10 @@ export class GeographicSiteService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public createGeographicSite(geographicSiteCreate: GeographicSiteCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<GeographicSite>; - public createGeographicSite(geographicSiteCreate: GeographicSiteCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<GeographicSite>>; - public createGeographicSite(geographicSiteCreate: GeographicSiteCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<GeographicSite>>; - public createGeographicSite(geographicSiteCreate: GeographicSiteCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public createGeographicSite(geographicSiteCreate: GeographicSiteCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<GeographicSite>; + public createGeographicSite(geographicSiteCreate: GeographicSiteCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<GeographicSite>>; + public createGeographicSite(geographicSiteCreate: GeographicSiteCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<GeographicSite>>; + public createGeographicSite(geographicSiteCreate: GeographicSiteCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { if (geographicSiteCreate === null || geographicSiteCreate === undefined) { throw new Error('Required parameter geographicSiteCreate was null or undefined when calling createGeographicSite.'); } @@ -122,7 +122,7 @@ export class GeographicSiteService { const httpHeaderAccepts: string[] = [ 'application/json' ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + // localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); } if (localVarHttpHeaderAcceptSelected !== undefined) { localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); @@ -133,42 +133,42 @@ export class GeographicSiteService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } // to determine the Content-Type header const consumes: string[] = [ 'application/json' ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 'application/json'; if (httpContentTypeSelected !== undefined) { localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); } let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/geographicSite`; - return this.httpClient.request<GeographicSite>('post', `${this.configuration.basePath}${localVarPath}`, + // if (localVarHttpHeaderAcceptSelected) { + // if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + // responseType_ = 'text'; + // } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + // responseType_ = 'json'; + // } else { + // responseType_ = 'blob'; + // } + // } + + let localVarPath = `/geographicSiteManagement/v5/geographicSite`; + return this.httpClient.request<GeographicSite>('post', `${this.configuration.rootUrl}${localVarPath}`, { context: localVarHttpContext, body: geographicSiteCreate, responseType: <any>responseType_, - withCredentials: this.configuration.withCredentials, + // withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, + // transferCache: localVarTransferCache, reportProgress: reportProgress } ); @@ -181,10 +181,10 @@ export class GeographicSiteService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public deleteGeographicSite(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>; - public deleteGeographicSite(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; - public deleteGeographicSite(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; - public deleteGeographicSite(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public deleteGeographicSite(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any>; + public deleteGeographicSite(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<any>>; + public deleteGeographicSite(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<any>>; + public deleteGeographicSite(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling deleteGeographicSite.'); } @@ -197,7 +197,7 @@ export class GeographicSiteService { const httpHeaderAccepts: string[] = [ 'application/json' ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + localVarHttpHeaderAcceptSelected = 'application/json'; } if (localVarHttpHeaderAcceptSelected !== undefined) { localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); @@ -208,32 +208,32 @@ export class GeographicSiteService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/geographicSite/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request<any>('delete', `${this.configuration.basePath}${localVarPath}`, + // if (localVarHttpHeaderAcceptSelected) { + // if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + // responseType_ = 'text'; + // } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + // responseType_ = 'json'; + // } else { + // responseType_ = 'blob'; + // } + // } + + let localVarPath = `/geographicSiteManagement/v5/geographicSite/${this.encoder.encodeValue(id)}`; + return this.httpClient.request<any>('delete', `${this.configuration.rootUrl}${localVarPath}`, { context: localVarHttpContext, responseType: <any>responseType_, - withCredentials: this.configuration.withCredentials, + // withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, + // transferCache: localVarTransferCache, reportProgress: reportProgress } ); @@ -248,10 +248,10 @@ export class GeographicSiteService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public listGeographicSite(fields?: string, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<GeographicSite>>; - public listGeographicSite(fields?: string, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<GeographicSite>>>; - public listGeographicSite(fields?: string, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<GeographicSite>>>; - public listGeographicSite(fields?: string, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public listGeographicSite(fields?: string, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<GeographicSite>>; + public listGeographicSite(fields?: string, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<GeographicSite>>>; + public listGeographicSite(fields?: string, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<GeographicSite>>>; + public listGeographicSite(fields?: string, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { let localVarQueryParameters = new HttpParams({encoder: this.encoder}); if (fields !== undefined && fields !== null) { @@ -275,7 +275,7 @@ export class GeographicSiteService { const httpHeaderAccepts: string[] = [ 'application/json' ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + localVarHttpHeaderAcceptSelected = 'application/json'; } if (localVarHttpHeaderAcceptSelected !== undefined) { localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); @@ -286,33 +286,33 @@ export class GeographicSiteService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/geographicSite`; - return this.httpClient.request<Array<GeographicSite>>('get', `${this.configuration.basePath}${localVarPath}`, + // if (localVarHttpHeaderAcceptSelected) { + // if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + // responseType_ = 'text'; + // } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + // responseType_ = 'json'; + // } else { + // responseType_ = 'blob'; + // } + // } + + let localVarPath = `/geographicSiteManagement/v5/geographicSite`; + return this.httpClient.request<Array<GeographicSite>>('get', `${this.configuration.rootUrl}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters, responseType: <any>responseType_, - withCredentials: this.configuration.withCredentials, + // withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, + // transferCache: localVarTransferCache, reportProgress: reportProgress } ); @@ -326,10 +326,10 @@ export class GeographicSiteService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public patchGeographicSite(id: string, geographicSiteUpdate: GeographicSiteUpdate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/merge-patch+json' | 'application/json-patch+json' | 'application/json-patch-query+json', context?: HttpContext, transferCache?: boolean}): Observable<GeographicSite>; - public patchGeographicSite(id: string, geographicSiteUpdate: GeographicSiteUpdate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/merge-patch+json' | 'application/json-patch+json' | 'application/json-patch-query+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<GeographicSite>>; - public patchGeographicSite(id: string, geographicSiteUpdate: GeographicSiteUpdate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/merge-patch+json' | 'application/json-patch+json' | 'application/json-patch-query+json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<GeographicSite>>; - public patchGeographicSite(id: string, geographicSiteUpdate: GeographicSiteUpdate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/merge-patch+json' | 'application/json-patch+json' | 'application/json-patch-query+json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public patchGeographicSite(id: string, geographicSiteUpdate: GeographicSiteUpdate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/merge-patch+json' | 'application/json-patch+json' | 'application/json-patch-query+json', context?: HttpContext}): Observable<GeographicSite>; + public patchGeographicSite(id: string, geographicSiteUpdate: GeographicSiteUpdate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/merge-patch+json' | 'application/json-patch+json' | 'application/json-patch-query+json', context?: HttpContext}): Observable<HttpResponse<GeographicSite>>; + public patchGeographicSite(id: string, geographicSiteUpdate: GeographicSiteUpdate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/merge-patch+json' | 'application/json-patch+json' | 'application/json-patch-query+json', context?: HttpContext}): Observable<HttpEvent<GeographicSite>>; + public patchGeographicSite(id: string, geographicSiteUpdate: GeographicSiteUpdate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/merge-patch+json' | 'application/json-patch+json' | 'application/json-patch-query+json', context?: HttpContext}): Observable<any> { if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling patchGeographicSite.'); } @@ -348,7 +348,7 @@ export class GeographicSiteService { 'application/json-patch+json', 'application/json-patch-query+json' ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + localVarHttpHeaderAcceptSelected = 'application/json'; } if (localVarHttpHeaderAcceptSelected !== undefined) { localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); @@ -359,10 +359,10 @@ export class GeographicSiteService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } // to determine the Content-Type header @@ -372,32 +372,31 @@ export class GeographicSiteService { 'application/json-patch+json', 'application/json-patch-query+json' ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = 'application/json'; if (httpContentTypeSelected !== undefined) { localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); } let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/geographicSite/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request<GeographicSite>('patch', `${this.configuration.basePath}${localVarPath}`, + // if (localVarHttpHeaderAcceptSelected) { + // if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + // responseType_ = 'text'; + // } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + // responseType_ = 'json'; + // } else { + // responseType_ = 'blob'; + // } + // } + + let localVarPath = `/geographicSiteManagement/v5/geographicSite/${this.encoder.encodeValue(id)}`; + return this.httpClient.request<GeographicSite>('patch', `${this.configuration.rootUrl}${localVarPath}`, { context: localVarHttpContext, body: geographicSiteUpdate, responseType: <any>responseType_, - withCredentials: this.configuration.withCredentials, + // withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, reportProgress: reportProgress } ); @@ -410,10 +409,10 @@ export class GeographicSiteService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public retrieveGeographicSite(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<GeographicSite>; - public retrieveGeographicSite(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<GeographicSite>>; - public retrieveGeographicSite(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<GeographicSite>>; - public retrieveGeographicSite(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public retrieveGeographicSite(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<GeographicSite>; + public retrieveGeographicSite(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<GeographicSite>>; + public retrieveGeographicSite(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<GeographicSite>>; + public retrieveGeographicSite(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling retrieveGeographicSite.'); } @@ -426,7 +425,7 @@ export class GeographicSiteService { const httpHeaderAccepts: string[] = [ 'application/json' ]; - localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + localVarHttpHeaderAcceptSelected = 'application/json'; } if (localVarHttpHeaderAcceptSelected !== undefined) { localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); @@ -437,32 +436,26 @@ export class GeographicSiteService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/geographicSite/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - return this.httpClient.request<GeographicSite>('get', `${this.configuration.basePath}${localVarPath}`, + // if (localVarHttpHeaderAcceptSelected) { + // if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + // responseType_ = 'text'; + // } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + // responseType_ = 'json'; + // } else { + // responseType_ = 'blob'; + // } + // } + + let localVarPath = `/geographicSiteManagement/v5/geographicSite/${this.encoder.encodeValue(id)}`; + return this.httpClient.request<GeographicSite>('get', `${this.configuration.rootUrl}${localVarPath}`, { context: localVarHttpContext, responseType: <any>responseType_, - withCredentials: this.configuration.withCredentials, + // withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, reportProgress: reportProgress } ); diff --git a/src/app/openApis/geographicSiteManagement/services/notificationListener.service.ts b/src/app/openApis/geographicSiteManagement/services/notificationListener.service.ts index 1078f914994120be29853a1a7dbed1acf79fba32..98e5de2c8a6d071c254b9eb2dc188521157ab737 100644 --- a/src/app/openApis/geographicSiteManagement/services/notificationListener.service.ts +++ b/src/app/openApis/geographicSiteManagement/services/notificationListener.service.ts @@ -29,7 +29,7 @@ import { GeographicSiteStateChangeEvent } from '../model/geographicSiteStateChan // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; +import { Configuration } from '../api-configuration'; @@ -104,10 +104,10 @@ export class NotificationListenerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public geographicSiteAttributeValueChangeEvent(geographicSiteAttributeValueChangeEvent: GeographicSiteAttributeValueChangeEvent, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>; - public geographicSiteAttributeValueChangeEvent(geographicSiteAttributeValueChangeEvent: GeographicSiteAttributeValueChangeEvent, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; - public geographicSiteAttributeValueChangeEvent(geographicSiteAttributeValueChangeEvent: GeographicSiteAttributeValueChangeEvent, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; - public geographicSiteAttributeValueChangeEvent(geographicSiteAttributeValueChangeEvent: GeographicSiteAttributeValueChangeEvent, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public geographicSiteAttributeValueChangeEvent(geographicSiteAttributeValueChangeEvent: GeographicSiteAttributeValueChangeEvent, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any>; + public geographicSiteAttributeValueChangeEvent(geographicSiteAttributeValueChangeEvent: GeographicSiteAttributeValueChangeEvent, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<any>>; + public geographicSiteAttributeValueChangeEvent(geographicSiteAttributeValueChangeEvent: GeographicSiteAttributeValueChangeEvent, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<any>>; + public geographicSiteAttributeValueChangeEvent(geographicSiteAttributeValueChangeEvent: GeographicSiteAttributeValueChangeEvent, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { if (geographicSiteAttributeValueChangeEvent === null || geographicSiteAttributeValueChangeEvent === undefined) { throw new Error('Required parameter geographicSiteAttributeValueChangeEvent was null or undefined when calling geographicSiteAttributeValueChangeEvent.'); } @@ -131,10 +131,10 @@ export class NotificationListenerService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } // to determine the Content-Type header @@ -166,7 +166,7 @@ export class NotificationListenerService { withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, + // transferCache: localVarTransferCache, reportProgress: reportProgress } ); @@ -179,10 +179,10 @@ export class NotificationListenerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public geographicSiteCreateEvent(geographicSiteCreateEvent: GeographicSiteCreateEvent, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>; - public geographicSiteCreateEvent(geographicSiteCreateEvent: GeographicSiteCreateEvent, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; - public geographicSiteCreateEvent(geographicSiteCreateEvent: GeographicSiteCreateEvent, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; - public geographicSiteCreateEvent(geographicSiteCreateEvent: GeographicSiteCreateEvent, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public geographicSiteCreateEvent(geographicSiteCreateEvent: GeographicSiteCreateEvent, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any>; + public geographicSiteCreateEvent(geographicSiteCreateEvent: GeographicSiteCreateEvent, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<any>>; + public geographicSiteCreateEvent(geographicSiteCreateEvent: GeographicSiteCreateEvent, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<any>>; + public geographicSiteCreateEvent(geographicSiteCreateEvent: GeographicSiteCreateEvent, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { if (geographicSiteCreateEvent === null || geographicSiteCreateEvent === undefined) { throw new Error('Required parameter geographicSiteCreateEvent was null or undefined when calling geographicSiteCreateEvent.'); } @@ -206,10 +206,10 @@ export class NotificationListenerService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } // to determine the Content-Type header @@ -241,7 +241,7 @@ export class NotificationListenerService { withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, + // transferCache: localVarTransferCache, reportProgress: reportProgress } ); @@ -254,10 +254,10 @@ export class NotificationListenerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public geographicSiteDeleteEvent(geographicSiteDeleteEvent: GeographicSiteDeleteEvent, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>; - public geographicSiteDeleteEvent(geographicSiteDeleteEvent: GeographicSiteDeleteEvent, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; - public geographicSiteDeleteEvent(geographicSiteDeleteEvent: GeographicSiteDeleteEvent, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; - public geographicSiteDeleteEvent(geographicSiteDeleteEvent: GeographicSiteDeleteEvent, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public geographicSiteDeleteEvent(geographicSiteDeleteEvent: GeographicSiteDeleteEvent, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any>; + public geographicSiteDeleteEvent(geographicSiteDeleteEvent: GeographicSiteDeleteEvent, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<any>>; + public geographicSiteDeleteEvent(geographicSiteDeleteEvent: GeographicSiteDeleteEvent, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<any>>; + public geographicSiteDeleteEvent(geographicSiteDeleteEvent: GeographicSiteDeleteEvent, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { if (geographicSiteDeleteEvent === null || geographicSiteDeleteEvent === undefined) { throw new Error('Required parameter geographicSiteDeleteEvent was null or undefined when calling geographicSiteDeleteEvent.'); } @@ -281,10 +281,10 @@ export class NotificationListenerService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } // to determine the Content-Type header @@ -316,7 +316,7 @@ export class NotificationListenerService { withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, + // transferCache: localVarTransferCache, reportProgress: reportProgress } ); @@ -329,10 +329,10 @@ export class NotificationListenerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public geographicSiteStateChangeEvent(geographicSiteStateChangeEvent: GeographicSiteStateChangeEvent, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>; - public geographicSiteStateChangeEvent(geographicSiteStateChangeEvent: GeographicSiteStateChangeEvent, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>; - public geographicSiteStateChangeEvent(geographicSiteStateChangeEvent: GeographicSiteStateChangeEvent, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>; - public geographicSiteStateChangeEvent(geographicSiteStateChangeEvent: GeographicSiteStateChangeEvent, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> { + public geographicSiteStateChangeEvent(geographicSiteStateChangeEvent: GeographicSiteStateChangeEvent, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any>; + public geographicSiteStateChangeEvent(geographicSiteStateChangeEvent: GeographicSiteStateChangeEvent, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<any>>; + public geographicSiteStateChangeEvent(geographicSiteStateChangeEvent: GeographicSiteStateChangeEvent, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<any>>; + public geographicSiteStateChangeEvent(geographicSiteStateChangeEvent: GeographicSiteStateChangeEvent, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { if (geographicSiteStateChangeEvent === null || geographicSiteStateChangeEvent === undefined) { throw new Error('Required parameter geographicSiteStateChangeEvent was null or undefined when calling geographicSiteStateChangeEvent.'); } @@ -356,10 +356,10 @@ export class NotificationListenerService { localVarHttpContext = new HttpContext(); } - let localVarTransferCache: boolean | undefined = options && options.transferCache; - if (localVarTransferCache === undefined) { - localVarTransferCache = true; - } + // let localVarTransferCache: boolean | undefined = options && options.transferCache; + // if (localVarTransferCache === undefined) { + // localVarTransferCache = true; + // } // to determine the Content-Type header @@ -391,7 +391,7 @@ export class NotificationListenerService { withCredentials: this.configuration.withCredentials, headers: localVarHeaders, observe: observe, - transferCache: localVarTransferCache, + // transferCache: localVarTransferCache, reportProgress: reportProgress } ); diff --git a/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.html b/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.html index 5518d0afb926c4244c10315e51e85b154660f9ec..8d6f29e832b943206973d39fba45ea470f0e1e7a 100644 --- a/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.html +++ b/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.html @@ -81,54 +81,138 @@ </div> - <h6 class="mt-3">Geographic Site Details</h6> - <div class="row align-items-center" formGroupName="geographicSiteInfo"> + <h6 class="mt-3" *ngIf="testbedProvider">Geographic Site Details</h6> + <div class="row align-items-center" formGroupName="geographicSiteInfo" *ngIf="testbedProvider"> + <mat-form-field class="col-md-4"> <mat-label class="d-flex"> - City + Code </mat-label> - <input matInput formControlName="locality"> + <input matInput formControlName="code"> </mat-form-field> <mat-form-field class="col-md-4"> <mat-label class="d-flex"> - Email + Description + </mat-label> + <input matInput formControlName="description"> + </mat-form-field> + + <mat-form-field class="col-md-4"> + <mat-label class="d-flex"> + Status + </mat-label> + <input matInput formControlName="status"> + </mat-form-field> + <mat-form-field class="col-md-4"> + <mat-label class="d-flex"> + Locality + </mat-label> + <input matInput formControlName="locality"> + </mat-form-field> + + <mat-form-field class="col-md-4"> + <mat-label> + Postcode </mat-label> <input matInput formControlName="postcode"> </mat-form-field> <mat-form-field class="col-md-4"> <mat-label class="d-flex"> - Phone + State Or Province </mat-label> <input matInput formControlName="stateOrProvince"> </mat-form-field> + <mat-form-field class="col-md-4"> + <mat-label> + Street Number + </mat-label> + <input matInput formControlName="streetNr"> + </mat-form-field> + <mat-form-field class="col-md-4"> + <mat-label class="d-flex"> + Street Suffix + </mat-label> + <input matInput formControlName="streetSuffix"> + </mat-form-field> <mat-form-field class="col-md-4"> <mat-label class="d-flex"> + Street Type + </mat-label> + <input matInput formControlName="streetType"> + </mat-form-field> + + <mat-form-field class="col-md-4"> + <mat-label> City </mat-label> - <input matInput formControlName="streetNr"> + <input matInput formControlName="city"> + </mat-form-field> + + <mat-form-field class="col-md-4"> + <mat-label> + Country + </mat-label> + <input matInput formControlName="country"> + </mat-form-field> + <mat-form-field class="col-md-4"> + <mat-label> + Street Name + </mat-label> + <input matInput formControlName="streetName"> </mat-form-field> <mat-form-field class="col-md-4"> <mat-label class="d-flex"> - Email + Building Name </mat-label> - <input matInput formControlName="city"> + <input matInput formControlName="buildingName"> </mat-form-field> <mat-form-field class="col-md-4"> <mat-label class="d-flex"> - Phone + Level Type </mat-label> - <input matInput formControlName="country"> + <input matInput formControlName="levelType"> </mat-form-field> + <mat-form-field class="col-md-4"> <mat-label class="d-flex"> - Phone + Level Number </mat-label> - <input matInput formControlName="streetName"> + <input matInput formControlName="levelNumber"> + </mat-form-field> + + <mat-form-field class="col-md-4"> + <mat-label class="d-flex"> + Private Street Name + </mat-label> + <input matInput formControlName="privateStreetName"> </mat-form-field> + + <mat-form-field class="col-md-4"> + <mat-label class="d-flex"> + Private Street Number + </mat-label> + <input matInput formControlName="privateStreetNumber"> + </mat-form-field> + + <mat-form-field class="col-md-4"> + <mat-label class="d-flex"> + Sub Address Name + </mat-label> + <input matInput formControlName="subAddressName"> + </mat-form-field> + + <mat-form-field class="col-md-4"> + <mat-label class="d-flex"> + Sub Address Type + </mat-label> + <input matInput formControlName="subAddressType"> + </mat-form-field> + + </div> diff --git a/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.ts b/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.ts index bead41a8ceb1e0f6d93d3b32bfd5141ab1a32878..9cd38a8f04871f6c65034fbd2d6bfb34ce74d76e 100644 --- a/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.ts +++ b/src/app/shared/components/partyManagement/edit-individuals/edit-individuals.component.ts @@ -1,10 +1,12 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router, ActivationEnd } from '@angular/router'; import { IndividualService, OrganizationService } from 'src/app/openApis/partyManagement/services'; +import { GeographicSiteService } from 'src/app/openApis/geographicSiteManagement/services'; import { MatDialog } from '@angular/material/dialog'; import { ToastrService } from 'ngx-toastr'; import { Individual, Organization, IndividualCreate, IndividualUpdate } from 'src/app/openApis/partyManagement/models'; -import { FormGroup, FormControl } from '@angular/forms'; +import { GeographicSite, GeographicSiteCreate, GeographicSiteUpdate } from 'src/app/openApis/geographicSiteManagement/model/models'; +import { FormGroup, FormControl, Validators } from '@angular/forms'; import { Subscription } from 'rxjs'; import { AuthService } from 'src/app/shared/services/auth.service'; import { trigger } from '@angular/animations'; @@ -22,6 +24,7 @@ export class EditIndividualsComponent implements OnInit { private activatedRoute: ActivatedRoute, private individualService: IndividualService, private organizationService: OrganizationService, + private geographicSiteService: GeographicSiteService, private authService: AuthService, private router: Router, private dialog: MatDialog, @@ -30,6 +33,7 @@ export class EditIndividualsComponent implements OnInit { individualID: string individual: Individual + geographicSite: GeographicSite organizations: Organization[] @@ -44,12 +48,24 @@ export class EditIndividualsComponent implements OnInit { }), geographicSiteInfo: new FormGroup({ locality: new FormControl(), - postcode: new FormControl(), + postcode: new FormControl(null, Validators.required), stateOrProvince: new FormControl(), - streetNr: new FormControl(), - city: new FormControl(), - country: new FormControl(), - streetName: new FormControl(), + streetNr: new FormControl(null, Validators.required), + city: new FormControl(null, Validators.required), + country: new FormControl(null, Validators.required), + streetName: new FormControl(null, Validators.required), + code : new FormControl(), + description : new FormControl(), + status : new FormControl(), + buildingName : new FormControl(), + levelType : new FormControl(), + levelNumber : new FormControl(), + privateStreetName : new FormControl(), + privateStreetNumber : new FormControl(), + subAddressName : new FormControl(), + subAddressType : new FormControl(), + streetSuffix : new FormControl(), + streetType : new FormControl() }) }) @@ -64,6 +80,8 @@ export class EditIndividualsComponent implements OnInit { newIndividual = false + testbedProvider = false + subscriptions = new Subscription() ngOnInit() { @@ -76,6 +94,12 @@ export class EditIndividualsComponent implements OnInit { if (this.authService.portalUser && this.authService.portalUser.id === this.individualID) { this.individualID = "myuser" } + for(var val of this.authService.portalUserJWT.realm_access.roles){ + if (val ==='TESTBED_PROVIDER') { + this.testbedProvider=true + this.retrieveGeographicSite() + } + } this.retrieveIndividual() } else { // this.initNewOrganizationFormArray() @@ -151,7 +175,7 @@ export class EditIndividualsComponent implements OnInit { // updateObj = this.editForm.value let updatedIndividual: Individual - + if (this.newIndividual) { // const definedCharacteristics = this.editForm.get('partyCharacteristic').value.filter(el => el.value) // if (definedCharacteristics.length) updateObj.partyCharacteristic = definedCharacteristics @@ -160,6 +184,9 @@ export class EditIndividualsComponent implements OnInit { data => { updatedIndividual = data }, error => console.error(error), () => { + if(this.testbedProvider) { + this.updateGeographicSite(updatedIndividual.id); + } this.newIndividual = false this.toast.success("Individual was successfully created") this.refreshIndividual(updatedIndividual) @@ -171,18 +198,132 @@ export class EditIndividualsComponent implements OnInit { data => { updatedIndividual = data }, error => console.error(error), () => { + if(this.testbedProvider) { + this.updateGeographicSite(updatedIndividual.id); + } this.newIndividual = false this.toast.success("Individual was successfully updated") this.refreshIndividual(updatedIndividual) } ) } - + // this.updateGeographicSite(); } refreshIndividual(updatedIndividual: Individual) { // this.individualID = updatedIndividual.id this.retrieveIndividual() + if(this.testbedProvider) { + this.retrieveGeographicSite() + } + console.log("TODO-Retrieve Geographic Site info as well")//TODO + } + + retrieveGeographicSite(){ + this.geographicSiteService.retrieveGeographicSite(this.individualID).subscribe( + data => this.geographicSite = data, + error => console.error(error), + () => { + this.editForm.patchValue({ + geographicSiteInfo: { + code:this.geographicSite.code, + description: this.geographicSite.description, + locality: this.geographicSite.place[0].geographicAddress.locality , + postcode: this.geographicSite.place[0].geographicAddress.postcode , + stateOrProvince: this.geographicSite.place[0].geographicAddress.stateOrProvince , + streetNr: this.geographicSite.place[0].geographicAddress.streetNr , + streetSuffix: this.geographicSite.place[0].geographicAddress.streetSuffix , + streetType: this.geographicSite.place[0].geographicAddress.streetType , + streetName: this.geographicSite.place[0].geographicAddress.streetName , + city: this.geographicSite.place[0].geographicAddress.city , + country: this.geographicSite.place[0].geographicAddress.country , + buildingName: this.geographicSite.place[0].geographicAddress.geographicSubAddress.buildingName , + levelNumber: this.geographicSite.place[0].geographicAddress.geographicSubAddress.levelNumber , + levelType: this.geographicSite.place[0].geographicAddress.geographicSubAddress.levelType , + name: this.geographicSite.place[0].geographicAddress.geographicSubAddress.name , + privateStreetName: this.geographicSite.place[0].geographicAddress.geographicSubAddress.privateStreetName , + privateStreetNumber: this.geographicSite.place[0].geographicAddress.geographicSubAddress.privateStreetNumber , + subAddressType: this.geographicSite.place[0].geographicAddress.geographicSubAddress.subAddressType + } + + }) + + // if (this.individual.partyCharacteristic.length) { + // this.customOrganizationCtrl.setValue(this.individual.partyCharacteristic.find( char => char.name === 'organization').value.value) + // } + + // if (this.individualID ==="myuser") { + // this.authService.portalUser = this.individual + // } + + //prefefined Organization in Related Party + + // + } + + ) + } + + updateGeographicSite(id: String){ + if (this.editForm.valid) { + let updateObj: GeographicSiteCreate | GeographicSiteUpdate ={ + code:this.editForm.value.geographicSiteInfo.code, + description: this.editForm.value.geographicSiteInfo.description, + relatedParty: [{ + id:this.individualID + }], + externalIdentifier: [], + calendar:[], + place:[{ + geographicAddress:{ + locality: this.editForm.value.geographicSiteInfo.locality , + postcode: this.editForm.value.geographicSiteInfo.postcode , + stateOrProvince: this.editForm.value.geographicSiteInfo.stateOrProvince , + streetNr: this.editForm.value.geographicSiteInfo.streetNr , + streetSuffix: this.editForm.value.geographicSiteInfo.streetSuffix , + streetType: this.editForm.value.geographicSiteInfo.streetType , + streetName: this.editForm.value.geographicSiteInfo.streetName , + city: this.editForm.value.geographicSiteInfo.city , + country: this.editForm.value.geographicSiteInfo.country , + geographicSubAddress: { + buildingName: this.editForm.value.geographicSiteInfo.buildingName , + levelNumber: this.editForm.value.geographicSiteInfo.levelNumber , + levelType: this.editForm.value.geographicSiteInfo.levelType , + name: this.editForm.value.geographicSiteInfo.subAddressName , + privateStreetName: this.editForm.value.geographicSiteInfo.privateStreetName , + privateStreetNumber: this.editForm.value.geographicSiteInfo.privateStreetNumber , + subAddressType: this.editForm.value.geographicSiteInfo.subAddressType + } + + } + + }], + siteRelationship:[] + } + console.log(updateObj) + let updatedGeographicSite: GeographicSite + + if (this.newIndividual) { + + this.geographicSiteService.createGeographicSite(updateObj).subscribe( + data => { updatedGeographicSite = data }, + error => console.error(error), + () => { + this.toast.success("Geographic site was successfully created") + } + ) + } + else { + this.geographicSiteService.patchGeographicSite(this.individual.id,updateObj).subscribe( + data => { updatedGeographicSite = data }, + error => console.error(error), + () => { + this.toast.success("Geographic site was successfully updated") + } + ) + } + + } } ngOnDestroy() { diff --git a/src/app/shared/components/redirect/redirect.component.ts b/src/app/shared/components/redirect/redirect.component.ts index 003fe2c0b4cbe710c5a32a022f09c8352b224846..f84844cffbaf58ebe2fc403e61782206708d055e 100644 --- a/src/app/shared/components/redirect/redirect.component.ts +++ b/src/app/shared/components/redirect/redirect.component.ts @@ -17,6 +17,7 @@ export class RedirectComponent implements OnInit { ) { } ngOnInit() { + // this.authService.fetchIndividualInfo(); let isTestbedProvider = false; if(this.authService != null && this.authService.portalUserJWT !=null) { for(var val of this.authService.portalUserJWT.realm_access.roles){ diff --git a/src/app/shared/services/app.service.ts b/src/app/shared/services/app.service.ts index e29e1cc977182bcf265cabe4f3451f954143c1d2..029e931ed9f6a3b2ee93a65ccd25fcd20d537511 100644 --- a/src/app/shared/services/app.service.ts +++ b/src/app/shared/services/app.service.ts @@ -41,8 +41,8 @@ export class AppService { private tmfResourceCatalogConfig: ResourceCatalogAPIconfig, private tmfResourceInventoryConfig: ResourceInventoryAPIconfig, private resourcePoolManagementAPIconfig: resourcePoolManagementAPIconfig, - private tmfProductCatalogConfig: ProductCatalogAPIconfig -// private tmfGeographicSiteConfig: GeographicSiteManagementAPIconfig + private tmfProductCatalogConfig: ProductCatalogAPIconfig, + private tmfGeographicSiteConfig: GeographicSiteManagementAPIconfig ) { this.setAPIurls() this.recognizePortalDomain() @@ -66,7 +66,7 @@ export class AppService { this.serviceTestManagementAPIconfig.rootUrl = this.config.APITMFURL this.resourcePoolManagementAPIconfig.rootUrl = this.config.APITMFURL this.tmfProductCatalogConfig.rootUrl = this.config.APITMFURL -// this.tmfGeographicSiteConfig.rootUrl = this.config.APITMFURL + this.tmfGeographicSiteConfig.rootUrl = this.config.APITMFURL } //recognition of which portal is used (services/testing/product) diff --git a/src/app/shared/services/auth.service.ts b/src/app/shared/services/auth.service.ts index cf7cda01e290021b66fafbac951c364f75370c7b..d2227e4fe99ef92476695adfd3c921f6536807fd 100644 --- a/src/app/shared/services/auth.service.ts +++ b/src/app/shared/services/auth.service.ts @@ -126,6 +126,18 @@ export class AuthService { ) } + public fetchIndividualInfo() { + // this.portalUserJWT = decode(this.getAccessToken()) + this.individualService.retrieveIndividual({id:'myuser'}).subscribe( + data => { this.portalUser = data }, + error => { + console.error(error) + // this.toast.error('An error occurred fetching user information') + // this.logout() + } + ) + } + public login() { this.oauthService.initCodeFlow() }