import { APIResource } from "../../../core/resource.js"; import * as TokensAPI from "./tokens.js"; import { BaseTokens, TokenCreateParams, TokenCreateResponse, TokenDeleteParams, TokenDeleteResponse, TokenListParams, TokenListResponse, Tokens } from "./tokens.js"; import { APIPromise } from "../../../core/api-promise.js"; import { PagePromise, SinglePage } from "../../../core/pagination.js"; import { RequestOptions } from "../../../internal/request-options.js"; export declare class BaseRelays extends APIResource { static readonly _key: readonly ['moq', 'relays']; /** * 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 always set to defaults (upstreams off) and cannot be supplied here — * sending a non-empty `config` is rejected (21014); `null` or `{}` is accepted as * absent. Use PUT to configure the relay after it exists. * * @example * ```ts * const relay = await client.moq.relays.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * name: 'Production Live Stream', * }); * ``` */ create(params: RelayCreateParams, options?: RequestOptions): APIPromise; /** * Updates a relay's name and/or configuration. The relay ID goes in the URL path — * `PUT /accounts/{account_id}/moq/relays/{relay_id}` — not the request body; there * is no collection-level update endpoint. This is also the only way to set a * relay's config (config cannot be set at create time). Partial updates: omitted * fields are preserved; config sub-objects replace as whole objects when present. * * @example * ```ts * const relay = await client.moq.relays.update( * 'a1b2c3d4e5f67890a1b2c3d4e5f67890', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ update(relayID: string, params: RelayUpdateParams, options?: RequestOptions): APIPromise; /** * 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. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const relayListResponse of client.moq.relays.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params: RelayListParams, options?: RequestOptions): PagePromise; /** * Soft-deletes a MoQ relay. The relay ID goes in the URL path — * `DELETE /accounts/{account_id}/moq/relays/{relay_id}` — not the request body; * there is no collection-level delete endpoint. * * @example * ```ts * const relay = await client.moq.relays.delete( * 'a1b2c3d4e5f67890a1b2c3d4e5f67890', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(relayID: string, params: RelayDeleteParams, options?: RequestOptions): APIPromise; /** * Retrieves a single MoQ relay including config and status. Tokens are NOT * included. * * @example * ```ts * const relay = await client.moq.relays.get( * 'a1b2c3d4e5f67890a1b2c3d4e5f67890', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(relayID: string, params: RelayGetParams, options?: RequestOptions): APIPromise; } export declare class Relays extends BaseRelays { tokens: TokensAPI.Tokens; } export type RelayListResponsesSinglePage = SinglePage; /** * Relay with its auto-created default token pair (one full-access [publish, * subscribe] and one [subscribe]-only), each with its one-time secret, wrapped in * the issuers envelope. */ export interface RelayCreateResponse { config: RelayCreateResponse.Config; created: string; /** * Token collection (discriminated union on `type`). On create this holds the * auto-created default pair, each including its one-time secret. */ issuers: Array; modified: string; name: string; /** * Server-generated unique identifier (32 hex chars). */ uid: string; } export declare namespace RelayCreateResponse { interface Config { /** * Upstreams are external MOQT server publishers that a relay falls back to when it * has no local publisher for a requested namespace/track. */ upstreams?: Config.Upstreams; } namespace Config { /** * Upstreams are external MOQT server publishers that a relay falls back to when it * has no local publisher for a requested namespace/track. */ interface Upstreams { enabled?: boolean; /** * Ordered list of upstream MOQT server publishers. Each entry is an object (not a * bare string) so per-upstream configuration can be added in the future without * another breaking change. */ upstreams?: Array; } namespace Upstreams { /** * A single upstream MOQT server publisher. */ interface Upstream { /** * Upstream MOQT server publisher URL. Must be an absolute URL with a host and a * scheme the relay can dial: moqt:// (raw QUIC) or https:// (WebTransport). * Validated on update (PUT); rejected with 21013. */ url: string; } } } /** * One arm of the discriminated-union token collection. */ interface Issuer { /** * Always present ([] when empty). */ cloudflare_tokens: Array; issuer: 'cloudflare'; type: 'cloudflare_jwt'; } namespace Issuer { interface CloudflareToken { created: string; /** * Mandatory; no more than 1 year after `created`. */ expires: string; /** * Token identity and registry key (32 hex chars). */ jti: string; /** * Signed allowlist of what the token may do. V1 coarse roles; the array form * extends to fine-grained MoQT message names later without a breaking change. */ operations: Array<'publish' | 'subscribe'>; /** * Optional, customer-set. */ label?: string; /** * The signed JWT. Present ONLY in create / auto-create responses (shown once); * never returned by list, never stored. */ secret?: string; } } } /** * Full relay details (no tokens). */ export interface RelayUpdateResponse { config: RelayUpdateResponse.Config; created: string; modified: string; name: string; uid: string; /** * "connected" when active, omitted otherwise. */ status?: 'connected'; } export declare namespace RelayUpdateResponse { interface Config { /** * Upstreams are external MOQT server publishers that a relay falls back to when it * has no local publisher for a requested namespace/track. */ upstreams?: Config.Upstreams; } namespace Config { /** * Upstreams are external MOQT server publishers that a relay falls back to when it * has no local publisher for a requested namespace/track. */ interface Upstreams { enabled?: boolean; /** * Ordered list of upstream MOQT server publishers. Each entry is an object (not a * bare string) so per-upstream configuration can be added in the future without * another breaking change. */ upstreams?: Array; } namespace Upstreams { /** * A single upstream MOQT server publisher. */ interface Upstream { /** * Upstream MOQT server publisher URL. Must be an absolute URL with a host and a * scheme the relay can dial: moqt:// (raw QUIC) or https:// (WebTransport). * Validated on update (PUT); rejected with 21013. */ url: string; } } } } /** * Abbreviated relay for list responses. */ export interface RelayListResponse { created: string; modified: string; name: string; uid: string; } export type RelayDeleteResponse = unknown; /** * Full relay details (no tokens). */ export interface RelayGetResponse { config: RelayGetResponse.Config; created: string; modified: string; name: string; uid: string; /** * "connected" when active, omitted otherwise. */ status?: 'connected'; } export declare namespace RelayGetResponse { interface Config { /** * Upstreams are external MOQT server publishers that a relay falls back to when it * has no local publisher for a requested namespace/track. */ upstreams?: Config.Upstreams; } namespace Config { /** * Upstreams are external MOQT server publishers that a relay falls back to when it * has no local publisher for a requested namespace/track. */ interface Upstreams { enabled?: boolean; /** * Ordered list of upstream MOQT server publishers. Each entry is an object (not a * bare string) so per-upstream configuration can be added in the future without * another breaking change. */ upstreams?: Array; } namespace Upstreams { /** * A single upstream MOQT server publisher. */ interface Upstream { /** * Upstream MOQT server publisher URL. Must be an absolute URL with a host and a * scheme the relay can dial: moqt:// (raw QUIC) or https:// (WebTransport). * Validated on update (PUT); rejected with 21013. */ url: string; } } } } export interface RelayCreateParams { /** * Path param: Cloudflare account identifier. */ account_id: string; /** * Body param: Human-readable name for the relay. */ name: string; } export interface RelayUpdateParams { /** * Path param: Cloudflare account identifier. */ account_id: string; /** * Body param */ config?: RelayUpdateParams.Config; /** * Body param */ name?: string; } export declare namespace RelayUpdateParams { interface Config { /** * Upstreams are external MOQT server publishers that a relay falls back to when it * has no local publisher for a requested namespace/track. */ upstreams?: Config.Upstreams; } namespace Config { /** * Upstreams are external MOQT server publishers that a relay falls back to when it * has no local publisher for a requested namespace/track. */ interface Upstreams { enabled?: boolean; /** * Ordered list of upstream MOQT server publishers. Each entry is an object (not a * bare string) so per-upstream configuration can be added in the future without * another breaking change. */ upstreams?: Array; } namespace Upstreams { /** * A single upstream MOQT server publisher. */ interface Upstream { /** * Upstream MOQT server publisher URL. Must be an absolute URL with a host and a * scheme the relay can dial: moqt:// (raw QUIC) or https:// (WebTransport). * Validated on update (PUT); rejected with 21013. */ url: string; } } } } export interface RelayListParams { /** * Path param: Cloudflare account identifier. */ account_id: string; /** * Query param: Sort order by `created`. When true, results are returned * oldest-first (ascending); otherwise newest-first (descending, the default). */ asc?: boolean; /** * Query param: Cursor for pagination. Returns relays created strictly after this * RFC 3339 timestamp (typically the `created` value of the last item on the * current page, to fetch the next page). */ created_after?: string; /** * Query param: Cursor for pagination. Returns relays created strictly before this * RFC 3339 timestamp (typically the `created` value of the first item on the * current page, to fetch the previous page). */ created_before?: string; /** * Query param: Maximum number of relays to return per page. Values above the * maximum are clamped to it rather than rejected. */ per_page?: number; } export interface RelayDeleteParams { /** * Cloudflare account identifier. */ account_id: string; } export interface RelayGetParams { /** * Cloudflare account identifier. */ account_id: string; } export declare namespace Relays { export { type RelayCreateResponse as RelayCreateResponse, type RelayUpdateResponse as RelayUpdateResponse, type RelayListResponse as RelayListResponse, type RelayDeleteResponse as RelayDeleteResponse, type RelayGetResponse as RelayGetResponse, type RelayListResponsesSinglePage as RelayListResponsesSinglePage, type RelayCreateParams as RelayCreateParams, type RelayUpdateParams as RelayUpdateParams, type RelayListParams as RelayListParams, type RelayDeleteParams as RelayDeleteParams, type RelayGetParams as RelayGetParams, }; export { Tokens as Tokens, BaseTokens as BaseTokens, type TokenCreateResponse as TokenCreateResponse, type TokenListResponse as TokenListResponse, type TokenDeleteResponse as TokenDeleteResponse, type TokenCreateParams as TokenCreateParams, type TokenListParams as TokenListParams, type TokenDeleteParams as TokenDeleteParams, }; } //# sourceMappingURL=relays.d.ts.map