Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SupportedProviders map[string]interface{} = map[string]interface{}{"rss": nil}
SupportedProviders contains a list of "type" of providers that are supported by the aggregator. This map could later on use a factory function to create an instance of associated provider, instead of the placeholder `interface{}`
Functions ¶
This section is empty.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error,omitempty"`
}
ErrorResponse is returned to requests that result in some error state such as bad request or internal server error
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements HTTP API
func NewHandler ¶
NewHandler constructs a new instance of Handler
func (*Handler) HandleGetArticles ¶
func (h *Handler) HandleGetArticles() http.HandlerFunc
HandleGetArticles returns articles matching specified criteria
func (*Handler) HandlePing ¶
func (h *Handler) HandlePing() http.HandlerFunc
HandlePing is a simple handle to enable clients to test connectivity
func (*Handler) HandlePostProvider ¶
func (h *Handler) HandlePostProvider() http.HandlerFunc
HandlePostProvider saves provider information for use by the aggregator component
type Service ¶
type Service interface { GetArticles(ctx context.Context, offset, count int, category, provider []string) ([]storage.Article, error) SaveProvider(ctx context.Context, provider storage.Provider) (string, error) }
Service defines the functionality required by the mobile-api
type ServiceImpl ¶
type ServiceImpl struct {
// contains filtered or unexported fields
}
ServiceImpl implements the domain logic for the mobile api
func NewService ¶
func NewService(articleRepo storage.ArticleRepository, providerRepo storage.ProviderRepository, msgBus *nats.Conn) (*ServiceImpl, error)
NewService returns a new instance of the service mobile api service domain logic implementation
func (*ServiceImpl) GetArticles ¶
func (s *ServiceImpl) GetArticles(ctx context.Context, offset, count int, category, provider []string) ([]storage.Article, error)
GetArticles retrieves a list of articles from underlying storage. Filter parameters can be used to reduce the results
func (*ServiceImpl) SaveProvider ¶
SaveProvider saves a provider to underlying storage