52 lines
2.5 KiB
TypeScript
52 lines
2.5 KiB
TypeScript
import type {
|
|
AgentAvailability,
|
|
Bootstrap,
|
|
Channel,
|
|
InboxItem,
|
|
InboxState,
|
|
Message,
|
|
Notification,
|
|
SearchResult,
|
|
Ticket,
|
|
TicketState,
|
|
User,
|
|
} from "@lynkd/messaging-inbox-sdk";
|
|
|
|
/**
|
|
* The contract every BFF handler talks to. This is the ONE seam between the UI
|
|
* and a real backend. Two implementations:
|
|
* - MockBackend (default) — the in-memory store
|
|
* - IiosBackend — proxies the real IIOS service
|
|
* Selected by BFF_BACKEND ("mock" | "iios"). All methods are async so a network
|
|
* backend drops in without changing the routes.
|
|
*/
|
|
export interface Backend {
|
|
bootstrap(): Promise<Bootstrap>;
|
|
listChannels(): Promise<Channel[]>;
|
|
createChannel(input: { name: string; kind?: string; topic?: string; memberIds?: string[] }): Promise<Channel>;
|
|
addMember(channelId: string, userId: string): Promise<Channel | null>;
|
|
removeMember(channelId: string, userId: string): Promise<Channel | null>;
|
|
markRead(channelId: string): Promise<Channel | null>;
|
|
setStatus(text: string | undefined, emoji: string | undefined, clearAt?: number): Promise<User>;
|
|
updateMe(patch: { name?: string; title?: string; avatarColor?: string; avatarUrl?: string | null; presence?: string }): Promise<User>;
|
|
channelMessages(channelId: string): Promise<Message[]>;
|
|
thread(channelId: string, parentId: string): Promise<{ parent: Message | null; replies: Message[] }>;
|
|
send(channelId: string, body: string, opts?: { parentId?: string; scheduledFor?: number; attachments?: import("@lynkd/messaging-inbox-sdk").Attachment[]; threadRootId?: string | null }): Promise<Message>;
|
|
editMessage(channelId: string, messageId: string, body: string): Promise<Message | null>;
|
|
deleteMessage(channelId: string, messageId: string): Promise<{ ok: boolean }>;
|
|
react(channelId: string, messageId: string, emoji: string): Promise<Message | null>;
|
|
pin(channelId: string, messageId: string): Promise<Message | null>;
|
|
save(channelId: string, messageId: string): Promise<Message | null>;
|
|
savedMessages(): Promise<Message[]>;
|
|
threadParents(): Promise<Message[]>;
|
|
listInbox(state?: InboxState): Promise<InboxItem[]>;
|
|
patchInbox(id: string, state: InboxState): Promise<InboxItem | null>;
|
|
listTickets(scope?: string): Promise<Ticket[]>;
|
|
getTicket(id: string): Promise<Ticket | null>;
|
|
patchTicket(id: string, state: TicketState): Promise<Ticket | null>;
|
|
replyTicket(id: string, body: string): Promise<Ticket | null>;
|
|
availability(): Promise<AgentAvailability[]>;
|
|
search(q: string): Promise<SearchResult[]>;
|
|
notifications(): Promise<Notification[]>;
|
|
}
|