Initial types and interfaces

This commit is contained in:
Layla 2020-12-25 21:22:45 -05:00
parent 80bce1ef8d
commit 12099a2847
No known key found for this signature in database
GPG Key ID: A494D9357BA1BE31
7 changed files with 47 additions and 1 deletions

View File

@ -1 +1 @@
# OpenSkins-PluginInterface # OpenSkins-Common

9
datastore/skinstore.go Normal file
View File

@ -0,0 +1,9 @@
package datastore
import "github.com/josephbmanley/OpenSkins-Common/datatypes"
type Skinstore interface {
Initialize() error
GetSkin(string) (datatypes.Skin, error)
AddSkin(string, []byte) error
}

9
datastore/userstore.go Normal file
View File

@ -0,0 +1,9 @@
package datastore
import "github.com/josephbmanley/OpenSkins-Common/datatypes"
type Userstore interface {
Initialize() error
GetUser(uid string) (datatypes.User, error)
SetUser(datatypes.User) error
}

7
datatypes/character.go Normal file
View File

@ -0,0 +1,7 @@
package datatypes
// Character represents something that can be skinned
type Character struct {
Name string `json:"name"`
Skin Skin `json:"skin"`
}

11
datatypes/skin.go Normal file
View File

@ -0,0 +1,11 @@
package datatypes
// Skin struct holds the
type Skin struct {
Name string `json:"name"`
Location string `json:"location"`
Metadata map[string]string `json:"metadata"`
}
// Skins are an array of Skin
type Skins []Skin

7
datatypes/user.go Normal file
View File

@ -0,0 +1,7 @@
package datatypes
// User is an object representing a user
type User struct {
UID string `json:"uid"`
OwnedSkins Skins `json:"skins"`
}

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module github.com/josephbmanley/OpenSkins-Common
go 1.13