104 lines
2.1 KiB
Go
104 lines
2.1 KiB
Go
package skirdasession
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
type SkirdaSession interface {
|
|
GetSessionId() string
|
|
GetGameId() string
|
|
GetUIAssets() SessionUIAssets
|
|
GetGameType() string
|
|
GetSessionData() string
|
|
}
|
|
|
|
// type SkirdaSession struct {
|
|
// SkirdaSessionId string
|
|
// SkirdaGameId string
|
|
// Assets SessionUIAssets
|
|
// }
|
|
|
|
type SkirdaSessions []SkirdaSession
|
|
|
|
type SessionUIAssets struct {
|
|
// GameID string `json:"gameId"`
|
|
Title string `json:"title"`
|
|
Icon string `json:"icon"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
func (sessions SkirdaSessions) FindSessionById(sessionId string) (SkirdaSession, error) {
|
|
for _, session := range sessions {
|
|
if session.GetSessionId() == sessionId {
|
|
return session, nil
|
|
}
|
|
}
|
|
return nil, errors.New("no any sessions founded")
|
|
}
|
|
|
|
func (sessions SkirdaSessions) AddSessions(newSessions []SkirdaSession) {
|
|
sessions = append(sessions, newSessions...)
|
|
}
|
|
|
|
type MinecraftSession struct {
|
|
SkirdaSessionId string
|
|
SkirdaGameId string
|
|
Assets SessionUIAssets
|
|
Version string
|
|
}
|
|
|
|
func (session MinecraftSession) GetSessionId() string {
|
|
return session.SkirdaSessionId
|
|
}
|
|
|
|
func (session MinecraftSession) GetUIAssets() SessionUIAssets {
|
|
return session.Assets
|
|
}
|
|
|
|
func (session MinecraftSession) GetGameId() string {
|
|
return session.SkirdaGameId
|
|
}
|
|
|
|
func (session MinecraftSession) GetMinecraftVersion() string {
|
|
return session.SkirdaGameId
|
|
}
|
|
|
|
func (session MinecraftSession) GetGameType() string {
|
|
return "minecraft"
|
|
}
|
|
|
|
func (session MinecraftSession) GetSessionData() string {
|
|
return session.Version
|
|
}
|
|
|
|
type SteamSession struct {
|
|
SkirdaSessionId string
|
|
SkirdaGameId string
|
|
Assets SessionUIAssets
|
|
// Data SteamSessionData
|
|
}
|
|
|
|
type SteamSessionData struct {
|
|
kke string
|
|
}
|
|
|
|
func (session SteamSession) GetSessionId() string {
|
|
return session.SkirdaSessionId
|
|
}
|
|
|
|
func (session SteamSession) GetUIAssets() SessionUIAssets {
|
|
return session.Assets
|
|
}
|
|
|
|
func (session SteamSession) GetGameId() string {
|
|
return session.SkirdaGameId
|
|
}
|
|
|
|
func (session SteamSession) GetGameType() string {
|
|
return "steam"
|
|
}
|
|
|
|
func (session SteamSession) GetSessionData() string {
|
|
return ""
|
|
}
|