implement a bunch of enums

This commit is contained in:
krawieck 2020-08-11 19:29:56 +02:00
parent 5971a947d6
commit 771a5f28ff
3 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
import 'package:flutter/foundation.dart' show required; import 'package:flutter/foundation.dart' show required;
import 'package:lemmur/client/models/search.dart';
import '../models/category.dart'; import '../models/category.dart';
import '../models/search.dart';
export 'comment_endpoint.dart'; export 'comment_endpoint.dart';
export 'post_endpoint.dart'; export 'post_endpoint.dart';
@ -24,7 +24,7 @@ class V1 {
@required String q, @required String q,
@required SearchType type, @required SearchType type,
String communityId, String communityId,
@required String sort, @required SortType sort,
int page, int page,
int limit, int limit,
String auth, String auth,

View File

@ -32,8 +32,8 @@ extension PostEndpoint on V1 {
/// GET /post/list /// GET /post/list
/// https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#get-posts /// https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#get-posts
Future<List<PostView>> getPosts({ Future<List<PostView>> getPosts({
@required String type, @required PostListingType type,
@required String sort, @required SortType sort,
int page, int page,
int limit, int limit,
int communityId, int communityId,
@ -46,8 +46,8 @@ extension PostEndpoint on V1 {
instanceUrl, instanceUrl,
"/api/v1/post/list", "/api/v1/post/list",
{ {
'type_': type, 'type_': type.value,
'sort': sort, 'sort': sort.value,
if (page != null) 'page': page.toString(), if (page != null) 'page': page.toString(),
if (limit != null) 'limit': limit.toString(), if (limit != null) 'limit': limit.toString(),
if (communityId != null) 'community_id': communityId.toString(), if (communityId != null) 'community_id': communityId.toString(),

View File

@ -2,8 +2,8 @@ import 'package:flutter/foundation.dart' show required;
import 'package:lemmur/client/models/captcha.dart'; import 'package:lemmur/client/models/captcha.dart';
import 'package:lemmur/client/models/comment.dart'; import 'package:lemmur/client/models/comment.dart';
import 'package:lemmur/client/models/user.dart'; import 'package:lemmur/client/models/user.dart';
import '../models/private_message.dart';
import '../models/private_message.dart';
import 'main.dart'; import 'main.dart';
extension UserEndpoint on V1 { extension UserEndpoint on V1 {
@ -40,7 +40,7 @@ extension UserEndpoint on V1 {
Future<UserDetails> getUserDetails({ Future<UserDetails> getUserDetails({
int userId, int userId,
String username, String username,
@required String sort, @required SortType sort,
int page, int page,
int limit, int limit,
int communityId, int communityId,
@ -56,8 +56,8 @@ extension UserEndpoint on V1 {
Future<String> saveUserSettings({ Future<String> saveUserSettings({
@required bool showNsfw, @required bool showNsfw,
@required String theme, @required String theme,
@required int defaultSortType, @required SortType defaultSortType,
@required int defaultListingType, @required PostListingType defaultListingType,
@required String auth, @required String auth,
}) { }) {
throw UnimplementedError(); throw UnimplementedError();
@ -66,7 +66,7 @@ extension UserEndpoint on V1 {
/// GET /user/replies /// GET /user/replies
/// https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#get-replies--inbox /// https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#get-replies--inbox
Future<List<ReplyView>> getReplies({ Future<List<ReplyView>> getReplies({
@required String sort, @required SortType sort,
int page, int page,
int limit, int limit,
@required bool unreadOnly, @required bool unreadOnly,