-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c06b81
commit 04319c6
Showing
8 changed files
with
125 additions
and
100 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/polytechcolloscopeclient/lib/polytechcolloscopeclient.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export 'src/consts.dart'; | ||
export 'src/polytechcolloscopeclient_base.dart'; |
43 changes: 43 additions & 0 deletions
43
packages/polytechcolloscopeclient/lib/src/colloscope_datastructs.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'package:equatable/equatable.dart'; | ||
|
||
class Student extends Equatable { | ||
final String name; | ||
final String id; | ||
|
||
Student(this.name, this.id); | ||
|
||
@override | ||
List<Object?> get props => [name, id]; | ||
|
||
@override | ||
bool? get stringify => true; | ||
} | ||
|
||
class StudentColloscope extends Equatable { | ||
final int studentId; | ||
final int trinomeId; | ||
final List kholles; | ||
|
||
StudentColloscope(this.studentId, this.trinomeId, this.kholles); | ||
|
||
@override | ||
List<Object?> get props => [studentId, trinomeId, kholles]; | ||
|
||
@override | ||
bool? get stringify => true; | ||
} | ||
|
||
class Kholle extends Equatable { | ||
final DateTime date; | ||
final String subject; | ||
final String? message; | ||
final String? kholleur; | ||
|
||
Kholle(this.date, this.subject, this.message, this.kholleur); | ||
|
||
@override | ||
List<Object?> get props => [date, subject, message, kholleur]; | ||
|
||
@override | ||
bool? get stringify => true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
enum Year { | ||
first, | ||
second, | ||
} | ||
|
||
class Consts { | ||
static const String userAgent = | ||
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0"; | ||
|
||
// HTTPS parce que le https est pas géré | ||
static const String _base = "http://math.univ-lyon1.fr/colles/"; | ||
|
||
static const kholleURL = { | ||
Year.first: "$_base?page=colles_1A", | ||
Year.second: "$_base?page=colles_2A" | ||
}; | ||
|
||
static const khollesStudentURL = { | ||
Year.first: "$_base?page=colles_1A&id_etudiant=:id", | ||
Year.second: "$_base?page=colles_2A&id_etudiant=:id" | ||
}; | ||
|
||
static const Map monthsTranslation = { | ||
"janvier": DateTime.january, | ||
"février": DateTime.february, | ||
"mars": DateTime.march, | ||
"avril": DateTime.april, | ||
"mai": DateTime.may, | ||
"juin": DateTime.june, | ||
"juillet": DateTime.july, | ||
"août": DateTime.august, | ||
"septembre": DateTime.september, | ||
"octobre": DateTime.october, | ||
"novembre": DateTime.november, | ||
"décembre": DateTime.december | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 19 additions & 2 deletions
21
packages/polytechcolloscopeclient/test/polytechcolloscopeclient_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
import 'package:dotenv/dotenv.dart'; | ||
import 'package:polytechcolloscopeclient/polytechcolloscopeclient.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
|
||
Future<void> main() async { | ||
DotEnv env = DotEnv(includePlatformEnvironment: true); | ||
|
||
env.load(); | ||
final String username = env['USERNAME'] ?? ""; | ||
final String password = env['PASSWORD'] ?? ""; | ||
|
||
if (username.isEmpty || password.isEmpty) { | ||
fail("username or password were empty. check your envt variables"); | ||
} | ||
|
||
PolytechColloscopeClient client = PolytechColloscopeClient("", ""); | ||
|
||
var students = await client.fetchStudents(Year.first); | ||
print(students); | ||
|
||
var colloscope = await client.getColloscope(Year.first, 828); | ||
print(colloscope); | ||
} |