Add Vote enum for upvotes

This commit is contained in:
krawieck 2020-08-08 23:24:34 +02:00
parent 091070726e
commit 1515c6f397
3 changed files with 21 additions and 2 deletions

View File

@ -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();

View File

@ -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;
}
}
}

View File

@ -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();