Documentation ¶
Index ¶
- Constants
- Variables
- func MakeBadRequest(err error) *goa.ServiceError
- func MakeInternalError(err error) *goa.ServiceError
- func NewFetchEndpoint(s Service) endpoint.Endpoint
- func NewViewedFetchMedia(res *FetchMedia, view string) *fetcherviews.FetchMedia
- type Client
- type Endpoints
- type FetchMedia
- type FetchPayload
- type Service
Constants ¶
const ServiceName = "fetcher"
ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.
Variables ¶
var MethodNames = [1]string{"fetch"}
MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.
Functions ¶
func MakeBadRequest ¶
func MakeBadRequest(err error) *goa.ServiceError
MakeBadRequest builds a goa.ServiceError from an error.
func MakeInternalError ¶
func MakeInternalError(err error) *goa.ServiceError
MakeInternalError builds a goa.ServiceError from an error.
func NewFetchEndpoint ¶
NewFetchEndpoint returns an endpoint function that calls the method "fetch" of service "fetcher".
func NewViewedFetchMedia ¶
func NewViewedFetchMedia(res *FetchMedia, view string) *fetcherviews.FetchMedia
NewViewedFetchMedia initializes viewed result type FetchMedia from result type FetchMedia using the given view.
Types ¶
type Client ¶
Client is the "fetcher" service client.
func (*Client) Fetch ¶
func (c *Client) Fetch(ctx context.Context, p *FetchPayload) (res *FetchMedia, err error)
Fetch calls the "fetch" endpoint of the "fetcher" service. Fetch may return the following errors:
- "bad_request" (type *goa.ServiceError)
- "internal_error" (type *goa.ServiceError)
- error: internal error
type Endpoints ¶
Endpoints wraps the "fetcher" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "fetcher" service with endpoints.
type FetchMedia ¶
type FetchMedia struct { // HTTP status code returned by fetched service Status int // The href to the corresponding archive in the archiver service ArchiveHref string }
FetchMedia is the result type of the fetcher service fetch method.
func NewFetchMedia ¶
func NewFetchMedia(vres *fetcherviews.FetchMedia) *FetchMedia
NewFetchMedia initializes result type FetchMedia from viewed result type FetchMedia.
type FetchPayload ¶
type FetchPayload struct { // URL to be fetched URL string }
FetchPayload is the payload type of the fetcher service fetch method.
type Service ¶
type Service interface { // Fetch makes a GET request to the given URL and stores the results in the // archiver service which must be running or the request fails Fetch(context.Context, *FetchPayload) (res *FetchMedia, err error) }
Service is the fetcher service interface.