Documentation ¶
Index ¶
- type MessageAPI
- func (a *MessageAPI) CreateMessage(ctx *gin.Context)
- func (a *MessageAPI) DeleteMessage(ctx *gin.Context)
- func (a *MessageAPI) DeleteMessageWithApplication(ctx *gin.Context)
- func (a *MessageAPI) DeleteMessages(ctx *gin.Context)
- func (a *MessageAPI) GetMessages(ctx *gin.Context)
- func (a *MessageAPI) GetMessagesWithApplication(ctx *gin.Context)
- type MessageDatabase
- type Notifier
- type TokenAPI
- func (a *TokenAPI) CreateApplication(ctx *gin.Context)
- func (a *TokenAPI) CreateClient(ctx *gin.Context)
- func (a *TokenAPI) DeleteApplication(ctx *gin.Context)
- func (a *TokenAPI) DeleteClient(ctx *gin.Context)
- func (a *TokenAPI) GetApplications(ctx *gin.Context)
- func (a *TokenAPI) GetClients(ctx *gin.Context)
- type TokenDatabase
- type UserAPI
- func (a *UserAPI) ChangePassword(ctx *gin.Context)
- func (a *UserAPI) CreateUser(ctx *gin.Context)
- func (a *UserAPI) DeleteUserByID(ctx *gin.Context)
- func (a *UserAPI) GetCurrentUser(ctx *gin.Context)
- func (a *UserAPI) GetUserByID(ctx *gin.Context)
- func (a *UserAPI) GetUsers(ctx *gin.Context)
- func (a *UserAPI) UpdateUserByID(ctx *gin.Context)
- type UserDatabase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageAPI ¶
type MessageAPI struct { DB MessageDatabase Notifier Notifier }
The MessageAPI provides handlers for managing messages.
func (*MessageAPI) CreateMessage ¶
func (a *MessageAPI) CreateMessage(ctx *gin.Context)
CreateMessage creates a message, authentication via application-token is required.
func (*MessageAPI) DeleteMessage ¶
func (a *MessageAPI) DeleteMessage(ctx *gin.Context)
DeleteMessage deletes a message with an id.
func (*MessageAPI) DeleteMessageWithApplication ¶
func (a *MessageAPI) DeleteMessageWithApplication(ctx *gin.Context)
DeleteMessageWithApplication deletes all messages from a specific application.
func (*MessageAPI) DeleteMessages ¶
func (a *MessageAPI) DeleteMessages(ctx *gin.Context)
DeleteMessages delete all messages from a user.
func (*MessageAPI) GetMessages ¶
func (a *MessageAPI) GetMessages(ctx *gin.Context)
GetMessages returns all messages from a user.
func (*MessageAPI) GetMessagesWithApplication ¶
func (a *MessageAPI) GetMessagesWithApplication(ctx *gin.Context)
GetMessagesWithApplication returns all messages from a specific application.
type MessageDatabase ¶
type MessageDatabase interface { GetMessagesByApplication(id uint) []*model.Message GetApplicationByID(id uint) *model.Application GetMessagesByUser(userID uint) []*model.Message DeleteMessageByID(id uint) error GetMessageByID(id uint) *model.Message DeleteMessagesByUser(userID uint) error DeleteMessagesByApplication(applicationID uint) error CreateMessage(message *model.Message) error GetApplicationByToken(token string) *model.Application }
The MessageDatabase interface for encapsulating database access.
type TokenAPI ¶
type TokenAPI struct {
DB TokenDatabase
}
The TokenAPI provides handlers for managing clients and applications.
func (*TokenAPI) CreateApplication ¶
CreateApplication creates an application and returns the access token.
func (*TokenAPI) CreateClient ¶
CreateClient creates a client and returns the access token.
func (*TokenAPI) DeleteApplication ¶
DeleteApplication deletes an application by its id.
func (*TokenAPI) DeleteClient ¶
DeleteClient deletes a client by its id.
func (*TokenAPI) GetApplications ¶
GetApplications returns all applications a user has.
func (*TokenAPI) GetClients ¶
GetClients returns all clients a user has.
type TokenDatabase ¶
type TokenDatabase interface { CreateApplication(application *model.Application) error GetApplicationByToken(token string) *model.Application GetApplicationByID(id uint) *model.Application GetApplicationsByUser(userID uint) []*model.Application DeleteApplicationByID(id uint) error CreateClient(client *model.Client) error GetClientByToken(token string) *model.Client GetClientByID(id uint) *model.Client GetClientsByUser(userID uint) []*model.Client DeleteClientByID(id uint) error }
The TokenDatabase interface for encapsulating database access.
type UserAPI ¶
type UserAPI struct { DB UserDatabase PasswordStrength int }
The UserAPI provides handlers for managing users.
func (*UserAPI) ChangePassword ¶
ChangePassword changes the password from the current user
func (*UserAPI) CreateUser ¶
CreateUser creates a user
func (*UserAPI) DeleteUserByID ¶
DeleteUserByID deletes the user by id
func (*UserAPI) GetCurrentUser ¶
GetCurrentUser returns the current user
func (*UserAPI) GetUserByID ¶
GetUserByID returns the user by id
func (*UserAPI) UpdateUserByID ¶
UpdateUserByID updates and user by id
type UserDatabase ¶
type UserDatabase interface { GetUsers() []*model.User GetUserByID(id uint) *model.User GetUserByName(name string) *model.User DeleteUserByID(id uint) error UpdateUser(user *model.User) CreateUser(user *model.User) error }
The UserDatabase interface for encapsulating database access.