client

package
v2.2.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFetchPayload

func BuildFetchPayload(fetcherFetchURL string) (*fetcher.FetchPayload, error)

BuildFetchPayload builds the payload for the fetcher fetch endpoint from CLI flags.

func DecodeFetchResponse

func DecodeFetchResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error)

DecodeFetchResponse returns a decoder for responses returned by the fetcher fetch endpoint. restoreBody controls whether the response body should be restored after having been read. DecodeFetchResponse may return the following errors:

  • "bad_request" (type *goa.ServiceError): http.StatusBadRequest
  • "internal_error" (type *goa.ServiceError): http.StatusInternalServerError
  • error: internal error

func FetchFetcherPath

func FetchFetcherPath(url_ string) string

FetchFetcherPath returns the URL path to the fetcher service fetch HTTP endpoint.

func NewFetchBadRequest

func NewFetchBadRequest(body *FetchBadRequestResponseBody) *goa.ServiceError

NewFetchBadRequest builds a fetcher service fetch endpoint bad_request error.

func NewFetchInternalError

func NewFetchInternalError(body *FetchInternalErrorResponseBody) *goa.ServiceError

NewFetchInternalError builds a fetcher service fetch endpoint internal_error error.

func NewFetchMediaViewOK

func NewFetchMediaViewOK(body *FetchResponseBody) *fetcherviews.FetchMediaView

NewFetchMediaViewOK builds a "fetcher" service "fetch" endpoint result from a HTTP "OK" response.

func ValidateFetchBadRequestResponseBody

func ValidateFetchBadRequestResponseBody(body *FetchBadRequestResponseBody) (err error)

ValidateFetchBadRequestResponseBody runs the validations defined on fetch_bad_request_response_body

func ValidateFetchInternalErrorResponseBody

func ValidateFetchInternalErrorResponseBody(body *FetchInternalErrorResponseBody) (err error)

ValidateFetchInternalErrorResponseBody runs the validations defined on fetch_internal_error_response_body

Types

type Client

type Client struct {
	// Fetch Doer is the HTTP client used to make requests to the fetch endpoint.
	FetchDoer goahttp.Doer

	// RestoreResponseBody controls whether the response bodies are reset after
	// decoding so they can be read again.
	RestoreResponseBody bool
	// contains filtered or unexported fields
}

Client lists the fetcher service endpoint HTTP clients.

func NewClient

func NewClient(
	scheme string,
	host string,
	doer goahttp.Doer,
	enc func(*http.Request) goahttp.Encoder,
	dec func(*http.Response) goahttp.Decoder,
	restoreBody bool,
) *Client

NewClient instantiates HTTP clients for all the fetcher service servers.

func (*Client) BuildFetchRequest

func (c *Client) BuildFetchRequest(ctx context.Context, v interface{}) (*http.Request, error)

BuildFetchRequest instantiates a HTTP request object with method and path set to call the "fetcher" service "fetch" endpoint

func (*Client) Fetch

func (c *Client) Fetch() endpoint.Endpoint

Fetch returns an endpoint that makes HTTP requests to the fetcher service fetch server.

type FetchBadRequestResponseBody

type FetchBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Is the error temporary?
	Temporary *bool `form:"temporary,omitempty" json:"temporary,omitempty" xml:"temporary,omitempty"`
	// Is the error a timeout?
	Timeout *bool `form:"timeout,omitempty" json:"timeout,omitempty" xml:"timeout,omitempty"`
	// Is the error a server-side fault?
	Fault *bool `form:"fault,omitempty" json:"fault,omitempty" xml:"fault,omitempty"`
}

FetchBadRequestResponseBody is the type of the "fetcher" service "fetch" endpoint HTTP response body for the "bad_request" error.

type FetchInternalErrorResponseBody

type FetchInternalErrorResponseBody struct {
	// Name is the name of this class of errors.
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Is the error temporary?
	Temporary *bool `form:"temporary,omitempty" json:"temporary,omitempty" xml:"temporary,omitempty"`
	// Is the error a timeout?
	Timeout *bool `form:"timeout,omitempty" json:"timeout,omitempty" xml:"timeout,omitempty"`
	// Is the error a server-side fault?
	Fault *bool `form:"fault,omitempty" json:"fault,omitempty" xml:"fault,omitempty"`
}

FetchInternalErrorResponseBody is the type of the "fetcher" service "fetch" endpoint HTTP response body for the "internal_error" error.

type FetchResponseBody

type FetchResponseBody struct {
	// HTTP status code returned by fetched service
	Status *int `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
	// The href to the corresponding archive in the archiver service
	ArchiveHref *string `form:"archive_href,omitempty" json:"archive_href,omitempty" xml:"archive_href,omitempty"`
}

FetchResponseBody is the type of the "fetcher" service "fetch" endpoint HTTP response body.

Jump to

Keyboard shortcuts

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