cloudflare
Version:
The official TypeScript library for the Cloudflare API
205 lines (177 loc) • 5.49 kB
text/typescript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as ConfigAPI from './config';
import { BaseConfig, Config, ConfigGetParams, ConfigUpdateParams, Configuration } from './config';
import * as DefaultAPI from './default';
import { BaseDefault, Default, DefaultGetParams } from './default';
import * as ExportAPI from './export';
import { BaseExport, Export, ExportGetParams } from './export';
import * as PublishAPI from './publish';
import { BasePublish, Publish, PublishCreateParams, PublishCreateResponse } from './publish';
import * as WorkflowAPI from './workflow';
import { BaseWorkflowResource, Workflow, WorkflowGetParams, WorkflowResource } from './workflow';
import * as HistoryAPI from './history/history';
import {
BaseHistory,
History,
HistoryListParams,
HistoryListResponse,
HistoryListResponsesSinglePage,
HistoryUpdateParams,
} from './history/history';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class BaseZaraz extends APIResource {
static override readonly _key: readonly ['zaraz'] = Object.freeze(['zaraz'] as const);
/**
* Updates Zaraz workflow for a zone.
*
* @example
* ```ts
* const workflow = await client.zaraz.update({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* workflow: 'realtime',
* });
* ```
*/
update(params: ZarazUpdateParams, options?: RequestOptions): APIPromise<WorkflowAPI.Workflow> {
const { zone_id, workflow } = params;
return (
this._client.put(path`/zones/${zone_id}/settings/zaraz/workflow`, {
body: workflow,
...options,
}) as APIPromise<{ result: WorkflowAPI.Workflow }>
)._thenUnwrap((obj) => obj.result);
}
}
export class Zaraz extends BaseZaraz {
config: ConfigAPI.Config = new ConfigAPI.Config(this._client);
default: DefaultAPI.Default = new DefaultAPI.Default(this._client);
export: ExportAPI.Export = new ExportAPI.Export(this._client);
history: HistoryAPI.History = new HistoryAPI.History(this._client);
publish: PublishAPI.Publish = new PublishAPI.Publish(this._client);
workflow: WorkflowAPI.WorkflowResource = new WorkflowAPI.WorkflowResource(this._client);
}
export interface ButtonTextTranslation {
/**
* Object where keys are language codes.
*/
accept_all: { [key: string]: string };
/**
* Object where keys are language codes.
*/
confirm_my_choices: { [key: string]: string };
/**
* Object where keys are language codes.
*/
reject_all: { [key: string]: string };
}
export interface ButtonTextTranslationParam {
/**
* Object where keys are language codes.
*/
accept_all: { [key: string]: string };
/**
* Object where keys are language codes.
*/
confirm_my_choices: { [key: string]: string };
/**
* Object where keys are language codes.
*/
reject_all: { [key: string]: string };
}
export interface NeoEvent {
/**
* Tool event type.
*/
actionType: string;
/**
* List of blocking triggers IDs.
*/
blockingTriggers: Array<string>;
/**
* Event payload.
*/
data: unknown;
/**
* List of firing triggers IDs.
*/
firingTriggers: Array<string>;
}
export interface NeoEventParam {
/**
* Tool event type.
*/
actionType: string;
/**
* List of blocking triggers IDs.
*/
blockingTriggers: Array<string>;
/**
* Event payload.
*/
data: unknown;
/**
* List of firing triggers IDs.
*/
firingTriggers: Array<string>;
}
export interface ZarazUpdateParams {
/**
* Path param: Identifier.
*/
zone_id: string;
/**
* Body param: Zaraz workflow.
*/
workflow: WorkflowAPI.WorkflowParam;
}
Zaraz.Config = Config;
Zaraz.BaseConfig = BaseConfig;
Zaraz.Default = Default;
Zaraz.BaseDefault = BaseDefault;
Zaraz.Export = Export;
Zaraz.BaseExport = BaseExport;
Zaraz.History = History;
Zaraz.BaseHistory = BaseHistory;
Zaraz.Publish = Publish;
Zaraz.BasePublish = BasePublish;
Zaraz.WorkflowResource = WorkflowResource;
Zaraz.BaseWorkflowResource = BaseWorkflowResource;
export declare namespace Zaraz {
export {
type ButtonTextTranslation as ButtonTextTranslation,
type NeoEvent as NeoEvent,
type ZarazUpdateParams as ZarazUpdateParams,
};
export {
Config as Config,
BaseConfig as BaseConfig,
type Configuration as Configuration,
type ConfigUpdateParams as ConfigUpdateParams,
type ConfigGetParams as ConfigGetParams,
};
export { Default as Default, BaseDefault as BaseDefault, type DefaultGetParams as DefaultGetParams };
export { Export as Export, BaseExport as BaseExport, type ExportGetParams as ExportGetParams };
export {
History as History,
BaseHistory as BaseHistory,
type HistoryListResponse as HistoryListResponse,
type HistoryListResponsesSinglePage as HistoryListResponsesSinglePage,
type HistoryUpdateParams as HistoryUpdateParams,
type HistoryListParams as HistoryListParams,
};
export {
Publish as Publish,
BasePublish as BasePublish,
type PublishCreateResponse as PublishCreateResponse,
type PublishCreateParams as PublishCreateParams,
};
export {
WorkflowResource as WorkflowResource,
BaseWorkflowResource as BaseWorkflowResource,
type Workflow as Workflow,
type WorkflowGetParams as WorkflowGetParams,
};
}