feat: apiman endpoint via config
MODIFY
config.json
config.json
{
"language": "de",
"supportedLanguages": ["de", "en"],
+ "endpoint": "https://vagrantguest/pas/apiman",
"hero": {
"title": "HOME.TITLE",
"subtitle": "HOME.SUBTITLE",

MODIFY
src/app/interfaces/IConfig.ts
src/app/interfaces/IConfig.ts
export interface IConfig {
"language": string,
"supportedLanguages": string[],
+ "endpoint": string;
"hero": IHero,
"navigation": INavigation,
"footer": IFooter

MODIFY
src/app/services/backend/backend.service.ts
src/app/services/backend/backend.service.ts
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {Observable} from "rxjs";
import {map} from "rxjs/operators";
+import {ConfigService} from '../config/config.service';
export interface ApiSummaryBean {
organizationId?: string;
@@ -87,11 +88,13 @@ export interface PagingBean {
})
export class BackendService {
+ private endpoint: string;
- constructor(private http: HttpClient) { }
+ constructor(private http: HttpClient,
+ private configService: ConfigService) {
+ this.endpoint = configService.getEndpoint();
+ }
- // ToDo replace hard-coded URL with variable URL in config File
- private apiMgmtUiRestUrl: string = 'https://vagrantguest/pas/apiman';
// ToDo remove credentials and use anonymous call
private credentials: string = 'test:test1234' // Format username:password
private httpOptions = {
@@ -104,7 +107,7 @@ export class BackendService {
* Searches apis
*/
public searchApis(searchCriteria: SearchCriteriaBean): Observable<SearchResultsBeanApiSummaryBean> {
- const url = this.apiMgmtUiRestUrl + '/search/apis';
+ const url = this.endpoint + '/search/apis';
return this.http.post(url, searchCriteria, this.httpOptions) as Observable<SearchResultsBeanApiSummaryBean>;
}
@@ -112,7 +115,7 @@ export class BackendService {
* Get Api
*/
public getApi(orgId: String, apiId: String): Observable<ApiBean> {
- const url = this.apiMgmtUiRestUrl + `/organizations/${orgId}/apis/${apiId}`;
+ const url = this.endpoint + `/organizations/${orgId}/apis/${apiId}`;
return this.http.get(url, this.httpOptions) as Observable<ApiBean>;
}
@@ -120,7 +123,7 @@ export class BackendService {
* Get Api Versions
*/
public getApiVersions(orgId: String, apiId: String): Observable<ApiVersionSummaryBean[]> {
- const url = this.apiMgmtUiRestUrl + `/organizations/${orgId}/apis/${apiId}/versions`
+ const url = this.endpoint + `/organizations/${orgId}/apis/${apiId}/versions`
return this.http.get<ApiVersionSummaryBean[]>(url, this.httpOptions).pipe(
map(apiVersions => {
apiVersions.sort((a, b) => {

MODIFY
src/app/services/config/config.service.ts
src/app/services/config/config.service.ts
@@ -37,4 +37,8 @@ export class ConfigService {
getLanguage(): string {
return this.config.language;
}
+
+ getEndpoint(): string {
+ return this.config.endpoint;
+ }
}

feat: apiman endpoint via config