createCustomListResponse method

Future<Response> createCustomListResponse(
  1. String sessionToken,
  2. String listName,
  3. Visibility visibility,
  4. List<String> mangaIds,
  5. int version,
)
inherited

Endpoint used: POST /list

Creates a custom list with the name listName and sets visibility to either Visibility.private or Visibility.public and adds all mangas IDs / UUIDs in the mangaIds list and returns a http response containing data of the list created.

Implementation

Future<http.Response> createCustomListResponse(
    String sessionToken,
    String listName,
    Visibility visibility,
    List<String> mangaIds,
    int version) async {
  var payload = {HttpHeaders.authorizationHeader: 'Bearer $sessionToken'};
  var body = {
    'name': listName,
    'visibility': EnumUtils.parseVisibilityFromEnum(visibility),
    'manga': mangaIds,
    'version': version,
  };
  var unencodedPath = '/list';
  final uri = 'https://$AUTHORITY$unencodedPath';
  return await http.post(Uri.parse(uri), headers: payload, body: body);
}