// File generated from our OpenAPI spec by Stainless.
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`, R2BucketsCursorPagination, {
            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 R2BucketsCursorPagination extends CursorPagination {
}
(function (Buckets) {
    Buckets.R2BucketsCursorPagination = BucketsAPI.R2BucketsCursorPagination;
})(Buckets || (Buckets = {}));
//# sourceMappingURL=buckets.mjs.map