cloudflare
Version:
The official TypeScript library for the Cloudflare API
43 lines • 1.64 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as BucketsAPI from 'cloudflare/resources/r2/buckets';
import { CursorPagination } from 'cloudflare/pagination';
export class Buckets extends APIResource {
/**
* Creates a new R2 bucket.
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(`/accounts/${account_id}/r2/buckets`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Lists all R2 buckets on your account
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(`/accounts/${account_id}/r2/buckets`, BucketsCursorPagination, {
query,
...options,
});
}
/**
* Deletes an existing R2 bucket.
*/
delete(bucketName, params, options) {
const { account_id } = params;
return this._client.delete(`/accounts/${account_id}/r2/buckets/${bucketName}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Gets metadata for an existing R2 bucket.
*/
get(bucketName, params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}`, options)._thenUnwrap((obj) => obj.result);
}
}
export class BucketsCursorPagination extends CursorPagination {
}
(function (Buckets) {
Buckets.BucketsCursorPagination = BucketsAPI.BucketsCursorPagination;
})(Buckets || (Buckets = {}));
//# sourceMappingURL=buckets.mjs.map