Some checks failed
Build and Deploy Docs / build-and-deploy (push) Has been cancelled
- Created logs/ structure (sessions, operations, incidents) - Added session-start/log/end scripts - Installed Git hooks for auto-logging commits/pushes - Added shell integration for zsh - Created CHANGELOG.md - Documented today's session (2026-01-10)
43 lines
634 B
TypeScript
43 lines
634 B
TypeScript
import type { Message } from '../types/messenger';
|
|
|
|
export async function getChannelMessages(
|
|
channelId: string,
|
|
limit: number = 50,
|
|
before?: string
|
|
): Promise<Message[]> {
|
|
let url = `/api/messaging/channels/${channelId}/messages?limit=${limit}`;
|
|
if (before) {
|
|
url += `&before=${encodeURIComponent(before)}`;
|
|
}
|
|
|
|
const res = await fetch(url, {
|
|
method: 'GET',
|
|
headers: {
|
|
'Accept': 'application/json',
|
|
'X-User-Id': 'user:admin', // TODO: get from auth context
|
|
},
|
|
});
|
|
|
|
if (!res.ok) {
|
|
throw new Error(`Failed to fetch messages: ${res.status}`);
|
|
}
|
|
|
|
return res.json();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|