Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637import type { Nsid } from "@atcute/lexicons/syntax";import type { OAuthUserAgent } from "@atcute/oauth-browser-client";import type { BobbinContext, XrpcRequestInit } from "./client";import { jsonGet } from "./_request";import type { RecordView } from "./records";import { deleteRecord, putRecord } from "./write";import type * as ShTangledFeedReaction from "./lexicons/types/sh/tangled/feed/reaction";
export type ReactionRecord = ShTangledFeedReaction.Main;
const REACTION_COLLECTION = "sh.tangled.feed.reaction" as Nsid;
export const putReaction = async ( agent: OAuthUserAgent, rkey: string, record: ReactionRecord): Promise<RecordView<ReactionRecord>> => { const { uri, cid } = await putRecord(agent, REACTION_COLLECTION, rkey, record); return { uri, cid, value: record };};
export const deleteReaction = async (agent: OAuthUserAgent, rkey: string): Promise<void> => { await deleteRecord(agent, REACTION_COLLECTION, rkey);};
export interface ReactionListPage { cursor?: string | null; items: RecordView<ReactionRecord>[];}
export const listReactions = ( ctx: BobbinContext, subject: string, filter: { limit?: number; cursor?: string; order?: "asc" | "desc" } = {}, init?: XrpcRequestInit) => jsonGet<ReactionListPage>(ctx, "sh.tangled.feed.listReactions", { subject, ...filter }, init);