Documentation ¶
Index ¶
Constants ¶
View Source
const ( APIBase = "https://app.mochi.cards/api/" PathCard = "/cards" PathDeck = "/decks" )
Variables ¶
This section is empty.
Functions ¶
func LoadTemplateConfig ¶
Types ¶
type Card ¶
type Card struct { ID string `json:"id,omitempty"` Content string `json:"content"` DeckID string `json:"deck-id"` TemplateID string `json:"template-id,omitempty"` Fields map[string]CardField `json:"fields,omitempty"` Archived bool `json:"archived?"` ReviewReversed bool `json:"review-reverse?"` Position string `json:"pos,omitempty"` }
func (*Card) SetTemplate ¶
type Client ¶
type Client struct { HTTPClient *http.Client `json:"-"` APIBase string `json:"api_base"` APIKey string `json:"-"` Templates *TemplateConfigSet `json:"templates"` Debug bool `json:"debug"` Noop bool `json:"noop"` }
func (*Client) Request ¶
Request makes the request against the mochi api.
WARNING: This method is Private API, it may change at any point, and is only exposed as an escape hatch.
- body: if included it will encode it as JSON and send it as the body of the request. - response: if set the response will be JSON decoded into the response
type FieldConfig ¶
type TemplateConfig ¶
type TemplateConfig struct { ID string `json:"id"` Name string `json:"name"` Fields []*FieldConfig `json:"fields"` }
func (*TemplateConfig) Get ¶
func (t *TemplateConfig) Get(name string) *FieldConfig
Get will get the field with the requested name. Returns nil if not found.
This is safe to call if TemplateConfig is nil, which allows easily chain requests without constantly nil check.
type TemplateConfigSet ¶
type TemplateConfigSet struct {
Templates map[string]*TemplateConfig `json:"templates"`
}
func (*TemplateConfigSet) Get ¶
func (set *TemplateConfigSet) Get(name string) *TemplateConfig
Get looks for the requested template. If it isn't found it will return nil.
Click to show internal directories.
Click to hide internal directories.