Skip to content

Define TokenResponse domain type at GitHubInstallationTokenClient boundary #92

Description

@coderabbitai

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

  1. Define a new domain-level struct in src/github/installation_token.rs:
    pub struct TokenResponse {
        pub token: String,
        pub expires_at: Option<String>,
    }
  2. Update GitHubInstallationTokenClient::acquire_installation_token to return Result<TokenResponse, GitHubError> instead of Result<octocrab::models::InstallationToken, GitHubError>.
  3. Translate the Octocrab response to TokenResponse inside OctocrabAppClient's implementation.
  4. 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).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions