Add Vote enum for upvotes
This commit is contained in:
parent
091070726e
commit
1515c6f397
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue