diff --git a/lib/client/v1/comment_endpoint.dart b/lib/client/v1/comment_endpoint.dart index 187498f..03880ce 100644 --- a/lib/client/v1/comment_endpoint.dart +++ b/lib/client/v1/comment_endpoint.dart @@ -73,7 +73,7 @@ extension CommentEndpoint on V1 { /// https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#create-comment-like String createCommentLike({ @required int commentId, - @required int score, + @required Vote score, @required String auth, }) { throw UnimplementedError(); diff --git a/lib/client/v1/main.dart b/lib/client/v1/main.dart index c39784e..51a0058 100644 --- a/lib/client/v1/main.dart +++ b/lib/client/v1/main.dart @@ -29,3 +29,22 @@ class V1 { throw UnimplementedError(); } } + +enum Vote { + up, + none, + down, +} + +extension VoteValue on Vote { + int get value { + switch (this) { + case Vote.up: + return 1; + case Vote.none: + return 0; + case Vote.down: + return -1; + } + } +} diff --git a/lib/client/v1/post_endpoint.dart b/lib/client/v1/post_endpoint.dart index 39c6f24..3334046 100644 --- a/lib/client/v1/post_endpoint.dart +++ b/lib/client/v1/post_endpoint.dart @@ -42,7 +42,7 @@ extension PostEndpoint on V1 { /// https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#create-post-like String createPostLike({ @required int postId, - @required int score, + @required Vote score, @required String auth, }) { throw UnimplementedError();