Skip to content

🛠️ Refactor: Endpoints - Collapse list logic and remove duplication#621

Closed
fderuiter wants to merge 5 commits intomainfrom
refactor/endpoints-collapse-duplication-9015745037105151916
Closed

🛠️ Refactor: Endpoints - Collapse list logic and remove duplication#621
fderuiter wants to merge 5 commits intomainfrom
refactor/endpoints-collapse-duplication-9015745037105151916

Conversation

@fderuiter
Copy link
Copy Markdown
Owner

This PR refactors several endpoints to remove code duplication and enforce SOLID principles.

Changes:

  • ListGetEndpointMixin: Added _extract_special_params hook to allow subclasses to inject custom query parameters without overriding the entire _list_impl method (Open/Closed Principle).
  • UsersEndpoint: Removed _list_impl override and used _extract_special_params to handle includeInactive.
  • RecordsEndpoint: Removed _list_impl override and used _extract_special_params to handle recordDataFilter.
  • SubjectsEndpoint: Extracted duplicate filtering logic from list_by_site and async_list_by_site into a shared _filter_by_site method (DRY).

Verification:

  • Ran unit tests for affected endpoints (tests/unit/endpoints/).
  • Confirmed that logic for includeInactive (Users) and recordDataFilter (Records) remains functionally equivalent (missing flag defaults to false/empty).
  • Confirmed that site ID filtering (Subjects) maintains strict string comparison logic.

PR created automatically by Jules for task 9015745037105151916 started by @fderuiter

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>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

fderuiter and others added 4 commits February 2, 2026 20:47
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>
@fderuiter fderuiter closed this Feb 3, 2026
@fderuiter fderuiter deleted the refactor/endpoints-collapse-duplication-9015745037105151916 branch February 9, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant