Design configapi interfaces

pull/89/head
Aloïs Micard 3 years ago
parent 08be8ddce5
commit a1f8313246
No known key found for this signature in database
GPG Key ID: 1A0EB82F071F5EFE

@ -0,0 +1,9 @@
package api
// ConfigAPI expose the functionality of the config API
type ConfigAPI interface {
// Get value of given key
Get(key string) ([]byte, error)
// Set value of given key
Set(key string, value []byte) error
}

@ -0,0 +1,30 @@
package client
//go:generate mockgen -destination=../client_mock/client_mock.go -package=client_mock . Client
const (
forbiddenMimeTypes = "forbidden-mime-types"
forbiddenHostnames = "forbidden-hostnames"
)
// ForbiddenMimeType is the mime types who's crawling is forbidden
type ForbiddenMimeType struct {
// The content-type
ContentType string `json:"content-type"`
// The list of associated extensions
Extensions []string `json:"extensions"`
}
// ForbiddenHostname is the hostnames who's crawling is forbidden
type ForbiddenHostname struct {
Hostname string `json:"hostname"`
}
// Client is a nice client interface for the ConfigAPI
type Client interface {
GetForbiddenMimeTypes() ([]ForbiddenMimeType, error)
SetForbiddenMimeTypes(values []ForbiddenMimeType) error
GetForbiddenHostnames() ([]ForbiddenHostname, error)
SetForbiddenHostnames(values []ForbiddenHostname) error
}
Loading…
Cancel
Save