clients

package
v0.0.0-...-4d3b9b5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubClient

type GitHubClient interface {
	ListIssues() ([]github.Issue, error)
	ListComments(issue github.Issue) ([]*github.IssueComment, error)
	GetUser(login string) (github.User, error)
	GetRateLimits() (github.RateLimits, error)
}

GitHubClient is a wrapper around the GitHub API Client library we use. It allows us to swap in other implementations, such as a dry run clients, or mock clients for testing.

func NewGitHubClient

func NewGitHubClient(config cfg.Config) (GitHubClient, error)

NewGitHubClient creates a GitHubClient and returns it; which implementation it uses depends on the configuration of this run. For example, a dry-run clients may be created which does not make any requests that would change anything on the server, but instead simply prints out the actions that it's asked to take.

type JIRAClient

type JIRAClient interface {
	ListIssues(ids []int) ([]jira.Issue, error)
	GetIssue(key string) (jira.Issue, error)
	CreateIssue(issue jira.Issue) (jira.Issue, error)
	UpdateIssue(issue jira.Issue) (jira.Issue, error)
	CreateComment(issue jira.Issue, comment github.IssueComment, github GitHubClient) (jira.Comment, error)
	UpdateComment(issue jira.Issue, id string, comment github.IssueComment, github GitHubClient) (jira.Comment, error)
}

JIRAClient is a wrapper around the JIRA API clients library we use. It allows us to hide implementation details such as backoff as well as swap in other implementations, such as for dry run or test mocking.

func NewJIRAClient

func NewJIRAClient(config *cfg.Config) (JIRAClient, error)

NewJIRAClient creates a new JIRAClient and configures it with the config object provided. The type of clients created depends on the configuration; currently, it creates either a standard clients, or a dry-run clients.

Jump to

Keyboard shortcuts

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