http

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	Value string `json:"value" example:"ACE"`
	Suit  string `json:"suit" example:"SPADES"`
	Code  string `json:"code" example:"AS"`
}

Card represents a card. @Description represents a card

type Cards

type Cards struct {
	Cards []Card `json:"cards"`
}

Cards represents a collection of cards. @Description represents a collection of cards

func DomainCardsToCards added in v0.1.3

func DomainCardsToCards(dc []card.Card) *Cards

DomainCardsToCards transforms domain cards to Cards.

type DeckClosed

type DeckClosed struct {
	ID        string `json:"deck_id" example:"f6afe993-9847-508e-b206-2487f1ef5a3c"`
	Shuffled  bool   `json:"shuffled" example:"true"`
	Remaining int    `json:"remaining" example:"1"`
}

DeckClosed represents a closed deck of cards. @Description represents a closed deck of cards

func DomainDeckToDeckClosed added in v0.1.3

func DomainDeckToDeckClosed(d *deck.Deck) *DeckClosed

DomainDeckToDeckClosed transforms a domain deck to a DeckClosed.

type DeckOpened

type DeckOpened struct {
	DeckClosed
	Cards []Card `json:"cards"`
}

DeckOpened represents a opened deck of cards. @Description represents a opened deck of cards

func DomainDeckToDeckOpened added in v0.3.0

func DomainDeckToDeckOpened(d *deck.Deck) *DeckOpened

DomainDeckToDeckOpened transforms a domain deck to a DeckOpened.

type Error

type Error struct {
	Error string `json:"error"`
}

Error defines the structure for a failed response. @Description defines the structure for a failed response

type Server

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

Server is the main HTTP server.

func NewServer

func NewServer(
	debug bool,
	host string,
	port int,
	logger *logger.Logger,
	build *build.Info,
	repo repo.Repository,
) *Server

NewServer creates a new Server.

func (*Server) Start

func (s *Server) Start() error

Start starts the server. It blocks until the server stops.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the server.

type Success

type Success struct {
	Message string `json:"message"`
}

Success defines the structure for a successful response. @Description defines the structure for a successful response

Jump to

Keyboard shortcuts

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