createComment method
Future<CommentActivityResult>
createComment({
- required String token,
- required String targetId,
- required String body,
- String? category,
- List<
String> ? tags, - String? pushRedirectUrl,
override
Implementation
@override
Future<CommentActivityResult> createComment({
required String token,
required String targetId,
required String body,
String? category,
List<String>? tags,
String? pushRedirectUrl,
}) async {
final response = await dio.post(
'/microsite/comments',
options: Options(headers: {'Authorization': 'Bearer $token'}),
data: {
'api_key': Environment.apiKey,
'campaign': Environment.campaign,
'target_id': targetId,
'comment': {
'body': body,
'category': ?category,
if (tags != null && tags.isNotEmpty) 'tags': tags,
'push_redirect_url': ?pushRedirectUrl,
},
},
);
final responseData = _parseResponse(response.data);
return CommentMapper.commentActivityResultToEntity(
CommentActivityResultResponse.fromJson(responseData),
);
}