import { ESPCDFGroup } from "./ESPCDFGroup"; import { ESPCDFGroupSharingRequest } from "./ESPCDFGroupSharingRequest"; import { ESPCDFUserInfo, ESPCDFPaginatedAPIResponse, ESPCDFUserOperationType, ESPCDFUserInterface, ESPCDFUserOperation, ESPCDFUserCustomDataRequest, ESPCDFCreateGroupRequest, ESPCDFAPIResponse, ESPCDFAPIDataResponse, GroupStoreCallbacks, ESPCDFCreateHomeRequestParams, AddDeviceParams, AddOnNetworkDeviceParams, ESPCDFSubscribeToNodeUpdatesRequestParams, ESPCDFMatterPrecommissionInfo, ESPCDFAssumeRoleRequest, ESPCDFAssumeRoleResponse } from "../types"; import type { ESPCDFSyncOptions } from "../types/cdf"; import type { ESPCDFSessionEndReason } from "../types/entities/user"; import { ESPCDFOperationEventEmitter, ESPCDFOperationListener } from "../utils/OperationEventEmitter"; import { ESPCDFNode } from "./ESPCDFNode"; export declare class ESPCDFUser implements ESPCDFUserInterface { #private; identifier: string; userInfo: ESPCDFUserInfo; customData?: Record; operations: ESPCDFUserOperation; _raw: any; __storeCallbacks?: GroupStoreCallbacks; readonly events: ESPCDFOperationEventEmitter; constructor(userData: ESPCDFUserInterface); /** * Subscribe to all operation events * @param listener - The callback function to register * @returns Unsubscribe function */ subscribe(listener: ESPCDFOperationListener): () => void; /** * Remove all listeners and clean up */ dispose(): void; /** * Reports that the SDK session is gone (tokens cleared by a 401 or a * rejected refresh). Clears the stores and the snapshot, like `logout`, and * emits `sessionEnded` once so the app can leave the signed-in screens. */ sessionEnded(reason: ESPCDFSessionEndReason): void; /** * Internal method to emit callbacks after operations */ private emit; /** * Wraps an operation with consistent event emission logic */ private runAndEmit; getUserInfo(): Promise; updateUserInfo(userInfo: Partial): Promise; getCustomData(): Promise; setCustomData(customData: ESPCDFUserCustomDataRequest): Promise; changePassword(oldPassword: string, newPassword: string): Promise; updateName(name: string): Promise; requestAccountDeletion(): Promise; confirmAccountDeletion(code: string): Promise; logout(): Promise; registerForNotification(platform: string, deviceToken: string): Promise; unregisterForNotification(deviceToken: string): Promise; getIssuedGroupSharingRequests(count?: number): Promise>; getReceivedGroupSharingRequests(count?: number): Promise>; setTimeZone(timeZone: string): Promise; createGroup(groupRequest: ESPCDFCreateGroupRequest): Promise; /** * Creates a Matter fabric (`ESPRMUser.createFabric`). * On success, {@link UserStoreSynchronizer} adds the fabric to the group store. */ createFabric(groupRequest: ESPCDFCreateGroupRequest): Promise; searchESPDevices(devicePrefix: string, transport: string): Promise; searchESPBLEDevices(customerId: number): Promise; createProvisioningDevice(name: string, transport: string, security?: number, proofOfPossession?: string, softAPPassword?: string, username?: string): Promise; getGroupById(groupId: string, options: Record): Promise; subscribeToEvent(event: string, callback: (data: any) => void): Promise; unsubscribeFromEvent(event: string, callback: (data: any) => void): Promise; setMultipleNodesParams(payload: { nodeId: string; payload: any; }[]): Promise; /** * Fetches groups from all registered SDKs that support group fetching. * This method mirrors the functionality of groupStore.syncGroupsList() but is * accessible through the user entity and works through callback operations. * Calls operations.getGroups() (implemented with access to rootStore), updates groupStore * reactively through callbacks, and stores pagination context for on-demand loading. * @returns Promise resolving to batch operation result with successful and failed group fetches */ getGroups(): Promise>; /** Fetches one node's details into the store. Concurrent calls for the same node share one fetch. */ getNodeDetails(nodeId: string): Promise; /** * Get the access token for the user * @returns The access token */ getAccessToken(): Promise; setStoreCallbacks(callbacks: GroupStoreCallbacks): void; /** * Full home → rooms → nodes sync through the adaptor. Once the tree is synced, * a non-forced call returns the current home from the store without touching * the network, until a push event or a mutation marks the tree stale. * Concurrent calls share one run. */ syncHomeWithNodes(options?: ESPCDFSyncOptions): Promise; setCurrentHome(home: ESPCDFGroup): Promise; /** * Create a home and add it to the group store via callbacks (same pattern as syncHomeWithNodes). * @param params - Name and node IDs to include in the home * @returns The created ESPCDFGroup */ createHome(params: ESPCDFCreateHomeRequestParams): Promise; /** * Add a device via provisioning. Orchestrates provision, timezone setup, * node fetch, and group store update in the adapter layer. * @returns The provisioned ESPCDFNode or null on failure */ addDevice(params: AddDeviceParams): Promise; /** * Add a device that is already on the user's local network using the * challenge-response flow (LAN HTTP). The device is identified by mDNS * discovery and verified through a cloud-issued challenge that the device * signs with its credentials. * @param params - Discovered device, group id, and (optionally) POP * @returns Provisioned ESPCDFNode or `null` if the active adaptor does not * support on-network provisioning or the verification did not yield * a fetchable node. */ addOnNetworkDevice(params: AddOnNetworkDeviceParams): Promise; subscribeToNodeUpdates(params: ESPCDFSubscribeToNodeUpdatesRequestParams): Promise; unsubscribeFromNodeUpdates(): Promise; /** * Obtain short-lived AWS credentials scoped to the requested role/resources. * Throws if the active adaptor does not support this operation. */ assumeRole(request: ESPCDFAssumeRoleRequest): Promise; /** * Returns whether a user NOC is already stored for the given fabric id. * @param fabricId - Matter fabric id */ isUserNocAvailableForFabric(fabricId: string): Promise; storePrecommissionInfo(info: ESPCDFMatterPrecommissionInfo): Promise; createCmdRespRequest(params: T): Promise; getCmdRespRequestById(requestId: string, nodeId?: string): Promise; getCmdRespRequestList(params?: T): Promise; cancelCmdRespRequest(params: T): Promise; createFileUploadRequest(params: T): Promise; uploadFile(content: Blob | ArrayBuffer | Uint8Array, params: T, onProgress?: (progress: unknown) => void): Promise; getFiles(params?: T): Promise; getFileById(fileId: string, params?: T): Promise; downloadFile(fileId: string, params?: T): Promise; }