printhouse

package
v0.0.0-...-a815375 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Orders

Contains communication logic to handle orders negotiations with the server.

PrintFiles

Contains communication logic to handle printfiles negotiations with the server.

Package printhouse:

go-printhouse provides an easy-to-use API to access Printhouse's WEB API

Products

Contains communication logic to handle products negotiations with the server.

Shipping Quotes Contains communication logic to handle shipping quotes negotiations with the server.

Structs to be used on this library, contains analog models to the ones on api server side.

Index

Constants

View Source
const (
	BASE_URL    = "https://api.printhouse.io"
	API_VERSION = "v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Order

type Order struct {
}

type PrintFile

type PrintFile struct {
	Product string
	FileUrl string
	Id      string
}

type Printhouse

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

Printhouse struct which we use to wrap our request operations.

func New

func New(clientID, clientSecret string) Printhouse

Creates a New Printhouse API object with the clientID and clientSecret Usage:

printhouse.New("XXX","YYY")

func (*Printhouse) ConfirmOrder

func (ph *Printhouse) ConfirmOrder(order *Order) bool

Charges the developer's account and sends an order to production.

An order cannot be updated once it has been confirmed

Usage:

1: ph.ConfirmOrder(&Order{...})

func (*Printhouse) Get

func (printhouse *Printhouse) Get(format string, data map[string]interface{}, args ...interface{}) ([]byte, []error)

Creates a new GET Request to Printhouse and returns the response as a map[string]interface{}.

format: target endpoint format like "products/%s" - string

data: content to be sent with the request - map[string]interface{}

args: Arguments to be used based on format

Usage:

printhouse.Get("order/%s",nil,"0001")

func (*Printhouse) GetOrder

func (ph *Printhouse) GetOrder(id string) *Order

Returns a single order's information

Usage:

1: ph.GetOrder("54808653b7017c7f795a6ac6")

func (*Printhouse) GetOrders

func (ph *Printhouse) GetOrders() []Order

Lists all the orders in the account.

Usage:

1: ph.GetOrders()

func (*Printhouse) GetPrintFile

func (ph *Printhouse) GetPrintFile(id string) *PrintFile

Returns the information of a single print file.

Usage:

1: ph.GetPrintFile("54808653b7017c7f795a6ac6")

func (*Printhouse) GetPrintFiles

func (ph *Printhouse) GetPrintFiles() []PrintFile

Lists all the print files created for the developer's account.

Usage:

1: ph.GetPrintFiles()

func (*Printhouse) GetProduct

func (ph *Printhouse) GetProduct(id string) *Product

Returns a single products' full information.

Usage:

1: ph.GetProduct("54808653b7017c7f795a6ac6")

func (*Printhouse) GetProducts

func (ph *Printhouse) GetProducts(filters string) []Product

Returns the list of products available through Printhouse (canvas, photo paper, posters, etc. in all their sizes).

Usage:

1: ph.GetProducts(nil): Retrieve all

products.

2: ph.GetProducts("kind=canvas&format=4x3"):

Retrieve products filtered by optional parameters such as kind, size, and format

func (*Printhouse) GetShippingQuote

func (ph *Printhouse) GetShippingQuote(id string) *ShippingQuote

Get's the specified shipping quote for the user

Usage:

1: ph.GetShippingQuote("54808653b7017c7f795a6ac6")

func (*Printhouse) GetShippingQuotes

func (ph *Printhouse) GetShippingQuotes() []ShippingQuote

Lists all shipping quotes for the user

Usage:

1: ph.GetShippingQuotes()

func (*Printhouse) Post

func (printhouse *Printhouse) Post(format string, data map[string]interface{}, args ...interface{}) ([]byte, []error)

Creates a new POST Request to Printhouse and returns the response as a map[string]interface{}.

format: target endpoint format like "order/%s/confirm" - string

data: content to be sent with the request - map[string]interface{}

args: Arguments to be used based on format

Usage:

printhouse.Post("order/%s/confirm",map[string]interface{},"0001")

func (*Printhouse) PostOrder

func (ph *Printhouse) PostOrder(order *Order) *Order

Creates an order, with the inner order_items needed.

If positive, the Order will have a new Id. Usage:

1: ph.PostOrder(&Order{...})

func (*Printhouse) PostPrintFile

func (ph *Printhouse) PostPrintFile(printfile *PrintFile) *PrintFile

Creates a print file

If positive, the PrintFile will have a new Id. Usage:

1: ph.PostPrintFile(&PrintFile{Product: "0001", FileUrl: "http://dom.myFile.host"})

func (*Printhouse) PostShippingQuote

func (ph *Printhouse) PostShippingQuote(sq *ShippingQuote) *ShippingQuote

Generates a shipping quote based on the information submitted

If positive, the ShippingQuote will have a new Id. Usage:

1: ph.PostShippingQuote(&ShippingQuote{...})

func (*Printhouse) Put

func (printhouse *Printhouse) Put(format string, data map[string]interface{}, args ...interface{}) ([]byte, []error)

Creates a new PUT Request to Printhouse and returns the response as a map[string]interface{}.

format: target endpoint format like "orders/%s" - string

data: content to be sent with the request - map[string]interface{}

args: Arguments to be used based on format

Usage:

printhouse.Put("orders/%s",nil,"00001")

func (*Printhouse) PutOrder

func (ph *Printhouse) PutOrder(order *Order) (*Order, error)

Updates an order, if it hasn't been confirmed.

Usage:

1: ph.PutOrder(&Order{...})

func (*Printhouse) Request

func (printhouse *Printhouse) Request(method, format string, data map[string]interface{}, args ...interface{}) ([]byte, []error)

Creates a new Request to Printhouse and returns the response as a map[string]interface{}.

method: GET/POST/PUT - string

format: target endpoint format like "products/%s" - string

data: content to be sent with the request - map[string]interface{}

args: Arguments to be used based on format

Usage:

printhouse.request("GET","products/%s",nil,"00001")

type Product

type Product struct {
	Id          string
	Kind        string
	Description string
	Price       float64
	XInches     int16
	YInches     int16
	XPixels     int16
	YPixels     int16
	Format      string
}

type ShippingQuote

type ShippingQuote struct {
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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