feat(shared): types for federation user lookup + WS events

Add FederationUserLookupRequest, FederationUserLookupProfile, and
FederationUserLookupResponse for the peer lookup endpoint contract.
Add friend_request_sent and friend_request_relay_failed ServerEvent
variants alongside existing friend_request_* cases.
This commit is contained in:
Jannis Braun
2026-04-25 21:19:40 +02:00
parent 1b98b052a1
commit 1a9dc547c4
+18
View File
@@ -438,6 +438,8 @@ export type ServerEvent =
| { type: 'friend_removed'; userId: string } | { type: 'friend_removed'; userId: string }
| { type: 'friend_request_cancelled'; requestId: string; userId: string } | { type: 'friend_request_cancelled'; requestId: string; userId: string }
| { type: 'friend_request_declined'; requestId: string; userId: string } | { type: 'friend_request_declined'; requestId: string; userId: string }
| { type: 'friend_request_sent'; request: FriendRequest }
| { type: 'friend_request_relay_failed'; requestId: string; reason: 'user_not_found' | 'peer_rejected'; message: string; targetHandle: string }
| { type: 'channel_created'; channel: Channel; spaceId: string } | { type: 'channel_created'; channel: Channel; spaceId: string }
| { type: 'channel_updated'; channel: Channel; spaceId: string } | { type: 'channel_updated'; channel: Channel; spaceId: string }
| { type: 'channel_deleted'; channelId: string; spaceId: string } | { type: 'channel_deleted'; channelId: string; spaceId: string }
@@ -993,6 +995,22 @@ export interface FederationSyncResponse {
checkpoint: number; checkpoint: number;
} }
export interface FederationUserLookupRequest {
username: string;
}
export interface FederationUserLookupProfile {
displayName: string | null;
avatar: string | null;
avatarColor: AvatarColor | null;
banner: string | null;
bio: string | null;
}
export type FederationUserLookupResponse =
| { found: true; user: { homeUserId: string; username: string; profile: FederationUserLookupProfile } }
| { found: false; code: 'user_not_found' };
export interface FederationPeer { export interface FederationPeer {
id: string; id: string;
origin: string; origin: string;