26 lines
564 B
Dart
26 lines
564 B
Dart
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:http/http.dart';
|
|
|
|
import '../talkApi.dart';
|
|
|
|
class SetFavorite extends TalkApi {
|
|
String chatToken;
|
|
bool favoriteState;
|
|
|
|
SetFavorite(this.chatToken, this.favoriteState) : super('v4/room/$chatToken/favorite', null);
|
|
|
|
@override
|
|
assemble(String raw) => null;
|
|
|
|
@override
|
|
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) {
|
|
if(favoriteState) {
|
|
return http.post(uri, headers: headers);
|
|
} else {
|
|
return http.delete(uri, headers: headers);
|
|
}
|
|
}
|
|
|
|
}
|