cloudflare
Version:
The official TypeScript library for the Cloudflare API
79 lines • 2.71 kB
JavaScript
;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.SippyResource = void 0;
const resource_1 = require("../../../resource.js");
class SippyResource extends resource_1.APIResource {
/**
* Sets configuration for Sippy for an existing R2 bucket.
*
* @example
* ```ts
* const sippy = await client.r2.buckets.sippy.update(
* 'example-bucket',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
update(bucketName, params, options) {
const { account_id, jurisdiction, ...body } = params;
return this._client.put(`/accounts/${account_id}/r2/buckets/${bucketName}/sippy`, {
body,
...options,
headers: {
...(jurisdiction?.toString() != null ?
{ 'cf-r2-jurisdiction': jurisdiction?.toString() }
: undefined),
...options?.headers,
},
})._thenUnwrap((obj) => obj.result);
}
/**
* Disables Sippy on this bucket.
*
* @example
* ```ts
* const sippy = await client.r2.buckets.sippy.delete(
* 'example-bucket',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(bucketName, params, options) {
const { account_id, jurisdiction } = params;
return this._client.delete(`/accounts/${account_id}/r2/buckets/${bucketName}/sippy`, {
...options,
headers: {
...(jurisdiction?.toString() != null ?
{ 'cf-r2-jurisdiction': jurisdiction?.toString() }
: undefined),
...options?.headers,
},
})._thenUnwrap((obj) => obj.result);
}
/**
* Gets configuration for Sippy for an existing R2 bucket.
*
* @example
* ```ts
* const sippy = await client.r2.buckets.sippy.get(
* 'example-bucket',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(bucketName, params, options) {
const { account_id, jurisdiction } = params;
return this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/sippy`, {
...options,
headers: {
...(jurisdiction?.toString() != null ?
{ 'cf-r2-jurisdiction': jurisdiction?.toString() }
: undefined),
...options?.headers,
},
})._thenUnwrap((obj) => obj.result);
}
}
exports.SippyResource = SippyResource;
//# sourceMappingURL=sippy.js.map