aboutsummaryrefslogtreecommitdiffstats
path: root/muddle/moodle.py
diff options
context:
space:
mode:
Diffstat (limited to 'muddle/moodle.py')
-rw-r--r--muddle/moodle.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/muddle/moodle.py b/muddle/moodle.py
index a9209d7..8146fd4 100644
--- a/muddle/moodle.py
+++ b/muddle/moodle.py
@@ -104,10 +104,10 @@ class Course(SchemaObj):
def get_sections(self, api):
req = api.core_course_get_contents(courseid=self.id)
- for sec in req.json():
+ for s in req.json():
# rest api response does not contain course id
- sec["course"] = self.id
- yield Section._fromdict(sec)
+ s["course"] = self.id
+ yield Section._fromdict(s)
@dataclasses.dataclass
@@ -122,8 +122,13 @@ class Section(SchemaObj):
name: str
summary: str
visible: bool
+
modules: List
+ def get_modules(self):
+ for m in self.modules:
+ yield Module._fromdict(m)
+
@dataclasses.dataclass
class Module(SchemaObj):
@@ -132,16 +137,23 @@ class Module(SchemaObj):
https://www.examulator.com/er/output/tables/course_modules.html
"""
id: int
- course: int
- module: int
- section: int
+ name: str
+
+
+@dataclasses.dataclass
+class File(SchemaObj):
+ filename: str
+ fileurl: str
@dataclasses.dataclass
class Folder(SchemaObj):
- """
- Resource type that holds files
- """
+ pass
+
+
+@dataclasses.dataclass
+class ExternalLink(SchemaObj):
+ pass
class ApiHelper: