add sessions interface

This commit is contained in:
cyber-dream 2022-11-12 02:56:43 +03:00
parent bf4b92b296
commit e8adbe4653
2 changed files with 20 additions and 4 deletions

View File

@ -20,5 +20,8 @@ type JSSessionInterface struct {
GameID string `json:"gameId"` GameID string `json:"gameId"`
SessionId string `json:"sessionId"` SessionId string `json:"sessionId"`
Expires time.Time `json:"expires"` Expires time.Time `json:"expires"`
Assets GameInterfaceAssets `json:"assets"` Title string `json:"title"`
Icon string `json:"icon"`
Description string `json:"description"`
Backgrounds []string `json:"backgrounds"`
} }

View File

@ -26,6 +26,19 @@ func FindSessionByID(sessionId string, sessions []Session) Session {
} }
} }
func GetJSSessionInterface(s Session) JSSessionInterface {
newInterface := JSSessionInterface{ //TODO: If session icon empty - use game icon
GameID: s.GameId,
SessionId: s.SessionId,
Expires: time.Time{},
Title: s.Assets.Title,
Icon: s.Assets.Icon,
Description: s.Assets.Description,
Backgrounds: []string{}, //TODO: Complete
}
return newInterface
}
var FakeSessions = Sessions{ //TODO: Move to front var FakeSessions = Sessions{ //TODO: Move to front
Sessions: []Session{ Sessions: []Session{
{ {