108 lines
2.4 KiB
Plaintext
108 lines
2.4 KiB
Plaintext
package lishwist // import "lishwist/core"
|
|
|
|
|
|
VARIABLES
|
|
|
|
var ErrorUsernameTaken = errors.New("Username is taken")
|
|
|
|
FUNCTIONS
|
|
|
|
func Init(dataSourceName string) error
|
|
func PrintTables(d *sql.DB)
|
|
func PrintViews(d *sql.DB)
|
|
|
|
TYPES
|
|
|
|
type Admin struct {
|
|
// Has unexported fields.
|
|
}
|
|
|
|
func (a *Admin) AddUserToGroup(userId, groupId string) error
|
|
|
|
func (a *Admin) CreateGroup(name string, reference string) (*Group, error)
|
|
|
|
func (*Admin) GetUser(id string) (*User, error)
|
|
|
|
func (a *Admin) ListGroups() ([]Group, error)
|
|
|
|
func (*Admin) ListUsers() ([]User, error)
|
|
|
|
func (a *Admin) RemoveUserFromGroup(userId, groupId string) error
|
|
|
|
func (u *Admin) UserSetLive(userReference string, setting bool) error
|
|
|
|
type ErrorInvalidCredentials error
|
|
|
|
type Group struct {
|
|
Id string
|
|
Name string
|
|
Reference string
|
|
Members []User
|
|
}
|
|
|
|
func GetGroupByReference(reference string) (*Group, error)
|
|
|
|
func (g *Group) MemberIndex(userId string) int
|
|
|
|
type Session struct {
|
|
// Has unexported fields.
|
|
}
|
|
|
|
func Login(username, password string) (*Session, error)
|
|
|
|
func SessionFromUsername(username string) (*Session, error)
|
|
|
|
func (s *Session) Admin() *Admin
|
|
|
|
func (s *Session) ClaimWishes(claims, unclaims []string) error
|
|
|
|
func (s *Session) CompleteWishes(claims []string) error
|
|
|
|
func (s *Session) GetGroupByReference(reference string) (*Group, error)
|
|
|
|
func (u *Session) GetGroups() ([]Group, error)
|
|
|
|
func (s *Session) GetOthersWishes(userReference string) ([]Wish, error)
|
|
|
|
func (s *Session) GetWishes() ([]Wish, error)
|
|
|
|
func (s *Session) MakeWish(name string) error
|
|
|
|
func (s *Session) RecindWishesForUser(ids ...string) error
|
|
|
|
func (s *Session) RevokeWishes(ids ...string) error
|
|
|
|
func (u *Session) SuggestWishForUser(otherUserReference string, wishName string) error
|
|
|
|
func (s *Session) User() User
|
|
|
|
type User struct {
|
|
Id string
|
|
NormalName string
|
|
Name string
|
|
Reference string
|
|
IsAdmin bool
|
|
IsLive bool
|
|
}
|
|
|
|
func GetUserByReference(reference string) (*User, error)
|
|
|
|
func Register(username, newPassword string) (*User, error)
|
|
|
|
func (u *User) GetTodo() ([]Wish, error)
|
|
|
|
func (u *User) WishCount() (int, error)
|
|
|
|
type Wish struct {
|
|
Id string
|
|
Name string
|
|
ClaimantId string `json:",omitempty"`
|
|
ClaimantName string `json:",omitempty"`
|
|
Sent bool
|
|
RecipientId string `json:",omitempty"`
|
|
RecipientName string `json:",omitempty"`
|
|
RecipientRef string `json:",omitempty"`
|
|
CreatorId string `json:",omitempty"`
|
|
CreatorName string `json:",omitempty"`
|
|
}
|