api

package
v1.43.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParamQ                  = "q"
	ParamSort               = "sort"
	ParamHighlight          = "highlight"
	ParamTopics             = "topics"
	ParamLimit              = "limit"
	ParamOffset             = "offset"
	ParamContentType        = "content_type"
	ParamPopulationTypes    = "population_types"
	ParamDimensions         = "dimensions"
	ParamSubtypeProvisional = "subtype-provisional"
	ParamSubtypeConfirmed   = "subtype-confirmed"
	ParamSubtypePostponed   = "subtype-postponed"
	ParamCensus             = "census"
	ParamNLPWeighting       = "nlp_weighting"
)

Variables

This section is empty.

Functions

func AddNlpToSearch added in v1.43.0

func AddNlpToSearch(ctx context.Context, queryBuilder QueryBuilder, params url.Values, nlpSettings query.NlpSettings, clList *ClientList) *query.NlpCriteria

func CreateReleaseRequest added in v1.34.0

func CreateReleaseRequest(w http.ResponseWriter, req *http.Request, validator QueryParamValidator) (string, *query.ReleaseSearchRequest)

func CreateRequests added in v1.34.0

func CreateRequests(w http.ResponseWriter, req *http.Request, validator QueryParamValidator, nlpCriteria *query.NlpCriteria) (string, *query.SearchRequest, *query.CountRequest)

CreateRequests reads the parameters from the request and generates the corresponding SearchRequest and CountRequest If any validation fails, the http.Error is already handled, and nil is returned: in this case the caller may return straight away

func LegacySearchHandlerFunc

func LegacySearchHandlerFunc(validator QueryParamValidator, queryBuilder QueryBuilder, nlpConfig *config.Config, clList *ClientList, transformer ResponseTransformer) http.HandlerFunc

LegacySearchHandlerFunc returns a http handler function handling search api requests. TODO: This wil be deleted once the switch over is done to ES 7.10

func SearchHandlerFunc

func SearchHandlerFunc(validator QueryParamValidator, queryBuilder QueryBuilder, nlpConfig *config.Config, clList *ClientList, transformer ResponseTransformer) http.HandlerFunc

SearchHandlerFunc returns a http handler function handling search api requests.

func SearchReleasesHandlerFunc

func SearchReleasesHandlerFunc(validator QueryParamValidator, builder ReleaseQueryBuilder, searcher DpElasticSearcher, transformer ReleaseResponseTransformer) http.HandlerFunc

SearchReleasesHandlerFunc returns a http handler function handling release calendar search api requests.

Types

type AuthHandler

type AuthHandler interface {
	Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
}

AuthHandler provides authorisation checks on requests

type AuthHandlerMock

type AuthHandlerMock struct {
	// RequireFunc mocks the Require method.
	RequireFunc func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
	// contains filtered or unexported fields
}

AuthHandlerMock is a mock implementation of AuthHandler.

func TestSomethingThatUsesAuthHandler(t *testing.T) {

	// make and configure a mocked AuthHandler
	mockedAuthHandler := &AuthHandlerMock{
		RequireFunc: func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc {
			panic("mock out the Require method")
		},
	}

	// use mockedAuthHandler in code that requires AuthHandler
	// and then make assertions.

}

func (*AuthHandlerMock) Require

func (mock *AuthHandlerMock) Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc

Require calls RequireFunc.

func (*AuthHandlerMock) RequireCalls

func (mock *AuthHandlerMock) RequireCalls() []struct {
	Required auth.Permissions
	Handler  http.HandlerFunc
}

RequireCalls gets all the calls that were made to Require. Check the length with:

len(mockedAuthHandler.RequireCalls())

type ClientList added in v1.43.0

type ClientList struct {
	BerlinClient   berlin.Clienter
	CategoryClient category.Clienter
	DpESClient     DpElasticSearcher
	ScrubberClient scrubber.Clienter
	// Remove deprecatedESClient once the legacy handler is removed
	DeprecatedESClient ElasticSearcher
}

ClientList is a struct obj of all the clients the service is dependent on

func NewClientList added in v1.43.0

func NewClientList(brl berlin.Clienter, cat category.Clienter, dpEsClient DpElasticSearcher, scr scrubber.Clienter, deprecatedEs ElasticSearcher) *ClientList

NewClientList returns a new ClientList obj with all available clients

type DpElasticSearcher

