Documentation
¶
Index ¶
- Variables
- type Client
- func New(zapprURL string, githubToken string, httpClient *http.Client) Client
- func NewMockAndHandler() (Client, *test.MockHandler, *test.Server)
- func NewMockAndHandlerNilResponse() (Client, *test.MockHandler, *test.Server)
- func NewMockAndHandlerWithGithubToken(githubToken string) (Client, *test.MockHandler, *test.Server)
- type NilResponseTransport
- type RewriteTransport
Constants ¶
This section is empty.
Variables ¶
var ( ErrZapprUnauthorized = errors.New("you do not have permissions to use zappr api") // ErrZapprAlreadyEnabled is used when "Enable" is called for a repo that Zappr is already enabled for ErrZapprAlreadyEnabled = errors.New("zappr already enabled for the repo") // ErrZapprAlreadyNotEnabled is used when "Disable" is called for a repo that Zappr is already NOT enabled for ErrZapprAlreadyNotEnabled = errors.New("zappr is already not enabled for the repo") // ErrZapprServerError is used when we receive a code different than 200 from Zappr ErrZapprServerError = errors.New("unknown error from zappr") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
Enable(repoID int) error
Disable(repoID int) error
ImpersonateGitHubApp() error // Retrieves the Github token representing Zappr and uses that for future requests
}
Client represents a zappr client
func New ¶ added in v0.0.15
New creates a new Zappr client that uses Github Token to make calls to Zappr
func NewMockAndHandler ¶
func NewMockAndHandler() (Client, *test.MockHandler, *test.Server)
NewMockAndHandler returns a Zappr Client that uses Github Token, Mockhandler, and Server. The client proxies requests to the server and handlers can be registered on the mux to handle requests. The caller must close the test server.
func NewMockAndHandlerNilResponse ¶
func NewMockAndHandlerNilResponse() (Client, *test.MockHandler, *test.Server)
NewMockAndHandlerNilResponse returns a Zappr Client that uses Github Token, Mockhandler, and Server. The internal http client always returns a nil response object.
func NewMockAndHandlerWithGithubToken ¶
NewMockAndHandlerWithGithubToken returns a Zappr Client that uses Github Token, Mockhandler, and Server. The client proxies requests to the server and handlers can be registered on the mux to handle requests. The caller must close the test server.
type NilResponseTransport ¶
type NilResponseTransport struct {
Transport http.RoundTripper
}
NilResponseTransport always returns a nil response object
type RewriteTransport ¶
type RewriteTransport struct {
Transport http.RoundTripper
}
RewriteTransport rewrites https requests to http to avoid TLS cert issues during testing.