Added option to add reactions to talk messages
This commit is contained in:
26
lib/api/marianumcloud/talk/reactMessage/reactMessage.dart
Normal file
26
lib/api/marianumcloud/talk/reactMessage/reactMessage.dart
Normal file
@ -0,0 +1,26 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../../../apiParams.dart';
|
||||
import '../talkApi.dart';
|
||||
import 'reactMessageParams.dart';
|
||||
|
||||
class ReactMessage extends TalkApi {
|
||||
String chatToken;
|
||||
int messageId;
|
||||
ReactMessage({required this.chatToken, required this.messageId, required ReactMessageParams params}) : super("v1/reaction/$chatToken/$messageId", params);
|
||||
|
||||
@override
|
||||
assemble(String raw) {
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Response>? request(Uri uri, ApiParams? body, Map<String, String>? headers) {
|
||||
if(body is ReactMessageParams) {
|
||||
return http.post(uri, headers: headers, body: body.toJson());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../apiParams.dart';
|
||||
|
||||
part 'reactMessageParams.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class ReactMessageParams extends ApiParams {
|
||||
String reaction;
|
||||
|
||||
ReactMessageParams(this.reaction);
|
||||
|
||||
factory ReactMessageParams.fromJson(Map<String, dynamic> json) => _$ReactMessageParamsFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$ReactMessageParamsToJson(this);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'reactMessageParams.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
ReactMessageParams _$ReactMessageParamsFromJson(Map<String, dynamic> json) =>
|
||||
ReactMessageParams(
|
||||
json['reaction'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ReactMessageParamsToJson(ReactMessageParams instance) =>
|
||||
<String, dynamic>{
|
||||
'reaction': instance.reaction,
|
||||
};
|
Reference in New Issue
Block a user