import { removeWatch } from '../core/rooms.ts' import { handle, optionalString, params } from '../runtime.ts' import { actor, roomAuthFields } from './shared.ts' /** * Remove a member's push wake. * * @param input.room - Room id. * @param input.token - Your room token. * @param input.memberId - Whose watch (default: you; others need the creator). * @returns `{ status: 'ok', memberId, removed }` * @example * import unwatch from 'kody:@kody/rooms/unwatch' * await unwatch({ room: 'room_…', token: '…' }) */ export default async function unwatch(input: unknown) { return handle(async () => { const p = params(input, [...roomAuthFields, 'memberId']) const { ctx, room, member } = await actor(p) return removeWatch(ctx, room, member, { memberId: optionalString(p.memberId, 'memberId') }) }) }