2020-08-05 23:21:26 +02:00
|
|
|
import 'package:flutter/foundation.dart';
|
2020-08-06 22:06:53 +02:00
|
|
|
|
|
|
|
export 'comment_endpoint.dart';
|
|
|
|
export 'post_endpoint.dart';
|
|
|
|
export 'user_endpoint.dart';
|
2020-08-05 23:21:26 +02:00
|
|
|
|
|
|
|
class V1 {
|
|
|
|
String instanceUrl;
|
|
|
|
|
2020-08-06 22:06:53 +02:00
|
|
|
V1(this.instanceUrl);
|
2020-08-05 23:21:26 +02:00
|
|
|
|
|
|
|
/// GET /categories
|
|
|
|
/// https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#list-categories
|
|
|
|
String listCategories() {
|
|
|
|
throw UnimplementedError();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// POST /search
|
|
|
|
/// https://dev.lemmy.ml/docs/contributing_websocket_http_api.html#search
|
|
|
|
String search({
|
|
|
|
@required String q,
|
|
|
|
@required String type,
|
|
|
|
String communityId,
|
|
|
|
@required String sort,
|
|
|
|
int page,
|
|
|
|
int limit,
|
|
|
|
String auth,
|
|
|
|
}) {
|
|
|
|
throw UnimplementedError();
|
|
|
|
}
|
|
|
|
}
|
2020-08-08 23:24:34 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2020-08-09 23:20:21 +02:00
|
|
|
throw Exception("unreachable");
|
2020-08-08 23:24:34 +02:00
|
|
|
}
|
|
|
|
}
|
2020-08-09 23:24:06 +02:00
|
|
|
|
|
|
|
class Captcha {
|
|
|
|
final String png;
|
|
|
|
|
|
|
|
/// can be null
|
|
|
|
final String wav;
|
|
|
|
final String uuid;
|
|
|
|
Captcha({this.png, this.wav, this.uuid});
|
|
|
|
}
|