cloudflare
Version:
The official TypeScript library for the Cloudflare API
163 lines • 6.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Events = exports.BaseEvents = void 0;
const tslib_1 = require("../../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const DetailsAPI = tslib_1.__importStar(require("./details.js"));
const details_1 = require("./details.js");
const pagination_1 = require("../../../core/pagination.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseEvents = /* @__PURE__ */ (() => {
class BaseEvents extends resource_1.APIResource {
/**
* Only available for the Waiting Room Advanced subscription. Creates an event for
* a waiting room. An event takes place during a specified period of time,
* temporarily changing the behavior of a waiting room. While the event is active,
* some of the properties in the event's configuration may either override or
* inherit from the waiting room's configuration. Note that events cannot overlap
* with each other, so only one event can be active at a time.
*
* @example
* ```ts
* const event = await client.waitingRooms.events.create(
* '699d98642c564d2e855e9661899b7252',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* event_end_time: '2021-09-28T17:00:00Z',
* event_start_time: '2021-09-28T15:30:00Z',
* name: 'production_webinar_event',
* },
* );
* ```
*/
create(waitingRoomID, params, options) {
const { zone_id, ...body } = params;
return this._client.post((0, path_1.path) `/zones/${zone_id}/waiting_rooms/${waitingRoomID}/events`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Updates a configured event for a waiting room.
*
* @example
* ```ts
* const event = await client.waitingRooms.events.update(
* '25756b2dfe6e378a06b033b670413757',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* waiting_room_id: '699d98642c564d2e855e9661899b7252',
* event_end_time: '2021-09-28T17:00:00Z',
* event_start_time: '2021-09-28T15:30:00Z',
* name: 'production_webinar_event',
* },
* );
* ```
*/
update(eventID, params, options) {
const { zone_id, waiting_room_id, ...body } = params;
return this._client.put((0, path_1.path) `/zones/${zone_id}/waiting_rooms/${waiting_room_id}/events/${eventID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists events for a waiting room.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const event of client.waitingRooms.events.list(
* '699d98642c564d2e855e9661899b7252',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(waitingRoomID, params, options) {
const { zone_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/waiting_rooms/${waitingRoomID}/events`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Deletes an event for a waiting room.
*
* @example
* ```ts
* const event = await client.waitingRooms.events.delete(
* '25756b2dfe6e378a06b033b670413757',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* waiting_room_id: '699d98642c564d2e855e9661899b7252',
* },
* );
* ```
*/
delete(eventID, params, options) {
const { zone_id, waiting_room_id } = params;
return this._client.delete((0, path_1.path) `/zones/${zone_id}/waiting_rooms/${waiting_room_id}/events/${eventID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Patches a configured event for a waiting room.
*
* @example
* ```ts
* const event = await client.waitingRooms.events.edit(
* '25756b2dfe6e378a06b033b670413757',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* waiting_room_id: '699d98642c564d2e855e9661899b7252',
* event_end_time: '2021-09-28T17:00:00Z',
* event_start_time: '2021-09-28T15:30:00Z',
* name: 'production_webinar_event',
* },
* );
* ```
*/
edit(eventID, params, options) {
const { zone_id, waiting_room_id, ...body } = params;
return this._client.patch((0, path_1.path) `/zones/${zone_id}/waiting_rooms/${waiting_room_id}/events/${eventID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches a single configured event for a waiting room.
*
* @example
* ```ts
* const event = await client.waitingRooms.events.get(
* '25756b2dfe6e378a06b033b670413757',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* waiting_room_id: '699d98642c564d2e855e9661899b7252',
* },
* );
* ```
*/
get(eventID, params, options) {
const { zone_id, waiting_room_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/waiting_rooms/${waiting_room_id}/events/${eventID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseEvents._key = Object.freeze([
'waitingRooms',
'events',
]);
return BaseEvents;
})();
exports.BaseEvents = BaseEvents;
var Events = /* @__PURE__ */ (() => {
class Events extends BaseEvents {
constructor() {
super(...arguments);
this.details = new DetailsAPI.Details(this._client);
}
}
Events.Details = details_1.Details;
Events.BaseDetails = details_1.BaseDetails;
return Events;
})();
exports.Events = Events;
//# sourceMappingURL=events.js.map