service

package
v0.0.0-...-f67852a Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(bnetProfile *bnet.CharacterProfile) *model.Character

Convert converts profile from Battle.Net API to a required object

Types

type CachableCharacterService

type CachableCharacterService struct {
	// contains filtered or unexported fields
}

CachableCharacterService implements CharacterService interface It caches and stores data in db. If not found, searches data in Bnet.API

func New

func New(cache cache.Cache, storage storage.CharacterRepository, bnetClient *bnet.Client) *CachableCharacterService

func (*CachableCharacterService) Add

func (s *CachableCharacterService) Add(streamerID, region, realm, name string) error

func (*CachableCharacterService) Delete

func (s *CachableCharacterService) Delete(streamerID, region, realm, name string) error

func (*CachableCharacterService) List

func (s *CachableCharacterService) List(streamerID string) ([]*model.CharacterInfo, error)

func (*CachableCharacterService) Profile

func (s *CachableCharacterService) Profile(streamerID, region, realm, name string) (*model.Character, error)

type CharacterService

type CharacterService interface {
	// Get short characters info. Returns empty slice if no characters
	List(streamerID string) ([]*model.CharacterInfo, error)
	// Add new character to storage. If character exists with such realm - name pair, error is thrown
	Add(streamerID, region, realm, name string) error
	// Delete character from storage
	Delete(streamerID, region, realm, name string) error
	// Retrieve full character profile
	Profile(streamerID, region, realm, name string) (*model.Character, error)
}

CharacterService allows to view currently added WoW characters, add new characters, delete character and get a detailed info of selected character

Jump to

Keyboard shortcuts

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