Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAliasAlreadyExist = echo.NewHTTPError(409, "alias already exist")
ErrAliasAlreadyExist is returned when user already own the wanted alias
var ErrAliasNotFound = echo.NewHTTPError(404, "alias not found")
ErrAliasNotFound is returned when the wanted alias cannot be found
var ErrAliasTaken = echo.NewHTTPError(409, "alias already taken")
ErrAliasTaken is returned when the wanted alias is already taken by someone else
var ErrDomainNotFound = echo.NewHTTPError(404, "requested domain not found")
ErrDomainNotFound is returned when the alias to register use non supported / not existing domain
var ErrInvalidParameters = echo.NewHTTPError(400, "invalid request parameter(s)")
ErrInvalidParameters is returned when the given request is invalid
Functions ¶
This section is empty.
Types ¶
type APIContract ¶
type APIContract interface { // Authenticate user using given credential // this either return the JWT token or an error if something goes wrong // POST /sessions Authenticate(cred CredentialsDto) (TokenDto, error) // GetAliases return user current aliases // GET /aliases GetAliases(token TokenDto) ([]AliasDto, error) // RegisterAlias register a new alias for the user // POST /aliases RegisterAlias(token TokenDto, alias AliasDto) (AliasDto, error) // UpdateAlias update the user existing alias // PUT /aliases/{name} UpdateAlias(token TokenDto, alias AliasDto) (AliasDto, error) // DeleteAlias delete the user given alias // DELETE /aliases/{name} DeleteAlias(token TokenDto, name string) error // GetDomains return the list of available / supported domains // for alias creation // GET /domains GetDomains(token TokenDto) ([]DomainDto, error) }
APIContract defined the API served by the Daemon
type CredentialsDto ¶
CredentialsDto represent the credentials when issuing a authentication request
type DomainDto ¶
type DomainDto struct {
Domain string `json:"domain"`
}
DomainDto represent a domain usable to create alias on the Daemon
type ErrorDto ¶
type ErrorDto struct {
Message string `json:"message"`
}
ErrorDto is the generic error response in case of API error TODO make my own error mapper
type TokenDto ¶
type TokenDto struct {
Token string `json:"token"`
}
TokenDto represent the object that encapsulate the JWT token when issuing a authentication request
type UserContext ¶
type UserContext struct {
UserID uint
}
UserContext represent the JWT token payload and identify the logged in user in secured endpoints