INNER CODE UNIT · TypeScript

SandstormClient

tomascupr/sandstorm · clients/typescript/src/index.ts:22

export class SandstormClient {
  readonly baseUrl: string;
  private readonly apiKey?: string;
  private readonly fetchImpl: typeof globalThis.fetch;

  constructor(options: ClientOptions) {
    if (!options.baseUrl) {
      throw new Error("SandstormClient: baseUrl is required");
    }
    this.baseUrl = options.baseUrl.replace(/\/$/, "");
    this.apiKey = options.apiKey;
    this.fetchImpl = options.fetch ?? globalThis.fetch;
    if (!this.fetchImpl) {
      throw new Error(
        "SandstormClient: no fetch available — pass options.fetch or upgrade to Node 18+",
      );
    }
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…