Documentation
¶
Index ¶
- type BasicUserInformationResult
- type DeckCreateRequest
- type DeckInfoResponse
- type DeckInfoResponseBlackCard
- type DeckInfoResponseWhiteCard
- type RandomCardRequests
- type RandomCardResponse
- type RouteController
- func (rc *RouteController) AuthInfo(c *gin.Context)
- func (rc *RouteController) DeckCreate(c *gin.Context)
- func (rc *RouteController) DeckInfo(c *gin.Context)
- func (rc *RouteController) Login(c *gin.Context)
- func (rc *RouteController) RandomCards(c *gin.Context)
- func (rc *RouteController) Reachable(c *gin.Context)
- func (rc *RouteController) Register(c *gin.Context)
- type RouteEnvironment
- type Router
- type UserLoginResponse
- type UserRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeckCreateRequest ¶
type DeckCreateRequest struct { Name string `json:"name" binding:"required"` Official bool `json:"official"` BlackCards []string `json:"blackCards" binding:"required"` WhiteCards []string `json:"whiteCards" binding:"required"` }
func (*DeckCreateRequest) AmountBlackCards ¶
func (dcr *DeckCreateRequest) AmountBlackCards() int
Returns the amount of black cards in this creation request.
func (*DeckCreateRequest) AmountWhiteCards ¶
func (dcr *DeckCreateRequest) AmountWhiteCards() int
Returns the amount of white cards in this creation request.
type DeckInfoResponse ¶
type DeckInfoResponse struct { ID uint `json:"id"` Name string `json:"name"` Official bool `json:"official"` OwnerID uint `json:"ownerId"` BlackCards []DeckInfoResponseBlackCard `json:"blackCards"` WhiteCards []DeckInfoResponseWhiteCard `json:"whiteCards"` }
type RandomCardRequests ¶
type RandomCardRequests struct { DeckIDs []uint `json:"deckIds" binding:"required"` Type validators.CardType `json:"type" binding:"required,cardtype"` Amount uint `json:"amount" binding:"required"` }
type RandomCardResponse ¶
type RandomCardResponse struct {
Cards []interface{} `json:"cards"`
}
type RouteController ¶
type RouteController struct {
RouteEnvironment
}
Contains all routes.
func NewRouteController ¶
func NewRouteController(environment RouteEnvironment) *RouteController
Returns a new RouteController instance.
func (*RouteController) AuthInfo ¶
func (rc *RouteController) AuthInfo(c *gin.Context)
Shows some basic information about the authenticated users.
func (*RouteController) DeckCreate ¶
func (rc *RouteController) DeckCreate(c *gin.Context)
Responsible for deck creation.
func (*RouteController) DeckInfo ¶
func (rc *RouteController) DeckInfo(c *gin.Context)
Shows information about a deck
func (*RouteController) Login ¶
func (rc *RouteController) Login(c *gin.Context)
Responsible for user login.
func (*RouteController) RandomCards ¶
func (rc *RouteController) RandomCards(c *gin.Context)
Returns random cards. Currently it can happen that it returns a card slice that has the length zero when invalid data (e.g. non-existent deck ids or no deck ids at all) is supplied. At the moment, this can be ignored since this is not a public route.
func (*RouteController) Reachable ¶
func (rc *RouteController) Reachable(c *gin.Context)
Just a route that returns an empty HTTP response with a status code of 200 (OK).
func (*RouteController) Register ¶
func (rc *RouteController) Register(c *gin.Context)
Responsible for user creation.
type RouteEnvironment ¶
type RouteEnvironment struct { UserRepo repositories.UserRepository DeckRepo repositories.DeckRepository }
Contains everything that is needed for the api so it can operate smoothly. This includes repositories or additional external hooks, for example.
type Router ¶
type Router struct {
RouteEnvironment
}
func NewRouter ¶
func NewRouter(environment RouteEnvironment) *Router
Creates a new Router instance.