Documentation
¶
Index ¶
- Constants
- func Read(cfg *config.Config, hc *HandlerClients, cacheList cache.List, template string) http.HandlerFunc
- func ReadDataAggregation(cfg *config.Config, hc *HandlerClients, cacheList cache.List, template string) http.HandlerFunc
- func ReadDataAggregationWithTopics(cfg *config.Config, hc *HandlerClients, cacheList cache.List, template string) http.HandlerFunc
- func ReadFindDataset(cfg *config.Config, hc *HandlerClients, cacheList cache.List) http.HandlerFunc
- type ClientError
- type HandlerClients
- type RenderClient
- type RenderClientMock
- type SearchClient
- type SearchClientError
- type SearchClientMock
- type TopicClient
- type TopicClientMock
- func (mock *TopicClientMock) GetNavigationPublic(ctx context.Context, reqHeaders topic.Headers, options topic.Options) (*topicModels.Navigation, topicError.Error)
- func (mock *TopicClientMock) GetNavigationPublicCalls() []struct{ ... }
- func (mock *TopicClientMock) GetRootTopicsPrivate(ctx context.Context, reqHeaders topic.Headers) (*topicModels.PrivateSubtopics, topicError.Error)
- func (mock *TopicClientMock) GetRootTopicsPrivateCalls() []struct{ ... }
- func (mock *TopicClientMock) GetRootTopicsPublic(ctx context.Context, reqHeaders topic.Headers) (*topicModels.PublicSubtopics, topicError.Error)
- func (mock *TopicClientMock) GetRootTopicsPublicCalls() []struct{ ... }
- func (mock *TopicClientMock) GetSubtopicsPrivate(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.PrivateSubtopics, topicError.Error)
- func (mock *TopicClientMock) GetSubtopicsPrivateCalls() []struct{ ... }
- func (mock *TopicClientMock) GetSubtopicsPublic(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.PublicSubtopics, topicError.Error)
- func (mock *TopicClientMock) GetSubtopicsPublicCalls() []struct{ ... }
- func (mock *TopicClientMock) GetTopicPrivate(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.TopicResponse, topicError.Error)
- func (mock *TopicClientMock) GetTopicPrivateCalls() []struct{ ... }
- func (mock *TopicClientMock) GetTopicPublic(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.Topic, topicError.Error)
- func (mock *TopicClientMock) GetTopicPublicCalls() []struct{ ... }
- func (mock *TopicClientMock) PutTopicReleasePrivate(ctx context.Context, reqHeaders topic.Headers, id string, topicRelease []byte) (*topic.ResponseInfo, topicError.Error)
- func (mock *TopicClientMock) PutTopicReleasePrivateCalls() []struct{ ... }
- type ZebedeeClient
- type ZebedeeClientMock
Constants ¶
const ( DateFrom = "fromDate" DateFromErr = DateFrom + "-error" DateTo = "toDate" DateToErr = DateTo + "-error" Bearer = "Bearer " )
Constants...
Variables ¶
This section is empty.
Functions ¶
func Read ¶ added in v0.2.0
func Read(cfg *config.Config, hc *HandlerClients, cacheList cache.List, template string) http.HandlerFunc
Read Handler
func ReadDataAggregation ¶ added in v0.47.0
func ReadDataAggregation(cfg *config.Config, hc *HandlerClients, cacheList cache.List, template string) http.HandlerFunc
Read Handler
func ReadDataAggregationWithTopics ¶ added in v0.53.0
func ReadDataAggregationWithTopics(cfg *config.Config, hc *HandlerClients, cacheList cache.List, template string) http.HandlerFunc
Read Handler for data aggregation routes with topic/subtopics
func ReadFindDataset ¶ added in v0.41.0
func ReadFindDataset(cfg *config.Config, hc *HandlerClients, cacheList cache.List) http.HandlerFunc
Types ¶
type ClientError ¶
type ClientError interface {
Code() int
}
ClientError is an interface that can be used to retrieve the status code if a client has errored
type HandlerClients ¶ added in v0.47.0
type HandlerClients struct {
Renderer RenderClient
SearchClient SearchClient
ZebedeeClient ZebedeeClient
TopicClient TopicClient
}
HandlerClients represents the handlers for search and data-aggregation
func NewHandlerClients ¶ added in v0.47.0
func NewHandlerClients(rc RenderClient, sc SearchClient, zc ZebedeeClient, tc TopicClient) *HandlerClients
NewHandlerClients creates a new instance of FilterFlex
type RenderClient ¶ added in v0.2.0
type RenderClient interface {
BuildPage(w io.Writer, pageModel interface{}, templateName string)
NewBasePageModel() coreModel.Page
}
RenderClient is an interface with methods for require for rendering a template
type RenderClientMock ¶ added in v0.2.0
type RenderClientMock struct {
// BuildPageFunc mocks the BuildPage method.
BuildPageFunc func(w io.Writer, pageModel interface{}, templateName string)
// NewBasePageModelFunc mocks the NewBasePageModel method.
NewBasePageModelFunc func() coreModel.Page
// contains filtered or unexported fields
}
RenderClientMock is a mock implementation of RenderClient.
func TestSomethingThatUsesRenderClient(t *testing.T) {
// make and configure a mocked RenderClient
mockedRenderClient := &RenderClientMock{
BuildPageFunc: func(w io.Writer, pageModel interface{}, templateName string) {
panic("mock out the BuildPage method")
},
NewBasePageModelFunc: func() coreModel.Page {
panic("mock out the NewBasePageModel method")
},
}
// use mockedRenderClient in code that requires RenderClient
// and then make assertions.
}
func (*RenderClientMock) BuildPage ¶ added in v0.11.0
func (mock *RenderClientMock) BuildPage(w io.Writer, pageModel interface{}, templateName string)
BuildPage calls BuildPageFunc.
func (*RenderClientMock) BuildPageCalls ¶ added in v0.11.0
func (mock *RenderClientMock) BuildPageCalls() []struct { W io.Writer PageModel interface{} TemplateName string }
BuildPageCalls gets all the calls that were made to BuildPage. Check the length with:
len(mockedRenderClient.BuildPageCalls())
func (*RenderClientMock) NewBasePageModel ¶ added in v0.11.0
func (mock *RenderClientMock) NewBasePageModel() coreModel.Page
NewBasePageModel calls NewBasePageModelFunc.
func (*RenderClientMock) NewBasePageModelCalls ¶ added in v0.11.0
func (mock *RenderClientMock) NewBasePageModelCalls() []struct { }
NewBasePageModelCalls gets all the calls that were made to NewBasePageModel. Check the length with:
len(mockedRenderClient.NewBasePageModelCalls())
type SearchClient ¶ added in v0.2.0
type SearchClient interface {
GetSearch(ctx context.Context, options searchSDK.Options) (*searchModels.SearchResponse, searchError.Error)
}
SearchClient is an interface with methods required for a search client
type SearchClientError ¶ added in v0.44.0
type SearchClientError interface {
Status() int
}
Search API returns a SearchClientError interface, which differs from ZebedeeClient
type SearchClientMock ¶ added in v0.2.0
type SearchClientMock struct {
// GetSearchFunc mocks the GetSearch method.
GetSearchFunc func(ctx context.Context, options searchSDK.Options) (*searchModels.SearchResponse, apiError.Error)
// contains filtered or unexported fields
}
SearchClientMock is a mock implementation of SearchClient.
func TestSomethingThatUsesSearchClient(t *testing.T) {
// make and configure a mocked SearchClient
mockedSearchClient := &SearchClientMock{
GetSearchFunc: func(ctx context.Context, options searchSDK.Options) (*searchModels.SearchResponse, apiError.Error) {
panic("mock out the GetSearch method")
},
}
// use mockedSearchClient in code that requires SearchClient
// and then make assertions.
}
func (*SearchClientMock) GetSearch ¶ added in v0.2.0
func (mock *SearchClientMock) GetSearch(ctx context.Context, options searchSDK.Options) (*searchModels.SearchResponse, apiError.Error)
GetSearch calls GetSearchFunc.
func (*SearchClientMock) GetSearchCalls ¶ added in v0.2.0
func (mock *SearchClientMock) GetSearchCalls() []struct { Ctx context.Context Options searchSDK.Options }
GetSearchCalls gets all the calls that were made to GetSearch. Check the length with:
len(mockedSearchClient.GetSearchCalls())
type TopicClient ¶ added in v0.53.0
type TopicClient interface {
GetRootTopicsPrivate(ctx context.Context, reqHeaders topicSDK.Headers) (*topicModels.PrivateSubtopics, topicError.Error)
GetRootTopicsPublic(ctx context.Context, reqHeaders topicSDK.Headers) (*topicModels.PublicSubtopics, topicError.Error)
GetSubtopicsPrivate(ctx context.Context, reqHeaders topicSDK.Headers, id string) (*topicModels.PrivateSubtopics, topicError.Error)
GetSubtopicsPublic(ctx context.Context, reqHeaders topicSDK.Headers, id string) (*topicModels.PublicSubtopics, topicError.Error)
GetTopicPrivate(ctx context.Context, reqHeaders topicSDK.Headers, id string) (*topicModels.TopicResponse, topicError.Error)
GetTopicPublic(ctx context.Context, reqHeaders topicSDK.Headers, id string) (*topicModels.Topic, topicError.Error)
}
TopicClient is an interface with methods required for a zebedee client
type TopicClientMock ¶ added in v0.53.0
type TopicClientMock struct {
GetNavigationPublicFunc func(ctx context.Context, reqHeaders topic.Headers, options topic.Options) (*topicModels.Navigation, topicError.Error)
// GetRootTopicsPrivateFunc mocks the GetRootTopicsPrivate method.
GetRootTopicsPrivateFunc func(ctx context.Context, reqHeaders topic.Headers) (*topicModels.PrivateSubtopics, topicError.Error)
// GetRootTopicsPublicFunc mocks the GetRootTopicsPublic method.
GetRootTopicsPublicFunc func(ctx context.Context, reqHeaders topic.Headers) (*topicModels.PublicSubtopics, topicError.Error)
// GetSubtopicsPrivateFunc mocks the GetSubtopicsPrivate method.
GetSubtopicsPrivateFunc func(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.PrivateSubtopics, topicError.Error)
// GetSubtopicsPublicFunc mocks the GetSubtopicsPublic method.
GetSubtopicsPublicFunc func(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.PublicSubtopics, topicError.Error)
// GetTopicPrivateFunc mocks the GetTopicPrivate method.
GetTopicPrivateFunc func(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.TopicResponse, topicError.Error)
// GetTopicPublicFunc mocks the GetTopicPublic method.
GetTopicPublicFunc func(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.Topic, topicError.Error)
// PutTopicReleasePrivateFunc mocks the PutTopicReleasePrivate method.
PutTopicReleasePrivateFunc func(ctx context.Context, reqHeaders topic.Headers, id string, topicRelease []byte) (*topic.ResponseInfo, topicError.Error)
// contains filtered or unexported fields
}
TopicClientMock is a mock implementation of TopicClient.
func TestSomethingThatUsesTopicClient(t *testing.T) {
// make and configure a mocked TopicClient
mockedTopicClient := &TopicClientMock{
GetNavigationPublicFunc: func(ctx context.Context, reqHeaders topic.Headers, options topic.Options) (*topicModels.Navigation, topicError.Error) {
panic("mock out the GetNavigationPublic method")
},
GetRootTopicsPrivateFunc: func(ctx context.Context, reqHeaders topic.Headers) (*topicModels.PrivateSubtopics, topicError.Error) {
panic("mock out the GetRootTopicsPrivate method")
},
GetRootTopicsPublicFunc: func(ctx context.Context, reqHeaders topic.Headers) (*topicModels.PublicSubtopics, topicError.Error) {
panic("mock out the GetRootTopicsPublic method")
},
GetSubtopicsPrivateFunc: func(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.PrivateSubtopics, topicError.Error) {
panic("mock out the GetSubtopicsPrivate method")
},
GetSubtopicsPublicFunc: func(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.PublicSubtopics, topicError.Error) {
panic("mock out the GetSubtopicsPublic method")
},
GetTopicPrivateFunc: func(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.TopicResponse, topicError.Error) {
panic("mock out the GetTopicPrivate method")
},
GetTopicPublicFunc: func(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.Topic, topicError.Error) {
panic("mock out the GetTopicPublic method")
},
PutTopicReleasePrivateFunc: func(ctx context.Context, reqHeaders topic.Headers, id string, topicRelease []byte) (*topic.ResponseInfo, topicError.Error) {
panic("mock out the PutTopicReleasePrivate method")
},
}
// use mockedTopicClient in code that requires TopicClient
// and then make assertions.
}
func (*TopicClientMock) GetNavigationPublic ¶ added in v0.53.0
func (mock *TopicClientMock) GetNavigationPublic(ctx context.Context, reqHeaders topic.Headers, options topic.Options) (*topicModels.Navigation, topicError.Error)
GetNavigationPublic calls GetNavigationPublicFunc.
func (*TopicClientMock) GetNavigationPublicCalls ¶ added in v0.53.0
func (mock *TopicClientMock) GetNavigationPublicCalls() []struct { Ctx context.Context ReqHeaders topic.Headers Options topic.Options }
GetNavigationPublicCalls gets all the calls that were made to GetNavigationPublic. Check the length with:
len(mockedTopicClient.GetNavigationPublicCalls())
func (*TopicClientMock) GetRootTopicsPrivate ¶ added in v0.53.0
func (mock *TopicClientMock) GetRootTopicsPrivate(ctx context.Context, reqHeaders topic.Headers) (*topicModels.PrivateSubtopics, topicError.Error)
GetRootTopicsPrivate calls GetRootTopicsPrivateFunc.
func (*TopicClientMock) GetRootTopicsPrivateCalls ¶ added in v0.53.0
func (mock *TopicClientMock) GetRootTopicsPrivateCalls() []struct { Ctx context.Context ReqHeaders topic.Headers }
GetRootTopicsPrivateCalls gets all the calls that were made to GetRootTopicsPrivate. Check the length with:
len(mockedTopicClient.GetRootTopicsPrivateCalls())
func (*TopicClientMock) GetRootTopicsPublic ¶ added in v0.53.0
func (mock *TopicClientMock) GetRootTopicsPublic(ctx context.Context, reqHeaders topic.Headers) (*topicModels.PublicSubtopics, topicError.Error)
GetRootTopicsPublic calls GetRootTopicsPublicFunc.
func (*TopicClientMock) GetRootTopicsPublicCalls ¶ added in v0.53.0
func (mock *TopicClientMock) GetRootTopicsPublicCalls() []struct { Ctx context.Context ReqHeaders topic.Headers }
GetRootTopicsPublicCalls gets all the calls that were made to GetRootTopicsPublic. Check the length with:
len(mockedTopicClient.GetRootTopicsPublicCalls())
func (*TopicClientMock) GetSubtopicsPrivate ¶ added in v0.53.0
func (mock *TopicClientMock) GetSubtopicsPrivate(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.PrivateSubtopics, topicError.Error)
GetSubtopicsPrivate calls GetSubtopicsPrivateFunc.
func (*TopicClientMock) GetSubtopicsPrivateCalls ¶ added in v0.53.0
func (mock *TopicClientMock) GetSubtopicsPrivateCalls() []struct { Ctx context.Context ReqHeaders topic.Headers ID string }
GetSubtopicsPrivateCalls gets all the calls that were made to GetSubtopicsPrivate. Check the length with:
len(mockedTopicClient.GetSubtopicsPrivateCalls())
func (*TopicClientMock) GetSubtopicsPublic ¶ added in v0.53.0
func (mock *TopicClientMock) GetSubtopicsPublic(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.PublicSubtopics, topicError.Error)
GetSubtopicsPublic calls GetSubtopicsPublicFunc.
func (*TopicClientMock) GetSubtopicsPublicCalls ¶ added in v0.53.0
func (mock *TopicClientMock) GetSubtopicsPublicCalls() []struct { Ctx context.Context ReqHeaders topic.Headers ID string }
GetSubtopicsPublicCalls gets all the calls that were made to GetSubtopicsPublic. Check the length with:
len(mockedTopicClient.GetSubtopicsPublicCalls())
func (*TopicClientMock) GetTopicPrivate ¶ added in v0.53.0
func (mock *TopicClientMock) GetTopicPrivate(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.TopicResponse, topicError.Error)
GetTopicPrivate calls GetTopicPrivateFunc.
func (*TopicClientMock) GetTopicPrivateCalls ¶ added in v0.53.0
func (mock *TopicClientMock) GetTopicPrivateCalls() []struct { Ctx context.Context ReqHeaders topic.Headers ID string }
GetTopicPrivateCalls gets all the calls that were made to GetTopicPrivate. Check the length with:
len(mockedTopicClient.GetTopicPrivateCalls())
func (*TopicClientMock) GetTopicPublic ¶ added in v0.53.0
func (mock *TopicClientMock) GetTopicPublic(ctx context.Context, reqHeaders topic.Headers, id string) (*topicModels.Topic, topicError.Error)
GetTopicPublic calls GetTopicPublicFunc.
func (*TopicClientMock) GetTopicPublicCalls ¶ added in v0.53.0
func (mock *TopicClientMock) GetTopicPublicCalls() []struct { Ctx context.Context ReqHeaders topic.Headers ID string }
GetTopicPublicCalls gets all the calls that were made to GetTopicPublic. Check the length with:
len(mockedTopicClient.GetTopicPublicCalls())
func (*TopicClientMock) PutTopicReleasePrivate ¶ added in v0.53.0
func (mock *TopicClientMock) PutTopicReleasePrivate(ctx context.Context, reqHeaders topic.Headers, id string, topicRelease []byte) (*topic.ResponseInfo, topicError.Error)
PutTopicReleasePrivate calls PutTopicReleasePrivateFunc.
func (*TopicClientMock) PutTopicReleasePrivateCalls ¶ added in v0.53.0
func (mock *TopicClientMock) PutTopicReleasePrivateCalls() []struct { Ctx context.Context ReqHeaders topic.Headers ID string TopicRelease []byte }
PutTopicReleasePrivateCalls gets all the calls that were made to PutTopicReleasePrivate. Check the length with:
len(mockedTopicClient.PutTopicReleasePrivateCalls())
type ZebedeeClient ¶ added in v0.26.0
type ZebedeeClient interface {
GetHomepageContent(ctx context.Context, userAuthToken, collectionID, lang, path string) (m zebedee.HomepageContent, err error)
}
ZebedeeClient is an interface with methods required for a zebedee client
type ZebedeeClientMock ¶ added in v0.26.0
type ZebedeeClientMock struct {
// GetHomepageContentFunc mocks the GetHomepageContent method.
GetHomepageContentFunc func(ctx context.Context, userAuthToken string, collectionID string, lang string, path string) (zebedeeCli.HomepageContent, error)
// contains filtered or unexported fields
}
ZebedeeClientMock is a mock implementation of ZebedeeClient.
func TestSomethingThatUsesZebedeeClient(t *testing.T) {
// make and configure a mocked ZebedeeClient
mockedZebedeeClient := &ZebedeeClientMock{
GetHomepageContentFunc: func(ctx context.Context, userAuthToken string, collectionID string, lang string, path string) (zebedeeCli.HomepageContent, error) {
panic("mock out the GetHomepageContent method")
},
}
// use mockedZebedeeClient in code that requires ZebedeeClient
// and then make assertions.
}
func (*ZebedeeClientMock) GetHomepageContent ¶ added in v0.26.0
func (mock *ZebedeeClientMock) GetHomepageContent(ctx context.Context, userAuthToken string, collectionID string, lang string, path string) (zebedeeCli.HomepageContent, error)
GetHomepageContent calls GetHomepageContentFunc.
func (*ZebedeeClientMock) GetHomepageContentCalls ¶ added in v0.26.0
func (mock *ZebedeeClientMock) GetHomepageContentCalls() []struct { Ctx context.Context UserAuthToken string CollectionID string Lang string Path string }
GetHomepageContentCalls gets all the calls that were made to GetHomepageContent. Check the length with:
len(mockedZebedeeClient.GetHomepageContentCalls())