mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Paginate get_plans to return flat list[PlanSummary] 🟩
This commit is contained in:
parent
62acc3ce98
commit
f83ddd05a8
1 changed files with 3 additions and 1 deletions
|
|
@ -11,7 +11,9 @@ class MagicPlanClient:
|
|||
self._session.headers.update({"customer": customer_id, "key": api_key})
|
||||
|
||||
def get_plans(self) -> list[PlanSummary]:
|
||||
raise NotImplementedError
|
||||
r = self._session.get(f"{_BASE_URL}/workgroups/plans", params={"page": 1})
|
||||
r.raise_for_status()
|
||||
return PlansListResponse.model_validate(r.json()["data"]).plans
|
||||
|
||||
def get_plan(self, plan_id: str) -> MagicPlanPlan:
|
||||
return MagicPlanPlan.model_validate(self._fetch_plan(plan_id).json()["data"])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue