UNPKG

@river-build/react-sdk

Version:
31 lines 1.18 kB
import { type TimelineEvents } from '@river-build/sdk'; import { type ObservableConfig } from './useObservable'; /** * Hook to get the timeline events from a stream. * * You can use the `useTimeline` hook to get the timeline events from a channel stream, dm stream or group dm stream * * @example * ```ts * import { useTimeline } from '@river-build/react-sdk' * import { RiverTimelineEvent } from '@river-build/sdk' * * const { data: events } = useTimeline(streamId) * * // You can filter the events by their kind * const messages = events.filter((event) => event.content?.kind === RiverTimelineEvent.ChannelMessage) * ``` * * @param streamId - The id of the stream to get the timeline events from. * @param config - Configuration options for the observable. * @returns The timeline events of the stream as an observable. */ export declare const useTimeline: (streamId: string, config?: ObservableConfig.FromObservable<TimelineEvents>) => { data: import("@river-build/sdk").TimelineEvent[]; error: undefined; status: "loading" | "loaded"; isLoading: boolean; isError: false; isLoaded: boolean; }; //# sourceMappingURL=useTimeline.d.ts.map