This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / web / src / lib / api / strings.ts
798 B 27 lines
1import { ok } from "@atcute/client"; 2import { mainSchema as putRecordSchema } from "@atcute/atproto/types/repo/putRecord"; 3import type { Nsid, RecordKey } from "@atcute/lexicons/syntax"; 4import type { OAuthUserAgent } from "@atcute/oauth-browser-client"; 5import { createClient } from "$lib/auth/agent"; 6import type { StringRecord } from "./records"; 7 8const STRING_COLLECTION = "sh.tangled.string" as Nsid; 9 10// strings live at a generated tid rkey; put upserts the record at `rkey`. 11export const putString = async ( 12 agent: OAuthUserAgent, 13 rkey: string, 14 record: StringRecord 15): Promise<void> => { 16 const rpc = createClient(agent); 17 await ok( 18 rpc.call(putRecordSchema, { 19 input: { 20 repo: agent.sub, 21 collection: STRING_COLLECTION, 22 rkey: rkey as RecordKey, 23 record 24 } 25 }) 26 ); 27};