diff --git a/.gitignore b/.gitignore index b37824c..740df9b 100644 --- a/.gitignore +++ b/.gitignore @@ -253,4 +253,4 @@ ehthumbs.db Thumbs.db # Playwright auth state (contains session cookies/tokens) -.playwright_auth_state.json +.playwright_auth_state.json \ No newline at end of file diff --git a/campus_python/api/v1/timetable.py b/campus_python/api/v1/timetable.py index 4a28ef3..9e1a4d4 100644 --- a/campus_python/api/v1/timetable.py +++ b/campus_python/api/v1/timetable.py @@ -3,6 +3,8 @@ Campus API timetable resource (v1). """ +import typing + import campus.model from ...interface import Resource, ResourceCollection @@ -114,6 +116,22 @@ def new(self, metadata: dict, data: dict) -> dict: resp.raise_for_status() return resp.json() + def list(self, **filters: typing.Any) -> "list[campus.model.TimetableMetadata]": + """List timetables matching the provided filters. + + Args: + **filters: Arbitrary filter parameters applied to the query. + + Returns: + list[campus.model.TimetableMetadata]: Matching timetable metadata objects. + """ + resp = self.client.get(self.make_path(), query=filters if filters else None) + resp.raise_for_status() + return [ + campus.model.TimetableMetadata.from_resource(item) + for item in resp.json() + ] + class Timetable(Resource): """A single timetable with start date.""" diff --git a/pyproject.toml b/pyproject.toml index 8cc5ba1..00888d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "campus-api-python" -version = "0.1.59" +version = "0.1.60" description = "Campus API for Python projects" authors = ["NYJC Computing "]