type DpElasticSearcher interface {
	CreateIndex(ctx context.Context, indexName string, indexSettings []byte) error
	MultiSearch(ctx context.Context, searches []client.Search, params *client.QueryParams) ([]byte, error)
	Count(ctx context.Context, count client.Count) ([]byte, error)
	Checker(ctx context.Context, state *health.CheckState) error
}

DpElasticSearcher provides an interface for the dp-elasticsearch functionality

type DpElasticSearcherMock

type DpElasticSearcherMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, state *health.CheckState) error

	// CountFunc mocks the Count method.
	CountFunc func(ctx context.Context, count client.Count) ([]byte, error)

	// CreateIndexFunc mocks the CreateIndex method.
	CreateIndexFunc func(ctx context.Context, indexName string, indexSettings []byte) error

	// MultiSearchFunc mocks the MultiSearch method.
	MultiSearchFunc func(ctx context.Context, searches []client.Search, params *client.QueryParams) ([]byte, error)
	// contains filtered or unexported fields
}

DpElasticSearcherMock is a mock implementation of DpElasticSearcher.

func TestSomethingThatUsesDpElasticSearcher(t *testing.T) {

	// make and configure a mocked DpElasticSearcher
	mockedDpElasticSearcher := &DpElasticSearcherMock{
		CheckerFunc: func(ctx context.Context, state *health.CheckState) error {
			panic("mock out the Checker method")
		},
		CountFunc: func(ctx context.Context, count client.Count) ([]byte, error) {
			panic("mock out the Count method")
		},
		CreateIndexFunc: func(ctx context.Context, indexName string, indexSettings []byte) error {
			panic("mock out the CreateIndex method")
		},
		MultiSearchFunc: func(ctx context.Context, searches []client.Search, params *client.QueryParams) ([]byte, error) {
			panic("mock out the MultiSearch method")
		},
	}

	// use mockedDpElasticSearcher in code that requires DpElasticSearcher
	// and then make assertions.

}

func (*DpElasticSearcherMock) Checker added in v1.43.0

func (mock *DpElasticSearcherMock) Checker(ctx context.Context, state *health.CheckState) error

Checker calls CheckerFunc.

func (*DpElasticSearcherMock) CheckerCalls added in v1.43.0

func (mock *DpElasticSearcherMock) CheckerCalls() []struct {
	Ctx   context.Context
	State *health.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedDpElasticSearcher.CheckerCalls())

func (*DpElasticSearcherMock) Count added in v1.32.0

func (mock *DpElasticSearcherMock) Count(ctx context.Context, count client.Count) ([]byte, error)

Count calls CountFunc.

func (*DpElasticSearcherMock) CountCalls added in v1.32.0

func (mock *DpElasticSearcherMock) CountCalls() []struct {
	Ctx   context.Context
	Count client.Count
}

CountCalls gets all the calls that were made to Count. Check the length with:

len(mockedDpElasticSearcher.CountCalls())

func (*DpElasticSearcherMock) CreateIndex

func (mock *DpElasticSearcherMock) CreateIndex(ctx context.Context, indexName string, indexSettings []byte) error

CreateIndex calls CreateIndexFunc.

func (*DpElasticSearcherMock) CreateIndexCalls

func (mock *DpElasticSearcherMock) CreateIndexCalls() []struct {
	Ctx           context.Context
	IndexName     string
	IndexSettings []byte
}

CreateIndexCalls gets all the calls that were made to CreateIndex. Check the length with:

len(mockedDpElasticSearcher.CreateIndexCalls())

func (*DpElasticSearcherMock) MultiSearch

func (mock *DpElasticSearcherMock) MultiSearch(ctx context.Context, searches []client.Search, params *client.QueryParams) ([]byte, error)

MultiSearch calls MultiSearchFunc.

func (*DpElasticSearcherMock) MultiSearchCalls

func (mock *DpElasticSearcherMock) MultiSearchCalls() []struct {
	Ctx      context.Context
	Searches []client.Search
	Params   *client.QueryParams
}

MultiSearchCalls gets all the calls that were made to MultiSearch. Check the length with:

len(mockedDpElasticSearcher.MultiSearchCalls())

type ElasticSearcher

type ElasticSearcher interface {
	Search(ctx context.Context, index string, docType string, request []byte) ([]byte, error)
	MultiSearch(ctx context.Context, index string, docType string, request []byte) ([]byte, error)
}

ElasticSearcher provides client methods for the elasticsearch package - now deprecated, due to be replaced with the methods in dp-elasticsearch

