fancyhands

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

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

Go to latest
Published: Aug 17, 2014 License: MIT Imports: 5 Imported by: 0

README

FancyHands-Go

FancyHands API wrapper in Go!

Installation:

go get github.com/ameng/fancyhands-go

Example:

package main

import (
    "fmt"
    "github.com/ameng/fancyhands-go"
)

func main() {
    client := fancyhands.NewTestClient("YOUR KEY HERE", "YOUR SECRET HERE")

    status_code, response, err := client.Echo("hello world")

    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(status_code, response)
    }
}

Documentation:

Read the documentation at godoc.org

License:

MIT

Documentation

Index

Constants

View Source
const (
	STATUS_NEW     = 1
	STATUS_OPEN    = 5
	STATUS_CLOSED  = 20
	STATUS_EXPIRED = 21
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(key string, secret string) *Client

Create an API Client

func NewTestClient

func NewTestClient(key string, secret string) *Client

Create a test API Client. This will send API calls without actually sending tasks to Fancy Hands assistants.

func (*Client) Call

func (c *Client) Call(phone string, conversation string) (code int, body string, err error)

Create a task for a phone call. The conversation field must be a string formatted as JSON.

func (*Client) CancelTask

func (c *Client) CancelTask(key string) (code int, body string, err error)

Cancel a task based on its key

func (*Client) CreateCustomTask

func (c *Client) CreateCustomTask(title string, desc string, bid float64, expiration time.Time, custom string) (code int, body string, err error)

Create a custom task. The custom field must be a string formatted as JSON.

func (*Client) CreateMessage

func (c *Client) CreateMessage(key string, message string) (code int, body string, err error)

Add a message to a specific task based on the task's key.`

func (*Client) CreateTask

func (c *Client) CreateTask(title string, desc string, bid float64, expiration time.Time) (code int, body string, err error)

Create a task. All fields are required.

func (*Client) Echo

func (c *Client) Echo(value string) (code int, body string, err error)

Send a string to the API and it will echo it back.

func (*Client) GetAllTasks

func (c *Client) GetAllTasks() (code int, body string, err error)

Get all tasks

func (*Client) GetTask

func (c *Client) GetTask(key string) (code int, body string, err error)

Get a specific task based on its key

func (*Client) GetTasksByCursor

func (c *Client) GetTasksByCursor(cursor string) (code int, body string, err error)

Get tasks filtered by cursor. The API may return a cursor for pagination.

func (*Client) GetTasksByStatus

func (c *Client) GetTasksByStatus(status int) (code int, body string, err error)

Get tasks filtered by status. Use the predefined status constants (fancyhands.STATUS_OPEN, etc).

Jump to

Keyboard shortcuts

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