// 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> = { lingeringSubscribe: "lingering_subscribe", maxTimeoutMs: "max_timeout_ms", originFallback: "origin_fallback", tokenPublishSubscribe: "token_publish_subscribe", tokenSubscribe: "token_subscribe", }; export interface CreateRelayRequest { /** Cloudflare account identifier. */ accountId: string; /** Human-readable name for the relay. */ name: string; } export const CreateRelayRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), name: S.String, }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/moq/relays", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateRelayRequest", }) as any as S.Schema; export interface RelaysCreateResponseConfigLingeringSubscribe { enabled?: boolean | null; /** Relay-level ceiling on lingering subscribe timeout (ms). Default 30000. */ maxTimeoutMs?: number | null; } export const RelaysCreateResponseConfigLingeringSubscribe = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.NullOr(S.Boolean)), maxTimeoutMs: S.optional( S.NullOr(S.Number).pipe(T.Body("max_timeout_ms")), ), }), ).annotate({ identifier: "RelaysCreateResponseConfigLingeringSubscribe", }) as any as S.Schema; export interface RelaysCreateResponseConfigUpstreamsUpstreamsItem { /** Upstream MOQT server publisher URL. */ url?: string | null; } export const RelaysCreateResponseConfigUpstreamsUpstreamsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ url: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "RelaysCreateResponseConfigUpstreamsUpstreamsItem", }) as any as S.Schema; export type RelaysCreateResponseConfigUpstreamsUpstreamsList = Array; export const RelaysCreateResponseConfigUpstreamsUpstreamsList = /*@__PURE__*/ S.Array( RelaysCreateResponseConfigUpstreamsUpstreamsItem, ) as any as S.Schema; export interface RelaysCreateResponseConfigUpstreams { enabled?: boolean | null; /** Ordered list of upstream MOQT server publishers. Each entry is an */ upstreams?: RelaysCreateResponseConfigUpstreamsUpstreamsList | null; } export const RelaysCreateResponseConfigUpstreams = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.NullOr(S.Boolean)), upstreams: S.optional( S.NullOr(RelaysCreateResponseConfigUpstreamsUpstreamsList), ), }), ).annotate({ identifier: "RelaysCreateResponseConfigUpstreams", }) as any as S.Schema; export interface RelaysCreateResponseConfig { lingeringSubscribe?: RelaysCreateResponseConfigLingeringSubscribe | null; /** Upstreams are external MOQT server publishers that a relay falls back */ upstreams?: RelaysCreateResponseConfigUpstreams | null; } export const RelaysCreateResponseConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ lingeringSubscribe: S.optional( S.NullOr(RelaysCreateResponseConfigLingeringSubscribe).pipe( T.Body("lingering_subscribe"), ), ), upstreams: S.optional(S.NullOr(RelaysCreateResponseConfigUpstreams)), }), ).annotate({ identifier: "RelaysCreateResponseConfig", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateRelayResponse { /** upstreams and lingering_subscribe are mutually exclusive. */ config: RelaysCreateResponseConfig; created: string; modified: string; name: string; /** Full access token (publish + subscribe). Treat as sensitive. */ tokenPublishSubscribe: string; /** Subscribe-only token. Treat as sensitive. */ tokenSubscribe: string; /** Server-generated unique identifier (32 hex chars). */ uid: string; } export const CreateRelayResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ config: RelaysCreateResponseConfig, created: S.String, modified: S.String, name: S.String, tokenPublishSubscribe: S.String.pipe(T.Body("token_publish_subscribe")), tokenSubscribe: S.String.pipe(T.Body("token_subscribe")), uid: S.String, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateRelayResponse", }) as any as S.Schema; export interface DeleteRelayRequest { /** Cloudflare account identifier. */ accountId: string; relayId: string; } export const DeleteRelayRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), relayId: S.String.pipe(T.Label("relay_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/moq/relays/{relay_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteRelayRequest", }) as any as S.Schema; export type DeleteRelayResponse = unknown; export const DeleteRelayResponse = /*@__PURE__*/ S.suspend(() => S.Unknown.pipe(T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteRelayResponse", }) as any as S.Schema; export interface GetRelayRequest { /** Cloudflare account identifier. */ accountId: string; relayId: string; } export const GetRelayRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), relayId: S.String.pipe(T.Label("relay_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/moq/relays/{relay_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRelayRequest", }) as any as S.Schema; export type RelaysGetResponseConfigLingeringSubscribe = RelaysCreateResponseConfigLingeringSubscribe; export const RelaysGetResponseConfigLingeringSubscribe = RelaysCreateResponseConfigLingeringSubscribe; export type RelaysGetResponseConfigUpstreamsUpstreamsItem = RelaysCreateResponseConfigUpstreamsUpstreamsItem; export const RelaysGetResponseConfigUpstreamsUpstreamsItem = RelaysCreateResponseConfigUpstreamsUpstreamsItem; export type RelaysGetResponseConfigUpstreamsUpstreamsList = Array; export const RelaysGetResponseConfigUpstreamsUpstreamsList = /*@__PURE__*/ S.Array( RelaysCreateResponseConfigUpstreamsUpstreamsItem, ) as any as S.Schema; export interface RelaysGetResponseConfigUpstreams { enabled?: boolean | null; /** Ordered list of upstream MOQT server publishers. Each entry is an */ upstreams?: RelaysGetResponseConfigUpstreamsUpstreamsList | null; } export const RelaysGetResponseConfigUpstreams = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.NullOr(S.Boolean)), upstreams: S.optional( S.NullOr(RelaysGetResponseConfigUpstreamsUpstreamsList), ), }), ).annotate({ identifier: "RelaysGetResponseConfigUpstreams", }) as any as S.Schema; export interface RelaysGetResponseConfig { lingeringSubscribe?: RelaysCreateResponseConfigLingeringSubscribe | null; /** Upstreams are external MOQT server publishers that a relay falls back */ upstreams?: RelaysGetResponseConfigUpstreams | null; } export const RelaysGetResponseConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ lingeringSubscribe: S.optional( S.NullOr(RelaysCreateResponseConfigLingeringSubscribe).pipe( T.Body("lingering_subscribe"), ), ), upstreams: S.optional(S.NullOr(RelaysGetResponseConfigUpstreams)), }), ).annotate({ identifier: "RelaysGetResponseConfig", }) as any as S.Schema; export type RelaysGetResponseStatus = "connected"; export const RelaysGetResponseStatus = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetRelayResponse { /** upstreams and lingering_subscribe are mutually exclusive. */ config: RelaysGetResponseConfig; created: string; modified: string; name: string; uid: string; /** "connected" when active, omitted otherwise. */ status?: RelaysGetResponseStatus | null; } export const GetRelayResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ config: RelaysGetResponseConfig, created: S.String, modified: S.String, name: S.String, uid: S.String, status: S.optional(S.NullOr(RelaysGetResponseStatus)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRelayResponse", }) as any as S.Schema; export interface ListRelaysRequest { /** Cloudflare account identifier. */ accountId: string; /** Sort order by `created`. When true, results are returned oldest-first */ asc?: boolean; /** Cursor for pagination. Returns relays created strictly after this */ createdAfter?: string; /** Cursor for pagination. Returns relays created strictly before this */ createdBefore?: string; /** Maximum number of relays to return per page. */ perPage?: number; } export const ListRelaysRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), asc: S.optional(S.Boolean.pipe(T.Query())), createdAfter: S.optional(S.String.pipe(T.Query("created_after"))), createdBefore: S.optional(S.String.pipe(T.Query("created_before"))), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/moq/relays", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListRelaysRequest", }) as any as S.Schema; export interface RelaysListResultItem { created: string; modified: string; name: string; uid: string; } export const RelaysListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.String, modified: S.String, name: S.String, uid: S.String, }), ).annotate({ identifier: "RelaysListResultItem", }) as any as S.Schema; export type RelaysListResultList = Array; export const RelaysListResultList = /*@__PURE__*/ S.Array( RelaysListResultItem, ) as any as S.Schema; export interface ListRelaysResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: RelaysListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListRelaysResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: RelaysListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListRelaysResponse", }) as any as S.Schema; export type RelaysTokensRotateRequestType = "publish_subscribe" | "subscribe"; export const RelaysTokensRotateRequestType = /*@__PURE__*/ S.String; export interface RotateRelayTokenRequest { /** Cloudflare account identifier. */ accountId: string; relayId: string; /** Which token type to rotate. */ type: RelaysTokensRotateRequestType | (string & {}); } export const RotateRelayTokenRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), relayId: S.String.pipe(T.Label("relay_id")), type: RelaysTokensRotateRequestType, }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/moq/relays/{relay_id}/tokens/rotate", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "RotateRelayTokenRequest", }) as any as S.Schema; export type RelaysTokensRotateResponseType = "publish_subscribe" | "subscribe"; export const RelaysTokensRotateResponseType = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface RotateRelayTokenResponse { /** New token value (shown once). Treat as sensitive. */ token: string; type: RelaysTokensRotateResponseType; } export const RotateRelayTokenResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ token: S.String, type: RelaysTokensRotateResponseType, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "RotateRelayTokenResponse", }) as any as S.Schema; export interface RelaysUpdateRequestConfigLingeringSubscribe { enabled?: boolean; /** Relay-level ceiling on lingering subscribe timeout (ms). Default 30000. */ maxTimeoutMs?: number; } export const RelaysUpdateRequestConfigLingeringSubscribe = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.Boolean), maxTimeoutMs: S.optional(S.Number.pipe(T.Body("max_timeout_ms"))), }), ).annotate({ identifier: "RelaysUpdateRequestConfigLingeringSubscribe", }) as any as S.Schema; export interface RelaysUpdateRequestConfigUpstreamsUpstreamsItem { /** Upstream MOQT server publisher URL. */ url?: string; } export const RelaysUpdateRequestConfigUpstreamsUpstreamsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ url: S.optional(S.String), }), ).annotate({ identifier: "RelaysUpdateRequestConfigUpstreamsUpstreamsItem", }) as any as S.Schema; export type RelaysUpdateRequestConfigUpstreamsUpstreamsList = Array; export const RelaysUpdateRequestConfigUpstreamsUpstreamsList = /*@__PURE__*/ S.Array( RelaysUpdateRequestConfigUpstreamsUpstreamsItem, ) as any as S.Schema; export interface RelaysUpdateRequestConfigUpstreams { enabled?: boolean; /** Ordered list of upstream MOQT server publishers. Each entry is an */ upstreams?: RelaysUpdateRequestConfigUpstreamsUpstreamsList; } export const RelaysUpdateRequestConfigUpstreams = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.Boolean), upstreams: S.optional(RelaysUpdateRequestConfigUpstreamsUpstreamsList), }), ).annotate({ identifier: "RelaysUpdateRequestConfigUpstreams", }) as any as S.Schema; export interface RelaysUpdateRequestConfig { lingeringSubscribe?: RelaysUpdateRequestConfigLingeringSubscribe; /** Upstreams are external MOQT server publishers that a relay falls back */ upstreams?: RelaysUpdateRequestConfigUpstreams; } export const RelaysUpdateRequestConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ lingeringSubscribe: S.optional( RelaysUpdateRequestConfigLingeringSubscribe.pipe( T.Body("lingering_subscribe"), ), ), upstreams: S.optional(RelaysUpdateRequestConfigUpstreams), }), ).annotate({ identifier: "RelaysUpdateRequestConfig", }) as any as S.Schema; export interface UpdateRelayRequest { /** Cloudflare account identifier. */ accountId: string; relayId: string; /** upstreams and lingering_subscribe are mutually exclusive. */ config?: RelaysUpdateRequestConfig; name?: string; } export const UpdateRelayRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), relayId: S.String.pipe(T.Label("relay_id")), config: S.optional(RelaysUpdateRequestConfig), name: S.optional(S.String), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/moq/relays/{relay_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateRelayRequest", }) as any as S.Schema; export type RelaysUpdateResponseConfigLingeringSubscribe = RelaysCreateResponseConfigLingeringSubscribe; export const RelaysUpdateResponseConfigLingeringSubscribe = RelaysCreateResponseConfigLingeringSubscribe; export type RelaysUpdateResponseConfigUpstreamsUpstreamsItem = RelaysCreateResponseConfigUpstreamsUpstreamsItem; export const RelaysUpdateResponseConfigUpstreamsUpstreamsItem = RelaysCreateResponseConfigUpstreamsUpstreamsItem; export type RelaysUpdateResponseConfigUpstreamsUpstreamsList = Array; export const RelaysUpdateResponseConfigUpstreamsUpstreamsList = /*@__PURE__*/ S.Array( RelaysCreateResponseConfigUpstreamsUpstreamsItem, ) as any as S.Schema; export interface RelaysUpdateResponseConfigUpstreams { enabled?: boolean | null; /** Ordered list of upstream MOQT server publishers. Each entry is an */ upstreams?: RelaysUpdateResponseConfigUpstreamsUpstreamsList | null; } export const RelaysUpdateResponseConfigUpstreams = /*@__PURE__*/ S.suspend(() => S.Struct({ enabled: S.optional(S.NullOr(S.Boolean)), upstreams: S.optional( S.NullOr(RelaysUpdateResponseConfigUpstreamsUpstreamsList), ), }), ).annotate({ identifier: "RelaysUpdateResponseConfigUpstreams", }) as any as S.Schema; export interface RelaysUpdateResponseConfig { lingeringSubscribe?: RelaysCreateResponseConfigLingeringSubscribe | null; /** Upstreams are external MOQT server publishers that a relay falls back */ upstreams?: RelaysUpdateResponseConfigUpstreams | null; } export const RelaysUpdateResponseConfig = /*@__PURE__*/ S.suspend(() => S.Struct({ lingeringSubscribe: S.optional( S.NullOr(RelaysCreateResponseConfigLingeringSubscribe).pipe( T.Body("lingering_subscribe"), ), ), upstreams: S.optional(S.NullOr(RelaysUpdateResponseConfigUpstreams)), }), ).annotate({ identifier: "RelaysUpdateResponseConfig", }) as any as S.Schema; export type RelaysUpdateResponseStatus = "connected"; export const RelaysUpdateResponseStatus = /*@__PURE__*/ S.String; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateRelayResponse { /** upstreams and lingering_subscribe are mutually exclusive. */ config: RelaysUpdateResponseConfig; created: string; modified: string; name: string; uid: string; /** "connected" when active, omitted otherwise. */ status?: RelaysUpdateResponseStatus | null; } export const UpdateRelayResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ config: RelaysUpdateResponseConfig, created: S.String, modified: S.String, name: S.String, uid: S.String, status: S.optional(S.NullOr(RelaysUpdateResponseStatus)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateRelayResponse", }) as any as S.Schema; export type CreateRelayError = CloudflareOpError; /** Provisions a new MoQ relay instance. Auto-creates a publish+subscribe token and a subscribe-only token. Token values are included in the response (shown once). Config is set to defaults (lingering subscribe enabled, 30s ceiling, upstreams off). Use PUT to modify. */ export const createRelay: API.OperationMethod< CreateRelayRequest, CreateRelayResponse, CreateRelayError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateRelayRequest, output: CreateRelayResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteRelayError = CloudflareOpError; /** Soft-deletes a MoQ relay. */ export const deleteRelay: API.OperationMethod< DeleteRelayRequest, DeleteRelayResponse, DeleteRelayError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteRelayRequest, output: DeleteRelayResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetRelayError = CloudflareOpError; /** Retrieves a single MoQ relay including config and status. Tokens are NOT included. */ export const getRelay: API.OperationMethod< GetRelayRequest, GetRelayResponse, GetRelayError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetRelayRequest, output: GetRelayResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListRelaysError = CloudflareOpError; /** Lists all MoQ relays for the account. Returns only metadata. Config, status, and tokens are omitted. Results are cursor-paginated (keyset on the `created` timestamp). Use `created_before` / `created_after` with the `created` value of the first/last item in a page to fetch the adjacent page. `result_info` reports the page `count` and the `total` matching the cursor filters. */ export const listRelays: API.PaginatedOperationMethod< ListRelaysRequest, ListRelaysResponse, ListRelaysError, CloudflareOpContext, RelaysListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListRelaysRequest, output: ListRelaysResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type RotateRelayTokenError = CloudflareOpError; /** Generates a new token for the specified type. The old token is immediately invalidated. Token value is shown once in the response. */ export const rotateRelayToken: API.OperationMethod< RotateRelayTokenRequest, RotateRelayTokenResponse, RotateRelayTokenError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: RotateRelayTokenRequest, output: RotateRelayTokenResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type UpdateRelayError = CloudflareOpError; /** Updates a relay's name and/or configuration. Partial updates: omitted fields are preserved. Config sub-objects replace as whole objects when present. upstreams and lingering_subscribe are mutually exclusive. */ export const updateRelay: API.OperationMethod< UpdateRelayRequest, UpdateRelayResponse, UpdateRelayError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateRelayRequest, output: UpdateRelayResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, }));