client

package
v0.0.0-...-f99326c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCreateBookPayload

func BuildCreateBookPayload(librarianCreateBookBody string) (*librarian.CreateBookPayload, error)

BuildCreateBookPayload builds the payload for the librarian create-book endpoint from CLI flags.

func BuildDeleteBookPayload

func BuildDeleteBookPayload(librarianDeleteBookID string) (*librarian.DeleteBookPayload, error)

BuildDeleteBookPayload builds the payload for the librarian delete-book endpoint from CLI flags.

func BuildGetBookPayload

func BuildGetBookPayload(librarianGetBookID string) (*librarian.GetBookPayload, error)

BuildGetBookPayload builds the payload for the librarian get-book endpoint from CLI flags.

func BuildGetBooksPayload

func BuildGetBooksPayload(librarianGetBooksSkip string, librarianGetBooksTake string) (*librarian.GetBooksPayload, error)

BuildGetBooksPayload builds the payload for the librarian get-books endpoint from CLI flags.

func BuildUpdateBookPayload

func BuildUpdateBookPayload(librarianUpdateBookBody string) (*librarian.UpdateBookPayload, error)

BuildUpdateBookPayload builds the payload for the librarian update-book endpoint from CLI flags.

func CreateBookLibrarianPath

func CreateBookLibrarianPath() string

CreateBookLibrarianPath returns the URL path to the librarian service create-book HTTP endpoint.

func DecodeCreateBookResponse

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

DecodeCreateBookResponse returns a decoder for responses returned by the librarian create-book endpoint. restoreBody controls whether the response body should be restored after having been read. DecodeCreateBookResponse may return the following errors:

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

func DecodeDeleteBookResponse

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

DecodeDeleteBookResponse returns a decoder for responses returned by the librarian delete-book endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeGetBookResponse

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

DecodeGetBookResponse returns a decoder for responses returned by the librarian get-book endpoint. restoreBody controls whether the response body should be restored after having been read. DecodeGetBookResponse may return the following errors:

  • "not_found" (type *goa.ServiceError): http.StatusNotFound
  • "internal_server_error" (type *goa.ServiceError): http.StatusInternalServerError
  • error: internal error

func DecodeGetBooksResponse

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

DecodeGetBooksResponse returns a decoder for responses returned by the librarian get-books endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeUpdateBookResponse

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

DecodeUpdateBookResponse returns a decoder for responses returned by the librarian update-book endpoint. restoreBody controls whether the response body should be restored after having been read.

func DeleteBookLibrarianPath

func DeleteBookLibrarianPath(id int) string

DeleteBookLibrarianPath returns the URL path to the librarian service delete-book HTTP endpoint.

func EncodeCreateBookRequest

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

EncodeCreateBookRequest returns an encoder for requests sent to the librarian create-book server.

func EncodeUpdateBookRequest

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

EncodeUpdateBookRequest returns an encoder for requests sent to the librarian update-book server.

func GetBookLibrarianPath

func GetBookLibrarianPath(id int) string

GetBookLibrarianPath returns the URL path to the librarian service get-book HTTP endpoint.

func GetBooksLibrarianPath

func GetBooksLibrarianPath(skip int, take int) string

GetBooksLibrarianPath returns the URL path to the librarian service get-books HTTP endpoint.

func NewCreateBookBadRequest

func NewCreateBookBadRequest(body *CreateBookBadRequestResponseBody) *goa.ServiceError

NewCreateBookBadRequest builds a librarian service create-book endpoint bad_request error.

func NewCreateBookCreatebookresponseOK

func NewCreateBookCreatebookresponseOK(body *CreateBookResponseBody) *librarianviews.CreatebookresponseView

NewCreateBookCreatebookresponseOK builds a "librarian" service "create-book" endpoint result from a HTTP "OK" response.

func NewCreateBookInternalServerError

