Initial commit

This commit is contained in:
r 2019-12-13 18:08:26 +00:00
commit 5e4da01c3a
43 changed files with 3429 additions and 0 deletions

19
model/app.go Normal file
View file

@ -0,0 +1,19 @@
package model
import "errors"
var (
ErrAppNotFound = errors.New("app not found")
)
type App struct {
InstanceURL string
ClientID string
ClientSecret string
}
type AppRepository interface {
Add(app App) (err error)
Update(instanceURL string, clientID string, clientSecret string) (err error)
Get(instanceURL string) (app App, err error)
}

23
model/session.go Normal file
View file

@ -0,0 +1,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
}