akiapi

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

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

Go to latest
Published: Dec 1, 2024 License: Unlicense Imports: 9 Imported by: 1

README

Akinator api written in golang. This is purely for educational purposes.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer struct {
	Id          string
	Name        string
	Description string
	PhotoUrl    string
}

type AnswerResponse

type AnswerResponse struct {
	Completion  string `json:"completion"`
	Step        string `json:"step"`
	Progression string `json:"progression"`
	QuestionID  string `json:"question_id"`
	Question    string `json:"question"`

	GuessId          string `json:"id_proposition"`
	GuessName        string `json:"name_proposition"`
	GuessDescription string `json:"description_proposition"`
	PhotoUrl         string `json:"photo"`
}

type AutoGenerated

type AutoGenerated struct {
	Completion             string `json:"completion"`
	IDProposition          string `json:"id_proposition"`
	IDBaseProposition      string `json:"id_base_proposition"`
	ValideContrainte       string `json:"valide_contrainte"`
	NameProposition        string `json:"name_proposition"`
	DescriptionProposition string `json:"description_proposition"`
	FlagPhoto              string `json:"flag_photo"`
	Photo                  string `json:"photo"`
	Pseudo                 string `json:"pseudo"`
	NbElements             int    `json:"nb_elements"`
}

type Client

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

func NewClient

func NewClient() *Client

func (*Client) AcceptAnswer

func (c *Client) AcceptAnswer() error

func (*Client) Answer

func (c *Client) Answer() Answer

func (*Client) DeclineAnswer

func (c *Client) DeclineAnswer() error

func (*Client) History

func (c *Client) History() []QuestionAnswer

func (*Client) IsAnswered

func (c *Client) IsAnswered() bool

func (*Client) NewGame

func (c *Client) NewGame(theme Theme, childMode bool) error

func (*Client) Progress

func (c *Client) Progress() string

func (*Client) Question

func (c *Client) Question() string

func (*Client) Respond

func (c *Client) Respond(response Response) error

func (*Client) SetHttpClient

func (c *Client) SetHttpClient(httpClient *http.Client)

func (*Client) UndoResponse

func (c *Client) UndoResponse() error

type QuestionAnswer

type QuestionAnswer struct {
	Question string
	Answer   Response
}

type Response

type Response string
const (
	ResponseYes         Response = "0"
	ResponseNo          Response = "1"
	ResponseDontKnow    Response = "2"
	ResponseProbably    Response = "3"
	ResponseProbablyNot Response = "4"
)

type SessionManager

type SessionManager interface {
	NewGame(theme Theme, childMode bool) error

	Respond(response Response) error
	UndoResponse() error

	Question() string
	Answer() Answer
	Progress() string
	History() []QuestionAnswer

	IsAnswered() bool
	AcceptAnswer() error
	DeclineAnswer() error
}

type Theme

type Theme string
const (
	ThemeCharacters Theme = "1"
	ThemeObjects    Theme = "2"
	ThemeAnimals    Theme = "14"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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