type ElasticSearcherMock

type ElasticSearcherMock struct {
	// MultiSearchFunc mocks the MultiSearch method.
	MultiSearchFunc func(ctx context.Context, index string, docType string, request []byte) ([]byte, error)

	// SearchFunc mocks the Search method.
	SearchFunc func(ctx context.Context, index string, docType string, request []byte) ([]byte, error)
	// contains filtered or unexported fields
}

ElasticSearcherMock is a mock implementation of ElasticSearcher.

func TestSomethingThatUsesElasticSearcher(t *testing.T) {

	// make and configure a mocked ElasticSearcher
	mockedElasticSearcher := &ElasticSearcherMock{
		MultiSearchFunc: func(ctx context.Context, index string, docType string, request []byte) ([]byte, error) {
			panic("mock out the MultiSearch method")
		},
		SearchFunc: func(ctx context.Context, index string, docType string, request []byte) ([]byte, error) {
			panic("mock out the Search method")
		},
	}

	// use mockedElasticSearcher in code that requires ElasticSearcher
	// and then make assertions.

}

func (*ElasticSearcherMock) MultiSearch

func (mock *ElasticSearcherMock) MultiSearch(ctx context.Context, index string, docType string, request []byte) ([]byte, error)

MultiSearch calls MultiSearchFunc.

func (*ElasticSearcherMock) MultiSearchCalls

func (mock *ElasticSearcherMock) MultiSearchCalls() []struct {
	Ctx     context.Context
	Index   string
	DocType string
	Request []byte
}

MultiSearchCalls gets all the calls that were made to MultiSearch. Check the length with:

len(mockedElasticSearcher.MultiSearchCalls())

func (*ElasticSearcherMock) Search

func (mock *ElasticSearcherMock) Search(ctx context.Context, index string, docType string, request []byte) ([]byte, error)

Search calls SearchFunc.

func (*ElasticSearcherMock) SearchCalls

func (mock *ElasticSearcherMock) SearchCalls() []struct {
	Ctx     context.Context
	Index   string
	DocType string
	Request []byte
}

SearchCalls gets all the calls that were made to Search. Check the length with:

len(mockedElasticSearcher.SearchCalls())

type QueryBuilder

type QueryBuilder interface {
	AddNlpCategorySearch(nlpCriteria *query.NlpCriteria, category string, subCategory string, categoryWeighting float32) *query.NlpCriteria
	AddNlpSubdivisionSearch(nlpCriteria *query.NlpCriteria, subdivisionWords string) *query.NlpCriteria
	BuildSearchQuery(ctx context.Context, req *query.SearchRequest, esVersion710 bool) ([]byte, error)
	BuildCountQuery(ctx context.Context, req *query.CountRequest) ([]byte, error)
}

QueryBuilder provides methods for the search package

type QueryBuilderMock

type QueryBuilderMock struct {
	// AddNlpCategorySearchFunc mocks the AddNlpCategorySearch method.
	AddNlpCategorySearchFunc func(nlpCriteria *query.NlpCriteria, category string, subCategory string, categoryWeighting float32) *query.NlpCriteria

	// AddNlpSubdivisionSearchFunc mocks the AddNlpSubdivisionSearch method.
	AddNlpSubdivisionSearchFunc func(nlpCriteria *query.NlpCriteria, subdivisionWords string) *query.NlpCriteria

	// BuildCountQueryFunc mocks the BuildCountQuery method.
	BuildCountQueryFunc func(ctx context.Context, req *query.CountRequest) ([]byte, error)

	// BuildSearchQueryFunc mocks the BuildSearchQuery method.
	BuildSearchQueryFunc func(ctx context.Context, req *query.SearchRequest, esVersion710 bool) ([]byte, error)
	// contains filtered or unexported fields
}

QueryBuilderMock is a mock implementation of QueryBuilder.

func TestSomethingThatUsesQueryBuilder(t *testing.T) {

	// make and configure a mocked QueryBuilder
	mockedQueryBuilder := &QueryBuilderMock{
		AddNlpCategorySearchFunc: func(nlpCriteria *query.NlpCriteria, category string, subCategory string, categoryWeighting float32) *query.NlpCriteria {
			panic("mock out the AddNlpCategorySearch method")
		},
		AddNlpSubdivisionSearchFunc: func(nlpCriteria *query.NlpCriteria, subdivisionWords string) *query.NlpCriteria {
			panic("mock out the AddNlpSubdivisionSearch method")
		},
		BuildCountQueryFunc: func(ctx context.Context, req *query.CountRequest) ([]byte, error) {
			panic("mock out the BuildCountQuery method")
		},
		BuildSearchQueryFunc: func(ctx context.Context, req *query.SearchRequest, esVersion710 bool) ([]byte, error) {
			panic("mock out the BuildSearchQuery method")
		},
	}

	// use mockedQueryBuilder in code that requires QueryBuilder
	// and then make assertions.

}

