followManga method
Future<Result>
followManga(
- String sessionToken,
- String mangaId, {
- ReadingStatus? readingStatus,
inherited
Endpoint used: POST /manga/{id}/follow
Follow a manga identified by mangaId
and optionally set a reading status for it.
If no readingStatus
is specified, the reading status is set to 'reading' by default
Implementation
Future<Result> followManga(String sessionToken, String mangaId,
{ReadingStatus? readingStatus}) async {
var unencodedPath = '/manga/$mangaId/follow';
final uri = 'https://$AUTHORITY$unencodedPath';
var response = await http.post(Uri.parse(uri), headers: {
HttpHeaders.contentTypeHeader: 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $sessionToken'
});
try {
await setMangaReadingStatus(sessionToken, mangaId, readingStatus);
} on Exception {
print("couldn't set reading status for manga $mangaId");
}
try {
return Result.fromJson(jsonDecode(response.body));
} on Exception {
throw MangadexServerException(jsonDecode(response.body));
}
}