cloudflare
Version:
The official TypeScript library for the Cloudflare API
57 lines • 2.24 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
export class Routes extends APIResource {
/**
* Creates a new Magic static route. Use `?validate_only=true` as an optional query
* parameter to run validation only without persisting changes.
*/
create(params, options) {
const { account_id, body } = params;
return this._client.post(`/accounts/${account_id}/magic/routes`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Update a specific Magic static route. Use `?validate_only=true` as an optional
* query parameter to run validation only without persisting changes.
*/
update(routeIdentifier, params, options) {
const { account_id, ...body } = params;
return this._client.put(`/accounts/${account_id}/magic/routes/${routeIdentifier}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List all Magic static routes.
*/
list(params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/magic/routes`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Disable and remove a specific Magic static route.
*/
delete(routeIdentifier, params, options) {
const { account_id } = params;
return this._client.delete(`/accounts/${account_id}/magic/routes/${routeIdentifier}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Delete multiple Magic static routes.
*/
empty(params, options) {
const { account_id, ...body } = params;
return this._client.delete(`/accounts/${account_id}/magic/routes`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Get a specific Magic static route.
*/
get(routeIdentifier, params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/magic/routes/${routeIdentifier}`, options)._thenUnwrap((obj) => obj.result);
}
}
(function (Routes) {
})(Routes || (Routes = {}));
//# sourceMappingURL=routes.mjs.map