You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
714 B
Dart

import 'package:isekai_wiki/api/base_api.dart';
2 years ago
import 'package:isekai_wiki/global.dart';
class RestbaseApi {
static Uri getUri(String endpoint, {Map<String, dynamic>? search}) {
String url = Global.siteConfig.restfulApiUrl;
2 years ago
if (url.endsWith("/")) {
url = url.substring(0, url.length - 1);
}
return Uri.parse(url + endpoint).replace(queryParameters: search);
}
static Future<String> get(String path, {Map<String, dynamic>? search}) async {
var uri = getUri(path, search: search);
return BaseApi.get(uri);
2 years ago
}
static Future<Map> getJson(String path, {Map<String, dynamic>? search}) async {
var uri = getUri(path, search: search);
return BaseApi.getJson(uri);
2 years ago
}
}