1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 06:49:22 +00:00
comunicmobile/lib/models/api_request.dart
2019-04-22 19:16:26 +02:00

28 lines
630 B
Dart

import 'package:meta/meta.dart';
/// API Request model
///
/// Contains all the information associated to an API request
///
/// @author Pierre HUBERT
class APIRequest {
final String uri;
final bool needLogin;
Map<String, String> args;
APIRequest({
@required this.uri,
this.needLogin = false,
}) : assert(uri != null),
assert(needLogin != null),
args = Map();
void addString(String name, String value) => args[name] = value;
void addInt(String name, int value) => args[name] = value.toString();
void addBool(String name, bool value) =>
args[name] = value ? "true" : "false";
}