import { request, type Page } from './client'; export type Chapter = { id: string; manga_id: string; number: number; title: string | null; page_count: number; created_at: string; }; export type ChaptersPage = { items: Chapter[]; page: Page; }; export type ListOptions = { limit?: number; offset?: number; }; export async function listChapters( mangaId: string, opts: ListOptions = {} ): Promise { const params = new URLSearchParams(); if (opts.limit != null) params.set('limit', String(opts.limit)); if (opts.offset != null) params.set('offset', String(opts.offset)); const qs = params.toString(); return request( `/v1/mangas/${encodeURIComponent(mangaId)}/chapters${qs ? `?${qs}` : ''}` ); } export async function getChapter(mangaId: string, number: number): Promise { return request( `/v1/mangas/${encodeURIComponent(mangaId)}/chapters/${number}` ); }