/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { RootSupervisor } from "#behavior/supervision/RootSupervisor.js"; import type { ValueSupervisor } from "#behavior/supervision/ValueSupervisor.js"; import { Abort, MaybePromise } from "@matter/general"; import { DataModelPath, Schema } from "@matter/model"; import { Envelope } from "./Envelope.js"; import { LocalResponse } from "./LocalResponse.js"; /** * A node in the logical API tree structure. * * {@link ApiResource}s are ephemeral objects created on-demand as the server navigates paths. */ export declare abstract class ApiResource { /** * The item's identifier in the logical model path. */ abstract readonly id: string; /** * The item's owner, if any. */ readonly parent?: ApiResource; /** * Data model path used for diagnostics. */ abstract readonly dataModelPath: DataModelPath; /** * Value supervisor, if any. */ abstract readonly supervisor?: ValueSupervisor; /** * Data value. */ abstract readonly value: unknown; /** * Indicates whether this is an RPC endpoint. */ readonly isInvocable: boolean; /** * Indicates whether this is an event endpoint. */ readonly isSubscribable: boolean; /** * The {@link ApiResource.Kind} for {@link value}. */ abstract readonly valueKind: ApiResource.Kind; constructor(parent: undefined | ApiResource); /** * Retrieve the body of the item. */ read(): Envelope<{} | null> | undefined; /** * Create or replace item. */ write(_request: Envelope.Data): void; /** * Update item using matter.js patch semantics. */ patch(_request: Envelope.Data): MaybePromise; /** * Add a child item of this item. */ add(_request: Envelope.Data): MaybePromise; /** * Remove this item. */ delete(): MaybePromise; /** * The {@link Schema} for this resource subtree. */ get schema(): Schema | undefined; /** * Obtain the appropriate {@link ValueSupervisor} for a {@link Schema} in this subtree. */ supervisorFor(schema: Schema): ValueSupervisor; /** * The {@link RootSupervisor} for this resource subtree. */ get rootSupervisor(): RootSupervisor | undefined; /** * Execute a procedure. */ invoke(_request?: Envelope.Data): Promise; /** * Subscribe to events. */ subscribe(_abort: Abort.Signal, _request?: Envelope.Data): AsyncGenerator, void, void>; /** * Retrieve a child with the specified ID. */ childFor(_id: string): Promise; } export declare namespace ApiResource { /** * "Kind" values provided in response JSON payloads. */ type Kind = "ok" | "node" | "endpoint" | "index" | "cluster" | "attribute" | "field" | "error" | "command" | "response" | "changes"; } //# sourceMappingURL=ApiResource.d.ts.map