Hi,
In v9.1 I've developed a custom api , created and imported the generated imx-api-ccc.tgz into my custom app and placed the .dll file in the bin directory of the Apiserver. Tested and working alright with the swagger-ui .
Now, following the source code for other apps I've created an api.service.ts just as follows:
/*
* ONE IDENTITY LLC. PROPRIETARY INFORMATION
*
* This software is confidential. One Identity, LLC. or one of its affiliates or
* subsidiaries, has supplied this software to you under terms of a
* license agreement, nondisclosure agreement or both.
*
* You may not copy, disclose, or use this software except in accordance with
* those terms.
*
*
* Copyright 2022 One Identity LLC.
* ALL RIGHTS RESERVED.
*
* ONE IDENTITY LLC. MAKES NO REPRESENTATIONS OR
* WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR
* NON-INFRINGEMENT. ONE IDENTITY LLC. SHALL NOT BE
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
* AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
* THIS SOFTWARE OR ITS DERIVATIVES.
*
*/
import { Injectable } from '@angular/core';
import { V2Client, TypedClient } from 'imx-api-ccc';
import { ApiClient } from 'imx-qbm-dbts';
import { AppConfigService, ClassloggerService, ImxTranslationProviderService } from 'qbm';
@Injectable({
providedIn: 'root'
})
export class ApiService {
private tc: TypedClient;
public get typedClient(): TypedClient {
return this.tc;
}
private c: V2Client;
public get client(): V2Client {
return this.c;
}
public get apiClient(): ApiClient {
return this.config.apiClient;
}
constructor(
private readonly config: AppConfigService,
private readonly logger: ClassloggerService,
private readonly translationProvider: ImxTranslationProviderService) {
try {
console.log('Initializing API service');
// Use schema loaded by QBM client
const schemaProvider = config.client;
this.c = new V2Client(this.config.apiClient, schemaProvider);
//this.tc = new TypedClient(this.c, this.translationProvider);
} catch (e) {
this.logger.error(this, e);
}
}
}
When I run the app I get an error in the constructor:
Initializing API service
main.js:1 undefined
main.js:1 2023-05-30T06:54:07.360Z ERROR [main.js:1] Error: The value for the apiClient parameter is undefined.
at new t (main.js:1:3459831)
at new t (main.js:1:3461433)
at t.ɵfac [as factory] (main.js:1:3461646)
at $t.hydrate (main.js:1:835849)
at $t.get (main.js:1:833844)
at Oi (main.js:1:799819)
at J (main.js:1:799919)
at t.ɵfac [as factory] (main.js:1:5300378)
at $t.hydrate (main.js:1:835849)
at $t.get (main.js:1:833844)
Caller: t
It looks like there's something wrong with the config.apiClient object which I don't seem to be able to solve. Any hints? Any other help regarding the AppConfigService class would also be very very much appreciated.
Thanks!