🛠️ Refactor: Endpoints - Collapse list logic and remove duplication#621
🛠️ Refactor: Endpoints - Collapse list logic and remove duplication#621
Conversation
Collapsed redundant list implementation logic in `UsersEndpoint` and `RecordsEndpoint` by introducing `_extract_special_params` hook in `ListGetEndpointMixin`. Extracted duplicate site filtering logic in `SubjectsEndpoint` to a shared helper method. This enforces DRY and Open/Closed principles without altering behavior. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Collapsed redundant list implementation logic in `UsersEndpoint` and `RecordsEndpoint` by introducing `_extract_special_params` hook in `ListGetEndpointMixin`. Extracted duplicate site filtering logic in `SubjectsEndpoint` to a shared helper method. This enforces DRY and Open/Closed principles without altering behavior. Fixed unused imports in `UsersEndpoint`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Collapsed redundant list implementation logic in `UsersEndpoint` and `RecordsEndpoint` by introducing `_extract_special_params` hook in `ListGetEndpointMixin`. Extracted duplicate site filtering logic in `SubjectsEndpoint` to a shared helper method. This enforces DRY and Open/Closed principles without altering behavior. Fixed unused imports in `UsersEndpoint`. Fixed mypy errors in `tests/unit/test_core_paginator.py`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Collapsed redundant list implementation logic in `UsersEndpoint` and `RecordsEndpoint` by introducing `_extract_special_params` hook in `ListGetEndpointMixin`. Extracted duplicate site filtering logic in `SubjectsEndpoint` to a shared helper method. This enforces DRY and Open/Closed principles without altering behavior. Fixed unused imports in `UsersEndpoint`. Fixed mypy errors in `tests/unit/test_core_paginator.py`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Collapsed redundant list implementation logic in `UsersEndpoint` and `RecordsEndpoint` by introducing `_extract_special_params` hook in `ListGetEndpointMixin`. Extracted duplicate site filtering logic in `SubjectsEndpoint` to a shared helper method. This enforces DRY and Open/Closed principles without altering behavior. Fixed unused imports in `UsersEndpoint`. Fixed mypy errors in `tests/unit/test_core_paginator.py`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This PR refactors several endpoints to remove code duplication and enforce SOLID principles.
Changes:
ListGetEndpointMixin: Added_extract_special_paramshook to allow subclasses to inject custom query parameters without overriding the entire_list_implmethod (Open/Closed Principle).UsersEndpoint: Removed_list_imploverride and used_extract_special_paramsto handleincludeInactive.RecordsEndpoint: Removed_list_imploverride and used_extract_special_paramsto handlerecordDataFilter.SubjectsEndpoint: Extracted duplicate filtering logic fromlist_by_siteandasync_list_by_siteinto a shared_filter_by_sitemethod (DRY).Verification:
tests/unit/endpoints/).includeInactive(Users) andrecordDataFilter(Records) remains functionally equivalent (missing flag defaults to false/empty).PR created automatically by Jules for task 9015745037105151916 started by @fderuiter