api

package
v0.0.0-...-399e6d5 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amount

type Amount = int64

type AppError

type AppError struct {
	Code     int    `json:"code" example:"400"`
	Message  string `json:"message" example:"Error message"`
	Cause    error  `json:"-"`
	Location string `json:"-"`
}

AppError Implements Error

func NewAuthorizationError

func NewAuthorizationError(err error, message string) *AppError

NewAuthorizationError Create a 401 Unauthorized.

err error The error to wrap.
message string The generic message to show.

func NewBadRequestError

func NewBadRequestError(err error, message string) *AppError

NewBadRequestError Create a 400 Bad Request Error.

err error The error to wrap.
message string The generic message to show.

func NewDBError

func NewDBError(err error, message string) *AppError

NewDBError Create a 500 Internal Server Error due to a DB failure.

err error The error to wrap.
message string The generic message to show.

func NewForbiddenError

func NewForbiddenError(err error, message string) *AppError

NewForbiddenError Create a 403 Forbidden Error.

err error The error to wrap.
message string The generic message to show.

func NewInternalServerError

func NewInternalServerError(err error, message string) *AppError

NewInternalServerError Create a 500 Internal Server Error.

err error The error to wrap.
message string The generic message to show.

func NewNotFoundError

func NewNotFoundError(err error, message string) *AppError

NewNotFoundError Create a 404 Not Found Error.

err error The error to wrap.
message string The generic message to show.

func (*AppError) Error

func (e *AppError) Error() string

func (*AppError) GetCause

func (e *AppError) GetCause() error

GetCause Returns the error.

func (*AppError) GetCode

func (e *AppError) GetCode() int

GetCode Returns the error code.

func (*AppError) GetLocation

func (e *AppError) GetLocation() string

GetLocation Returns the error location.

func (*AppError) GetMessage

func (e *AppError) GetMessage() string

GetMessage Returns the error message.

func (*AppError) String

func (e *AppError) String() string

type BalanceResponse

type BalanceResponse struct {
	Balance struct {
		Type     string `json:"type"`
		Quantity string `json:"quantity"`
	} `json:"balance"`
}

type Error

type Error interface {
	Error() string
	GetCode() int
	GetMessage() string
	GetLocation() string
	GetCause() error
}

Error Enhanced Error interface giving extra-error information.

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

Jump to

Keyboard shortcuts

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