api

package
v0.0.0-...-1f70e13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	// contains filtered or unexported fields
}

Api contains everything required to run the API section of the server.

func NewApi

func NewApi(db database.Db, client discord.Client, hostName, protocol string) Api

NewApi creates a new Api.

func (Api) DeleteChannel

func (a Api) DeleteChannel(c *gin.Context)

DeleteChannel deletes ("unsubscribes") a channel from the database.

func (Api) GuildListMiddleware

func (a Api) GuildListMiddleware() gin.HandlerFunc

GuildListMiddleware gets a GuildList using the clients session.

func (Api) HandleDiscordLogin

func (a Api) HandleDiscordLogin(c *gin.Context)

HandleDiscordLogin is the endpoint handler for when a user authenticates using Discords OAuth flow.

func (Api) HandleDiscordLogout

func (a Api) HandleDiscordLogout(c *gin.Context)

HandleDiscordLogout is for when a user wants to invalidate their session that contains Discord OAuth info.

func (Api) SessionMiddleware

func (a Api) SessionMiddleware() gin.HandlerFunc

SessionMiddleware checks for and passes along a decrypted users session as a database.SessionRecord.

func (Api) Stats

func (a Api) Stats(c *gin.Context)

Stats is the endpoint handler for statistics derived from collected metrics.

func (Api) SubscribedChannels

func (a Api) SubscribedChannels(c *gin.Context)

SubscribedChannels returns a list of information about guilds user is authed in that are subscribed to the notification service.

func (Api) UpdateChannel

func (a Api) UpdateChannel(c *gin.Context)

UpdateChannel updates information about a channel in the database.

func (Api) UserInfo

func (a Api) UserInfo(c *gin.Context)

UserInfo is the endpoint for getting the users username and avatar URL.

func (Api) VerifySession

func (a Api) VerifySession(c *gin.Context)

VerifySession allows the frontend to determine if the user has an active and valid session or not.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL