// 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> = { key: "secret", }; export class CallsAppNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("CallsAppNotFound", { code: S.Number, message: S.String, }), [{ code: 20007 }], ) {} export class Forbidden extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("Forbidden", { code: S.Number, message: S.String, }), [{ status: 403 }], ) {} export class TurnKeyNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("TurnKeyNotFound", { code: S.Number, message: S.String, }), [{ code: 20008 }], ) {} export interface CreateSfuRequest { /** The account identifier tag. */ accountId: string; /** A short description of Calls app, not shown to end users. */ name?: string; } export const CreateSfuRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), name: S.optional(S.String), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/calls/apps", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateSfuRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateSfuResponse { /** The date and time the item was created. */ created?: string | null; /** The date and time the item was last modified. */ modified?: string | null; /** A short description of Calls app, not shown to end users. */ name?: string | null; /** Bearer token */ secret?: string | null; /** A Cloudflare-generated unique identifier for a item. */ uid?: string | null; } export const CreateSfuResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.optional(S.NullOr(S.String)), modified: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), secret: S.optional(S.NullOr(S.String)), uid: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateSfuResponse", }) as any as S.Schema; export interface CreateTurnRequest { /** The account identifier tag. */ accountId: string; /** A short description of a TURN key, not shown to end users. */ name?: string; } export const CreateTurnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), name: S.optional(S.String), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/calls/turn_keys", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateTurnRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateTurnResponse { /** The date and time the item was created. */ created?: string | null; /** Bearer token */ key?: string | null; /** The date and time the item was last modified. */ modified?: string | null; /** A short description of a TURN key, not shown to end users. */ name?: string | null; /** A Cloudflare-generated unique identifier for a item. */ uid?: string | null; } export const CreateTurnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.optional(S.NullOr(S.String)), key: S.optional(S.NullOr(S.String)), modified: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), uid: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateTurnResponse", }) as any as S.Schema; export interface DeleteSfuRequest { /** The account identifier tag. */ accountId: string; /** A Cloudflare-generated unique identifier for a item. */ appId: string; } export const DeleteSfuRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), appId: S.String.pipe(T.Label("app_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/calls/apps/{app_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteSfuRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeleteSfuResponse { /** The date and time the item was created. */ created?: string | null; /** The date and time the item was last modified. */ modified?: string | null; /** A short description of Calls app, not shown to end users. */ name?: string | null; /** A Cloudflare-generated unique identifier for a item. */ uid?: string | null; } export const DeleteSfuResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.optional(S.NullOr(S.String)), modified: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), uid: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteSfuResponse", }) as any as S.Schema; export interface DeleteTurnRequest { /** The account identifier tag. */ accountId: string; /** A Cloudflare-generated unique identifier for a item. */ keyId: string; } export const DeleteTurnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), keyId: S.String.pipe(T.Label("key_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/calls/turn_keys/{key_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteTurnRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeleteTurnResponse { /** The date and time the item was created. */ created?: string | null; /** The date and time the item was last modified. */ modified?: string | null; /** A short description of Calls app, not shown to end users. */ name?: string | null; /** A Cloudflare-generated unique identifier for a item. */ uid?: string | null; } export const DeleteTurnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.optional(S.NullOr(S.String)), modified: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), uid: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteTurnResponse", }) as any as S.Schema; export interface GetSfuRequest { /** The account identifier tag. */ accountId: string; /** A Cloudflare-generated unique identifier for a item. */ appId: string; } export const GetSfuRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), appId: S.String.pipe(T.Label("app_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/calls/apps/{app_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetSfuRequest" }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetSfuResponse { /** The date and time the item was created. */ created?: string | null; /** The date and time the item was last modified. */ modified?: string | null; /** A short description of Calls app, not shown to end users. */ name?: string | null; /** A Cloudflare-generated unique identifier for a item. */ uid?: string | null; } export const GetSfuResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.optional(S.NullOr(S.String)), modified: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), uid: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetSfuResponse" }) as any as S.Schema; export interface GetTurnRequest { /** The account identifier tag. */ accountId: string; /** A Cloudflare-generated unique identifier for a item. */ keyId: string; } export const GetTurnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), keyId: S.String.pipe(T.Label("key_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/calls/turn_keys/{key_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetTurnRequest" }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetTurnResponse { /** The date and time the item was created. */ created?: string | null; /** The date and time the item was last modified. */ modified?: string | null; /** A short description of Calls app, not shown to end users. */ name?: string | null; /** A Cloudflare-generated unique identifier for a item. */ uid?: string | null; } export const GetTurnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.optional(S.NullOr(S.String)), modified: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), uid: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetTurnResponse", }) as any as S.Schema; export interface ListSfusRequest { /** The account identifier tag. */ accountId: string; } export const ListSfusRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/calls/apps", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListSfusRequest", }) as any as S.Schema; export interface SfuListResultItem { /** The date and time the item was created. */ created?: string | null; /** The date and time the item was last modified. */ modified?: string | null; /** A short description of Calls app, not shown to end users. */ name?: string | null; /** A Cloudflare-generated unique identifier for a item. */ uid?: string | null; } export const SfuListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.optional(S.NullOr(S.String)), modified: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), uid: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "SfuListResultItem", }) as any as S.Schema; export type SfuListResultList = Array; export const SfuListResultList = /*@__PURE__*/ S.Array( SfuListResultItem, ) as any as S.Schema; export interface ListSfusResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: SfuListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListSfusResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: SfuListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListSfusResponse", }) as any as S.Schema; export interface ListTurnsRequest { /** The account identifier tag. */ accountId: string; } export const ListTurnsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/calls/turn_keys", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListTurnsRequest", }) as any as S.Schema; export type TurnListResultItem = SfuListResultItem; export const TurnListResultItem = SfuListResultItem; export type TurnListResultList = Array; export const TurnListResultList = /*@__PURE__*/ S.Array( SfuListResultItem, ) as any as S.Schema; export interface ListTurnsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: TurnListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListTurnsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: TurnListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListTurnsResponse", }) as any as S.Schema; export interface UpdateSfuRequest { /** The account identifier tag. */ accountId: string; /** A Cloudflare-generated unique identifier for a item. */ appId: string; /** A short description of Calls app, not shown to end users. */ name?: string; } export const UpdateSfuRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), appId: S.String.pipe(T.Label("app_id")), name: S.optional(S.String), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/calls/apps/{app_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateSfuRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateSfuResponse { /** The date and time the item was created. */ created?: string | null; /** The date and time the item was last modified. */ modified?: string | null; /** A short description of Calls app, not shown to end users. */ name?: string | null; /** A Cloudflare-generated unique identifier for a item. */ uid?: string | null; } export const UpdateSfuResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.optional(S.NullOr(S.String)), modified: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), uid: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateSfuResponse", }) as any as S.Schema; export interface UpdateTurnRequest { /** The account identifier tag. */ accountId: string; /** A Cloudflare-generated unique identifier for a item. */ keyId: string; /** A short description of a TURN key, not shown to end users. */ name?: string; } export const UpdateTurnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), keyId: S.String.pipe(T.Label("key_id")), name: S.optional(S.String), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/calls/turn_keys/{key_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateTurnRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateTurnResponse { /** The date and time the item was created. */ created?: string | null; /** The date and time the item was last modified. */ modified?: string | null; /** A short description of Calls app, not shown to end users. */ name?: string | null; /** A Cloudflare-generated unique identifier for a item. */ uid?: string | null; } export const UpdateTurnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ created: S.optional(S.NullOr(S.String)), modified: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), uid: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateTurnResponse", }) as any as S.Schema; export type CreateSfuError = Forbidden | CloudflareOpError; /** Creates a new Cloudflare calls app. An app is an unique enviroment where each Session can access all Tracks within the app. */ export const createSfu: API.OperationMethod< CreateSfuRequest, CreateSfuResponse, CreateSfuError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateSfuRequest, output: CreateSfuResponse, errors: [Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateTurnError = Forbidden | CloudflareOpError; /** Creates a new Cloudflare Calls TURN key. */ export const createTurn: API.OperationMethod< CreateTurnRequest, CreateTurnResponse, CreateTurnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateTurnRequest, output: CreateTurnResponse, errors: [Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteSfuError = CallsAppNotFound | Forbidden | CloudflareOpError; /** Deletes an app from Cloudflare Calls */ export const deleteSfu: API.OperationMethod< DeleteSfuRequest, DeleteSfuResponse, DeleteSfuError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteSfuRequest, output: DeleteSfuResponse, errors: [CallsAppNotFound, Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteTurnError = TurnKeyNotFound | Forbidden | CloudflareOpError; /** Deletes a TURN key from Cloudflare Calls */ export const deleteTurn: API.OperationMethod< DeleteTurnRequest, DeleteTurnResponse, DeleteTurnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteTurnRequest, output: DeleteTurnResponse, errors: [TurnKeyNotFound, Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetSfuError = CallsAppNotFound | Forbidden | CloudflareOpError; /** Fetches details for a single Calls app. */ export const getSfu: API.OperationMethod< GetSfuRequest, GetSfuResponse, GetSfuError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetSfuRequest, output: GetSfuResponse, errors: [CallsAppNotFound, Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetTurnError = TurnKeyNotFound | Forbidden | CloudflareOpError; /** Fetches details for a single TURN key. */ export const getTurn: API.OperationMethod< GetTurnRequest, GetTurnResponse, GetTurnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetTurnRequest, output: GetTurnResponse, errors: [TurnKeyNotFound, Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListSfusError = CloudflareOpError; /** Lists all apps in the Cloudflare account */ export const listSfus: API.PaginatedOperationMethod< ListSfusRequest, ListSfusResponse, ListSfusError, CloudflareOpContext, SfuListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListSfusRequest, output: ListSfusResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type ListTurnsError = CloudflareOpError; /** Lists all TURN keys in the Cloudflare account */ export const listTurns: API.PaginatedOperationMethod< ListTurnsRequest, ListTurnsResponse, ListTurnsError, CloudflareOpContext, SfuListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListTurnsRequest, output: ListTurnsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type UpdateSfuError = CallsAppNotFound | Forbidden | CloudflareOpError; /** Edit details for a single app. */ export const updateSfu: API.OperationMethod< UpdateSfuRequest, UpdateSfuResponse, UpdateSfuError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateSfuRequest, output: UpdateSfuResponse, errors: [CallsAppNotFound, Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type UpdateTurnError = TurnKeyNotFound | Forbidden | CloudflareOpError; /** Edit details for a single TURN key. */ export const updateTurn: API.OperationMethod< UpdateTurnRequest, UpdateTurnResponse, UpdateTurnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateTurnRequest, output: UpdateTurnResponse, errors: [TurnKeyNotFound, Forbidden, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, }));