Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeckHandler ¶
type DeckHandler struct {
// contains filtered or unexported fields
}
func NewDeckHandler ¶
func NewDeckHandler(service DeckService, log *log.Logger) (*DeckHandler, error)
func (*DeckHandler) CreateDeck ¶
func (h *DeckHandler) CreateDeck(w http.ResponseWriter, r *http.Request)
CreateDeck godoc
@Summary Creates a new deck @Description Creates new decks with all cards or specific ones. Also, it's possible to shuffle the deck. @Accept json @Produce json @Param shuffled query bool false "Shuffle cards on the deck." @Param cards query array false "The card codes to be added to the deck." @Success 200 {object} deck.CreateDeckResponse @Failure 400 {object} HttpError @Failure 404 {object} HttpError @Failure 422 {object} HttpError @Failure 500 {object} HttpError @Router / [post]
func (*DeckHandler) DrawCard ¶
func (h *DeckHandler) DrawCard(w http.ResponseWriter, r *http.Request)
DrawCard godoc
@Summary Draws a card from the deck @Description Draws one or more cards from the deck @Param id path string true "The ID (uuid) of the deck." @Param count query int true "The number of cards to draw from the deck." @Accept json @Produce json @Success 200 {object} deck.DrawCardResponse @Failure 400 {object} HttpError @Failure 404 {object} HttpError @Failure 422 {object} HttpError @Failure 500 {object} HttpError @Router /{id}/draw [get]
func (*DeckHandler) OpenDeck ¶
func (h *DeckHandler) OpenDeck(w http.ResponseWriter, r *http.Request)
OpenDeck godoc
@Summary Opens an existing deck @Description Returns an existing opened deck with all cards. @Accept json @Produce json @Param id path string true "The ID (uuid) of the deck." @Success 200 {object} deck.OpenDeckResponse @Failure 400 {object} HttpError @Failure 404 {object} HttpError @Failure 422 {object} HttpError @Failure 500 {object} HttpError @Router /{id} [get]
type DeckService ¶
Click to show internal directories.
Click to hide internal directories.