astatine

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

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

Go to latest
Published: Jun 10, 2018 License: MIT Imports: 10 Imported by: 0

README

astatine is a learning a language flashcard API

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Router chi.Router
	Decks  *Decks
}

func NewAPI

func NewAPI(decks *Decks) *API

func (*API) GetCard

func (a *API) GetCard(w http.ResponseWriter, r *http.Request)

func (*API) GetCards

func (a *API) GetCards(w http.ResponseWriter, r *http.Request)

func (*API) GetDeck

func (a *API) GetDeck(w http.ResponseWriter, r *http.Request)

func (*API) GetDecks

func (a *API) GetDecks(w http.ResponseWriter, r *http.Request)

func (*API) GetFields

func (a *API) GetFields(w http.ResponseWriter, r *http.Request)

func (*API) GetNextCard

func (a *API) GetNextCard(w http.ResponseWriter, r *http.Request)

func (*API) GetNote

func (a *API) GetNote(w http.ResponseWriter, r *http.Request)

func (*API) GetNotes

func (a *API) GetNotes(w http.ResponseWriter, r *http.Request)

func (*API) NewRouter

func (a *API) NewRouter()

func (*API) Run

func (a *API) Run(port int)

func (*API) Write

func (a *API) Write(w http.ResponseWriter, i string)

type Card

type Card struct {
	ID       string `json:"id"`
	*Notes   `json:"-"`
	Question string `json:"question"`
	Answer   string `json:"answer"`
	// contains filtered or unexported fields
}

func NewCard

func NewCard() *Card

func NewLanguageCard

func NewLanguageCard() *Card

func (*Card) Add

func (c *Card) Add(note *Note) *Card

func (*Card) Apply

func (c *Card) Apply()

func (*Card) SetField

func (c *Card) SetField(key, value string)

func (*Card) String

func (c *Card) String() string

func (*Card) With

func (c *Card) With(notes *Notes) *Card

func (*Card) WithFunc

func (c *Card) WithFunc(formatFunc func() error) *Card

type Cards

type Cards struct {
	Cards []*Card `json:"cards"`
}

func NewCards

func NewCards() *Cards

func (*Cards) Add

func (c *Cards) Add(card *Card) *Cards

func (*Cards) Exists

func (c *Cards) Exists(id string) bool

func (*Cards) Get

func (c *Cards) Get(id string) *Card

func (*Cards) Next

func (c *Cards) Next() *Card

func (*Cards) Shuffle

func (c *Cards) Shuffle()

func (*Cards) String

func (c *Cards) String() string

type Deck

type Deck struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	*Cards `json:"-"`
}

func NewDeck

func NewDeck() *Deck

func (*Deck) String

func (d *Deck) String() string

func (*Deck) With

func (d *Deck) With(cards *Cards) *Deck

type Decks

type Decks struct {
	Decks   []*Deck `json:"decks"`
	Primary *Deck   `json:"primary"`
}

func NewDecks

func NewDecks() *Decks

func (*Decks) Add

func (d *Decks) Add(deck *Deck) *Decks

func (*Decks) Exists

func (d *Decks) Exists(id string) bool

func (*Decks) Get

func (d *Decks) Get(id string) *Deck

func (*Decks) SetPrimary

func (d *Decks) SetPrimary(deck *Deck)

func (*Decks) String

func (d *Decks) String() string

type Field

type Field struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

func NewField

func NewField(key string, value string) *Field

func (*Field) GetValue

func (f *Field) GetValue() string

func (*Field) String

func (f *Field) String() string

type Fields

type Fields struct {
	Fields []*Field `json:"fields"`
}

func NewFields

func NewFields() *Fields

func (*Fields) Add

func (f *Fields) Add(field *Field) *Fields

func (*Fields) Exists

func (f *Fields) Exists(key string) bool

func (*Fields) Get

func (f *Fields) Get(key string) *Field

func (*Fields) String

func (f *Fields) String() string
type Links struct {
	Self string `json:"self"`
	Next string `json:"next"`
	Last string `json:"last"`
}

type Note

type Note struct {
	ID     string  `json:"id"`
	Fields *Fields `json:"fields"`
}

func NewNote

func NewNote() *Note

func (*Note) Add

func (n *Note) Add(field *Field) *Note

func (*Note) String

func (n *Note) String() string

func (*Note) With

func (n *Note) With(fields *Fields) *Note

type Notes

type Notes struct {
	Notes []*Note `json:"notes"`
}

func NewNotes

func NewNotes() *Notes

func (*Notes) Add

func (n *Notes) Add(note *Note) *Notes

func (*Notes) Exists

func (n *Notes) Exists(id string) bool

func (*Notes) Get

func (n *Notes) Get(id string) *Note

func (*Notes) String

func (n *Notes) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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