Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Kavita #39

Merged
merged 9 commits into from
Nov 13, 2024
Prev Previous commit
Next Next commit
Implement new book page
l7ssha committed Nov 13, 2024
commit 8249ecbb97b5801930516a757949183513f1710b
12 changes: 11 additions & 1 deletion lib/src/modules/kavita.dart
Original file line number Diff line number Diff line change
@@ -52,17 +52,20 @@ class ContinuePoint {
final int pagesRead;
final int pages;
final int volumeId;
final bool isBook;

int get chapterId => id;

ContinuePoint({required this.id, required this.pagesRead, required this.pages, required this.volumeId});
ContinuePoint(
{required this.id, required this.pagesRead, required this.pages, required this.volumeId, this.isBook = false});

factory ContinuePoint.fromJson(Map<String, dynamic> raw) {
return ContinuePoint(
id: raw['id'],
pagesRead: raw['pagesRead'],
pages: raw['pages'],
volumeId: raw['volumeId'],
isBook: (raw['files'] as List<dynamic>?)?.firstOrNull?['format'] == 3,
);
}
}
@@ -122,6 +125,13 @@ class AuthenticatedKavitaClient {
return ContinuePoint.fromJson(body);
}

Future<String> getBookPage(int chapterId, int page) async {
final result =
await _get("/api/Book/$chapterId/book-page", parameters: {"page": page.toString()}, authApiKey: true);

return result.body;
}

Future<int> getNextChapter(int seriesId, int volumeId, int currentChapterId) async {
final result = await _get("/api/Reader/next-chapter",
parameters: {