Documentation ¶
Index ¶
- func UserError(err error) usererrors.UserError
- type Client
- func (c *Client) Authorize() error
- func (c *Client) CreateConversation(convo *say.Conversation) error
- func (c *Client) CreateLine(convoID string, line *say.Line) error
- func (c *Client) CreateUser() (*auth.User, error)
- func (c *Client) DeleteConversation(id string) error
- func (c *Client) DeleteLine(convoID, lineID string) error
- func (c *Client) DeleteMood(name string) error
- func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) GetAnimals() ([]string, error)
- func (c *Client) GetConversation(id string) (*say.Conversation, error)
- func (c *Client) GetLine(convoID, lineID string) (*say.Line, error)
- func (c *Client) GetMood(name string) (*say.Mood, error)
- func (c *Client) ListConversations(params ListParams) *ConversationIter
- func (c *Client) ListMoods(params ListParams) *MoodIter
- func (c *Client) NewRequest(rt Route, rtVars Vars, form *url.Values) (*http.Request, error)
- func (c *Client) SetAuthorization(auth string)
- func (c *Client) SetMood(mood *say.Mood) error
- func (c *Client) UserExists(id string) (bool, error)
- type ConversationIter
- type Iter
- type ListParams
- type MoodIter
- type Route
- type TestClient
- type Vars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UserError ¶
func UserError(err error) usererrors.UserError
UserError returns the underlying UserError returned by the client request if the error was generated from a UserError response. Otherwise, it returns nil.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateConversation ¶
func (c *Client) CreateConversation(convo *say.Conversation) error
func (*Client) DeleteConversation ¶
func (*Client) DeleteLine ¶
func (*Client) DeleteMood ¶
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON-decoded and stored in the value pointed to by v. If a known usererror response is returned, the error will be a UserError with the correct underlying type.
func (*Client) GetAnimals ¶
func (*Client) GetConversation ¶
func (c *Client) GetConversation(id string) (*say.Conversation, error)
func (*Client) ListConversations ¶
func (c *Client) ListConversations(params ListParams) *ConversationIter
func (*Client) ListMoods ¶
func (c *Client) ListMoods(params ListParams) *MoodIter
func (*Client) NewRequest ¶
func (*Client) SetAuthorization ¶
type ConversationIter ¶
type ConversationIter struct {
*Iter
}
ConversationIter is an iterator for lists of Conversations. The embedded Iter carries methods with it; see its documentation for details.
func (*ConversationIter) Conversation ¶
func (it *ConversationIter) Conversation() say.Conversation
Conversation returns the most recent Conversation visited by a call to Next.
type Iter ¶
type Iter struct {
// contains filtered or unexported fields
}
func (*Iter) Current ¶
func (it *Iter) Current() interface{}
Current returns the most recent item visited by a call to Next.
type ListParams ¶
type MoodIter ¶
type MoodIter struct {
*Iter
}
MoodIter is an iterator for lists of Moods. The embedded Iter carries methods with it; see its documentation for details.
type Route ¶
type Route interface { // HTTPMethods must return exactly one method unless the additional // methodsa are only one of OPTIONS and HEAD. HTTPMethods() map[string]struct{} // URLPath should return the correct path for an API route // given a complete list of path variables. URLPath(map[pattern.Variable]string) (string, error) }
Route describes an API route for building client requests
type TestClient ¶
type TestClient struct { Client // contains filtered or unexported fields }
func NewTestClient ¶
func NewTestClient(cfg *app.Configuration) (*TestClient, error)
NewTestClient initializes a TestClient instance with an embedded copy of the app. This will modify your passed Configuration to incorporate testing default values. For non-stub configurations, this will initialize a new database and store the DSN in the Configuration.
func (*TestClient) Close ¶
func (c *TestClient) Close() error