updated project linter-rules and enforced them
This commit is contained in:
@ -9,7 +9,7 @@ import 'queries/authenticate/authenticate.dart';
|
||||
import 'webuntisError.dart';
|
||||
|
||||
abstract class WebuntisApi extends ApiRequest {
|
||||
Uri endpoint = Uri.parse("https://${EndpointData().webuntis().full()}/WebUntis/jsonrpc.do?school=marianum-fulda");
|
||||
Uri endpoint = Uri.parse('https://${EndpointData().webuntis().full()}/WebUntis/jsonrpc.do?school=marianum-fulda');
|
||||
String method;
|
||||
ApiParams? genericParam;
|
||||
http.Response? response;
|
||||
@ -22,11 +22,11 @@ abstract class WebuntisApi extends ApiRequest {
|
||||
Future<String> query(WebuntisApi untis) async {
|
||||
String query = '{"id":"ID","method":"$method","params":${untis._body()},"jsonrpc":"2.0"}';
|
||||
|
||||
String sessionId = "0";
|
||||
String sessionId = '0';
|
||||
if(authenticatedResponse) {
|
||||
sessionId = (await Authenticate.getSession()).sessionId;
|
||||
}
|
||||
http.Response data = await post(query, {"Cookie": "JSESSIONID=$sessionId"});
|
||||
http.Response data = await post(query, {'Cookie': 'JSESSIONID=$sessionId'});
|
||||
response = data;
|
||||
|
||||
dynamic jsonData = jsonDecode(data.body);
|
||||
@ -49,7 +49,7 @@ abstract class WebuntisApi extends ApiRequest {
|
||||
Future<ApiResponse> run();
|
||||
|
||||
String _body() {
|
||||
return genericParam == null ? "{}" : jsonEncode(genericParam);
|
||||
return genericParam == null ? '{}' : jsonEncode(genericParam);
|
||||
}
|
||||
|
||||
Future<http.Response> post(String data, Map<String, String>? headers) async {
|
||||
@ -57,7 +57,7 @@ abstract class WebuntisApi extends ApiRequest {
|
||||
.post(endpoint, body: data, headers: headers)
|
||||
.timeout(
|
||||
const Duration(seconds: 10),
|
||||
onTimeout: () => throw WebuntisError("Timeout", 1)
|
||||
onTimeout: () => throw WebuntisError('Timeout', 1)
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user