bpost

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

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

Go to latest
Published: May 30, 2016 License: MIT Imports: 6 Imported by: 0

README

go-bpost

Go client to communicate with BPOST web services

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Street      string `xml:"streetName"`
	Number      string `xml:"number"`
	Zip         string `xml:"postalCode"`
	City        string `xml:"locality"`
	CountryCode string `xml:"countryCode"`
}

type Box

type Box struct {
	Sender   Customer `xml:"sender"`
	Receiver Customer `xml:"nationalBox>atHome>receiver"`
	Status   string   `xml:"status"`
	Barcode  string   `xml:"barcode"`
}

type Client

type Client struct {
	// HTTP client to communicate with the request API.
	*http.Client
	// contains filtered or unexported fields
}

Client manages communication with the BPOST API.

func NewClient

func NewClient(httpClient *http.Client, url string, id, passPhrase string) *Client

NewClient returns a new BPOST API client.

func (*Client) FetchOrder

func (c *Client) FetchOrder(ref string) (*OrderInfo, error)

FetchOrder retrieves a single order by BPOST reference.

func (*Client) FetchTracking

func (c *Client) FetchTracking(ref string) (*TrackingInfo, error)

FetchTracking retrieves a single order by BPOST barcode.

func (*Client) NewRequest

func (c *Client) NewRequest(method, url string, tracking bool, body interface{}) (*http.Request, error)

type Customer

type Customer struct {
	Name    string  `xml:"name"`
	Company string  `xml:"company"`
	Email   string  `xml:"emailAddress"`
	Address Address `xml:"address"`
}

type OrderInfo

type OrderInfo struct {
	AccountID      int         `xml:"accountId"`
	OrderReference string      `xml:"reference"`
	Box            []Box       `xml:"box"`
	Status         string      `xml:"status"`
	CostCenter     string      `xml:"costCenter"`
	Orders         []OrderLine `xml:"orderLines"`
}

type OrderLine

type OrderLine struct {
	Text  string `xml:"text"`
	Count int    `xml:"nbOfItems"`
}

type StateInfo

type StateInfo struct {
	Time        string `xml:"time"`
	Code        string `xml:"stateCode"`
	Description string `xml:"stateDescription"`
}

type TrackingInfo

type TrackingInfo struct {
	ItemCode   string      `xml:"itemCode"`
	CostCenter string      `xml:"costCenter"`
	StateInfo  []StateInfo `xml:"stateInfo"`
}

Jump to

Keyboard shortcuts

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