MCPcopy Create free account
hub / github.com/observablehq/framework / constructor

Method constructor

src/observableApiClient.ts:47–56  ·  view source on GitHub ↗
({apiKey, apiOrigin = getObservableApiOrigin(), clack}: ObservableApiClientOptions)

Source from the content-addressed store, hash-verified

45 private _rateLimit: null | Promise<void> = null;
46
47 constructor({apiKey, apiOrigin = getObservableApiOrigin(), clack}: ObservableApiClientOptions) {
48 this._apiOrigin = apiOrigin;
49 this._apiHeaders = {
50 Accept: "application/json",
51 "User-Agent": `Observable Framework ${process.env.npm_package_version}`,
52 "X-Observable-Api-Version": "2023-12-06"
53 };
54 this._clack = clack;
55 if (apiKey) this.setApiKey(apiKey);
56 }
57
58 public setApiKey(apiKey: ApiKey): void {
59 this._apiHeaders["Authorization"] = `apikey ${apiKey.key}`;

Callers

nothing calls this directly

Calls 2

setApiKeyMethod · 0.95
getObservableApiOriginFunction · 0.85

Tested by

no test coverage detected