mirror of
https://github.com/cyberbread-ru/notepad.git
synced 2026-07-14 12:51:01 +03:00
initial vibecoded release
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class ApiClient {
|
||||
late final Dio _dio;
|
||||
|
||||
ApiClient({required String baseUrl, required String apiKey}) {
|
||||
_dio = Dio(
|
||||
BaseOptions(
|
||||
baseUrl: baseUrl,
|
||||
headers: {'X-API-Key': apiKey},
|
||||
contentType: 'application/json',
|
||||
connectTimeout: const Duration(seconds: 10),
|
||||
receiveTimeout: const Duration(seconds: 10),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<Response> get(String path) => _dio.get(path);
|
||||
|
||||
Future<Response> post(String path, Map<String, dynamic> body) =>
|
||||
_dio.post(path, data: body);
|
||||
|
||||
Future<Response> put(String path, Map<String, dynamic> body) =>
|
||||
_dio.put(path, data: body);
|
||||
|
||||
Future<Response> delete(String path) => _dio.delete(path);
|
||||
}
|
||||
Reference in New Issue
Block a user