class DoltDatabaseClient {
constructor({
host = "https://www.dolthub.com",
owner,
repo,
branch = "main",
origin = `${host}/api/v1alpha1/${owner}/${repo}/${branch}`
}) {
this.origin = `${origin}`;
}
async sql(strings, ...args) {
if (strings.length > 1) throw new Error("query parameters not supported");
return fetch(`${this.origin}?${new URLSearchParams({q: strings[0]})}`)
.then(response => response.json())
.then(formatResults);
}
}