Documentation
¶
Index ¶
- type Company
- type CreateGameRequest
- type CreateRatingRequest
- type GameResponse
- type GamesResponse
- type Genre
- type GetGamesQueryParams
- type GetUserRatingsRequest
- type IDResponse
- type ModerationItem
- type Platform
- type RatingResponse
- type UpdateGameRequest
- type UploadImagesResponse
- type UploadedFileInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateGameRequest ¶
type CreateGameRequest struct {
Name string `json:"name"`
Developer string `json:"developer"`
ReleaseDate string `json:"releaseDate"`
GenresIDs []int32 `json:"genresIds"`
LogoURL string `json:"logoUrl"`
Summary string `json:"summary"`
PlatformsIDs []int32 `json:"platformsIds"`
Screenshots []string `json:"screenshots"`
Websites []string `json:"websites"`
}
CreateGameRequest - create game request
func (*CreateGameRequest) Sanitize ¶
func (r *CreateGameRequest) Sanitize()
Sanitize cleans up user input for CreateGameRequest
func (*CreateGameRequest) ValidateWith ¶
func (r *CreateGameRequest) ValidateWith(v *validation.Validator) (bool, []web.FieldError)
ValidateWith validates CreateGameRequest
type CreateRatingRequest ¶
type CreateRatingRequest struct {
Rating uint8 `json:"rating" validate:"gte=0,lte=5"` // 0 - remove rating
}
CreateRatingRequest - create rating request
func (*CreateRatingRequest) ValidateWith ¶
func (r *CreateRatingRequest) ValidateWith(v *validation.Validator) (bool, []web.FieldError)
ValidateWith validates CreateRatingRequest
type GameResponse ¶
type GameResponse struct {
ID int32 `json:"id"`
Name string `json:"name"`
Developers []Company `json:"developers"`
Publishers []Company `json:"publishers"`
ReleaseDate string `json:"releaseDate"`
Genres []Genre `json:"genres"`
LogoURL string `json:"logoUrl,omitempty"`
Rating float64 `json:"rating"`
Summary string `json:"summary,omitempty"`
Slug string `json:"slug,omitempty"`
Platforms []Platform `json:"platforms"`
Screenshots []string `json:"screenshots"`
Websites []string `json:"websites"`
}
GameResponse - game response
type GamesResponse ¶
type GamesResponse struct {
Games []GameResponse `json:"games"`
Count uint64 `json:"count"`
}
GamesResponse - games response
type GetGamesQueryParams ¶
type GetGamesQueryParams struct {
PageSize uint32 `form:"pageSize"`
Page uint32 `form:"page"`
OrderBy string `form:"orderBy"`
Name string `form:"name"`
GenreID int32 `form:"genre"`
DeveloperID int32 `form:"developer"`
PublisherID int32 `form:"publisher"`
}
GetGamesQueryParams - get games query params
type GetUserRatingsRequest ¶
type GetUserRatingsRequest struct {
GameIDs []int32 `json:"gameIds"`
}
GetUserRatingsRequest - get user ratings request
func (*GetUserRatingsRequest) ValidateWith ¶
func (r *GetUserRatingsRequest) ValidateWith(v *validation.Validator) (bool, []web.FieldError)
ValidateWith validates GetUserRatingsRequest
type IDResponse ¶
type IDResponse struct {
ID int32 `json:"id"`
}
IDResponse represents response with id
type ModerationItem ¶
type ModerationItem struct {
ID int32 `json:"id"`
Status string `json:"resultStatus"`
Details string `json:"details"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
}
ModerationItem represents a moderation entity for API response
type Platform ¶
type Platform struct {
ID int32 `json:"id"`
Name string `json:"name"`
Abbreviation string `json:"abbreviation"`
}
Platform represents platform response
type RatingResponse ¶
RatingResponse - rating response
type UpdateGameRequest ¶
type UpdateGameRequest struct {
Name *string `json:"name"`
Developer *string `json:"developer"`
ReleaseDate *string `json:"releaseDate"`
GenresIDs *[]int32 `json:"genresIds"`
LogoURL *string `json:"logoUrl"`
Summary *string `json:"summary"`
PlatformsIDs *[]int32 `json:"platformsIds"`
Screenshots *[]string `json:"screenshots"`
Websites *[]string `json:"websites"`
}
UpdateGameRequest - update game request. All fields are optional
func (*UpdateGameRequest) Sanitize ¶
func (r *UpdateGameRequest) Sanitize()
Sanitize cleans up user input for CreateGameRequest
func (*UpdateGameRequest) ValidateWith ¶
func (r *UpdateGameRequest) ValidateWith(v *validation.Validator) (bool, []web.FieldError)
ValidateWith validates UpdateGameRequest
type UploadImagesResponse ¶
type UploadImagesResponse struct {
Files []UploadedFileInfo `json:"files"`
}
UploadImagesResponse represents the response for image upload