Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,4 @@ ehthumbs.db
Thumbs.db

# Playwright auth state (contains session cookies/tokens)
.playwright_auth_state.json
.playwright_auth_state.json
18 changes: 18 additions & 0 deletions campus_python/api/v1/timetable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Campus API timetable resource (v1).
"""

import typing

import campus.model

from ...interface import Resource, ResourceCollection
Expand Down Expand Up @@ -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."""

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <nyjc.computing@nyjc.edu.sg>"]

Expand Down
Loading