func NewCreateBookInternalServerError(body *CreateBookInternalServerErrorResponseBody) *goa.ServiceError

NewCreateBookInternalServerError builds a librarian service create-book endpoint internal_server_error error.

func NewCreateBookNotFound

func NewCreateBookNotFound(body *CreateBookNotFoundResponseBody) *goa.ServiceError

NewCreateBookNotFound builds a librarian service create-book endpoint not_found error.

func NewGetBookGetbookresponseOK

func NewGetBookGetbookresponseOK(body *GetBookResponseBody) *librarianviews.GetbookresponseView

NewGetBookGetbookresponseOK builds a "librarian" service "get-book" endpoint result from a HTTP "OK" response.

func NewGetBookInternalServerError

func NewGetBookInternalServerError(body *GetBookInternalServerErrorResponseBody) *goa.ServiceError

NewGetBookInternalServerError builds a librarian service get-book endpoint internal_server_error error.

func NewGetBookNotFound

func NewGetBookNotFound(body *GetBookNotFoundResponseBody) *goa.ServiceError

NewGetBookNotFound builds a librarian service get-book endpoint not_found error.

func NewGetBooksGetbooksresponseOK

func NewGetBooksGetbooksresponseOK(body *GetBooksResponseBody) *librarianviews.GetbooksresponseView

NewGetBooksGetbooksresponseOK builds a "librarian" service "get-books" endpoint result from a HTTP "OK" response.

func NewUpdateBookUpdatebookresponseOK

func NewUpdateBookUpdatebookresponseOK(body *UpdateBookResponseBody) *librarianviews.UpdatebookresponseView

NewUpdateBookUpdatebookresponseOK builds a "librarian" service "update-book" endpoint result from a HTTP "OK" response.

func UpdateBookLibrarianPath

func UpdateBookLibrarianPath() string

UpdateBookLibrarianPath returns the URL path to the librarian service update-book HTTP endpoint.

func ValidateCreateBookBadRequestResponseBody

func ValidateCreateBookBadRequestResponseBody(body *CreateBookBadRequestResponseBody) (err error)

ValidateCreateBookBadRequestResponseBody runs the validations defined on create-book_bad_request_response_body

func ValidateCreateBookInternalServerErrorResponseBody

func ValidateCreateBookInternalServerErrorResponseBody(body *CreateBookInternalServerErrorResponseBody) (err error)

ValidateCreateBookInternalServerErrorResponseBody runs the validations defined on create-book_internal_server_error_response_body

func ValidateCreateBookNotFoundResponseBody

func ValidateCreateBookNotFoundResponseBody(body *CreateBookNotFoundResponseBody) (err error)

ValidateCreateBookNotFoundResponseBody runs the validations defined on create-book_not_found_response_body

func ValidateGetBookInternalServerErrorResponseBody

func ValidateGetBookInternalServerErrorResponseBody(body *GetBookInternalServerErrorResponseBody) (err error)

ValidateGetBookInternalServerErrorResponseBody runs the validations defined on get-book_internal_server_error_response_body

func ValidateGetBookNotFoundResponseBody

func ValidateGetBookNotFoundResponseBody(body *GetBookNotFoundResponseBody) (err error)

ValidateGetBookNotFoundResponseBody runs the validations defined on get-book_not_found_response_body

func ValidateResultbookCollectionResponseBody

func ValidateResultbookCollectionResponseBody(body ResultbookCollectionResponseBody) (err error)

ValidateResultbookCollectionResponseBody runs the validations defined on ResultbookCollectionResponseBody

func ValidateResultbookResponseBody

func ValidateResultbookResponseBody(body *ResultbookResponseBody) (err error)

ValidateResultbookResponseBody runs the validations defined on ResultbookResponseBody

Types

type Client

