Documentation ¶
Index ¶
- type Application
- func (a Application) AddImage(ctx context.Context, w http.ResponseWriter, r *http.Request, ownerUuid string)
- func (a Application) AuthenticateKey(ctx context.Context, w http.ResponseWriter, r *http.Request) bool
- func (a Application) DeleteAccount(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) DeleteImage(ctx context.Context, w http.ResponseWriter, r *http.Request, ownerUuid string)
- func (a Application) DeleteKey(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) FindImage(ctx context.Context, w http.ResponseWriter, r *http.Request, query string, ...)
- func (a Application) FindImages(ctx context.Context, w http.ResponseWriter, r *http.Request, query []string, ...)
- func (a Application) FindOwner(ctx context.Context, w http.ResponseWriter, r *http.Request) (string, error)
- func (a Application) GetLeaderboard(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) MatchResult(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) Refresh(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) RequestMatch(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) ShowKey(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) Signin(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) Signout(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) Signup(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (a Application) UpdateImage(ctx context.Context, w http.ResponseWriter, r *http.Request, ownerUuid string)
- func (a Application) UpdateKey(ctx context.Context, w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApplication ¶
func NewApplication(dbImage ports.DbImagePort, dbAccAuth ports.DbAccAuthPort, dbKeyAuth ports.DbKeyAuthPort, dbElo ports.DbEloSystemPort, session ports.SessionPort, cdn ports.CdnPort) *Application
Constructor
func (Application) AddImage ¶
func (a Application) AddImage(ctx context.Context, w http.ResponseWriter, r *http.Request, ownerUuid string)
Adds a single image CDN and the image meta data to database. Simple verification and image convertion is done aswell.
func (Application) AuthenticateKey ¶
func (a Application) AuthenticateKey(ctx context.Context, w http.ResponseWriter, r *http.Request) bool
Uses the appended key query parameter and checks if the key exist in the caching layer or database.
func (Application) DeleteAccount ¶
func (a Application) DeleteAccount(ctx context.Context, w http.ResponseWriter, r *http.Request)
Take the session token from the cookie and use that
func (Application) DeleteImage ¶
func (a Application) DeleteImage(ctx context.Context, w http.ResponseWriter, r *http.Request, ownerUuid string)
Deletes an image from the CDN and database.
func (Application) DeleteKey ¶
func (a Application) DeleteKey(ctx context.Context, w http.ResponseWriter, r *http.Request)
Uses the session token for verification and sets the users key field to empty string.
func (Application) FindImage ¶
func (a Application) FindImage(ctx context.Context, w http.ResponseWriter, r *http.Request, query string, querytype string)
Returns a single image based on query parameters from the database.
func (Application) FindImages ¶
func (a Application) FindImages(ctx context.Context, w http.ResponseWriter, r *http.Request, query []string, querytype string, quantity int)
Returns multiple images based on query parameters from the database.
func (Application) FindOwner ¶
func (a Application) FindOwner(ctx context.Context, w http.ResponseWriter, r *http.Request) (string, error)
returns the user uuid of the API key. Used for image uploading and updating/deletion.
func (Application) GetLeaderboard ¶
func (a Application) GetLeaderboard(ctx context.Context, w http.ResponseWriter, r *http.Request)
func (Application) MatchResult ¶
func (a Application) MatchResult(ctx context.Context, w http.ResponseWriter, r *http.Request)
func (Application) Refresh ¶
func (a Application) Refresh(ctx context.Context, w http.ResponseWriter, r *http.Request)
func (Application) RequestMatch ¶
func (a Application) RequestMatch(ctx context.Context, w http.ResponseWriter, r *http.Request)
func (Application) ShowKey ¶
func (a Application) ShowKey(ctx context.Context, w http.ResponseWriter, r *http.Request)
Returns the API key for the user.
func (Application) Signin ¶
func (a Application) Signin(ctx context.Context, w http.ResponseWriter, r *http.Request)
func (Application) Signout ¶
func (a Application) Signout(ctx context.Context, w http.ResponseWriter, r *http.Request)
func (Application) Signup ¶
func (a Application) Signup(ctx context.Context, w http.ResponseWriter, r *http.Request)
Generates a new key on signup
func (Application) UpdateImage ¶
func (a Application) UpdateImage(ctx context.Context, w http.ResponseWriter, r *http.Request, ownerUuid string)
Updates image metadata in the CDN and database. Simple verification is done aswell.
func (Application) UpdateKey ¶
func (a Application) UpdateKey(ctx context.Context, w http.ResponseWriter, r *http.Request)
Keys are autogenerated upon acc creation. The session token is used for verification to generate a fresh key.