updated project linter-rules and enforced them
This commit is contained in:
@ -9,7 +9,7 @@ import 'authenticateResponse.dart';
|
||||
class Authenticate extends WebuntisApi {
|
||||
AuthenticateParams param;
|
||||
|
||||
Authenticate(this.param) : super("authenticate", param, authenticatedResponse: false);
|
||||
Authenticate(this.param) : super('authenticate', param, authenticatedResponse: false);
|
||||
|
||||
@override
|
||||
Future<AuthenticateResponse> run() async {
|
||||
|
@ -4,7 +4,7 @@ import '../../webuntisApi.dart';
|
||||
import 'getHolidaysResponse.dart';
|
||||
|
||||
class GetHolidays extends WebuntisApi {
|
||||
GetHolidays() : super("getHolidays", null);
|
||||
GetHolidays() : super('getHolidays', null);
|
||||
|
||||
@override
|
||||
Future<GetHolidaysResponse> run() async {
|
||||
|
@ -6,7 +6,7 @@ import 'getHolidaysResponse.dart';
|
||||
|
||||
class GetHolidaysCache extends RequestCache<GetHolidaysResponse> {
|
||||
GetHolidaysCache({onUpdate}) : super(RequestCache.cacheDay, onUpdate) {
|
||||
start("MarianumMobile", "wu-holidays");
|
||||
start('MarianumMobile', 'wu-holidays');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -5,7 +5,7 @@ import '../../webuntisApi.dart';
|
||||
import 'getRoomsResponse.dart';
|
||||
|
||||
class GetRooms extends WebuntisApi {
|
||||
GetRooms() : super("getRooms", null);
|
||||
GetRooms() : super('getRooms', null);
|
||||
|
||||
@override
|
||||
Future<GetRoomsResponse> run() async {
|
||||
@ -14,10 +14,10 @@ class GetRooms extends WebuntisApi {
|
||||
return finalize(GetRoomsResponse.fromJson(jsonDecode(rawAnswer)));
|
||||
} catch(e, trace) {
|
||||
log(trace.toString());
|
||||
log("Failed to parse getRoom data with server response: $rawAnswer");
|
||||
log('Failed to parse getRoom data with server response: $rawAnswer');
|
||||
}
|
||||
|
||||
throw Exception("Failed to parse getRoom server response: $rawAnswer");
|
||||
throw Exception('Failed to parse getRoom server response: $rawAnswer');
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ import 'getRoomsResponse.dart';
|
||||
|
||||
class GetRoomsCache extends RequestCache<GetRoomsResponse> {
|
||||
GetRoomsCache({onUpdate}) : super(RequestCache.cacheHour, onUpdate) {
|
||||
start("MarianumMobile", "wu-rooms");
|
||||
start('MarianumMobile', 'wu-rooms');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -4,7 +4,7 @@ import '../../webuntisApi.dart';
|
||||
import 'getSubjectsResponse.dart';
|
||||
|
||||
class GetSubjects extends WebuntisApi {
|
||||
GetSubjects() : super("getSubjects", null);
|
||||
GetSubjects() : super('getSubjects', null);
|
||||
|
||||
@override
|
||||
Future<GetSubjectsResponse> run() async {
|
||||
|
@ -6,7 +6,7 @@ import 'getSubjectsResponse.dart';
|
||||
|
||||
class GetSubjectsCache extends RequestCache<GetSubjectsResponse> {
|
||||
GetSubjectsCache({onUpdate}) : super(RequestCache.cacheHour, onUpdate) {
|
||||
start("MarianumMobile", "wu-subjects");
|
||||
start('MarianumMobile', 'wu-subjects');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -7,7 +7,7 @@ import 'getTimetableResponse.dart';
|
||||
class GetTimetable extends WebuntisApi {
|
||||
GetTimetableParams params;
|
||||
|
||||
GetTimetable(this.params) : super("getTimetable", params);
|
||||
GetTimetable(this.params) : super('getTimetable', params);
|
||||
|
||||
@override
|
||||
Future<GetTimetableResponse> run() async {
|
||||
|
@ -11,7 +11,7 @@ class GetTimetableCache extends RequestCache<GetTimetableResponse> {
|
||||
int enddate;
|
||||
|
||||
GetTimetableCache({required onUpdate, onError, required this.startdate, required this.enddate}) : super(RequestCache.cacheMinute, onUpdate, onError: onError) {
|
||||
start("MarianumMobile", "wu-timetable-$startdate-$enddate");
|
||||
start('MarianumMobile', 'wu-timetable-$startdate-$enddate');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -67,10 +67,10 @@ class GetTimetableParamsOptions {
|
||||
}
|
||||
|
||||
enum GetTimetableParamsOptionsFields {
|
||||
@JsonValue("id") id,
|
||||
@JsonValue("name") name,
|
||||
@JsonValue("longname") longname,
|
||||
@JsonValue("externalkey") externalkey;
|
||||
@JsonValue('id') id,
|
||||
@JsonValue('name') name,
|
||||
@JsonValue('longname') longname,
|
||||
@JsonValue('externalkey') externalkey;
|
||||
|
||||
static List<GetTimetableParamsOptionsFields> all = [id, name, longname, externalkey];
|
||||
}
|
||||
@ -88,7 +88,7 @@ class GetTimetableParamsOptionsElement {
|
||||
}
|
||||
|
||||
enum GetTimetableParamsOptionsElementKeyType {
|
||||
@JsonValue("id") id,
|
||||
@JsonValue("name") name,
|
||||
@JsonValue("externalkey") externalkey
|
||||
@JsonValue('id') id,
|
||||
@JsonValue('name') name,
|
||||
@JsonValue('externalkey') externalkey
|
||||
}
|
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@ class WebuntisError implements Exception {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "WebUntis ($code): $message";
|
||||
return 'WebUntis ($code): $message';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user