Skip to content

Refactor endpoints for DRY and SOLID principles#675

Merged
fderuiter merged 3 commits intomainfrom
refactor/endpoints-dry-solid-18318603622383437127
Feb 18, 2026
Merged

Refactor endpoints for DRY and SOLID principles#675
fderuiter merged 3 commits intomainfrom
refactor/endpoints-dry-solid-18318603622383437127

Conversation

@fderuiter
Copy link
Owner

This PR refactors the endpoint architecture to reduce code duplication and enforce SOLID principles.

Key changes:

  1. GenericEndpoint Refactoring: Added a _get_client(is_async: bool) helper method to GenericEndpoint. This centralizes the logic for retrieving the appropriate client (sync or async) based on the execution context, adhering to the DRY principle and simplifying subclasses.
  2. EdcEndpointMixin Cleanup: Removed the _build_path method from EdcEndpointMixin. The implementation was identical (in behavior) to GenericEndpoint._build_path, so removing it eliminates redundancy. EdcEndpointMixin now relies on the base implementation, which correctly handles the BASE_PATH defined in the mixin.
  3. GenericListEndpoint & GenericListPathGetEndpoint Update: Updated these mixins to use the new _get_client helper, making the client retrieval logic consistent across the codebase.
  4. RecordsEndpoint Consolidation: Refactored RecordsEndpoint to introduce a _create_impl method. This method encapsulates the common logic for creating records, which was previously duplicated in create and async_create. The public methods now delegate to this implementation, ensuring consistent behavior and reducing maintenance overhead.

These changes are structural only and do not alter the runtime behavior of the SDK. Tests have been run to verify no regressions were introduced.


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

- Add `_get_client` to `GenericEndpoint` to unify client retrieval.
- Remove duplicated `_build_path` from `EdcEndpointMixin`.
- Update `GenericListEndpoint` and `GenericListPathGetEndpoint` to use `_get_client`.
- Refactor `RecordsEndpoint` to consolidate `create` and `async_create` logic into `_create_impl`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
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 18, 2026 20:48
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
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 18, 2026 20:57
@fderuiter fderuiter merged commit 7938e91 into main Feb 18, 2026
13 checks passed
@fderuiter fderuiter deleted the refactor/endpoints-dry-solid-18318603622383437127 branch February 18, 2026 20:57
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

Comments