cloudflare
Version:
The official TypeScript library for the Cloudflare API
47 lines • 1.72 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as DomainsAPI from 'cloudflare/resources/workers/domains';
import { SinglePage } from 'cloudflare/pagination';
export class Domains extends APIResource {
/**
* Attaches a Worker to a zone and hostname.
*/
update(params, options) {
const { account_id, ...body } = params;
return this._client.put(`/accounts/${account_id}/workers/domains`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Lists all Worker Domains for an account.
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(`/accounts/${account_id}/workers/domains`, DomainsSinglePage, {
query,
...options,
});
}
/**
* Detaches a Worker from a zone and hostname.
*/
delete(domainId, params, options) {
const { account_id, body } = params;
return this._client.delete(`/accounts/${account_id}/workers/domains/${domainId}`, {
body: body,
...options,
headers: { Accept: '*/*', ...options?.headers },
});
}
/**
* Gets a Worker domain.
*/
get(domainId, params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/workers/domains/${domainId}`, options)._thenUnwrap((obj) => obj.result);
}
}
export class DomainsSinglePage extends SinglePage {
}
(function (Domains) {
Domains.DomainsSinglePage = DomainsAPI.DomainsSinglePage;
})(Domains || (Domains = {}));
//# sourceMappingURL=domains.mjs.map