mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-09 10:00:27 +00:00
feat: support calling Gopeed API via host RPC (#1247)
This commit is contained in:
4 files changed
+100
-17
No files matched your search
@@ -14,7 +14,6 @@ import 'model/downloader_config.dart';
|
||||
import 'model/extension.dart';
|
||||
import 'model/install_extension.dart';
|
||||
import 'model/login.dart';
|
||||
import 'model/request.dart';
|
||||
import 'model/resolve_result.dart';
|
||||
import 'model/resolve_task.dart';
|
||||
import 'model/result.dart';
|
||||
@@ -267,3 +266,19 @@ String join(String path) {
|
||||
: baseUrl;
|
||||
return "$cleanBaseUrl/${Util.cleanPath(path)}";
|
||||
}
|
||||
|
||||
/// Generic request method for API proxy
|
||||
/// Directly forwards requests to gopeed REST API
|
||||
Future<Response> forward(
|
||||
String path, {
|
||||
String method = 'GET',
|
||||
dynamic data,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
}) async {
|
||||
return _client.dio.request(
|
||||
path,
|
||||
data: data,
|
||||
queryParameters: queryParameters,
|
||||
options: Options(method: method),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user