|
5 | 5 | import pandas as pd |
6 | 6 |
|
7 | 7 | from parcllabs.enums import RequestLimits |
8 | | -from parcllabs.schemas.schemas import PropertyV2RetrieveParams |
| 8 | +from parcllabs.schemas.schemas import PropertyV2RetrieveParamCategories, PropertyV2RetrieveParams |
9 | 9 | from parcllabs.services.parcllabs_service import ParclLabsService |
10 | 10 | from parcllabs.services.validators import Validators |
11 | 11 |
|
@@ -315,6 +315,16 @@ def _validate_limit(self, limit: int | None) -> int: |
315 | 315 |
|
316 | 316 | return limit |
317 | 317 |
|
| 318 | + def _build_param_categories( |
| 319 | + self, params: PropertyV2RetrieveParams |
| 320 | + ) -> PropertyV2RetrieveParamCategories: |
| 321 | + """Build parameter categories from validated Pydantic schema.""" |
| 322 | + return PropertyV2RetrieveParamCategories( |
| 323 | + property_filters=self._build_property_filters(params), |
| 324 | + event_filters=self._build_event_filters(params), |
| 325 | + owner_filters=self._build_owner_filters(params), |
| 326 | + ) |
| 327 | + |
318 | 328 | def retrieve( |
319 | 329 | self, |
320 | 330 | parcl_ids: list[int] | None = None, |
@@ -434,10 +444,11 @@ def retrieve( |
434 | 444 | ), |
435 | 445 | ) |
436 | 446 |
|
437 | | - # Build filters using validated parameters |
438 | | - data["property_filters"] = self._build_property_filters(input_params) |
439 | | - data["event_filters"] = self._build_event_filters(input_params) |
440 | | - data["owner_filters"] = self._build_owner_filters(input_params) |
| 447 | + # Build parameter categories using validated parameters |
| 448 | + param_categories = self._build_param_categories(input_params) |
| 449 | + |
| 450 | + # Update data with categories |
| 451 | + data.update(param_categories.model_dump(exclude_none=True)) |
441 | 452 |
|
442 | 453 | # Set limit |
443 | 454 | request_params = input_params.params.copy() |
|
0 commit comments