Documentation
¶
Index ¶
- type Client
- func (c *Client) CreateRelease(ctx context.Context, owner, repo string, req *CreateReleaseRequest) (*Release, error)
- func (c *Client) GetLatestRelease(ctx context.Context, owner, repo string) (*Release, error)
- func (c *Client) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
- func (c *Client) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*Release, error)
- func (c *Client) GetRepository(ctx context.Context, owner, repo string) (*Repository, error)
- func (c *Client) ListPullRequestsByCommit(ctx context.Context, owner, repo, sha string) ([]*PullRequest, error)
- type CreateReleaseRequest
- type GitHubClient
- type MockClient
- func (m *MockClient) AddPullRequest(owner, repo string, pr *PullRequest)
- func (m *MockClient) AddPullRequestForCommit(owner, repo, sha string, pr *PullRequest)
- func (m *MockClient) AddRelease(owner, repo string, release *Release)
- func (m *MockClient) CreateRelease(ctx context.Context, owner, repo string, req *CreateReleaseRequest) (*Release, error)
- func (m *MockClient) GetAllReleases(owner, repo string) []*Release
- func (m *MockClient) GetLatestRelease(ctx context.Context, owner, repo string) (*Release, error)
- func (m *MockClient) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
- func (m *MockClient) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*Release, error)
- func (m *MockClient) GetRepository(ctx context.Context, owner, repo string) (*Repository, error)
- func (m *MockClient) ListPullRequestsByCommit(ctx context.Context, owner, repo, sha string) ([]*PullRequest, error)
- func (m *MockClient) Reset()
- func (m *MockClient) SetupRepository(owner, repo string)
- type PullRequest
- type Release
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements GitHubClient using the real GitHub API
func NewClientWithoutAuth ¶
func NewClientWithoutAuth() *Client
NewClientWithoutAuth creates a GitHub client without authentication (for public operations)
func (*Client) CreateRelease ¶
func (*Client) GetLatestRelease ¶
func (*Client) GetPullRequest ¶
func (*Client) GetReleaseByTag ¶
func (*Client) GetRepository ¶
func (*Client) ListPullRequestsByCommit ¶
type CreateReleaseRequest ¶
type CreateReleaseRequest struct {
TagName string
Name string
Body string
Draft bool
Prerelease bool
TargetCommitish string
}
CreateReleaseRequest represents a request to create a release
type GitHubClient ¶
type GitHubClient interface {
// Release operations
GetLatestRelease(ctx context.Context, owner, repo string) (*Release, error)
GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*Release, error)
CreateRelease(ctx context.Context, owner, repo string, release *CreateReleaseRequest) (*Release, error)
// Repository operations
GetRepository(ctx context.Context, owner, repo string) (*Repository, error)
// Pull request operations
GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
ListPullRequestsByCommit(ctx context.Context, owner, repo, sha string) ([]*PullRequest, error)
}
GitHubClient provides an abstraction over GitHub API operations
type MockClient ¶
type MockClient struct {
// Hooks for testing error scenarios
GetLatestReleaseError error
GetReleaseByTagError error
CreateReleaseError error
GetRepositoryError error
GetPullRequestError error
ListPullRequestsByCommitError error
// contains filtered or unexported fields
}
MockClient implements GitHubClient for testing
func (*MockClient) AddPullRequest ¶
func (m *MockClient) AddPullRequest(owner, repo string, pr *PullRequest)
AddPullRequest adds a pull request to the mock
func (*MockClient) AddPullRequestForCommit ¶
func (m *MockClient) AddPullRequestForCommit(owner, repo, sha string, pr *PullRequest)
AddPullRequestForCommit associates a pull request with a commit SHA
func (*MockClient) AddRelease ¶
func (m *MockClient) AddRelease(owner, repo string, release *Release)
AddRelease adds a release to the mock
func (*MockClient) CreateRelease ¶
func (m *MockClient) CreateRelease(ctx context.Context, owner, repo string, req *CreateReleaseRequest) (*Release, error)
func (*MockClient) GetAllReleases ¶
func (m *MockClient) GetAllReleases(owner, repo string) []*Release
GetAllReleases returns all releases for a repository (helper for testing)
func (*MockClient) GetLatestRelease ¶
func (*MockClient) GetPullRequest ¶
func (m *MockClient) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
func (*MockClient) GetReleaseByTag ¶
func (*MockClient) GetRepository ¶
func (m *MockClient) GetRepository(ctx context.Context, owner, repo string) (*Repository, error)
func (*MockClient) ListPullRequestsByCommit ¶
func (m *MockClient) ListPullRequestsByCommit(ctx context.Context, owner, repo, sha string) ([]*PullRequest, error)
func (*MockClient) Reset ¶
func (m *MockClient) Reset()
Reset clears all data from the mock (helper for testing)
func (*MockClient) SetupRepository ¶
func (m *MockClient) SetupRepository(owner, repo string)
SetupRepository adds a repository to the mock
type PullRequest ¶
type PullRequest struct {
Number int
Title string
HTMLURL string
Author string
State string
Merged bool
MergeCommitSHA string
}
PullRequest represents a GitHub pull request