/** * Fabric API namespace — resource composition, addresses, and tokens. */ import type { HttpClient } from '../HttpClient.js'; import type { QueryParams } from '../types.js'; import { BaseResource } from '../base/BaseResource.js'; import { CrudWithAddresses } from '../base/CrudWithAddresses.js'; /** Standard fabric resource with CRUD + addresses (PATCH updates). */ export declare class FabricResource extends CrudWithAddresses { constructor(http: HttpClient, basePath: string); } /** Fabric resource that uses PUT for updates. */ export declare class FabricResourcePUT extends CrudWithAddresses { protected _updateMethod: 'PATCH' | 'PUT'; constructor(http: HttpClient, basePath: string); } /** Call flows with version management. Uses singular `call_flow` for sub-resource paths. */ export declare class CallFlowsResource extends FabricResourcePUT { constructor(http: HttpClient, basePath: string); /** * List addresses attached to a call flow resource. * * @param resourceId - Unique identifier of the call flow. * @param params - Optional filter / pagination query parameters. * @returns A paginated list of addresses. * @throws {RestError} On any non-2xx HTTP response. */ listAddresses(resourceId: string, params?: QueryParams): Promise; /** * List all saved versions of a call flow. * * @param resourceId - Unique identifier of the call flow. * @param params - Optional filter / pagination query parameters. * @returns A paginated list of call-flow versions. * @throws {RestError} On any non-2xx HTTP response. */ listVersions(resourceId: string, params?: QueryParams): Promise; /** * Publish a new version of a call flow. * * @param resourceId - Unique identifier of the call flow. * @param body - Version payload (schema and metadata). Defaults to `{}`. * @returns The newly-published version record. * @throws {RestError} On any non-2xx HTTP response. */ deployVersion(resourceId: string, body?: any): Promise; } /** Conference rooms — uses singular 'conference_room' for sub-resource paths. */ export declare class ConferenceRoomsResource extends FabricResourcePUT { constructor(http: HttpClient, basePath: string); /** * List addresses attached to a conference-room resource. * * @param resourceId - Unique identifier of the conference room. * @param params - Optional filter / pagination query parameters. * @returns A paginated list of addresses. * @throws {RestError} On any non-2xx HTTP response. */ listAddresses(resourceId: string, params?: QueryParams): Promise; } /** Subscribers with SIP endpoint management. */ export declare class SubscribersResource extends FabricResourcePUT { constructor(http: HttpClient, basePath: string); /** * List the SIP endpoints registered under a subscriber. * * @param subscriberId - Unique identifier of the subscriber. * @param params - Optional filter / pagination query parameters. * @returns A paginated list of SIP endpoints. * @throws {RestError} On any non-2xx HTTP response. */ listSipEndpoints(subscriberId: string, params?: QueryParams): Promise; /** * Register a new SIP endpoint under a subscriber. * * @param subscriberId - Unique identifier of the subscriber. * @param body - SIP endpoint payload (credentials, codecs, etc.). * @returns The newly-created SIP endpoint record. * @throws {RestError} On any non-2xx HTTP response. */ createSipEndpoint(subscriberId: string, body: any): Promise; /** * Fetch a single SIP endpoint by ID. * * @param subscriberId - Unique identifier of the subscriber. * @param endpointId - Unique identifier of the SIP endpoint. * @returns The SIP endpoint record. * @throws {RestError} On any non-2xx HTTP response (including `404`). */ getSipEndpoint(subscriberId: string, endpointId: string): Promise; /** * Update a SIP endpoint's settings. * * @param subscriberId - Unique identifier of the subscriber. * @param endpointId - Unique identifier of the SIP endpoint. * @param body - Partial update payload (PATCH semantics). * @returns The updated SIP endpoint record. * @throws {RestError} On any non-2xx HTTP response. */ updateSipEndpoint(subscriberId: string, endpointId: string, body: any): Promise; /** * Delete a SIP endpoint. * * @param subscriberId - Unique identifier of the subscriber. * @param endpointId - Unique identifier of the SIP endpoint. * @returns The platform's delete response. * @throws {RestError} On any non-2xx HTTP response. */ deleteSipEndpoint(subscriberId: string, endpointId: string): Promise; } /** cXML applications — no create method (read/update/delete only). */ export declare class CxmlApplicationsResource extends FabricResourcePUT { constructor(http: HttpClient, basePath: string); create(): Promise; } /** * Fabric webhook resource that is normally auto-materialized by the * corresponding `phoneNumbers.set*Webhook` helper. * * Creating directly produces an orphan Fabric resource that isn't bound to * any phone number — the API's binding model configures the webhook on the * phone number, and the server materializes the Fabric resource as a * side-effect. `create` remains for backwards compatibility but emits a * one-time deprecation warning on first call. * * See the porting-sdk's `phone-binding.md` for the full model. */ export declare class AutoMaterializedWebhookResource extends FabricResource { /** Label used in the deprecation warning (subclasses override). */ protected _autoHelperName: string; private static _warned; constructor(http: HttpClient, basePath: string); /** * @deprecated Creating a webhook Fabric resource directly produces an * orphan that is not bound to any phone number. Use the * `phoneNumbers.setSwmlWebhook` / `setCxmlWebhook` helper instead — it * updates the phone number and the server auto-materializes the * resource. Kept for backwards compatibility. */ create(body?: any): Promise; } /** Auto-materialized SWML webhook — normally created via `phoneNumbers.setSwmlWebhook`. */ export declare class SwmlWebhooksResource extends AutoMaterializedWebhookResource { protected _autoHelperName: string; } /** Auto-materialized cXML webhook — normally created via `phoneNumbers.setCxmlWebhook`. */ export declare class CxmlWebhooksResource extends AutoMaterializedWebhookResource { protected _autoHelperName: string; } /** Generic resource operations across all fabric resource types. */ export declare class GenericResources extends BaseResource { private static _assignPhoneRouteWarned; constructor(http: HttpClient, basePath: string); /** * List all fabric resources regardless of specific type. * * @param params - Optional filter / pagination query parameters. * @returns A paginated list of generic fabric resources. * @throws {RestError} On any non-2xx HTTP response. */ list(params?: QueryParams): Promise; /** * Fetch a single fabric resource by ID. * * @param resourceId - Unique identifier of the resource. * @returns The resource record. * @throws {RestError} On any non-2xx HTTP response (including `404`). */ get(resourceId: string): Promise; /** * Delete a fabric resource. * * @param resourceId - Unique identifier of the resource. * @returns The platform's delete response. * @throws {RestError} On any non-2xx HTTP response. */ delete(resourceId: string): Promise; /** * List addresses associated with any fabric resource. * * @param resourceId - Unique identifier of the resource. * @param params - Optional filter / pagination query parameters. * @returns A paginated list of addresses. * @throws {RestError} On any non-2xx HTTP response. */ listAddresses(resourceId: string, params?: QueryParams): Promise; /** * Assign a phone route to a fabric resource. * * @deprecated For the common cases — SWML webhooks, cXML webhooks, AI * agents — this endpoint **does not work**. Bindings for those are * configured on the phone number via {@link PhoneNumbersResource.setSwmlWebhook} * / `setCxmlWebhook` / `setAiAgent`, and the Fabric resource is * auto-materialized by the server. Calling this method against * `swml_webhook`, `cxml_webhook`, or `ai_agent` resource IDs returns * `404` or `422`. The endpoint (`POST /api/fabric/resources/{id}/phone_routes`) * applies only to a narrow set of legacy resource types listed in * `rest-apis/relay-rest/openapi.yaml`. Emits a one-time deprecation * warning on first call; kept for backwards compatibility. * * @param resourceId - Unique identifier of the resource. * @param body - Phone route payload. * @returns The phone-route assignment record. * @throws {RestError} On any non-2xx HTTP response. */ assignPhoneRoute(resourceId: string, body: any): Promise; /** * Assign a domain application to a fabric resource. * * @param resourceId - Unique identifier of the resource. * @param body - Domain application payload. * @returns The domain-application assignment record. * @throws {RestError} On any non-2xx HTTP response. */ assignDomainApplication(resourceId: string, body: any): Promise; } /** Read-only fabric addresses. */ export declare class FabricAddresses extends BaseResource { constructor(http: HttpClient, basePath: string); /** * List all fabric addresses in the project. * * @param params - Optional filter / pagination query parameters. * @returns A paginated list of fabric addresses. * @throws {RestError} On any non-2xx HTTP response. */ list(params?: QueryParams): Promise; /** * Fetch a single fabric address by ID. * * @param addressId - Unique identifier of the address. * @returns The address record. * @throws {RestError} On any non-2xx HTTP response (including `404`). */ get(addressId: string): Promise; } /** Subscriber, guest, invite, and embed token creation. */ export declare class FabricTokens extends BaseResource { constructor(http: HttpClient); /** * Issue a new subscriber JWT used by end-user clients. * * @param body - Token payload (subscriber ID, TTL, scopes). Defaults to `{}`. * @returns The token record, typically `{ token: "eyJ..." }`. * @throws {RestError} On any non-2xx HTTP response. */ createSubscriberToken(body?: any): Promise; /** * Refresh an existing subscriber JWT, extending its lifetime. * * @param body - Refresh payload (usually containing the current token). * Defaults to `{}`. * @returns The refreshed token record. * @throws {RestError} On any non-2xx HTTP response. */ refreshSubscriberToken(body?: any): Promise; /** * Create a single-use invite token for onboarding a new subscriber. * * @param body - Invite payload (email, phone, permissions). Defaults to `{}`. * @returns The invite record, including the share URL / code. * @throws {RestError} On any non-2xx HTTP response. */ createInviteToken(body?: any): Promise; /** * Issue a guest token (no subscriber account required). * * @param body - Guest-token payload (context, TTL, etc.). Defaults to `{}`. * @returns The token record. * @throws {RestError} On any non-2xx HTTP response. */ createGuestToken(body?: any): Promise; /** * Issue a short-lived embed token for browser-side SignalWire widgets. * * @param body - Embed-token payload (allowed origins, TTL, etc.). Defaults to `{}`. * @returns The token record. * @throws {RestError} On any non-2xx HTTP response. */ createEmbedToken(body?: any): Promise; } /** * Fabric API namespace grouping all resource types. * * Access via `client.fabric.*`. * * @example * ```ts * const agents = await client.fabric.aiAgents.list(); * const flow = await client.fabric.callFlows.create({ name: 'main-ivr' }); * const token = await client.fabric.tokens.createSubscriberToken({ subscriber_id: 'sub_123' }); * ``` */ export declare class FabricNamespace { /** SWML script CRUD (full-replacement `PUT` update). */ readonly swmlScripts: FabricResourcePUT; /** Relay Application CRUD (full-replacement `PUT` update). */ readonly relayApplications: FabricResourcePUT; /** Call Flow CRUD with version listing and publishing. */ readonly callFlows: CallFlowsResource; /** Conference Room CRUD with address listing. */ readonly conferenceRooms: ConferenceRoomsResource; /** FreeSWITCH Connector CRUD. */ readonly freeswitchConnectors: FabricResourcePUT; /** Subscriber CRUD plus nested SIP endpoint management. */ readonly subscribers: SubscribersResource; /** Top-level SIP endpoint CRUD. */ readonly sipEndpoints: FabricResourcePUT; /** cXML (LaML) script CRUD. */ readonly cxmlScripts: FabricResourcePUT; /** cXML application read / update / delete (no create). */ readonly cxmlApplications: CxmlApplicationsResource; /** * SWML webhook CRUD. **Auto-materialized** as a side-effect of * {@link PhoneNumbersResource.setSwmlWebhook}; direct `create` produces * an orphan resource and emits a deprecation warning. */ readonly swmlWebhooks: SwmlWebhooksResource; /** AI Agent CRUD — the platform-managed agent registration resource. */ readonly aiAgents: FabricResource; /** SIP Gateway CRUD. */ readonly sipGateways: FabricResource; /** * cXML webhook CRUD. **Auto-materialized** as a side-effect of * {@link PhoneNumbersResource.setCxmlWebhook}; direct `create` produces * an orphan resource and emits a deprecation warning. */ readonly cxmlWebhooks: CxmlWebhooksResource; /** Generic operations across all resource types (list, get, delete, phone route assignment). */ readonly resources: GenericResources; /** Read-only access to the unified fabric address table. */ readonly addresses: FabricAddresses; /** Subscriber, guest, invite, and embed token generation. */ readonly tokens: FabricTokens; constructor(http: HttpClient); }