Skip to content

🏗️ Architect: Refactor Endpoints#622

Merged
fderuiter merged 3 commits intomainfrom
architect-refactor-endpoints-6900409658252505423
Feb 3, 2026
Merged

🏗️ Architect: Refactor Endpoints#622
fderuiter merged 3 commits intomainfrom
architect-refactor-endpoints-6900409658252505423

Conversation

@fderuiter
Copy link
Copy Markdown
Owner

Refactor endpoints to adhere to SOLID principles.

  • Introduce _extract_special_params hook in ListGetEndpointMixin.
  • Refactor UsersEndpoint and RecordsEndpoint to use the new hook, removing _list_impl overrides.
  • Refactor RecordsEndpoint to share creation logic between sync and async methods via _prepare_create_request.
  • Refactor JobsEndpoint to share path building and parsing logic between sync and async methods.
  • Create .jules/architect.md to document architectural decisions.

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

- Introduce `_extract_special_params` hook in `ListGetEndpointMixin`.
- Refactor `UsersEndpoint` and `RecordsEndpoint` to use the new hook, removing `_list_impl` overrides.
- Refactor `RecordsEndpoint` to share creation logic between sync and async methods via `_prepare_create_request`.
- Refactor `JobsEndpoint` to share path building and parsing logic between sync and async methods.
- Create `.jules/architect.md` to document architectural decisions.

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 2 commits February 3, 2026 18:41
- Introduce `_extract_special_params` hook in `ListGetEndpointMixin`.
- Refactor `UsersEndpoint` and `RecordsEndpoint` to use the new hook, removing `_list_impl` overrides.
- Refactor `RecordsEndpoint` to share creation logic between sync and async methods via `_prepare_create_request`.
- Refactor `JobsEndpoint` to share path building and parsing logic between sync and async methods.
- Create `.jules/architect.md` to document architectural decisions.
- Remove unused imports in `imednet/endpoints/users.py`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Introduce `_extract_special_params` hook in `ListGetEndpointMixin`.
- Refactor `UsersEndpoint` and `RecordsEndpoint` to use the new hook, removing `_list_impl` overrides.
- Refactor `RecordsEndpoint` to share creation logic between sync and async methods via `_prepare_create_request`.
- Refactor `JobsEndpoint` to share path building and parsing logic between sync and async methods.
- Create `.jules/architect.md` to document architectural decisions.
- Remove unused imports in `imednet/endpoints/users.py`.
- Upgrade `pip` to `^26.0` in dev dependencies to resolve CVE-2026-1703 flagged by `pip-audit`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@fderuiter fderuiter marked this pull request as ready for review February 3, 2026 19:06
Copilot AI review requested due to automatic review settings February 3, 2026 19:06
@fderuiter fderuiter merged commit 4b09ac8 into main Feb 3, 2026
13 checks passed
@fderuiter fderuiter deleted the architect-refactor-endpoints-6900409658252505423 branch February 3, 2026 19:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors endpoint classes to improve code organization and reduce duplication by introducing a hook-based approach for special parameter handling and consolidating duplicate logic in sync/async method pairs.

Changes:

  • Introduced _extract_special_params hook in ListGetEndpointMixin to allow subclasses to handle special query parameters without overriding _list_impl
  • Refactored UsersEndpoint and RecordsEndpoint to use the new hook instead of overriding _list_impl
  • Consolidated duplicate validation and header-building logic in RecordsEndpoint between sync and async create methods via _prepare_create_request
  • Extracted path building and response parsing helper methods in JobsEndpoint to eliminate duplication between sync and async methods
  • Added pip 26.0 as a dev dependency (unrelated to refactoring changes)

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pyproject.toml Added pip 26.0 as a dev dependency
poetry.lock Updated lock file to include pip 26.0
imednet/endpoints/_mixins.py Added _extract_special_params hook and integrated it into _prepare_list_params
imednet/endpoints/users.py Replaced _list_impl override with _extract_special_params implementation
imednet/endpoints/records.py Replaced _list_impl override with _extract_special_params implementation and consolidated create logic via _prepare_create_request
imednet/endpoints/jobs.py Extracted helper methods to reduce duplication between sync and async methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml
sphinxcontrib-mermaid = "^0.9.2"
doc8 = "^2.0.0"
codespell = "^2.4.1"
pip = "^26.0"
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding pip as a dev dependency appears unrelated to the stated purpose of this PR (refactoring endpoints). Pip is typically already available in the Python environment and is not usually added as an explicit dependency unless there's a specific tool that requires a particular version. Please clarify the reason for this addition or remove it if it's not needed.

Copilot uses AI. Check for mistakes.
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.

2 participants