cloudflare
Version:
The official TypeScript library for the Cloudflare API
33 lines • 1.46 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
export class Bulk extends APIResource {
/**
* Write multiple keys and values at once. Body should be an array of up to 10,000
* key-value pairs to be stored, along with optional expiration information.
* Existing values and expirations will be overwritten. If neither `expiration` nor
* `expiration_ttl` is specified, the key-value pair will never expire. If both are
* set, `expiration_ttl` is used and `expiration` is ignored. The entire request
* size must be 100 megabytes or less.
*/
update(namespaceId, params, options) {
const { account_id, body } = params;
return this._client.put(`/accounts/${account_id}/storage/kv/namespaces/${namespaceId}/bulk`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Remove multiple KV pairs from the namespace. Body should be an array of up to
* 10,000 keys to be removed.
*/
delete(namespaceId, params, options) {
const { account_id, body } = params;
return this._client.delete(`/accounts/${account_id}/storage/kv/namespaces/${namespaceId}/bulk`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
(function (Bulk) {
})(Bulk || (Bulk = {}));
//# sourceMappingURL=bulk.mjs.map