// AUTO-GENERATED by scripts/generate.ts from .generated-specs. Do not edit. import * as S from "@distilled.cloud/core/schema"; import * as API from "@distilled.cloud/core/api"; import * as T from "../traits.ts"; import { CloudflareProtocol, CloudflarePaginatedProtocol, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.ts"; import { cloudflarePaginate, ResultInfo } from "../pagination.ts"; import { CloudflareError, CloudflareRateLimited } from "../errors.ts"; import * as Retry from "../retry.ts"; export type { CloudflareOpError, CloudflareOpContext }; /** Fallback camelCase→wire mapping for opaque content (mined from the distilled SDK). */ const KEY_DICTIONARY: Record> = { autoInstall: "auto_install", deleteRules: "delete_rules", isPaused: "is_paused", perPage: "per_page", resultInfo: "result_info", siteTag: "site_tag", siteToken: "site_token", totalCount: "total_count", zoneName: "zone_name", zoneTag: "zone_tag", }; export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export class MaxRulesExceeded extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("MaxRulesExceeded", { code: S.Number, message: S.String, }), [{ status: 409, message: { includes: "maxRulesError" } }], ) {} export class RuleNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("RuleNotFound", { code: S.Number, message: S.String, }), [{ code: 10003 }], ) {} export class RulesetNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("RulesetNotFound", { code: S.Number, message: S.String, }), [{ status: 404 }], ) {} export class RumSiteQuotaExceeded extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "RumSiteQuotaExceeded", { code: S.Number, message: S.String, }, ), [{ code: 10014 }], ) {} export class SiteNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("SiteNotFound", { code: S.Number, message: S.String, }), [{ code: 10015 }], ) {} export type RulesBulkCreateRequestDeleteRulesList = Array; export const RulesBulkCreateRequestDeleteRulesList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type RulesBulkCreateRequestRulesItemPathsList = Array; export const RulesBulkCreateRequestRulesItemPathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface RulesBulkCreateRequestRulesItem { /** The Web Analytics rule identifier. */ id?: string; host?: string; inclusive?: boolean; isPaused?: boolean; paths?: RulesBulkCreateRequestRulesItemPathsList; } export const RulesBulkCreateRequestRulesItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.String), host: S.optional(S.String), inclusive: S.optional(S.Boolean), isPaused: S.optional(S.Boolean.pipe(T.Body("is_paused"))), paths: S.optional(RulesBulkCreateRequestRulesItemPathsList), }), ).annotate({ identifier: "RulesBulkCreateRequestRulesItem", }) as any as S.Schema; export type RulesBulkCreateRequestRulesList = Array; export const RulesBulkCreateRequestRulesList = /*@__PURE__*/ S.Array( RulesBulkCreateRequestRulesItem, ) as any as S.Schema; export interface BulkCreateRulesRequest { /** Identifier. */ accountId: string; /** The Web Analytics ruleset identifier. */ rulesetId: string; /** A list of rule identifiers to delete. */ deleteRules?: RulesBulkCreateRequestDeleteRulesList; /** A list of rules to create or update. */ rules?: RulesBulkCreateRequestRulesList; } export const BulkCreateRulesRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), rulesetId: S.String.pipe(T.Label("ruleset_id")), deleteRules: S.optional( RulesBulkCreateRequestDeleteRulesList.pipe(T.Body("delete_rules")), ), rules: S.optional(RulesBulkCreateRequestRulesList), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/rum/v2/{ruleset_id}/rules", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "BulkCreateRulesRequest", }) as any as S.Schema; export type RulesBulkCreateResponseRulesItemPathsList = Array; export const RulesBulkCreateResponseRulesItemPathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface RulesBulkCreateResponseRulesItem { /** The Web Analytics rule identifier. */ id?: string | null; created?: string | null; /** The hostname the rule will be applied to. */ host?: string | null; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean | null; /** Whether the rule is paused or not. */ isPaused?: boolean | null; /** The paths the rule will be applied to. */ paths?: RulesBulkCreateResponseRulesItemPathsList | null; priority?: number | null; } export const RulesBulkCreateResponseRulesItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), created: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), inclusive: S.optional(S.NullOr(S.Boolean)), isPaused: S.optional(S.NullOr(S.Boolean).pipe(T.Body("is_paused"))), paths: S.optional(S.NullOr(RulesBulkCreateResponseRulesItemPathsList)), priority: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "RulesBulkCreateResponseRulesItem", }) as any as S.Schema; export type RulesBulkCreateResponseRulesList = Array; export const RulesBulkCreateResponseRulesList = /*@__PURE__*/ S.Array( RulesBulkCreateResponseRulesItem, ) as any as S.Schema; export interface RulesBulkCreateResponseRuleset { /** The Web Analytics ruleset identifier. */ id?: string | null; /** Whether the ruleset is enabled. */ enabled?: boolean | null; zoneName?: string | null; /** The zone identifier. */ zoneTag?: string | null; } export const RulesBulkCreateResponseRuleset = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), enabled: S.optional(S.NullOr(S.Boolean)), zoneName: S.optional(S.NullOr(S.String).pipe(T.Body("zone_name"))), zoneTag: S.optional(S.NullOr(S.String).pipe(T.Body("zone_tag"))), }), ).annotate({ identifier: "RulesBulkCreateResponseRuleset", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface BulkCreateRulesResponse { /** A list of rules. */ rules?: RulesBulkCreateResponseRulesList | null; ruleset?: RulesBulkCreateResponseRuleset | null; } export const BulkCreateRulesResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ rules: S.optional(S.NullOr(RulesBulkCreateResponseRulesList)), ruleset: S.optional(S.NullOr(RulesBulkCreateResponseRuleset)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "BulkCreateRulesResponse", }) as any as S.Schema; export type RulesCreateRequestPathsList = Array; export const RulesCreateRequestPathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface CreateRuleRequest { /** Identifier. */ accountId: string; /** The Web Analytics ruleset identifier. */ rulesetId: string; host?: string; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean; /** Whether the rule is paused or not. */ isPaused?: boolean; paths?: RulesCreateRequestPathsList; } export const CreateRuleRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), rulesetId: S.String.pipe(T.Label("ruleset_id")), host: S.optional(S.String), inclusive: S.optional(S.Boolean), isPaused: S.optional(S.Boolean.pipe(T.Body("is_paused"))), paths: S.optional(RulesCreateRequestPathsList), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/rum/v2/{ruleset_id}/rule", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateRuleRequest", }) as any as S.Schema; export type RulesCreateResponsePathsList = Array; export const RulesCreateResponsePathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateRuleResponse { /** The Web Analytics rule identifier. */ id?: string | null; created?: string | null; /** The hostname the rule will be applied to. */ host?: string | null; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean | null; /** Whether the rule is paused or not. */ isPaused?: boolean | null; /** The paths the rule will be applied to. */ paths?: RulesCreateResponsePathsList | null; priority?: number | null; } export const CreateRuleResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), created: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), inclusive: S.optional(S.NullOr(S.Boolean)), isPaused: S.optional(S.NullOr(S.Boolean).pipe(T.Body("is_paused"))), paths: S.optional(S.NullOr(RulesCreateResponsePathsList)), priority: S.optional(S.NullOr(S.Number)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateRuleResponse", }) as any as S.Schema; export interface CreateSiteInfoRequest { /** Identifier. */ accountId: string; /** If enabled, the JavaScript snippet is automatically injected for orange-clouded sites. */ autoInstall?: boolean; /** The hostname to use for gray-clouded sites. */ host?: string; /** The zone identifier. */ zoneTag?: string; } export const CreateSiteInfoRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), autoInstall: S.optional(S.Boolean.pipe(T.Body("auto_install"))), host: S.optional(S.String), zoneTag: S.optional(S.String.pipe(T.Body("zone_tag"))), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/rum/site_info", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateSiteInfoRequest", }) as any as S.Schema; export type SiteInfoCreateResponseRulesItemPathsList = Array; export const SiteInfoCreateResponseRulesItemPathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface SiteInfoCreateResponseRulesItem { /** The Web Analytics rule identifier. */ id?: string | null; created?: string | null; /** The hostname the rule will be applied to. */ host?: string | null; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean | null; /** Whether the rule is paused or not. */ isPaused?: boolean | null; /** The paths the rule will be applied to. */ paths?: SiteInfoCreateResponseRulesItemPathsList | null; priority?: number | null; } export const SiteInfoCreateResponseRulesItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), created: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), inclusive: S.optional(S.NullOr(S.Boolean)), isPaused: S.optional(S.NullOr(S.Boolean).pipe(T.Body("is_paused"))), paths: S.optional(S.NullOr(SiteInfoCreateResponseRulesItemPathsList)), priority: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "SiteInfoCreateResponseRulesItem", }) as any as S.Schema; export type SiteInfoCreateResponseRulesList = Array; export const SiteInfoCreateResponseRulesList = /*@__PURE__*/ S.Array( SiteInfoCreateResponseRulesItem, ) as any as S.Schema; export type SiteInfoCreateResponseRuleset = RulesBulkCreateResponseRuleset; export const SiteInfoCreateResponseRuleset = RulesBulkCreateResponseRuleset; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateSiteInfoResponse { /** If enabled, the JavaScript snippet is automatically injected for orange-clouded sites. */ autoInstall?: boolean | null; created?: string | null; /** A list of rules. */ rules?: SiteInfoCreateResponseRulesList | null; ruleset?: RulesBulkCreateResponseRuleset | null; /** The Web Analytics site identifier. */ siteTag?: string | null; /** The Web Analytics site token. */ siteToken?: string | null; /** Encoded JavaScript snippet. */ snippet?: string | null; /** The hostname the site measures (gray-clouded sites). */ host?: string | null; } export const CreateSiteInfoResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ autoInstall: S.optional(S.NullOr(S.Boolean).pipe(T.Body("auto_install"))), created: S.optional(S.NullOr(S.String)), rules: S.optional(S.NullOr(SiteInfoCreateResponseRulesList)), ruleset: S.optional(S.NullOr(RulesBulkCreateResponseRuleset)), siteTag: S.optional(S.NullOr(S.String).pipe(T.Body("site_tag"))), siteToken: S.optional(S.NullOr(S.String).pipe(T.Body("site_token"))), snippet: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateSiteInfoResponse", }) as any as S.Schema; export interface DeleteRuleRequest { /** Identifier. */ accountId: string; /** The Web Analytics ruleset identifier. */ rulesetId: string; /** The Web Analytics rule identifier. */ ruleId: string; } export const DeleteRuleRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), rulesetId: S.String.pipe(T.Label("ruleset_id")), ruleId: S.String.pipe(T.Label("rule_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/rum/v2/{ruleset_id}/rule/{rule_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteRuleRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeleteRuleResponse { /** The Web Analytics rule identifier. */ id?: string | null; } export const DeleteRuleResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteRuleResponse", }) as any as S.Schema; export interface DeleteSiteInfoRequest { /** Identifier. */ accountId: string; /** Identifier. */ siteId: string; } export const DeleteSiteInfoRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), siteId: S.String.pipe(T.Label("site_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/rum/site_info/{site_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteSiteInfoRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeleteSiteInfoResponse { /** The Web Analytics site identifier. */ siteTag?: string | null; } export const DeleteSiteInfoResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ siteTag: S.optional(S.NullOr(S.String).pipe(T.Body("site_tag"))), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteSiteInfoResponse", }) as any as S.Schema; export interface GetSiteInfoRequest { /** Identifier. */ accountId: string; /** Identifier. */ siteId: string; } export const GetSiteInfoRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), siteId: S.String.pipe(T.Label("site_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/rum/site_info/{site_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetSiteInfoRequest", }) as any as S.Schema; export type SiteInfoGetResponseRulesItemPathsList = Array; export const SiteInfoGetResponseRulesItemPathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface SiteInfoGetResponseRulesItem { /** The Web Analytics rule identifier. */ id?: string | null; created?: string | null; /** The hostname the rule will be applied to. */ host?: string | null; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean | null; /** Whether the rule is paused or not. */ isPaused?: boolean | null; /** The paths the rule will be applied to. */ paths?: SiteInfoGetResponseRulesItemPathsList | null; priority?: number | null; } export const SiteInfoGetResponseRulesItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), created: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), inclusive: S.optional(S.NullOr(S.Boolean)), isPaused: S.optional(S.NullOr(S.Boolean).pipe(T.Body("is_paused"))), paths: S.optional(S.NullOr(SiteInfoGetResponseRulesItemPathsList)), priority: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "SiteInfoGetResponseRulesItem", }) as any as S.Schema; export type SiteInfoGetResponseRulesList = Array; export const SiteInfoGetResponseRulesList = /*@__PURE__*/ S.Array( SiteInfoGetResponseRulesItem, ) as any as S.Schema; export type SiteInfoGetResponseRuleset = RulesBulkCreateResponseRuleset; export const SiteInfoGetResponseRuleset = RulesBulkCreateResponseRuleset; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetSiteInfoResponse { /** If enabled, the JavaScript snippet is automatically injected for orange-clouded sites. */ autoInstall?: boolean | null; created?: string | null; /** A list of rules. */ rules?: SiteInfoGetResponseRulesList | null; ruleset?: RulesBulkCreateResponseRuleset | null; /** The Web Analytics site identifier. */ siteTag?: string | null; /** The Web Analytics site token. */ siteToken?: string | null; /** Encoded JavaScript snippet. */ snippet?: string | null; /** The hostname the site measures (gray-clouded sites). */ host?: string | null; } export const GetSiteInfoResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ autoInstall: S.optional(S.NullOr(S.Boolean).pipe(T.Body("auto_install"))), created: S.optional(S.NullOr(S.String)), rules: S.optional(S.NullOr(SiteInfoGetResponseRulesList)), ruleset: S.optional(S.NullOr(RulesBulkCreateResponseRuleset)), siteTag: S.optional(S.NullOr(S.String).pipe(T.Body("site_tag"))), siteToken: S.optional(S.NullOr(S.String).pipe(T.Body("site_token"))), snippet: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetSiteInfoResponse", }) as any as S.Schema; export interface ListRulesRequest { /** Identifier. */ accountId: string; /** The Web Analytics ruleset identifier. */ rulesetId: string; } export const ListRulesRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), rulesetId: S.String.pipe(T.Label("ruleset_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/rum/v2/{ruleset_id}/rules", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListRulesRequest", }) as any as S.Schema; export type RulesListResponseRulesItemPathsList = Array; export const RulesListResponseRulesItemPathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface RulesListResponseRulesItem { /** The Web Analytics rule identifier. */ id?: string | null; created?: string | null; /** The hostname the rule will be applied to. */ host?: string | null; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean | null; /** Whether the rule is paused or not. */ isPaused?: boolean | null; /** The paths the rule will be applied to. */ paths?: RulesListResponseRulesItemPathsList | null; priority?: number | null; } export const RulesListResponseRulesItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), created: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), inclusive: S.optional(S.NullOr(S.Boolean)), isPaused: S.optional(S.NullOr(S.Boolean).pipe(T.Body("is_paused"))), paths: S.optional(S.NullOr(RulesListResponseRulesItemPathsList)), priority: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "RulesListResponseRulesItem", }) as any as S.Schema; export type RulesListResponseRulesList = Array; export const RulesListResponseRulesList = /*@__PURE__*/ S.Array( RulesListResponseRulesItem, ) as any as S.Schema; export type RulesListResponseRuleset = RulesBulkCreateResponseRuleset; export const RulesListResponseRuleset = RulesBulkCreateResponseRuleset; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface ListRulesResponse { /** A list of rules. */ rules?: RulesListResponseRulesList | null; ruleset?: RulesBulkCreateResponseRuleset | null; } export const ListRulesResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ rules: S.optional(S.NullOr(RulesListResponseRulesList)), ruleset: S.optional(S.NullOr(RulesBulkCreateResponseRuleset)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListRulesResponse", }) as any as S.Schema; export type SiteInfoListRequestOrderBy = "host" | "created"; export const SiteInfoListRequestOrderBy = /*@__PURE__*/ S.String; export interface ListSiteInfosRequest { /** Identifier. */ accountId: string; /** The property used to sort the list of results. */ orderBy?: SiteInfoListRequestOrderBy | (string & {}); /** Current page within the paginated list of results. */ page?: number; /** Number of items to return per page of results. */ perPage?: number; } export const ListSiteInfosRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), orderBy: S.optional(SiteInfoListRequestOrderBy.pipe(T.Query("order_by"))), page: S.optional(S.Number.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/rum/site_info/list", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListSiteInfosRequest", }) as any as S.Schema; export type SiteInfoListResultItemRulesItemPathsList = Array; export const SiteInfoListResultItemRulesItemPathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface SiteInfoListResultItemRulesItem { /** The Web Analytics rule identifier. */ id?: string | null; created?: string | null; /** The hostname the rule will be applied to. */ host?: string | null; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean | null; /** Whether the rule is paused or not. */ isPaused?: boolean | null; /** The paths the rule will be applied to. */ paths?: SiteInfoListResultItemRulesItemPathsList | null; priority?: number | null; } export const SiteInfoListResultItemRulesItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), created: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), inclusive: S.optional(S.NullOr(S.Boolean)), isPaused: S.optional(S.NullOr(S.Boolean).pipe(T.Body("is_paused"))), paths: S.optional(S.NullOr(SiteInfoListResultItemRulesItemPathsList)), priority: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "SiteInfoListResultItemRulesItem", }) as any as S.Schema; export type SiteInfoListResultItemRulesList = Array; export const SiteInfoListResultItemRulesList = /*@__PURE__*/ S.Array( SiteInfoListResultItemRulesItem, ) as any as S.Schema; export type SiteInfoListResultItemRuleset = RulesBulkCreateResponseRuleset; export const SiteInfoListResultItemRuleset = RulesBulkCreateResponseRuleset; export interface SiteInfoListResultItem { /** If enabled, the JavaScript snippet is automatically injected for orange-clouded sites. */ autoInstall?: boolean | null; created?: string | null; /** A list of rules. */ rules?: SiteInfoListResultItemRulesList | null; ruleset?: RulesBulkCreateResponseRuleset | null; /** The Web Analytics site identifier. */ siteTag?: string | null; /** The Web Analytics site token. */ siteToken?: string | null; /** Encoded JavaScript snippet. */ snippet?: string | null; /** The hostname the site measures (gray-clouded sites). */ host?: string | null; } export const SiteInfoListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ autoInstall: S.optional(S.NullOr(S.Boolean).pipe(T.Body("auto_install"))), created: S.optional(S.NullOr(S.String)), rules: S.optional(S.NullOr(SiteInfoListResultItemRulesList)), ruleset: S.optional(S.NullOr(RulesBulkCreateResponseRuleset)), siteTag: S.optional(S.NullOr(S.String).pipe(T.Body("site_tag"))), siteToken: S.optional(S.NullOr(S.String).pipe(T.Body("site_token"))), snippet: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "SiteInfoListResultItem", }) as any as S.Schema; export type SiteInfoListResultList = Array; export const SiteInfoListResultList = /*@__PURE__*/ S.Array( SiteInfoListResultItem, ) as any as S.Schema; export interface ListSiteInfosResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: SiteInfoListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListSiteInfosResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: SiteInfoListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListSiteInfosResponse", }) as any as S.Schema; export type RulesUpdateRequestPathsList = Array; export const RulesUpdateRequestPathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface UpdateRuleRequest { /** Identifier. */ accountId: string; /** The Web Analytics ruleset identifier. */ rulesetId: string; /** The Web Analytics rule identifier. */ ruleId: string; host?: string; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean; /** Whether the rule is paused or not. */ isPaused?: boolean; paths?: RulesUpdateRequestPathsList; } export const UpdateRuleRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), rulesetId: S.String.pipe(T.Label("ruleset_id")), ruleId: S.String.pipe(T.Label("rule_id")), host: S.optional(S.String), inclusive: S.optional(S.Boolean), isPaused: S.optional(S.Boolean.pipe(T.Body("is_paused"))), paths: S.optional(RulesUpdateRequestPathsList), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/rum/v2/{ruleset_id}/rule/{rule_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateRuleRequest", }) as any as S.Schema; export type RulesUpdateResponsePathsList = Array; export const RulesUpdateResponsePathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateRuleResponse { /** The Web Analytics rule identifier. */ id?: string | null; created?: string | null; /** The hostname the rule will be applied to. */ host?: string | null; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean | null; /** Whether the rule is paused or not. */ isPaused?: boolean | null; /** The paths the rule will be applied to. */ paths?: RulesUpdateResponsePathsList | null; priority?: number | null; } export const UpdateRuleResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), created: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), inclusive: S.optional(S.NullOr(S.Boolean)), isPaused: S.optional(S.NullOr(S.Boolean).pipe(T.Body("is_paused"))), paths: S.optional(S.NullOr(RulesUpdateResponsePathsList)), priority: S.optional(S.NullOr(S.Number)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateRuleResponse", }) as any as S.Schema; export interface UpdateSiteInfoRequest { /** Identifier. */ accountId: string; /** Identifier. */ siteId: string; /** If enabled, the JavaScript snippet is automatically injected for orange-clouded sites. */ autoInstall?: boolean; /** Enables or disables RUM. This option can be used only when auto_install is set to true. */ enabled?: boolean; /** The hostname to use for gray-clouded sites. */ host?: string; /** If enabled, the JavaScript snippet will not be injected for visitors from the EU. */ lite?: boolean; /** The zone identifier. */ zoneTag?: string; } export const UpdateSiteInfoRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), siteId: S.String.pipe(T.Label("site_id")), autoInstall: S.optional(S.Boolean.pipe(T.Body("auto_install"))), enabled: S.optional(S.Boolean), host: S.optional(S.String), lite: S.optional(S.Boolean), zoneTag: S.optional(S.String.pipe(T.Body("zone_tag"))), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/rum/site_info/{site_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateSiteInfoRequest", }) as any as S.Schema; export type SiteInfoUpdateResponseRulesItemPathsList = Array; export const SiteInfoUpdateResponseRulesItemPathsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface SiteInfoUpdateResponseRulesItem { /** The Web Analytics rule identifier. */ id?: string | null; created?: string | null; /** The hostname the rule will be applied to. */ host?: string | null; /** Whether the rule includes or excludes traffic from being measured. */ inclusive?: boolean | null; /** Whether the rule is paused or not. */ isPaused?: boolean | null; /** The paths the rule will be applied to. */ paths?: SiteInfoUpdateResponseRulesItemPathsList | null; priority?: number | null; } export const SiteInfoUpdateResponseRulesItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.optional(S.NullOr(S.String)), created: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), inclusive: S.optional(S.NullOr(S.Boolean)), isPaused: S.optional(S.NullOr(S.Boolean).pipe(T.Body("is_paused"))), paths: S.optional(S.NullOr(SiteInfoUpdateResponseRulesItemPathsList)), priority: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "SiteInfoUpdateResponseRulesItem", }) as any as S.Schema; export type SiteInfoUpdateResponseRulesList = Array; export const SiteInfoUpdateResponseRulesList = /*@__PURE__*/ S.Array( SiteInfoUpdateResponseRulesItem, ) as any as S.Schema; export type SiteInfoUpdateResponseRuleset = RulesBulkCreateResponseRuleset; export const SiteInfoUpdateResponseRuleset = RulesBulkCreateResponseRuleset; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateSiteInfoResponse { /** If enabled, the JavaScript snippet is automatically injected for orange-clouded sites. */ autoInstall?: boolean | null; created?: string | null; /** A list of rules. */ rules?: SiteInfoUpdateResponseRulesList | null; ruleset?: RulesBulkCreateResponseRuleset | null; /** The Web Analytics site identifier. */ siteTag?: string | null; /** The Web Analytics site token. */ siteToken?: string | null; /** Encoded JavaScript snippet. */ snippet?: string | null; /** The hostname the site measures (gray-clouded sites). */ host?: string | null; } export const UpdateSiteInfoResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ autoInstall: S.optional(S.NullOr(S.Boolean).pipe(T.Body("auto_install"))), created: S.optional(S.NullOr(S.String)), rules: S.optional(S.NullOr(SiteInfoUpdateResponseRulesList)), ruleset: S.optional(S.NullOr(RulesBulkCreateResponseRuleset)), siteTag: S.optional(S.NullOr(S.String).pipe(T.Body("site_tag"))), siteToken: S.optional(S.NullOr(S.String).pipe(T.Body("site_token"))), snippet: S.optional(S.NullOr(S.String)), host: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateSiteInfoResponse", }) as any as S.Schema; export type BulkCreateRulesError = CloudflareOpError; /** Modifies one or more rules in a Web Analytics ruleset with a single request. */ export const bulkCreateRules: API.OperationMethod< BulkCreateRulesRequest, BulkCreateRulesResponse, BulkCreateRulesError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: BulkCreateRulesRequest, output: BulkCreateRulesResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateRuleError = | Forbidden | RulesetNotFound | MaxRulesExceeded | CloudflareOpError; /** Creates a new rule in a Web Analytics ruleset. */ export const createRule: API.OperationMethod< CreateRuleRequest, CreateRuleResponse, CreateRuleError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateRuleRequest, output: CreateRuleResponse, errors: [ Forbidden, RulesetNotFound, MaxRulesExceeded, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateSiteInfoError = | Forbidden | RumSiteQuotaExceeded | CloudflareOpError; /** Creates a new Web Analytics site. */ export const createSiteInfo: API.OperationMethod< CreateSiteInfoRequest, CreateSiteInfoResponse, CreateSiteInfoError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateSiteInfoRequest, output: CreateSiteInfoResponse, errors: [ Forbidden, RumSiteQuotaExceeded, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteRuleError = | Forbidden | RulesetNotFound | RuleNotFound | CloudflareOpError; /** Deletes an existing rule from a Web Analytics ruleset. */ export const deleteRule: API.OperationMethod< DeleteRuleRequest, DeleteRuleResponse, DeleteRuleError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteRuleRequest, output: DeleteRuleResponse, errors: [ Forbidden, RulesetNotFound, RuleNotFound, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteSiteInfoError = SiteNotFound | Forbidden | CloudflareOpError; /** Deletes an existing Web Analytics site. */ export const deleteSiteInfo: API.OperationMethod< DeleteSiteInfoRequest, DeleteSiteInfoResponse, DeleteSiteInfoError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteSiteInfoRequest, output: DeleteSiteInfoResponse, errors: [SiteNotFound, Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetSiteInfoError = SiteNotFound | Forbidden | CloudflareOpError; /** Retrieves a Web Analytics site. */ export const getSiteInfo: API.OperationMethod< GetSiteInfoRequest, GetSiteInfoResponse, GetSiteInfoError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetSiteInfoRequest, output: GetSiteInfoResponse, errors: [SiteNotFound, Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListRulesError = Forbidden | RulesetNotFound | CloudflareOpError; /** Lists all the rules in a Web Analytics ruleset. */ export const listRules: API.OperationMethod< ListRulesRequest, ListRulesResponse, ListRulesError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: ListRulesRequest, output: ListRulesResponse, errors: [Forbidden, RulesetNotFound, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListSiteInfosError = Forbidden | CloudflareOpError; /** Lists all Web Analytics sites of an account. */ export const listSiteInfos: API.PaginatedOperationMethod< ListSiteInfosRequest, ListSiteInfosResponse, ListSiteInfosError, CloudflareOpContext, SiteInfoListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListSiteInfosRequest, output: ListSiteInfosResponse, errors: [Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "page", inputToken: "page", outputToken: "resultInfo.page", items: "result", pageSize: "perPage", } as const, }), cloudflarePaginate, ) as any; export type UpdateRuleError = Forbidden | RulesetNotFound | CloudflareOpError; /** Updates a rule in a Web Analytics ruleset. */ export const updateRule: API.OperationMethod< UpdateRuleRequest, UpdateRuleResponse, UpdateRuleError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateRuleRequest, output: UpdateRuleResponse, errors: [Forbidden, RulesetNotFound, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type UpdateSiteInfoError = SiteNotFound | Forbidden | CloudflareOpError; /** Updates an existing Web Analytics site. */ export const updateSiteInfo: API.OperationMethod< UpdateSiteInfoRequest, UpdateSiteInfoResponse, UpdateSiteInfoError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateSiteInfoRequest, output: UpdateSiteInfoResponse, errors: [SiteNotFound, Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, }));