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 / notifications.ts
1.1 kB 32 lines
1import { authedGet, authedPost, type AppviewContext } from "./appview"; 2import type { XrpcRequestInit } from "./client"; 3 4// mirrors org.tangled.temp.notification.getPreferences#preferences 5export interface NotificationPreferences { 6 repoStarred: boolean; 7 issueCreated: boolean; 8 issueCommented: boolean; 9 issueClosed: boolean; 10 pullCreated: boolean; 11 pullCommented: boolean; 12 pullMerged: boolean; 13 followed: boolean; 14 userMentioned: boolean; 15 emailNotifications: boolean; 16} 17 18const GET_PREFERENCES = "org.tangled.temp.notification.getPreferences"; 19const UPDATE_PREFERENCES = "org.tangled.temp.notification.updatePreferences"; 20 21export const getNotificationPreferences = ( 22 ctx: AppviewContext, 23 init?: XrpcRequestInit 24): Promise<NotificationPreferences> => 25 authedGet<NotificationPreferences>(ctx, GET_PREFERENCES, undefined, init); 26 27// only the provided fields are updated server-side. 28export const updateNotificationPreferences = ( 29 ctx: AppviewContext, 30 patch: Partial<NotificationPreferences>, 31 init?: XrpcRequestInit 32): Promise<void> => authedPost(ctx, UPDATE_PREFERENCES, patch, init).then(() => undefined);