Documentation ¶
Index ¶
- type Client
- type Clienter
- type ClienterMock
- func (mock *ClienterMock) Checker(ctx context.Context, check *health.CheckState) error
- func (mock *ClienterMock) CheckerCalls() []struct{ ... }
- func (mock *ClienterMock) GetBerlin(ctx context.Context, options Options) (*models.Berlin, errors.Error)
- func (mock *ClienterMock) GetBerlinCalls() []struct{ ... }
- func (mock *ClienterMock) Health() *healthcheck.Client
- func (mock *ClienterMock) HealthCalls() []struct{}
- func (mock *ClienterMock) URL() string
- func (mock *ClienterMock) URLCalls() []struct{}
- type Options
- type ResponseInfo
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
}
func NewWithHealthClient ¶
func NewWithHealthClient(hcCli *healthcheck.Client) *Client
NewWithHealthClient creates a new instance of berlin API Client, reusing the URL and Clienter from the provided healthcheck client
func (*Client) Checker ¶
Checker calls berlin api health endpoint and returns a check object to the caller
func (*Client) Health ¶
func (cli *Client) Health() *healthcheck.Client
Health returns the underlying Healthcheck Client for this berlin API client
type ClienterMock ¶
type ClienterMock struct { // CheckerFunc mocks the Checker method. CheckerFunc func(ctx context.Context, check *health.CheckState) error // GetBerlinFunc mocks the GetBerlin method. GetBerlinFunc func(ctx context.Context, options Options) (*models.Berlin, errors.Error) // HealthFunc mocks the Health method. HealthFunc func() *healthcheck.Client // URLFunc mocks the URL method. URLFunc func() string // contains filtered or unexported fields }
ClienterMock is a mock implementation of Clienter.
func TestSomethingThatUsesClienter(t *testing.T) { // make and configure a mocked Clienter mockedClienter := &ClienterMock{ CheckerFunc: func(ctx context.Context, check *health.CheckState) error { panic("mock out the Checker method") }, GetBerlinFunc: func(ctx context.Context, options Options) (*models.Berlin, errors.Error) { panic("mock out the GetBerlin method") }, HealthFunc: func() *healthcheck.Client { panic("mock out the Health method") }, URLFunc: func() string { panic("mock out the URL method") }, } // use mockedClienter in code that requires Clienter // and then make assertions. }
func (*ClienterMock) Checker ¶
func (mock *ClienterMock) Checker(ctx context.Context, check *health.CheckState) error
Checker calls CheckerFunc.
func (*ClienterMock) CheckerCalls ¶
func (mock *ClienterMock) CheckerCalls() []struct { Ctx context.Context Check *health.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedClienter.CheckerCalls())
func (*ClienterMock) GetBerlin ¶
func (mock *ClienterMock) GetBerlin(ctx context.Context, options Options) (*models.Berlin, errors.Error)
GetBerlin calls GetBerlinFunc.
func (*ClienterMock) GetBerlinCalls ¶
func (mock *ClienterMock) GetBerlinCalls() []struct { Ctx context.Context Options Options }
GetBerlinCalls gets all the calls that were made to GetBerlin. Check the length with:
len(mockedClienter.GetBerlinCalls())
func (*ClienterMock) Health ¶
func (mock *ClienterMock) Health() *healthcheck.Client
Health calls HealthFunc.
func (*ClienterMock) HealthCalls ¶
func (mock *ClienterMock) HealthCalls() []struct { }
HealthCalls gets all the calls that were made to Health. Check the length with:
len(mockedClienter.HealthCalls())
func (*ClienterMock) URLCalls ¶
func (mock *ClienterMock) URLCalls() []struct { }
URLCalls gets all the calls that were made to URL. Check the length with:
len(mockedClienter.URLCalls())
type Options ¶
Options is a struct containing for customised options for the API client
func (*Options) LevDist ¶
LevDist sets the 'lev_distance' Query parameter to the request Optional default is '2'
func (*Options) Limit ¶
Limit sets the 'limit' Query parameter to the request Optional default is '10'