UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

86 lines 3.43 kB
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. Object.defineProperty(exports, "__esModule", { value: true }); exports.Custom = void 0; const resource_1 = require("../../../../resource.js"); class Custom extends resource_1.APIResource { /** * Register a new custom domain for an existing R2 bucket. */ create(bucketName, params, options) { const { account_id, jurisdiction, ...body } = params; return this._client.post(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom`, { body, ...options, headers: { ...(jurisdiction?.toString() != null ? { 'cf-r2-jurisdiction': jurisdiction?.toString() } : undefined), ...options?.headers, }, })._thenUnwrap((obj) => obj.result); } /** * Edit the configuration for a custom domain on an existing R2 bucket. */ update(bucketName, domain, params, options) { const { account_id, jurisdiction, ...body } = params; return this._client.put(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom/${domain}`, { body, ...options, headers: { ...(jurisdiction?.toString() != null ? { 'cf-r2-jurisdiction': jurisdiction?.toString() } : undefined), ...options?.headers, }, })._thenUnwrap((obj) => obj.result); } /** * Gets a list of all custom domains registered with an existing R2 bucket. */ list(bucketName, params, options) { const { account_id, jurisdiction } = params; return this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom`, { ...options, headers: { ...(jurisdiction?.toString() != null ? { 'cf-r2-jurisdiction': jurisdiction?.toString() } : undefined), ...options?.headers, }, })._thenUnwrap((obj) => obj.result); } /** * Remove custom domain registration from an existing R2 bucket */ delete(bucketName, domain, params, options) { const { account_id, jurisdiction } = params; return this._client.delete(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom/${domain}`, { ...options, headers: { ...(jurisdiction?.toString() != null ? { 'cf-r2-jurisdiction': jurisdiction?.toString() } : undefined), ...options?.headers, }, })._thenUnwrap((obj) => obj.result); } /** * Get the configuration for a custom domain on an existing R2 bucket. */ get(bucketName, domain, params, options) { const { account_id, jurisdiction } = params; return this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom/${domain}`, { ...options, headers: { ...(jurisdiction?.toString() != null ? { 'cf-r2-jurisdiction': jurisdiction?.toString() } : undefined), ...options?.headers, }, })._thenUnwrap((obj) => obj.result); } } exports.Custom = Custom; //# sourceMappingURL=custom.js.map