/** * Individual backlink record returned by Microcosm Constellation. */ export interface BacklinkRecord { /** DID of the author who created the backlink. */ did: string; /** Collection type of the backlink record (e.g., "sh.tangled.feed.star"). */ collection: string; /** Record key of the backlink. */ rkey: string; } /** * Response from Microcosm Constellation API. */ export interface BacklinksResponse { /** Total count of backlinks. */ total: number; /** Array of backlink records. */ records: BacklinkRecord[]; /** Cursor for pagination (optional). */ cursor?: string; } /** * Parameters for fetching backlinks. */ export interface UseBacklinksParams { /** The AT-URI subject to get backlinks for (e.g., "at://did:plc:xxx/sh.tangled.repo/yyy"). */ subject: string; /** The source collection and path (e.g., "sh.tangled.feed.star:subject"). */ source: string; /** Maximum number of results to fetch (default: 16, max: 100). */ limit?: number; /** Base URL for the Microcosm Constellation API. */ constellationBaseUrl?: string; /** Whether to automatically fetch backlinks on mount. */ enabled?: boolean; } /** * Hook to fetch backlinks from Microcosm Constellation API. * * Backlinks are records that reference another record. For example, * `sh.tangled.feed.star` records are backlinks to `sh.tangled.repo` records, * representing users who have starred a repository. * * @param params - Configuration for fetching backlinks * @returns Object containing backlinks data, loading state, error, and refetch function * * @example * ```tsx * const { backlinks, loading, error, count } = useBacklinks({ * subject: "at://did:plc:example/sh.tangled.repo/3k2aexample", * source: "sh.tangled.feed.star:subject", * }); * ``` */ export declare function useBacklinks({ subject, source, limit, constellationBaseUrl, enabled, }: UseBacklinksParams): { /** Array of backlink records. */ backlinks: BacklinkRecord[]; /** Whether backlinks are currently being fetched. */ loading: boolean; /** Error if fetch failed. */ error: Error | undefined; /** Pagination cursor (not yet implemented for pagination). */ cursor: string | undefined; /** Total count of backlinks from the API. */ total: number; /** Total count of backlinks (alias for total). */ count: number; /** Function to manually refetch backlinks. */ refetch: () => void; };