Skip to content

Refactor/http session interface#35

Merged
BReijling merged 5 commits into
mainfrom
refactor/http-session-interface
Jun 6, 2026
Merged

Refactor/http session interface#35
BReijling merged 5 commits into
mainfrom
refactor/http-session-interface

Conversation

@BReijling
Copy link
Copy Markdown
Owner

This pull request introduces a new HTTPClient interface to provide a flexible, pluggable way to handle HTTP requests in the RestApiRepository. The RestApiRepository class is updated to use a new client parameter (replacing the older session parameter, which is now deprecated), and all HTTP operations now use this interface. Documentation and type hints are updated accordingly, and the package version is bumped to reflect these significant changes.

Key changes:

HTTP Client Abstraction

  • Added a new HTTPClient interface (as a Protocol) in src/alpha/interfaces/http_client.py, defining the expected methods and attributes for HTTP clients. This allows using different HTTP libraries (like requests, httpx, or custom implementations) interchangeably with the repository.
  • Updated RestApiRepository to accept a client parameter of type HTTPClient, deprecating the old session parameter. All internal HTTP calls now use self.client. [1] [2] [3] [4] [5] [6] [7]
  • Updated docstrings and parameter descriptions in RestApiRepository to reflect the new client parameter and the deprecation of session.

API and Type Consistency

  • Changed the return types for internal response-handling methods in RestApiRepository to consistently return dict[str, Any] | None, improving type safety and clarity. [1] [2] [3] [4]

Documentation

  • Added documentation for the new HTTPClient interface (docs/reference/interfaces/http_client.md) and linked it from the interfaces index. [1] [2]
  • Updated the changelog to describe the new interface, the deprecation of session, and the recommendation to use client going forward.

Versioning

  • Bumped the package version to 0.7.0 in pyproject.toml to indicate a backward-incompatible change.

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 introduces a new HTTPClient protocol to make RestApiRepository work with pluggable HTTP client implementations, shifts the repository constructor to prefer a new client parameter (with session deprecated), updates internal request call sites to use self.client, and bumps the package version to 0.7.0 with accompanying documentation updates.

Changes:

  • Added HTTPClient protocol and documentation page for it.
  • Refactored RestApiRepository to accept a client parameter and route HTTP calls through self.client.
  • Bumped package version to 0.7.0 and updated changelog + docs index.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
uv.lock Updates locked package version to 0.7.0.
src/alpha/repositories/rest_api_repository.py Introduces client parameter, switches HTTP calls to self.client, and adjusts response-handling type hints.
src/alpha/interfaces/http_client.py Adds HTTPClient protocol for pluggable HTTP client implementations.
pyproject.toml Bumps project version to 0.7.0.
docs/reference/interfaces/index.md Links to the new HTTPClient interface docs page.
docs/reference/interfaces/http_client.md Adds the reference page for the HTTPClient protocol.
CHANGELOG.md Documents the new interface and deprecation of session.

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

Comment thread src/alpha/repositories/rest_api_repository.py
Comment thread src/alpha/repositories/rest_api_repository.py
Comment thread src/alpha/repositories/rest_api_repository.py Outdated
Comment thread src/alpha/repositories/rest_api_repository.py
Comment thread src/alpha/interfaces/http_client.py
@BReijling BReijling merged commit e4d6372 into main Jun 6, 2026
4 checks passed
@BReijling BReijling deleted the refactor/http-session-interface branch June 6, 2026 12:50
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.

3 participants