func (*QueryBuilderMock) AddNlpCategorySearch added in v1.43.0

func (mock *QueryBuilderMock) AddNlpCategorySearch(nlpCriteria *query.NlpCriteria, category string, subCategory string, categoryWeighting float32) *query.NlpCriteria

AddNlpCategorySearch calls AddNlpCategorySearchFunc.

func (*QueryBuilderMock) AddNlpCategorySearchCalls added in v1.43.0

func (mock *QueryBuilderMock) AddNlpCategorySearchCalls() []struct {
	NlpCriteria       *query.NlpCriteria
	Category          string
	SubCategory       string
	CategoryWeighting float32
}

AddNlpCategorySearchCalls gets all the calls that were made to AddNlpCategorySearch. Check the length with:

len(mockedQueryBuilder.AddNlpCategorySearchCalls())

func (*QueryBuilderMock) AddNlpSubdivisionSearch added in v1.43.0

func (mock *QueryBuilderMock) AddNlpSubdivisionSearch(nlpCriteria *query.NlpCriteria, subdivisionWords string) *query.NlpCriteria

AddNlpSubdivisionSearch calls AddNlpSubdivisionSearchFunc.

func (*QueryBuilderMock) AddNlpSubdivisionSearchCalls added in v1.43.0

func (mock *QueryBuilderMock) AddNlpSubdivisionSearchCalls() []struct {
	NlpCriteria      *query.NlpCriteria
	SubdivisionWords string
}

AddNlpSubdivisionSearchCalls gets all the calls that were made to AddNlpSubdivisionSearch. Check the length with:

len(mockedQueryBuilder.AddNlpSubdivisionSearchCalls())

func (*QueryBuilderMock) BuildCountQuery added in v1.32.0

func (mock *QueryBuilderMock) BuildCountQuery(ctx context.Context, req *query.CountRequest) ([]byte, error)

BuildCountQuery calls BuildCountQueryFunc.

func (*QueryBuilderMock) BuildCountQueryCalls added in v1.32.0

func (mock *QueryBuilderMock) BuildCountQueryCalls() []struct {
	Ctx context.Context
	Req *query.CountRequest
}

BuildCountQueryCalls gets all the calls that were made to BuildCountQuery. Check the length with:

len(mockedQueryBuilder.BuildCountQueryCalls())

func (*QueryBuilderMock) BuildSearchQuery

func (mock *QueryBuilderMock) BuildSearchQuery(ctx context.Context, req *query.SearchRequest, esVersion710 bool) ([]byte, error)

BuildSearchQuery calls BuildSearchQueryFunc.

func (*QueryBuilderMock) BuildSearchQueryCalls

func (mock *QueryBuilderMock) BuildSearchQueryCalls() []struct {
	Ctx          context.Context
	Req          *query.SearchRequest
	EsVersion710 bool
}

BuildSearchQueryCalls gets all the calls that were made to BuildSearchQuery. Check the length with:

len(mockedQueryBuilder.BuildSearchQueryCalls())

type QueryParamValidator

type QueryParamValidator interface {
	Validate(ctx context.Context, name, value string) (interface{}, error)
}

QueryParamValidator provides an interface to validate api query parameters (used for /search/releases)

type QueryParamValidatorMock

type QueryParamValidatorMock struct {
	// ValidateFunc mocks the Validate method.
	ValidateFunc func(ctx context.Context, name string, value string) (interface{}, error)
	// contains filtered or unexported fields
}

QueryParamValidatorMock is a mock implementation of QueryParamValidator.

func TestSomethingThatUsesQueryParamValidator(t *testing.T) {

	// make and configure a mocked QueryParamValidator
	mockedQueryParamValidator := &QueryParamValidatorMock{
		ValidateFunc: func(ctx context.Context, name string, value string) (interface{}, error) {
			panic("mock out the Validate method")
		},
	}

	// use mockedQueryParamValidator in code that requires QueryParamValidator
	// and then make assertions.

}

