cloudflare
Version:
The official TypeScript library for the Cloudflare API
44 lines • 1.63 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
export class Consumers extends APIResource {
/**
* Creates a new consumer for a queue.
*/
create(queueId, params, options) {
const { account_id, body } = params;
return this._client.post(`/accounts/${account_id}/queues/${queueId}/consumers`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Updates the consumer for a queue, or creates one if it does not exist.
*/
update(queueId, consumerId, params, options) {
const { account_id, body } = params;
return this._client.put(`/accounts/${account_id}/queues/${queueId}/consumers/${consumerId}`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Deletes the consumer for a queue.
*/
delete(queueId, consumerId, params, options) {
const { account_id, body } = params;
return this._client.delete(`/accounts/${account_id}/queues/${queueId}/consumers/${consumerId}`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Returns the consumers for a queue.
*/
get(queueId, params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/queues/${queueId}/consumers`, options)._thenUnwrap((obj) => obj.result);
}
}
(function (Consumers) {
})(Consumers || (Consumers = {}));
//# sourceMappingURL=consumers.mjs.map