donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
33 lines • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DonobuApiClient = void 0;
/**
* Base class for DonobuApi persistence implementations.
* Provides reusable HTTP request helpers for communicating with the
* Donobu cloud API.
*/
class DonobuApiClient {
constructor(baseUrl, apiKey) {
this.baseUrl = baseUrl;
this.apiKey = apiKey;
}
async request(path, init) {
const url = `${this.baseUrl}${path}`;
return fetch(url, {
...init,
headers: {
Authorization: `Bearer ${this.apiKey}`,
...init.headers,
},
});
}
async jsonRequest(path, method, body) {
return this.request(path, {
method,
headers: body !== undefined ? { 'Content-Type': 'application/json' } : {},
body: body !== undefined ? JSON.stringify(body) : undefined,
});
}
}
exports.DonobuApiClient = DonobuApiClient;
//# sourceMappingURL=DonobuApiClient.js.map