1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 00:05:16 +00:00

Start to display user groups

This commit is contained in:
2020-04-15 12:04:19 +02:00
parent 8300fc8ca9
commit 4bedbc4b25
9 changed files with 173 additions and 1 deletions

View File

@ -16,4 +16,13 @@ class APIResponse {
/// Check if the request is successful or not
bool get isOK => code == 200;
/// Make sure the request succeed, or throw an exception else
APIResponse assertOk() {
if(!this.isOK)
throw Exception("Request failed with status $code");
return this;
}
}

View File

@ -22,6 +22,7 @@ enum GroupPostCreationLevel { MODERATORS, MEMBERS }
class Group {
final int id;
final String name;
final String iconURL;
final int numberMembers;
final GroupMembershipLevel membershipLevel;
final GroupVisibilityLevel visibilityLevel;
@ -33,6 +34,7 @@ class Group {
Group({
@required this.id,
@required this.name,
@required this.iconURL,
@required this.numberMembers,
@required this.membershipLevel,
@required this.visibilityLevel,
@ -42,6 +44,7 @@ class Group {
@required this.following,
}) : assert(id != null),
assert(name != null),
assert(iconURL != null),
assert(numberMembers != null),
assert(membershipLevel != null),
assert(visibilityLevel != null),