client

package
v0.0.0-...-5a969d9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildUploadPayload

func BuildUploadPayload(updownUploadDir string, updownUploadContentType string) (*updown.UploadPayload, error)

BuildUploadPayload builds the payload for the updown upload endpoint from CLI flags.

func BuildUploadStreamPayload

func BuildUploadStreamPayload(payload any, fpath string) (*updown.UploadRequestData, error)

// BuildUploadStreamPayload creates a streaming endpoint request payload from the method payload and the path to the file to be streamed

func DecodeDownloadResponse

func DecodeDownloadResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)

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

  • "invalid_file_path" (type *goa.ServiceError): http.StatusNotFound
  • "internal_error" (type *goa.ServiceError): http.StatusInternalServerError
  • error: internal error

func DecodeUploadResponse

func DecodeUploadResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)

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

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

func DownloadUpdownPath

func DownloadUpdownPath(filename string) string

DownloadUpdownPath returns the URL path to the updown service download HTTP endpoint.

func EncodeUploadRequest

func EncodeUploadRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error

EncodeUploadRequest returns an encoder for requests sent to the updown upload server.

func NewDownloadInternalError

func NewDownloadInternalError(body *DownloadInternalErrorResponseBody) *goa.ServiceError

NewDownloadInternalError builds a updown service download endpoint internal_error error.

func NewDownloadInvalidFilePath

func NewDownloadInvalidFilePath(body *DownloadInvalidFilePathResponseBody) *goa.ServiceError

NewDownloadInvalidFilePath builds a updown service download endpoint invalid_file_path error.

func NewDownloadResultOK

func NewDownloadResultOK(length int64) *updown.DownloadResult

NewDownloadResultOK builds a "updown" service "download" endpoint result from a HTTP "OK" response.

func NewUploadInternalError

func NewUploadInternalError(body *UploadInternalErrorResponseBody) *goa.ServiceError

NewUploadInternalError builds a updown service upload endpoint internal_error error.

func NewUploadInvalidMediaType

func NewUploadInvalidMediaType(body *UploadInvalidMediaTypeResponseBody) *goa.ServiceError

NewUploadInvalidMediaType builds a updown service upload endpoint invalid_media_type error.

func NewUploadInvalidMultipartRequest

func NewUploadInvalidMultipartRequest(body *UploadInvalidMultipartRequestResponseBody) *goa.ServiceError

NewUploadInvalidMultipartRequest builds a updown service upload endpoint invalid_multipart_request error.

func UploadUpdownPath

func UploadUpdownPath(dir string) string

UploadUpdownPath returns the URL path to the updown service upload HTTP endpoint.

func ValidateDownloadInternalErrorResponseBody

func ValidateDownloadInternalErrorResponseBody(body *DownloadInternalErrorResponseBody) (err error)

ValidateDownloadInternalErrorResponseBody runs the validations defined on download_internal_error_response_body

func ValidateDownloadInvalidFilePathResponseBody

func ValidateDownloadInvalidFilePathResponseBody(body *DownloadInvalidFilePathResponseBody) (err error)

ValidateDownloadInvalidFilePathResponseBody runs the validations defined on download_invalid_file_path_response_body

func ValidateUploadInternalErrorResponseBody

func ValidateUploadInternalErrorResponseBody(body *UploadInternalErrorResponseBody) (err error)

ValidateUploadInternalErrorResponseBody runs the validations defined on upload_internal_error_response_body

func ValidateUploadInvalidMediaTypeResponseBody

func ValidateUploadInvalidMediaTypeResponseBody(body *UploadInvalidMediaTypeResponseBody) (err error)

ValidateUploadInvalidMediaTypeResponseBody runs the validations defined on upload_invalid_media_type_response_body

func ValidateUploadInvalidMultipartRequestResponseBody

func ValidateUploadInvalidMultipartRequestResponseBody(body *UploadInvalidMultipartRequestResponseBody) (err error)

ValidateUploadInvalidMultipartRequestResponseBody runs the validations defined on upload_invalid_multipart_request_response_body

Types

type Client

type Client struct {
	// Upload Doer is the HTTP client used to make requests to the upload endpoint.
	UploadDoer goahttp.Doer

	// Download Doer is the HTTP client used to make requests to the download
	// endpoint.
	DownloadDoer 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 updown 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 updown service servers.

func (*Client) BuildDownloadRequest

func (c *Client) BuildDownloadRequest(ctx context.Context, v any) (*http.Request, error)

BuildDownloadRequest instantiates a HTTP request object with method and path set to call the "updown" service "download" endpoint

func (*Client) BuildUploadRequest

func (c *Client) BuildUploadRequest(ctx context.Context, v any) (*http.Request, error)

BuildUploadRequest instantiates a HTTP request object with method and path set to call the "updown" service "upload" endpoint

func (*Client) Download

func (c *Client) Download() goa.Endpoint

Download returns an endpoint that makes HTTP requests to the updown service download server.

func (*Client) Upload

func (c *Client) Upload() goa.Endpoint

Upload returns an endpoint that makes HTTP requests to the updown service upload server.

type DownloadInternalErrorResponseBody

type DownloadInternalErrorResponseBody 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"`
}

DownloadInternalErrorResponseBody is the type of the "updown" service "download" endpoint HTTP response body for the "internal_error" error.

type DownloadInvalidFilePathResponseBody

type DownloadInvalidFilePathResponseBody 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"`
}

DownloadInvalidFilePathResponseBody is the type of the "updown" service "download" endpoint HTTP response body for the "invalid_file_path" error.

type UploadInternalErrorResponseBody

type UploadInternalErrorResponseBody 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"`
}

UploadInternalErrorResponseBody is the type of the "updown" service "upload" endpoint HTTP response body for the "internal_error" error.

type UploadInvalidMediaTypeResponseBody

type UploadInvalidMediaTypeResponseBody 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"`
}

UploadInvalidMediaTypeResponseBody is the type of the "updown" service "upload" endpoint HTTP response body for the "invalid_media_type" error.

type UploadInvalidMultipartRequestResponseBody

type UploadInvalidMultipartRequestResponseBody 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"`
}

UploadInvalidMultipartRequestResponseBody is the type of the "updown" service "upload" endpoint HTTP response body for the "invalid_multipart_request" error.

Jump to

Keyboard shortcuts

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