type Client struct {
	// GetBook Doer is the HTTP client used to make requests to the get-book
	// endpoint.
	GetBookDoer goahttp.Doer

	// GetBooks Doer is the HTTP client used to make requests to the get-books
	// endpoint.
	GetBooksDoer goahttp.Doer

	// CreateBook Doer is the HTTP client used to make requests to the create-book
	// endpoint.
	CreateBookDoer goahttp.Doer

	// UpdateBook Doer is the HTTP client used to make requests to the update-book
	// endpoint.
	UpdateBookDoer goahttp.Doer

	// DeleteBook Doer is the HTTP client used to make requests to the delete-book
	// endpoint.
	DeleteBookDoer 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 librarian 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 librarian service servers.

func (*Client) BuildCreateBookRequest

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

BuildCreateBookRequest instantiates a HTTP request object with method and path set to call the "librarian" service "create-book" endpoint

func (*Client) BuildDeleteBookRequest

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

BuildDeleteBookRequest instantiates a HTTP request object with method and path set to call the "librarian" service "delete-book" endpoint

func (*Client) BuildGetBookRequest

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

BuildGetBookRequest instantiates a HTTP request object with method and path set to call the "librarian" service "get-book" endpoint

func (*Client) BuildGetBooksRequest

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

BuildGetBooksRequest instantiates a HTTP request object with method and path set to call the "librarian" service "get-books" endpoint

func (*Client) BuildUpdateBookRequest

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

BuildUpdateBookRequest instantiates a HTTP request object with method and path set to call the "librarian" service "update-book" endpoint

func (*Client) CreateBook

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

CreateBook returns an endpoint that makes HTTP requests to the librarian service create-book server.

func (*Client) DeleteBook

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

DeleteBook returns an endpoint that makes HTTP requests to the librarian service delete-book server.

func (*Client) GetBook

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

GetBook returns an endpoint that makes HTTP requests to the librarian service get-book server.

func (*Client) GetBooks

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

GetBooks returns an endpoint that makes HTTP requests to the librarian service get-books server.

func (*Client) UpdateBook

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

UpdateBook returns an endpoint that makes HTTP requests to the librarian service update-book server.

type CreateBookBadRequestResponseBody

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

CreateBookBadRequestResponseBody is the type of the "librarian" service "create-book" endpoint HTTP response body for the "bad_request" error.

type CreateBookInternalServerErrorResponseBody

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

CreateBookInternalServerErrorResponseBody is the type of the "librarian" service "create-book" endpoint HTTP response body for the "internal_server_error" error.

type CreateBookNotFoundResponseBody

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

CreateBookNotFoundResponseBody is the type of the "librarian" service "create-book" endpoint HTTP response body for the "not_found" error.

type CreateBookRequestBody

type CreateBookRequestBody struct {
	// The title of the book.
	Title string `form:"title" json:"title" xml:"title"`
	// The author of the book.
	Author string `form:"author" json:"author" xml:"author"`
	// The URL to the cover image.
	BookCover string `form:"book_cover" json:"book_cover" xml:"book_cover"`
	// The date at which the book was published.
	PublishedAt string `form:"published_at" json:"published_at" xml:"published_at"`
}

CreateBookRequestBody is the type of the "librarian" service "create-book" endpoint HTTP request body.

func NewCreateBookRequestBody

func NewCreateBookRequestBody(p *librarian.CreateBookPayload) *CreateBookRequestBody

NewCreateBookRequestBody builds the HTTP request body from the payload of the "create-book" endpoint of the "librarian" service.

type CreateBookResponseBody

type CreateBookResponseBody struct {
	// The unique id of the book.
	ID *int `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// The title of the book.
	Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
	// The author of the book.
	Author *string `form:"author,omitempty" json:"author,omitempty" xml:"author,omitempty"`
	// The cover image of the book.
	BookCover *string `form:"book_cover,omitempty" json:"book_cover,omitempty" xml:"book_cover,omitempty"`
	// The date at which the book was published.
	PublishedAt *string `form:"published_at,omitempty" json:"published_at,omitempty" xml:"published_at,omitempty"`
}

CreateBookResponseBody is the type of the "librarian" service "create-book" endpoint HTTP response body.

type GetBookInternalServerErrorResponseBody

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

GetBookInternalServerErrorResponseBody is the type of the "librarian" service "get-book" endpoint HTTP response body for the "internal_server_error" error.

type GetBookNotFoundResponseBody

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

GetBookNotFoundResponseBody is the type of the "librarian" service "get-book" endpoint HTTP response body for the "not_found" error.

type GetBookResponseBody

type GetBookResponseBody struct {
	// The unique id of the book.
	ID *int `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// The title of the book.
	Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
	// The author of the book.
	Author *string `form:"author,omitempty" json:"author,omitempty" xml:"author,omitempty"`
	// The cover image of the book.
	BookCover *string `form:"book_cover,omitempty" json:"book_cover,omitempty" xml:"book_cover,omitempty"`
	// The date at which the book was published.
	PublishedAt *string `form:"published_at,omitempty" json:"published_at,omitempty" xml:"published_at,omitempty"`
}

GetBookResponseBody is the type of the "librarian" service "get-book" endpoint HTTP response body.

type GetBooksResponseBody

type GetBooksResponseBody struct {
	// List of paginated books.
	Books ResultbookCollectionResponseBody `form:"books,omitempty" json:"books,omitempty" xml:"books,omitempty"`
}

GetBooksResponseBody is the type of the "librarian" service "get-books" endpoint HTTP response body.

type ResultbookCollectionResponseBody

type ResultbookCollectionResponseBody []*ResultbookResponseBody

ResultbookCollectionResponseBody is used to define fields on response body types.

type ResultbookResponseBody

type ResultbookResponseBody struct {
	// The unique id of the book.
	ID *int `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// The title of the book.
	Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
	// The author of the book.
	Author *string `form:"author,omitempty" json:"author,omitempty" xml:"author,omitempty"`
	// The cover image of the book.
	BookCover *string `form:"book_cover,omitempty" json:"book_cover,omitempty" xml:"book_cover,omitempty"`
	// The date at which the book was published.
	PublishedAt *string `form:"published_at,omitempty" json:"published_at,omitempty" xml:"published_at,omitempty"`
}

ResultbookResponseBody is used to define fields on response body types.

type UpdateBookRequestBody

type UpdateBookRequestBody struct {
	// The unique id of the book.
	ID *int `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// The title of the book.
	Title string `form:"title" json:"title" xml:"title"`
	// The author of the book.
	Author string `form:"author" json:"author" xml:"author"`
	// The URL to the cover image.
	BookCover string `form:"book_cover" json:"book_cover" xml:"book_cover"`
	// The date at which the book was published.
	PublishedAt string `form:"published_at" json:"published_at" xml:"published_at"`
}

UpdateBookRequestBody is the type of the "librarian" service "update-book" endpoint HTTP request body.

func NewUpdateBookRequestBody

func NewUpdateBookRequestBody(p *librarian.UpdateBookPayload) *UpdateBookRequestBody

NewUpdateBookRequestBody builds the HTTP request body from the payload of the "update-book" endpoint of the "librarian" service.

type UpdateBookResponseBody

type UpdateBookResponseBody struct {
	// The unique id of the book.
	ID *int `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// The title of the book.
	Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
	// The author of the book.
	Author *string `form:"author,omitempty" json:"author,omitempty" xml:"author,omitempty"`
	// The cover image of the book.
	BookCover *string `form:"book_cover,omitempty" json:"book_cover,omitempty" xml:"book_cover,omitempty"`
	// The date at which the book was published.
	PublishedAt *string `form:"published_at,omitempty" json:"published_at,omitempty" xml:"published_at,omitempty"`
}

UpdateBookResponseBody is the type of the "librarian" service "update-book" endpoint HTTP response body.

Jump to

Keyboard shortcuts

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