Skip to content

Commit 04cadc0

Browse files
authored
Make baseUrl mandatory, environment non mandatory (#10)
1 parent 7e1b332 commit 04cadc0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/CustomClient.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as core from "./core";
12
import {
23
WrappedAgentVersions,
34
WrappedApplications,
@@ -11,8 +12,13 @@ import {
1112
} from "./api/resources/_WrappedClients";
1213
import { TrueFoundryClient as BaseTrueFoundryClient } from "./Client";
1314

15+
export interface TrueFoundryClientOptions extends Omit<BaseTrueFoundryClient.Options, 'environment'> {
16+
baseUrl: core.Supplier<string>;
17+
environment?: core.Supplier<string>;
18+
}
1419

1520
export class TrueFoundryClient extends BaseTrueFoundryClient {
21+
protected readonly _options: BaseTrueFoundryClient.Options;
1622
protected _agentVersions: WrappedAgentVersions | undefined;
1723
protected _applications: WrappedApplications | undefined;
1824
protected _artifactVersions: WrappedArtifactVersions | undefined;
@@ -23,6 +29,12 @@ export class TrueFoundryClient extends BaseTrueFoundryClient {
2329
protected _tracingProjects: WrappedTracingProjects | undefined;
2430
protected _workspaces: WrappedWorkspaces | undefined;
2531

32+
constructor(_options: TrueFoundryClientOptions) {
33+
const options = {..._options, environment: _options.environment ?? ''}
34+
super(options);
35+
this._options = options;
36+
}
37+
2638
public get agentVersions(): WrappedAgentVersions {
2739
return (this._agentVersions ??= new WrappedAgentVersions(this._options));
2840
}

0 commit comments

Comments
 (0)