clients

package
v0.18.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package clients provides interfaces and implementations for GitHub and GitLab API clients, enabling dependency injection and testability.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGitHubPaginationClient added in v0.18.15

func NewGitHubPaginationClient(base http.RoundTripper, opts ...githubpagination.Option) *http.Client

NewGitHubPaginationClient returns an *http.Client like githubpagination.NewClient, but an error response keeps its own body.

githubpagination v1.0.1 stops at the first page that has no 200 status and returns that response. When earlier pages were read, its default driver then replaces the body of the error response with the merged earlier pages, so go-github cannot read the message of the error. Here every request gets its own keepErrorBodyDriver, which leaves the body of an error response alone.

A githubpagination.WithDriver in opts has no effect: the per request driver replaces it. To use another driver, put it in the context of the request with githubpagination.WithOverrideConfig.

Types

type GitHubClient

type GitHubClient interface {
	GetBranches(ctx context.Context, owner, repo string) ([]*gogithub.Branch, error)
	GetPullRequest(ctx context.Context, org, repo string, prNumber int) (*gogithub.PullRequest, error)
	GetSearchResults(ctx context.Context, query string) (*gogithub.IssuesSearchResult, error)
}

GitHubClient is the interface for GitHub API operations used by the migrator.

func NewGitHubClient

func NewGitHubClient(gh *gogithub.Client, logger hclog.Logger) GitHubClient

NewGitHubClient creates a new GitHub client with caching support.

type GitLabClient

type GitLabClient interface {
	GetUser(ctx context.Context, username string) (*gogitlab.User, error)
}

GitLabClient is the interface for GitLab API operations used by the migrator.

func NewGitLabClient

func NewGitLabClient(gl *gogitlab.Client, logger hclog.Logger) GitLabClient

NewGitLabClient creates a new GitLab client with caching support.

type SearchModder

type SearchModder struct {
	Base http.RoundTripper
}

SearchModder modifies GitHub API search requests to enable advanced search mode.

func (*SearchModder) RoundTrip

func (g *SearchModder) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL