Summary
The GitHubInstallationTokenClient trait currently exposes octocrab::models::InstallationToken at the domain boundary. This couples domain logic to a vendor type. Define a domain-level TokenResponse struct and update the trait accordingly.
Motivation
Domain logic in src/github/installation_token.rs only needs two fields from the Octocrab response: token: String and expires_at: Option<String>. Exposing the full octocrab::models::InstallationToken at the trait boundary violates domain segregation and makes the trait harder to implement in non-Octocrab contexts.
Proposed change
- Define a new domain-level struct in
src/github/installation_token.rs:
pub struct TokenResponse {
pub token: String,
pub expires_at: Option<String>,
}
- Update
GitHubInstallationTokenClient::acquire_installation_token to return Result<TokenResponse, GitHubError> instead of Result<octocrab::models::InstallationToken, GitHubError>.
- Translate the Octocrab response to
TokenResponse inside OctocrabAppClient's implementation.
- Update all call sites and mock implementations accordingly.
Acceptance criteria
octocrab::models::InstallationToken no longer appears in the GitHubInstallationTokenClient trait signature.
- All existing unit and BDD tests continue to pass.
make check-fmt, make lint, and make test all pass.
Background
Identified during review of PR #77 (requested by @leynos).
Summary
The
GitHubInstallationTokenClienttrait currently exposesoctocrab::models::InstallationTokenat the domain boundary. This couples domain logic to a vendor type. Define a domain-levelTokenResponsestruct and update the trait accordingly.Motivation
Domain logic in
src/github/installation_token.rsonly needs two fields from the Octocrab response:token: Stringandexpires_at: Option<String>. Exposing the fulloctocrab::models::InstallationTokenat the trait boundary violates domain segregation and makes the trait harder to implement in non-Octocrab contexts.Proposed change
src/github/installation_token.rs:GitHubInstallationTokenClient::acquire_installation_tokento returnResult<TokenResponse, GitHubError>instead ofResult<octocrab::models::InstallationToken, GitHubError>.TokenResponseinsideOctocrabAppClient's implementation.Acceptance criteria
octocrab::models::InstallationTokenno longer appears in theGitHubInstallationTokenClienttrait signature.make check-fmt,make lint, andmake testall pass.Background
Identified during review of PR #77 (requested by @leynos).