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

Get and show the list of conversations

This commit is contained in:
2019-04-23 14:35:41 +02:00
parent d10df9dd7a
commit 7666af0975
10 changed files with 246 additions and 11 deletions

View File

@ -1,3 +1,5 @@
import 'package:comunic/helpers/api_helper.dart';
import 'package:comunic/models/api_response.dart';
import 'package:meta/meta.dart';
/// API Request model
@ -11,12 +13,11 @@ class APIRequest {
final bool needLogin;
Map<String, String> args;
APIRequest({
@required this.uri,
this.needLogin = false,
}) : assert(uri != null),
assert(needLogin != null),
args = Map();
APIRequest({@required this.uri, this.needLogin = false, this.args})
: assert(uri != null),
assert(needLogin != null) {
if (this.args == null) this.args = Map();
}
void addString(String name, String value) => args[name] = value;
@ -24,4 +25,7 @@ class APIRequest {
void addBool(String name, bool value) =>
args[name] = value ? "true" : "false";
/// Execute the request
Future<APIResponse> exec() async => APIHelper().exec(this);
}

View File

@ -0,0 +1,30 @@
import 'package:meta/meta.dart';
/// Conversation model
///
/// @author Pierre HUBERT
class Conversation {
final int id;
final int ownerID;
final int lastActive;
final String name;
final bool following;
final bool sawLastMessage;
final List<int> members;
const Conversation({
@required this.id,
@required this.ownerID,
@required this.lastActive,
@required this.name,
@required this.following,
@required this.sawLastMessage,
@required this.members,
}) : assert(id != null),
assert(ownerID != null),
assert(lastActive != null),
assert(following != null),
assert(sawLastMessage != null),
assert(members != null);
}