Documentation
¶
Index ¶
- Variables
- func RegisterModRoutes(router *echo.Group)
- func RegisterModsRoutes(router *echo.Group)
- func RegisterOAuthRoutes(router *echo.Group)
- func RegisterSMLRoutes(router *echo.Group)
- func RegisterUserRoutes(router *echo.Group)
- func RegisterUsersRoutes(router *echo.Group)
- func RegisterVersionRoutes(router *echo.Group)
- type AuthorizedDataFunction
- type DataFunction
- type ErrorResponse
- type GenericResponse
- type Mod
- type ModUser
- type PublicUser
- type SMLVersion
- type User
- type UserMod
- type UserSession
- type Version
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorInvalidAuthorizationToken = ErrorResponse{Code: 100, Message: "invalid authorization token", Status: 403} ErrorUserNotAuthorized = ErrorResponse{Code: 101, Message: "you are not authorized to perform this action", Status: 403} ErrorInvalidOAuthCode = ErrorResponse{Code: 102, Message: "invalid oauth code", Status: 400} ErrorUserNotFound = ErrorResponse{Code: 103, Message: "user not found", Status: 404} ErrorUserBanned = ErrorResponse{Code: 104, Message: "user banned", Status: 403} ErrorModNotFound = ErrorResponse{Code: 200, Message: "mod not found", Status: 404} ErrorFailedModUpload = ErrorResponse{Code: 201, Message: "failed to upload mod", Status: 500} ErrorVersionNotFound = ErrorResponse{Code: 300, Message: "version not found", Status: 404} )
Functions ¶
func RegisterModRoutes ¶
func RegisterModsRoutes ¶
func RegisterOAuthRoutes ¶
func RegisterSMLRoutes ¶
func RegisterUserRoutes ¶
func RegisterUsersRoutes ¶
func RegisterVersionRoutes ¶
Types ¶
type AuthorizedDataFunction ¶
type AuthorizedDataFunction func(user *postgres.User, c echo.Context) (data interface{}, err *ErrorResponse)
type DataFunction ¶
type DataFunction func(c echo.Context) (data interface{}, err *ErrorResponse)
type ErrorResponse ¶
type ErrorResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Status int `json:"-"`
}
func GenericUserError ¶
func GenericUserError(err error) *ErrorResponse
type GenericResponse ¶
type GenericResponse struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
Error interface{} `json:"error,omitempty"`
}
type Mod ¶
type Mod struct {
ID string `json:"id"`
Name string `json:"name"`
ShortDescription string `json:"short_description"`
FullDescription string `json:"full_description"`
Logo string `json:"logo"`
SourceURL string `json:"source_url"`
CreatorID string `json:"creator_id"`
Approved bool `json:"approved"`
Views uint `json:"views"`
Downloads uint `json:"downloads"`
Hotness uint `json:"hotness"`
Popularity uint `json:"popularity"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
}
type ModUser ¶
func ModUserToModUser ¶
type PublicUser ¶
type PublicUser struct {
ID string `json:"id"`
Username string `json:"username"`
Avatar string `json:"avatar"`
CreatedAt time.Time `json:"created_at"`
}
func UserToPublicUser ¶
func UserToPublicUser(user *postgres.User) *PublicUser
type SMLVersion ¶
type SMLVersion struct {
ID string `json:"id"`
Version string `json:"version"`
SatisfactoryVersion int `json:"satisfactory_version"`
BootstrapVersion *string `json:"bootstrap_version"`
Stability string `json:"stability"`
Date time.Time `json:"date"`
Link string `json:"link"`
Changelog string `json:"changelog"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
}
func SMLVersionToSMLVersion ¶
func SMLVersionToSMLVersion(version *postgres.SMLVersion) *SMLVersion
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Username string `json:"username"`
Avatar string `json:"avatar"`
CreatedAt time.Time `json:"created_at"`
}
func UserToPrivateUser ¶
type UserMod ¶
func UserModToUserMod ¶
type UserSession ¶
type UserSession struct {
Token string `json:"token"`
}
func SessionToSession ¶
func SessionToSession(session *postgres.UserSession) *UserSession
type Version ¶
type Version struct {
ID string `json:"id"`
Version string `json:"version"`
SMLVersion string `json:"sml_version"`
Changelog string `json:"changelog"`
Downloads uint `json:"downloads"`
Stability string `json:"stability"`
ModID string `json:"mod_id"`
Approved bool `json:"approved"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
}
func VersionToVersion ¶
Click to show internal directories.
Click to hide internal directories.