mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-18 13:03:01 +00:00
27 lines
535 B
Go
27 lines
535 B
Go
package model
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
ErrSessionNotFound = errors.New("session not found")
|
|
)
|
|
|
|
type Session struct {
|
|
ID string `json:"id"`
|
|
InstanceDomain string `json:"instance_domain"`
|
|
AccessToken string `json:"access_token"`
|
|
CSRFToken string `json:"csrf_token"`
|
|
Settings Settings `json:"settings"`
|
|
}
|
|
|
|
type SessionRepo interface {
|
|
Add(session Session) (err error)
|
|
Get(sessionID string) (session Session, err error)
|
|
}
|
|
|
|
func (s Session) IsLoggedIn() bool {
|
|
return len(s.AccessToken) > 0
|
|
}
|