client

package
v0.0.0-...-2469c04 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePurchasePath

func CreatePurchasePath() string

CreatePurchasePath computes a request path to the create action of Purchase.

func ShowPurchasePath

func ShowPurchasePath(transactionID string) string

ShowPurchasePath computes a request path to the show action of Purchase.

Types

type Client

type Client struct {
	*goaclient.Client
	Encoder *goa.HTTPEncoder
	Decoder *goa.HTTPDecoder
}

Client is the pos service client.

func New

func New(c goaclient.Doer) *Client

New instantiates the client.

func (*Client) CreatePurchase

func (c *Client) CreatePurchase(ctx context.Context, path string, payload *PurchasePayload) (*http.Response, error)

creates a purchase

func (*Client) DecodePurchase

func (c *Client) DecodePurchase(resp *http.Response) (*Purchase, error)

DecodePurchase decodes the Purchase instance encoded in resp body.

func (*Client) DownloadJs

func (c *Client) DownloadJs(ctx context.Context, filename, dest string) (int64, error)

DownloadJs downloads /files with the given filename and writes it to the file dest. It returns the number of bytes downloaded in case of success.

func (*Client) DownloadSwaggerJSON

func (c *Client) DownloadSwaggerJSON(ctx context.Context, dest string) (int64, error)

DownloadSwaggerJSON downloads swagger.json and writes it to the file dest. It returns the number of bytes downloaded in case of success.

func (*Client) DownloadUI

func (c *Client) DownloadUI(ctx context.Context, dest string) (int64, error)

DownloadUI downloads index.html and writes it to the file dest. It returns the number of bytes downloaded in case of success.

func (*Client) NewCreatePurchaseRequest

func (c *Client) NewCreatePurchaseRequest(ctx context.Context, path string, payload *PurchasePayload) (*http.Request, error)

NewCreatePurchaseRequest create the request corresponding to the create action endpoint of the Purchase resource.

func (*Client) NewShowPurchaseRequest

func (c *Client) NewShowPurchaseRequest(ctx context.Context, path string) (*http.Request, error)

NewShowPurchaseRequest create the request corresponding to the show action endpoint of the Purchase resource.

func (*Client) ShowPurchase

func (c *Client) ShowPurchase(ctx context.Context, path string) (*http.Response, error)

retrieves a purchase

type Purchase

type Purchase struct {
	// API href of Purchase
	Href string `json:"href"`
	// Operation reference code
	Locator string `bson:"locator,omitempty" json:"locator"`
	// Total amount paid
	PurchaseValue float64 `bson:"purchase_value,omitempty" json:"purchase_value"`
	// Purchase status
	Status string `bson:"status,omitempty" json:"status"`
	// Unique transaction identifier
	TransactionID string `bson:"_id,omitempty" json:"transaction_id"`
}

Purchase media type (default view)

Identifier: application/json; view=default

func (*Purchase) Validate

func (mt *Purchase) Validate() (err error)

Validate validates the Purchase media type instance.

type PurchasePayload

type PurchasePayload struct {
	ID *bson.ObjectId `bson:"_id,omitempty"`
	// Operation reference code
	Locator string `bson:"locator,omitempty" json:"locator"`
	// Total amount paid
	PurchaseValue float64 `bson:"purchase_value,omitempty" json:"purchase_value"`
	Status        *string `bson:"status,omitempty" json:"status"`
}

Detailed information regarding a POS purchase operation

func (*PurchasePayload) Validate

func (ut *PurchasePayload) Validate() (err error)

Validate validates the PurchasePayload type instance.

Jump to

Keyboard shortcuts

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