diff --git a/ably.d.ts b/ably.d.ts index 2f3dd499a..9154ef81c 100644 --- a/ably.d.ts +++ b/ably.d.ts @@ -2028,7 +2028,44 @@ export declare interface PushChannel { /** * Enables the LiveObjects state to be subscribed to for a channel. */ -export declare interface LiveObjects {} +export declare interface LiveObjects { + getRoot(): Promise; +} + +// TODO: document public API for LiveObjects + +export declare interface LiveMap extends LiveObject { + get(key: string): LiveObject | StateValue | undefined; + size(): number; +} + +export declare interface LiveMapUpdate extends LiveObjectUpdate { + update: { [keyName: string]: 'updated' | 'removed' }; +} + +export type StateValue = string | number | boolean | Buffer | Uint8Array; + +export declare interface LiveCounter extends LiveObject { + value(): number; +} + +export declare interface LiveCounterUpdate extends LiveObjectUpdate { + update: { inc: number }; +} + +export declare interface LiveObject { + subscribe(listener: (update: TUpdate) => void): SubscribeResponse; + unsubscribe(listener: (update: TUpdate) => void): void; + unsubscribeAll(): void; +} + +export declare interface LiveObjectUpdate { + update: any; +} + +export declare interface SubscribeResponse { + unsubscribe(): void; +} /** * Enables messages to be published and historic messages to be retrieved for a channel.