Documentation
¶
Index ¶
- func ShiftPath(p string) (head, tail string)
- type APIRouter
- type AppRouter
- type AuthRouter
- type CharacterCreateResponseData
- type CharacterGetAllResponseData
- type CharacterRouter
- type CharacterUpdateResponseData
- type ForgotPasswordRequestData
- type LoginRequestData
- type LoginResponseData
- type LogoutRequestData
- type LogoutResponseData
- type MatchCreateResponseData
- type MatchGetAllResponseData
- type MatchRouter
- type MatchUpdateResponseData
- type RefreshRequestData
- type RefreshResponseData
- type RegisterRequestData
- type RegisterResponseData
- type ResetPasswordRequestData
- type Response
- type Services
- type StaticRouter
- type TagCreateResponseData
- type TagGetAllResponseData
- type TagRouter
- type TagUpdateResponseData
- type UserCharacterCreateResponseData
- type UserCharacterDeleteResponseData
- type UserCharacterRouter
- type UserCharacterUpdateResponseData
- type UserGetAllResponseData
- type UserGetResponseData
- type UserRouter
- type UserUpdateDefaultUserCharacterResponseData
- type UserUpdateResponseData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIRouter ¶
type APIRouter struct { Services *Services AuthRouter *AuthRouter MatchRouter *MatchRouter UserRouter *UserRouter CharacterRouter *CharacterRouter TagRouter *TagRouter }
APIRouter is responsible for serving "/api" or delegating to the appropriate sub api-router
func NewAPIRouter ¶
NewAPIRouter makes a new api router and sets up its children routers with access to our router services
type AppRouter ¶
type AppRouter struct { Services *Services APIRouter *APIRouter StaticRouter *StaticRouter }
AppRouter is the router responsible for serving "/" or delegating to the appropriate sub router
type AuthRouter ¶
type AuthRouter struct {
Services *Services
}
AuthRouter handles all of the authentication related routes
func NewAuthRouter ¶
func NewAuthRouter(routerServices *Services) *AuthRouter
NewAuthRouter makes a new api/auth router and hooks up its services
func (*AuthRouter) ServeHTTP ¶
func (r *AuthRouter) ServeHTTP(res http.ResponseWriter, req *http.Request)
type CharacterCreateResponseData ¶
CharacterCreateResponseData is the data we send back after a successfully creating a new character
type CharacterGetAllResponseData ¶
CharacterGetAllResponseData is the data we send back after a successfully getting all character data
type CharacterRouter ¶
type CharacterRouter struct {
Services *Services
}
CharacterRouter is responsible for serving "/api/character" Basically, connecting to our Postgres DB for all of the CRUD operations for our "Character" models
func NewCharacterRouter ¶
func NewCharacterRouter(routerServices *Services) *CharacterRouter
NewCharacterRouter makes a new api/character router and hooks up its services
func (*CharacterRouter) ServeHTTP ¶
func (r *CharacterRouter) ServeHTTP(res http.ResponseWriter, req *http.Request)
type CharacterUpdateResponseData ¶
CharacterUpdateResponseData is the data we send back after a successfully udpating a new character
type ForgotPasswordRequestData ¶
type ForgotPasswordRequestData struct {
UserEmail string `json:"userEmail"`
}
ForgotPasswordRequestData describes the data we're expecting when a user requests to send an email to reset their password
type LoginRequestData ¶
type LoginRequestData struct { EmailAddress string `json:"emailAddress"` Password string `json:"password"` }
LoginRequestData describes the data we're expecting when a user attempts to log in
type LoginResponseData ¶
type LoginResponseData struct { User *db.UserProfileView `json:"user"` UserCharacters []*db.UserCharacterView `json:"userCharacters"` AccessExpiration time.Time `json:"accessExpiration"` RefreshExpiration time.Time `json:"refreshExpiration"` }
LoginResponseData is the data we send back after a successful log in
type LogoutRequestData ¶
type LogoutRequestData struct {
UserID int64 `json:"userId"`
}
LogoutRequestData describes the data we're expecting when a user attempts to log out
type LogoutResponseData ¶
type LogoutResponseData struct {
UserID int64 `json:"userId"`
}
LogoutResponseData is the data we send back after a successful log out
type MatchCreateResponseData ¶
MatchCreateResponseData is the data we send back after a successfully creating a new match
type MatchGetAllResponseData ¶
MatchGetAllResponseData is the data we send back after a successfully get info for all matches in our db
type MatchRouter ¶
type MatchRouter struct {
Services *Services
}
MatchRouter is responsible for serving "/api/matches" Basically, connecting to our Postgres DB for all of the CRUD operations for our "Match" models
func NewMatchRouter ¶
func NewMatchRouter(routerServices *Services) *MatchRouter
NewMatchRouter makes a new api/match router and hooks up its services
func (*MatchRouter) ServeHTTP ¶
func (r *MatchRouter) ServeHTTP(res http.ResponseWriter, req *http.Request)
type MatchUpdateResponseData ¶
MatchUpdateResponseData is the data we send back after successfully updating a match
type RefreshRequestData ¶
type RefreshRequestData struct {
UserID int64 `json:"userId"`
}
RefreshRequestData describes the data we're expecting when a user attempts refresh their access token
type RefreshResponseData ¶
RefreshResponseData is the data we send back after a successful refresh
type RegisterRequestData ¶
type RegisterRequestData struct { UserName string `json:"userName"` EmailAddress string `json:"emailAddress"` Password string `json:"password"` }
RegisterRequestData describes the data we're expecting when a user attempts register
type RegisterResponseData ¶
type RegisterResponseData struct {
UserID int64 `json:"userId"`
}
RegisterResponseData is the data we send back after a successful register
type ResetPasswordRequestData ¶
type ResetPasswordRequestData struct { Token string `json:"token"` NewPassword string `json:"newPassword"` }
ResetPasswordRequestData describes the data we're expecting when a user requests to reset their password
type Response ¶
type Response struct { Success bool `json:"success"` Error error `json:"error"` Data interface{} `json:"data"` }
Response is the data
type Services ¶
type Services struct { Database db.DatabaseManager Auth auth.Authenticator Email email.Emailer }
Services describes what services are available to all routes in our application
func NewRouterServices ¶
func NewRouterServices() *Services
NewRouterServices initializes all of the services available to our routers
type StaticRouter ¶
type StaticRouter struct{}
StaticRouter is responsible for serving "/static"
func NewStaticRouter ¶
func NewStaticRouter() *StaticRouter
NewStaticRouter makes a new api/user router for serving our static assets
func (*StaticRouter) ServeHTTP ¶
func (r *StaticRouter) ServeHTTP(res http.ResponseWriter, req *http.Request)
type TagCreateResponseData ¶
TagCreateResponseData describes the data we send back after successfully creating a new tag
type TagGetAllResponseData ¶
TagGetAllResponseData is the data we send back after a successfully getiing all tags in our db
type TagRouter ¶
type TagRouter struct {
Services *Services
}
TagRouter is responsible for serving /api/tag
func NewTagRouter ¶
NewTagRouter makes a new api/tag router and hooks up its services
type TagUpdateResponseData ¶
TagUpdateResponseData describes the data we send back after successfully updating an existing tag
type UserCharacterCreateResponseData ¶
type UserCharacterCreateResponseData struct { UserCharacters []*db.UserCharacterView `json:"userCharacters"` User *db.UserProfileView `json:"user"` }
UserCharacterCreateResponseData is the data we send back after a successfully creating a new "saved character" for a given user
type UserCharacterDeleteResponseData ¶
type UserCharacterDeleteResponseData struct { UserCharacters []*db.UserCharacterView `json:"userCharacters"` User *db.UserProfileView `json:"user"` }
UserCharacterDeleteResponseData is the data we send back after a successfully deleting a "saved character" for a given user
type UserCharacterRouter ¶
type UserCharacterRouter struct {
Services *Services
}
UserCharacterRouter handles all of /api/user/character
func NewUserCharacterRouter ¶
func NewUserCharacterRouter(routerServices *Services) *UserCharacterRouter
NewUserCharacterRouter makes a new api/user/character router and hooks up its services
func (*UserCharacterRouter) ServeHTTP ¶
func (r *UserCharacterRouter) ServeHTTP(res http.ResponseWriter, req *http.Request)
type UserCharacterUpdateResponseData ¶
type UserCharacterUpdateResponseData struct { UserCharacters []*db.UserCharacterView `json:"userCharacters"` User *db.UserProfileView `json:"user"` }
UserCharacterUpdateResponseData is the data we send back after a successfully creating a new "saved character" for a given user
type UserGetAllResponseData ¶
type UserGetResponseData ¶
type UserGetResponseData struct { User *db.UserProfileView `json:"user"` UserCharacters []*db.UserCharacterView `json:"userCharacters"` }
UserGetResponseData is the data we send back after a successfully getting all user's info
type UserRouter ¶
type UserRouter struct { Services *Services UserCharacterRouter *UserCharacterRouter }
UserRouter is responsible for serving "/api/user" Basically, connecting to our Postgres DB for all of the CRUD operations for our "User" models
func NewUserRouter ¶
func NewUserRouter(routerServices *Services) *UserRouter
NewUserRouter makes a new api/user router and hooks up its services
func (*UserRouter) ServeHTTP ¶
func (r *UserRouter) ServeHTTP(res http.ResponseWriter, req *http.Request)
type UserUpdateDefaultUserCharacterResponseData ¶
type UserUpdateDefaultUserCharacterResponseData struct { User *db.UserProfileView `json:"user"` UserCharacters []*db.UserCharacterView `json:"userCharacters"` }
UserUpdateDefaultUserCharacterResponseData is the data we send back after successfully updating a user's default user character
type UserUpdateResponseData ¶
type UserUpdateResponseData struct { User *db.UserProfileView `json:"user"` UserCharacters []*db.UserCharacterView `json:"userCharacters"` }
UserUpdateResponseData is the data we send back after a successfully creating a new user