Monorepo for Tangled tangled.org
1

Configure Feed

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

web/lib/api: introduce putString

Signed-off-by: oppiliappan <me@oppi.li>

author
oppiliappan
committer
Tangled
date (Jul 24, 2026, 9:09 PM +0300) commit 91f1297b parent c6a973de change-id pottnwpl
+29
+2
web/src/lib/api/records.ts
··· 4 4 import type * as ShTangledRepo from "./lexicons/types/sh/tangled/repo"; 5 5 import type * as ShTangledRepoIssue from "./lexicons/types/sh/tangled/repo/issue"; 6 6 import type * as ShTangledRepoPull from "./lexicons/types/sh/tangled/repo/pull"; 7 + import type * as ShTangledString from "./lexicons/types/sh/tangled/string"; 7 8 8 9 export interface RecordView<V> { 9 10 uri: string; ··· 19 20 export type ProfileRecord = ShTangledActorProfile.Main; 20 21 export type IssueRecord = ShTangledRepoIssue.Main; 21 22 export type PullRecord = ShTangledRepoPull.Main; 23 + export type StringRecord = ShTangledString.Main; 22 24 23 25 export const BULK_LIMIT = 50; 24 26
+27
web/src/lib/api/strings.ts
··· 1 + import { ok } from "@atcute/client"; 2 + import { mainSchema as putRecordSchema } from "@atcute/atproto/types/repo/putRecord"; 3 + import type { Nsid, RecordKey } from "@atcute/lexicons/syntax"; 4 + import type { OAuthUserAgent } from "@atcute/oauth-browser-client"; 5 + import { createClient } from "$lib/auth/agent"; 6 + import type { StringRecord } from "./records"; 7 + 8 + const STRING_COLLECTION = "sh.tangled.string" as Nsid; 9 + 10 + // strings live at a generated tid rkey; put upserts the record at `rkey`. 11 + export 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 + };