2019-07-19 07:39:53 +00:00
|
|
|
package internal
|
2019-07-18 14:10:43 +00:00
|
|
|
|
2019-07-19 15:52:03 +00:00
|
|
|
import (
|
|
|
|
"github.com/nxshock/signaller/internal/models"
|
2019-07-21 09:43:14 +00:00
|
|
|
"github.com/nxshock/signaller/internal/models/createroom"
|
|
|
|
"github.com/nxshock/signaller/internal/models/rooms"
|
2019-07-19 15:52:03 +00:00
|
|
|
"github.com/nxshock/signaller/internal/models/sync"
|
|
|
|
)
|
2019-07-18 14:10:43 +00:00
|
|
|
|
|
|
|
type Backend interface {
|
2019-07-21 09:43:14 +00:00
|
|
|
Register(username, password, device string) (user User, token string, err *models.ApiError)
|
2019-07-18 15:15:19 +00:00
|
|
|
Login(username, password, device string) (token string, err *models.ApiError)
|
|
|
|
Logout(token string) *models.ApiError
|
2019-07-21 09:43:14 +00:00
|
|
|
CreateRoom(user User, request createroom.Request) (Room, *models.ApiError)
|
2019-07-19 15:52:03 +00:00
|
|
|
Sync(token string, request sync.SyncRequest) (response *sync.SyncReply, err *models.ApiError)
|
2019-07-18 14:10:43 +00:00
|
|
|
}
|
2019-07-21 09:43:14 +00:00
|
|
|
|
|
|
|
type Room interface {
|
|
|
|
ID() string
|
|
|
|
Creator() User
|
|
|
|
Users() User
|
|
|
|
AliasName() string
|
|
|
|
Name() string
|
|
|
|
Topic() string
|
2019-07-21 11:04:24 +00:00
|
|
|
SetTopic(user User, topic string) *models.ApiError
|
2019-07-21 09:43:14 +00:00
|
|
|
Events() []rooms.Event
|
|
|
|
}
|
|
|
|
|
|
|
|
type User interface {
|
|
|
|
Name() string
|
|
|
|
ID() string
|
|
|
|
Password() string
|
|
|
|
}
|