httpservice

package
v0.0.0-...-0a6f35f Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(c config.Config) error

Run starts the http server.

Types

type CardResponse

type CardResponse struct {
	Value string `json:"value"`
	Suite string `json:"suite"`
	Code  string `json:"code"`
}

type CreateDeckHandler

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

CreateDeckHandler represents http handler for deck creation operations.

func NewCreateDeckHandler

func NewCreateDeckHandler(createDeckService deck.CreateDeckService) *CreateDeckHandler

NewCreateDeckHandler creates and returns a new handler for serving create deck endpoint.

func (*CreateDeckHandler) CreateDeck

func (d *CreateDeckHandler) CreateDeck(c *gin.Context)

CreateDeck create a new deck. It accepts shuffle and cards query params. It returns the deck as a http response.

type DeckResponse

type DeckResponse struct {
	DeckID    string `json:"deck_id"`
	Shuffled  bool   `json:"shuffled"`
	Remaining int    `json:"remaining"`
}

type DeckWithCardsResponse

type DeckWithCardsResponse struct {
	DeckResponse
	Cards []CardResponse `json:"cards"`
}

type DrawCardsHandler

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

DrawCardsHandler represents http handler for card-draw operations.

func NewDrawCardsHandler

func NewDrawCardsHandler(drawCardsService deck.DrawCardsService) *DrawCardsHandler

NewDrawCardsHandler creates and returns a new handler for serving card-draw endpoint.

func (*DrawCardsHandler) DrawCards

func (d *DrawCardsHandler) DrawCards(c *gin.Context)

DrawCards draws card(s) from the requested deck. It returns the drawn cards.

type OpenDeckHandler

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

OpenDeckHandler represents http handler for deck retrival operations.

func NewOpenDeckHandler

func NewOpenDeckHandler(openDeckService deck.OpenDeckService) *OpenDeckHandler

NewOpenDeckHandler creates and returns a new handler for serving open-deck endpoint.

func (*OpenDeckHandler) OpenDeck

func (d *OpenDeckHandler) OpenDeck(c *gin.Context)

OpenDeck return a given deck by its UUID. It returns the deck as a http response.

Jump to

Keyboard shortcuts

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