func (*QueryParamValidatorMock) Validate

func (mock *QueryParamValidatorMock) Validate(ctx context.Context, name string, value string) (interface{}, error)

Validate calls ValidateFunc.

func (*QueryParamValidatorMock) ValidateCalls

func (mock *QueryParamValidatorMock) ValidateCalls() []struct {
	Ctx   context.Context
	Name  string
	Value string
}

ValidateCalls gets all the calls that were made to Validate. Check the length with:

len(mockedQueryParamValidator.ValidateCalls())

type ReleaseQueryBuilder

type ReleaseQueryBuilder interface {
	BuildSearchQuery(ctx context.Context, request interface{}) ([]client.Search, error)
}

ReleaseQueryBuilder provides an interface to build a search query for the Release content type

type ReleaseQueryBuilderMock

type ReleaseQueryBuilderMock struct {
	// BuildSearchQueryFunc mocks the BuildSearchQuery method.
	BuildSearchQueryFunc func(ctx context.Context, request interface{}) ([]client.Search, error)
	// contains filtered or unexported fields
}

ReleaseQueryBuilderMock is a mock implementation of ReleaseQueryBuilder.

func TestSomethingThatUsesReleaseQueryBuilder(t *testing.T) {

	// make and configure a mocked ReleaseQueryBuilder
	mockedReleaseQueryBuilder := &ReleaseQueryBuilderMock{
		BuildSearchQueryFunc: func(ctx context.Context, request interface{}) ([]client.Search, error) {
			panic("mock out the BuildSearchQuery method")
		},
	}

	// use mockedReleaseQueryBuilder in code that requires ReleaseQueryBuilder
	// and then make assertions.

}

func (*ReleaseQueryBuilderMock) BuildSearchQuery

func (mock *ReleaseQueryBuilderMock) BuildSearchQuery(ctx context.Context, request interface{}) ([]client.Search, error)

BuildSearchQuery calls BuildSearchQueryFunc.

func (*ReleaseQueryBuilderMock) BuildSearchQueryCalls

func (mock *ReleaseQueryBuilderMock) BuildSearchQueryCalls() []struct {
	Ctx     context.Context
	Request interface{}
}

BuildSearchQueryCalls gets all the calls that were made to BuildSearchQuery. Check the length with:

len(mockedReleaseQueryBuilder.BuildSearchQueryCalls())

type ReleaseResponseTransformer

type ReleaseResponseTransformer interface {
	TransformSearchResponse(ctx context.Context, responseData []byte, req query.ReleaseSearchRequest, highlight bool) ([]byte, error)
}

type ReleaseResponseTransformerMock added in v1.43.0

type ReleaseResponseTransformerMock struct {
	// TransformSearchResponseFunc mocks the TransformSearchResponse method.
	TransformSearchResponseFunc func(ctx context.Context, responseData []byte, req query.ReleaseSearchRequest, highlight bool) ([]byte, error)
	// contains filtered or unexported fields
}

ReleaseResponseTransformerMock is a mock implementation of ReleaseResponseTransformer.

func TestSomethingThatUsesReleaseResponseTransformer(t *testing.T) {

	// make and configure a mocked ReleaseResponseTransformer
	mockedReleaseResponseTransformer := &ReleaseResponseTransformerMock{
		TransformSearchResponseFunc: func(ctx context.Context, responseData []byte, req query.ReleaseSearchRequest, highlight bool) ([]byte, error) {
			panic("mock out the TransformSearchResponse method")
		},
	}

	// use mockedReleaseResponseTransformer in code that requires ReleaseResponseTransformer
	// and then make assertions.

}

func (*ReleaseResponseTransformerMock) TransformSearchResponse added in v1.43.0

func (mock *ReleaseResponseTransformerMock) TransformSearchResponse(ctx context.Context, responseData []byte, req query.ReleaseSearchRequest, highlight bool) ([]byte, error)

TransformSearchResponse calls TransformSearchResponseFunc.

func (*ReleaseResponseTransformerMock) TransformSearchResponseCalls added in v1.43.0

func (mock *ReleaseResponseTransformerMock) TransformSearchResponseCalls() []struct {
	Ctx          context.Context
	ResponseData []byte
	Req          query.ReleaseSearchRequest
	Highlight    bool
}

TransformSearchResponseCalls gets all the calls that were made to TransformSearchResponse. Check the length with:

len(mockedReleaseResponseTransformer.TransformSearchResponseCalls())

