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 / profile.ts
788 B 23 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 { ProfileRecord } from "./records"; 7 8const PROFILE_COLLECTION = "sh.tangled.actor.profile" as Nsid; 9 10// the profile record lives at the fixed rkey `self`; put upserts it. 11export const putProfile = async (agent: OAuthUserAgent, record: ProfileRecord): Promise<void> => { 12 const rpc = createClient(agent); 13 await ok( 14 rpc.call(putRecordSchema, { 15 input: { 16 repo: agent.sub, 17 collection: PROFILE_COLLECTION, 18 rkey: "self" as RecordKey, 19 record 20 } 21 }) 22 ); 23};