cloudflare
Version:
The official TypeScript library for the Cloudflare API
64 lines • 2.53 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as ConfigsAPI from 'cloudflare/resources/hyperdrive/configs';
import { SinglePage } from 'cloudflare/pagination';
export class Configs extends APIResource {
/**
* Creates and returns a new Hyperdrive configuration.
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(`/accounts/${account_id}/hyperdrive/configs`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Updates and returns the specified Hyperdrive configuration.
*/
update(hyperdriveId, params, options) {
const { account_id, ...body } = params;
return this._client.put(`/accounts/${account_id}/hyperdrive/configs/${hyperdriveId}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Returns a list of Hyperdrives
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList(`/accounts/${account_id}/hyperdrive/configs`, ConfigListResponsesSinglePage, options);
}
/**
* Deletes the specified Hyperdrive.
*/
delete(hyperdriveId, params, options) {
const { account_id } = params;
return this._client.delete(`/accounts/${account_id}/hyperdrive/configs/${hyperdriveId}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Patches and returns the specified Hyperdrive configuration. Updates to the
* origin and caching settings are applied with an all-or-nothing approach.
*/
edit(hyperdriveId, params, options) {
const { account_id, ...body } = params;
return this._client.patch(`/accounts/${account_id}/hyperdrive/configs/${hyperdriveId}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Returns the specified Hyperdrive configuration.
*/
get(hyperdriveId, params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/hyperdrive/configs/${hyperdriveId}`, options)._thenUnwrap((obj) => obj.result);
}
}
export class ConfigListResponsesSinglePage extends SinglePage {
}
(function (Configs) {
Configs.ConfigListResponsesSinglePage = ConfigsAPI.ConfigListResponsesSinglePage;
})(Configs || (Configs = {}));
//# sourceMappingURL=configs.mjs.map