@buildable/connections
Version:
Buildable is a fully managed event bus lets you send and receive data across mission-critical cloud apps, databases and warehouses.
44 lines (34 loc) • 798 B
text/typescript
interface ClientConfig {
environment?: "sandbox" | "production";
baseUrl?: string;
}
export class Client {
private secret: string;
private configs: ClientConfig;
constructor(secret: string, configs: ClientConfig = {}) {
this.secret = secret;
this.configs = configs;
}
/**
* Not for use outside the SDK lib
*/
get _clientInfo() {
return {
secret: this.secret,
configs: this.configs,
};
}
get _url() {
if (this.configs.baseUrl) {
return this.configs.baseUrl;
}
if (this.configs.environment === 'production') {
return 'https://api.event.dev';
}
//TODO: change this to sandbox
return 'https://development-stream.event.dev';
}
}
export const createClient = (secret: string, configs: ClientConfig = {}) => {
return new Client(secret, configs);
};