archiver

package
v2.0.10+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "archiver"

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

View Source
var MethodNames = [2]string{"archive", "read"}

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 MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func NewArchiveEndpoint

func NewArchiveEndpoint(s Service) endpoint.Endpoint

NewArchiveEndpoint returns an endpoint function that calls the method "archive" of service "archiver".

func NewReadEndpoint

func NewReadEndpoint(s Service) endpoint.Endpoint

NewReadEndpoint returns an endpoint function that calls the method "read" of service "archiver".

func NewViewedArchiveMedia

func NewViewedArchiveMedia(res *ArchiveMedia, view string) *archiverviews.ArchiveMedia

NewViewedArchiveMedia initializes viewed result type ArchiveMedia from result type ArchiveMedia using the given view.

Types

type ArchiveMedia

type ArchiveMedia struct {
	// The archive resouce href
	Href string
	// HTTP status
	Status int
	// HTTP response body content
	Body string
}

ArchiveMedia is the result type of the archiver service archive method.

func NewArchiveMedia

func NewArchiveMedia(vres *archiverviews.ArchiveMedia) *ArchiveMedia

NewArchiveMedia initializes result type ArchiveMedia from viewed result type ArchiveMedia.

type ArchivePayload

type ArchivePayload struct {
	// HTTP status
	Status int
	// HTTP response body content
	Body string
}

ArchivePayload is the payload type of the archiver service archive method.

type Client

type Client struct {
	ArchiveEndpoint endpoint.Endpoint
	ReadEndpoint    endpoint.Endpoint
}

Client is the "archiver" service client.

func NewClient

func NewClient(archive, read endpoint.Endpoint) *Client

NewClient initializes a "archiver" service client given the endpoints.

func (*Client) Archive

func (c *Client) Archive(ctx context.Context, p *ArchivePayload) (res *ArchiveMedia, err error)

Archive calls the "archive" endpoint of the "archiver" service.

func (*Client) Read

func (c *Client) Read(ctx context.Context, p *ReadPayload) (res *ArchiveMedia, err error)

Read calls the "read" endpoint of the "archiver" service. Read may return the following errors:

  • "not_found" (type *goa.ServiceError)
  • "bad_request" (type *goa.ServiceError)
  • error: internal error

type Endpoints

type Endpoints struct {
	Archive endpoint.Endpoint
	Read    endpoint.Endpoint
}

Endpoints wraps the "archiver" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "archiver" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(endpoint.Endpoint) endpoint.Endpoint)

Use applies the given middleware to all the "archiver" service endpoints.

type ReadPayload

type ReadPayload struct {
	// ID of archive
	ID int
}

ReadPayload is the payload type of the archiver service read method.

type Service

type Service interface {
	// Archive HTTP response
	Archive(context.Context, *ArchivePayload) (res *ArchiveMedia, err error)
	// Read HTTP response from archive
	Read(context.Context, *ReadPayload) (res *ArchiveMedia, err error)
}

Service is the archiver service interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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