dofus

package module
v0.0.0-...-3376678 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2022 License: MPL-2.0 Imports: 6 Imported by: 2

README

dofus

dofus is a library for working with Dofus accounts. It also declares the Storer interface implemented in package dofuspg.

Requirements

Installation

go get -u -v github.com/kralamoure/dofus

Documentation

Overview

Package dofus is a library for working with Dofus accounts. It also declares the Store interface implemented in package dofuspg (https://github.com/kralamoure/dofuspg).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrAlreadyExists = errors.New("already exists")

	ErrUserEmailAlreadyExists    = errors.New("user email already exists")
	ErrUserNicknameAlreadyExists = errors.New("user nickname already exists")
	ErrAccountNameAlreadyExists  = errors.New("account name already exists")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	Id           string
	UserId       string
	Name         dofustyp.AccountName
	Subscription time.Time
	Admin        bool
	LastAccess   time.Time
	LastIP       string
}

func (Account) Validate

func (a Account) Validate() error

type Store

type Store interface {
	CreateUser(ctx context.Context, user User) (id string, err error)
	Users(ctx context.Context) (users map[string]User, err error)
	User(ctx context.Context, id string) (user User, err error)
	UserByNickname(ctx context.Context, nickname string) (user User, err error)
	UserAddChatChannels(ctx context.Context, id string, chatChannels ...dofustyp.ChatChannel) error
	UserRemoveChatChannels(ctx context.Context, id string, chatChannels ...dofustyp.ChatChannel) error

	CreateAccount(ctx context.Context, account Account) (id string, err error)
	Accounts(ctx context.Context) (accounts map[string]Account, err error)
	AccountsByUserId(ctx context.Context, userId string) (accounts map[string]Account, err error)
	Account(ctx context.Context, id string) (account Account, err error)
	AccountByName(ctx context.Context, name string) (account Account, err error)
	SetAccountLastAccessAndLastIP(ctx context.Context, id string, lastAccess time.Time, lastIP string) error
}

type User

type User struct {
	Id             string
	Email          dofustyp.Email
	Nickname       dofustyp.Nickname
	Hash           dofustyp.Hash
	SecretQuestion string
	SecretAnswer   string
	Gender         dofustyp.Gender
	Community      dofustyp.Community
	ChatChannels   UserChatChannels
}

func (User) Validate

func (u User) Validate() error

type UserChatChannels

type UserChatChannels struct {
	Admin       bool
	Info        bool
	Public      bool
	Private     bool
	Group       bool
	Team        bool
	Guild       bool
	Alignment   bool
	Recruitment bool
	Trading     bool
	Newbies     bool
}

Directories

Path Synopsis
Package dofustyp is a library of basic data types for Dofus.
Package dofustyp is a library of basic data types for Dofus.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL