cloudflare
Version:
The official TypeScript library for the Cloudflare API
157 lines (141 loc) • 4.94 kB
text/typescript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class BaseSettings extends APIResource {
static override readonly _key: readonly ['waitingRooms', 'settings'] = Object.freeze([
'waitingRooms',
'settings',
] as const);
/**
* Replace zone-level Waiting Room settings.
*
* @example
* ```ts
* const setting = await client.waitingRooms.settings.update({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
update(params: SettingUpdateParams, options?: RequestOptions): APIPromise<SettingUpdateResponse | null> {
const { zone_id, ...body } = params;
return (
this._client.put(path`/zones/${zone_id}/waiting_rooms/settings`, { body, ...options }) as APIPromise<{
result: SettingUpdateResponse | null;
}>
)._thenUnwrap((obj) => obj.result);
}
/**
* Patch zone-level Waiting Room settings.
*
* @example
* ```ts
* const response = await client.waitingRooms.settings.edit({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
edit(params: SettingEditParams, options?: RequestOptions): APIPromise<SettingEditResponse | null> {
const { zone_id, ...body } = params;
return (
this._client.patch(path`/zones/${zone_id}/waiting_rooms/settings`, { body, ...options }) as APIPromise<{
result: SettingEditResponse | null;
}>
)._thenUnwrap((obj) => obj.result);
}
/**
* Get zone-level Waiting Room settings.
*
* @example
* ```ts
* const setting = await client.waitingRooms.settings.get({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
get(params: SettingGetParams, options?: RequestOptions): APIPromise<SettingGetResponse | null> {
const { zone_id } = params;
return (
this._client.get(path`/zones/${zone_id}/waiting_rooms/settings`, options) as APIPromise<{
result: SettingGetResponse | null;
}>
)._thenUnwrap((obj) => obj.result);
}
}
export class Settings extends BaseSettings {}
export interface Setting {
/**
* Whether to allow verified search engine crawlers to bypass all waiting rooms on
* this zone. Verified search engine crawlers will not be tracked or counted by the
* waiting room system, and will not appear in waiting room analytics.
*/
search_engine_crawler_bypass: boolean;
}
export interface SettingUpdateResponse {
/**
* Whether to allow verified search engine crawlers to bypass all waiting rooms on
* this zone. Verified search engine crawlers will not be tracked or counted by the
* waiting room system, and will not appear in waiting room analytics.
*/
search_engine_crawler_bypass: boolean;
}
export interface SettingEditResponse {
/**
* Whether to allow verified search engine crawlers to bypass all waiting rooms on
* this zone. Verified search engine crawlers will not be tracked or counted by the
* waiting room system, and will not appear in waiting room analytics.
*/
search_engine_crawler_bypass: boolean;
}
export interface SettingGetResponse {
/**
* Whether to allow verified search engine crawlers to bypass all waiting rooms on
* this zone. Verified search engine crawlers will not be tracked or counted by the
* waiting room system, and will not appear in waiting room analytics.
*/
search_engine_crawler_bypass: boolean;
}
export interface SettingUpdateParams {
/**
* Path param: Identifier.
*/
zone_id: string;
/**
* Body param: Whether to allow verified search engine crawlers to bypass all
* waiting rooms on this zone. Verified search engine crawlers will not be tracked
* or counted by the waiting room system, and will not appear in waiting room
* analytics.
*/
search_engine_crawler_bypass?: boolean;
}
export interface SettingEditParams {
/**
* Path param: Identifier.
*/
zone_id: string;
/**
* Body param: Whether to allow verified search engine crawlers to bypass all
* waiting rooms on this zone. Verified search engine crawlers will not be tracked
* or counted by the waiting room system, and will not appear in waiting room
* analytics.
*/
search_engine_crawler_bypass?: boolean;
}
export interface SettingGetParams {
/**
* Identifier.
*/
zone_id: string;
}
export declare namespace Settings {
export {
type Setting as Setting,
type SettingUpdateResponse as SettingUpdateResponse,
type SettingEditResponse as SettingEditResponse,
type SettingGetResponse as SettingGetResponse,
type SettingUpdateParams as SettingUpdateParams,
type SettingEditParams as SettingEditParams,
type SettingGetParams as SettingGetParams,
};
}