Skip to content

Commit a0d2670

Browse files
sm-sayedignprice
authored andcommitted
api: Add updateStatus
1 parent c25ff7b commit a0d2670

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/api/route/users.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:json_annotation/json_annotation.dart';
22

3+
import '../../basic.dart';
34
import '../core.dart';
45
import '../model/model.dart';
56

@@ -34,6 +35,21 @@ class GetOwnUserResult {
3435
Map<String, dynamic> toJson() => _$GetOwnUserResultToJson(this);
3536
}
3637

38+
/// https://zulip.com/api/update-status
39+
Future<void> updateStatus(ApiConnection connection, {
40+
required UserStatusChange change,
41+
}) {
42+
return connection.post('updateStatus', (_) {}, 'users/me/status', {
43+
if (change.text case OptionSome(:var value))
44+
'status_text': RawParameter(value ?? ''),
45+
if (change.emoji case OptionSome(:var value)) ...{
46+
'emoji_name': RawParameter(value?.emojiName ?? ''),
47+
'emoji_code': RawParameter(value?.emojiCode ?? ''),
48+
'reaction_type': RawParameter(value?.reactionType.toJson() ?? ''),
49+
}
50+
});
51+
}
52+
3753
/// https://zulip.com/api/update-presence
3854
///
3955
/// Passes true for `slim_presence` to avoid getting an ancient data format

0 commit comments

Comments
 (0)