'use strict';
class ApiClient {
constructor(fetcher) {
this.fetcher = fetcher;
}
baseUrl = "";
setBaseUrl(baseUrl) {
this.baseUrl = baseUrl;
return this;
}
//
get(path, ...params) {
return this.fetcher("get", this.baseUrl + path, params[0]);
}
//
//
post(path, ...params) {
return this.fetcher("post", this.baseUrl + path, params[0]);
}
//
//
delete(path, ...params) {
return this.fetcher("delete", this.baseUrl + path, params[0]);
}
//
//
patch(path, ...params) {
return this.fetcher("patch", this.baseUrl + path, params[0]);
}
//
//
put(path, ...params) {
return this.fetcher("put", this.baseUrl + path, params[0]);
}
//
}
function createApiClient(fetcher, baseUrl) {
return new ApiClient(fetcher).setBaseUrl(baseUrl ?? "");
}
exports.ApiClient = ApiClient;
exports.createApiClient = createApiClient;