aboutsummaryrefslogtreecommitdiff
path: root/model/session.go
blob: 43628ee2c2776b5b0254883008d624a0c4f9bb90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package model

import "errors"

var (
	ErrSessionNotFound = errors.New("session not found")
)

type Session struct {
	ID          string
	InstanceURL string
	AccessToken string
}

type SessionRepository interface {
	Add(session Session) (err error)
	Update(sessionID string, accessToken string) (err error)
	Get(sessionID string) (session Session, err error)
}

func (s Session) IsLoggedIn() bool {
	return len(s.AccessToken) > 0
}