portal-sdk/src/sdk.ts

22 lines
420 B
TypeScript
Raw Normal View History

2024-03-13 14:22:23 +00:00
import AccountApi from "./account.js";
2024-03-06 21:51:23 +00:00
export class Sdk {
2024-03-13 14:22:23 +00:00
private apiUrl: string;
private accountApi?: AccountApi;
2024-03-06 21:51:23 +00:00
2024-03-13 14:22:23 +00:00
constructor(apiUrl: string) {
this.apiUrl = apiUrl;
}
2024-03-06 21:51:23 +00:00
2024-03-13 14:22:23 +00:00
public static create(apiUrl: string): Sdk {
return new Sdk(apiUrl);
}
2024-03-06 21:51:23 +00:00
2024-03-13 14:22:23 +00:00
public account(): AccountApi {
if (!this.accountApi) {
this.accountApi = AccountApi.create(this.apiUrl);
2024-03-06 21:51:23 +00:00
}
2024-03-13 14:22:23 +00:00
return this.accountApi;
}
2024-03-06 21:51:23 +00:00
}