type ResponseTransformer

type ResponseTransformer interface {
	TransformSearchResponse(ctx context.Context, responseData []byte, query string, highlight bool) ([]byte, error)
	TransformCountResponse(ctx context.Context, responseData []byte) (int, error)
}

ResponseTransformer provides methods for the transform package

type ResponseTransformerMock

type ResponseTransformerMock struct {
	// TransformCountResponseFunc mocks the TransformCountResponse method.
	TransformCountResponseFunc func(ctx context.Context, responseData []byte) (int, error)

	// TransformSearchResponseFunc mocks the TransformSearchResponse method.
	TransformSearchResponseFunc func(ctx context.Context, responseData []byte, queryMoqParam string, highlight bool) ([]byte, error)
	// contains filtered or unexported fields
}

ResponseTransformerMock is a mock implementation of ResponseTransformer.

func TestSomethingThatUsesResponseTransformer(t *testing.T) {

	// make and configure a mocked ResponseTransformer
	mockedResponseTransformer := &ResponseTransformerMock{
		TransformCountResponseFunc: func(ctx context.Context, responseData []byte) (int, error) {
			panic("mock out the TransformCountResponse method")
		},
		TransformSearchResponseFunc: func(ctx context.Context, responseData []byte, queryMoqParam string, highlight bool) ([]byte, error) {
			panic("mock out the TransformSearchResponse method")
		},
	}

	// use mockedResponseTransformer in code that requires ResponseTransformer
	// and then make assertions.

}

func (*ResponseTransformerMock) TransformCountResponse added in v1.32.0

func (mock *ResponseTransformerMock) TransformCountResponse(ctx context.Context, responseData []byte) (int, error)

TransformCountResponse calls TransformCountResponseFunc.

func (*ResponseTransformerMock) TransformCountResponseCalls added in v1.32.0

func (mock *ResponseTransformerMock) TransformCountResponseCalls() []struct {
	Ctx          context.Context
	ResponseData []byte
}

TransformCountResponseCalls gets all the calls that were made to TransformCountResponse. Check the length with:

len(mockedResponseTransformer.TransformCountResponseCalls())

func (*ResponseTransformerMock) TransformSearchResponse

func (mock *ResponseTransformerMock) TransformSearchResponse(ctx context.Context, responseData []byte, queryMoqParam string, highlight bool) ([]byte, error)

TransformSearchResponse calls TransformSearchResponseFunc.

func (*ResponseTransformerMock) TransformSearchResponseCalls

func (mock *ResponseTransformerMock) TransformSearchResponseCalls() []struct {
	Ctx           context.Context
	ResponseData  []byte
	QueryMoqParam string
	Highlight     bool
}

TransformSearchResponseCalls gets all the calls that were made to TransformSearchResponse. Check the length with:

len(mockedResponseTransformer.TransformSearchResponseCalls())

type SearchAPI

type SearchAPI struct {
	Router *mux.Router
	// contains filtered or unexported fields
}

SearchAPI provides an API around elasticseach

func NewSearchAPI

func NewSearchAPI(router *mux.Router, clientList *ClientList, permissions AuthHandler) *SearchAPI

NewSearchAPI returns a new Search API struct after registering the routes

func (SearchAPI) CreateSearchIndexHandlerFunc

func (a SearchAPI) CreateSearchIndexHandlerFunc(w http.ResponseWriter, req *http.Request)

func (*SearchAPI) RegisterGetSearch added in v1.34.0

func (a *SearchAPI) RegisterGetSearch(validator QueryParamValidator, builder QueryBuilder, settingsNLP *config.Config, transformer ResponseTransformer) *SearchAPI

RegisterGetSearch registers the handler for GET /search endpoint with the provided validator and query builder as well as the API's elasticsearch client and response transformer

func (*SearchAPI) RegisterGetSearchReleases added in v1.34.0

func (a *SearchAPI) RegisterGetSearchReleases(validator QueryParamValidator, builder ReleaseQueryBuilder, transformer ReleaseResponseTransformer) *SearchAPI

RegisterGetSearchRelease registers the handler for GET /search/releases endpoint with the provided validator, query builder, searcher and validator

func (*SearchAPI) RegisterPostSearch added in v1.34.0

func (a *SearchAPI) RegisterPostSearch() *SearchAPI

RegisterPostSearch registers the handler for POST /search endpoint enforcing required update permissions

Jump to

Keyboard shortcuts

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