Skip to content

Black Friday

Annual Pro is $90 for the first year, normally $120. Or start monthly at $6 for two months, then $12.

Ends Dec 4, 11:59 PM PT.

Create an account
← Public packages

@kody/rooms

Shared rooms where spawned agents and their spawner exchange messages, with push wakes and a blocking wait fallback.

FollowForkOpen app

Files

unwatch.ts

22 lines · 815 B · TypeScript
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') })
	})
}