api

package
v0.0.0-...-82f7c04 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API contains each part of the API settings.

func New

func New() (*API, error)

New parses the config file and initializes the new API.

func (*API) Close

func (a *API) Close()

Close closes the grpc connection.

func (*API) NewGrpcConnection

func (a *API) NewGrpcConnection(address string) error

NewGrpcConnection makes a new connection on the gRPC server.

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is the implementation of http.Handler.

type AccountIn

type AccountIn struct {
	ID string `path:"id" description:"Account ID"`
}

AccountIn represents an account. It is used as argument in controllers.

type Health

type Health struct {
	// Status is the API health status.
	Status string `json:"status" description:"API health status."`
}

Health represents the API health status.

type ResponseBalanceOut

type ResponseBalanceOut struct {
	// AccountID is the targeted account id.
	AccountID uuid.UUID `json:"account_id" description:"Targeted Account ID"`
	// Balance is the targeted account balance.
	Balance int64 `json:"balance" description:"Targeted Account balance (updated after the transaction)"`
}

ResponseBalanceOut is used to give a response on a balance route.

type ResponseTransactionOut

type ResponseTransactionOut struct {
	// AccountID is the id of the account targeted by the transaction.
	AccountID uuid.UUID `json:"account_id" description:"Targeted Account ID"`
	// Balance is the targeted account balance.
	Balance int64 `json:"balance" description:"Targeted Account balance (updated after the transaction)"`
	// TransactionID is the transaction id.
	TransactionID uuid.UUID `json:"transaction_id" description:"Transaction ID"`
	// CreatedAt is the transaction creation date.
	CreatedAt time.Time `json:"created_at" description:"Transaction creation date"`
}

ResponseTransactionOut represents a response after a transaction is added or updated.

type TransactionIn

type TransactionIn struct {
	// AccountID is the id of the account targeted by the transaction.
	AccountID uuid.UUID `json:"account_id" description:"Targeted Account ID" validate:"required"`
	// Amount is the transaction amount.
	Amount int64 `json:"amount" description:"Transaction amount" validate:"required"`
	// Description is the transaction description.
	Description string `json:"description" description:"Transaction description"`
	// Currency is the transaction currency.
	Currency string `json:"currency" description:"Transaction currency"`
}

TransactionIn represents a transaction. It is used as argument in controllers.

type UpdateTransactionIn

type UpdateTransactionIn struct {
	// ID is the transaction ID.
	ID uuid.UUID `json:"id" description:"Transaction ID" validate="required"`
	// AccountID is the id of the account targeted by the transaction.
	AccountID uuid.UUID `json:"account_id" description:"Targeted Account ID" validate:"required"`
	// Amount is the transaction amount.
	Amount int64 `json:"amount" description:"Transaction amount" validate:"required"`
}

UpdateTransactionIn represents a transaction. It is used as argument in the update controller.

Jump to

Keyboard shortcuts

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