Documentation
¶
Overview ¶
Package itembase gives a thin wrapper around the itembase REST API.
Index ¶
- type Address
- type Api
- type Billing
- type Brand
- type Buyer
- type Buyers
- type Category
- type Client
- type Config
- type Contact
- type ItembaseError
- type ItembaseTokens
- type Product
- type ProductDescription
- type Products
- type Profile
- type Profiles
- type TokenLoader
- type TokenPermissions
- type TokenSaver
- type Transaction
- type Transactions
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api interface { // Call is responsible for performing HTTP transactions such as GET, POST, // PUT, PATCH, and DELETE. It is used to communicate with Itembase by all // of the Client methods. // // Arguments are as follows: // - `method`: The http method for this call // - `path`: The full itembase url to call // - `body`: Data to be marshalled to JSON (it's the responsibility of Call to do the marshalling and unmarshalling) // - `params`: Additional parameters to be passed to itembase // - `dest`: The object to save the unmarshalled response body to. // It's up to this method to unmarshal correctly, the default implemenation just uses `json.Unmarshal` Call(method, path, auth string, body interface{}, params map[string]string, dest interface{}) error }
Api is the internal interface for interacting with Itembase. The internal implementation of this interface is responsible for all HTTP operations that communicate with Itembase.
Users of this library can implement their own Api-conformant types for testing purposes. To use your own test Api type, pass it in to the NewClient function.
type Buyer ¶
type Buyer struct { Active bool `json:"active"` Contact Contact `json:"contact"` CreatedAt string `json:"created_at"` Currency string `json:"currency"` DateOfBirth string `json:"date_of_birth"` FirstName string `json:"first_name"` ID string `json:"id"` Language string `json:"language"` LastName string `json:"last_name"` Locale string `json:"locale"` Note string `json:"note"` OptOut bool `json:"opt_out"` OriginalReference string `json:"original_reference"` SourceID string `json:"source_id"` Status string `json:"status"` Type string `json:"type"` UpdatedAt string `json:"updated_at"` URL string `json:"url"` }
type Client ¶
type Client interface { // Returns the absolute URL path for the client Url() string //Gets the value referenced by the client and unmarshals it into // the passed in destination. GetInto(destination interface{}) error Get() (destination interface{}, err error) Me() (destination User, err error) // Child returns a reference to the child specified by `path`. This does not // actually make a request to itembase, but you can then manipulate the reference // by calling one of the other methods (such as `GetInto` or `Get`). Child(path string) Client Transactions() Client Products() Client Profiles() Client Buyers() Client Sandbox() Client User(path string) Client Select(prop string) Client CreatedAtFrom(value string) Client CreatedAtTo(value string) Client UpdatedAtFrom(value string) Client UpdatedAtTo(value string) Client Limit(limit uint) Client Offset(offset uint) Client SaveToken(userId string, token *oauth2.Token) (err error) GetCachedToken(userId string) (token *oauth2.Token, err error) GiveTokenPermissions(authUrl string) (authcode string, err error) }
type ItembaseError ¶
ItembaseError is a Go representation of the error message sent back by itembase when a request results in an error.
func (*ItembaseError) Error ¶
func (f *ItembaseError) Error() string
type ItembaseTokens ¶
type ItembaseTokens struct { TokenLoader TokenLoader TokenSaver TokenSaver TokenPermissions TokenPermissions }
type Product ¶
type Product struct { Active bool `json:"active"` Brand Brand `json:"brand"` Categories []Category `json:"categories"` Condition string `json:"condition"` CreatedAt string `json:"created_at"` Currency struct { Currency string `json:"currency"` } `json:"currency"` Description []ProductDescription `json:"description"` ID string `json:"id"` Identifier struct { ID string `json:"id"` } `json:"identifier"` Name []struct { Language string `json:"language"` Value string `json:"value"` } `json:"name"` OriginalReference string `json:"original_reference"` PictureUrls []struct { URLOriginal string `json:"url_original"` } `json:"picture_urls"` PricePerUnit float64 `json:"price_per_unit"` Shipping []struct { Price float64 `json:"price"` ShippingService string `json:"shipping_service"` } `json:"shipping"` SourceID string `json:"source_id"` StockInformation struct { InStock bool `json:"in_stock"` InventoryLevel float64 `json:"inventory_level"` InventoryUnit string `json:"inventory_unit"` } `json:"stock_information"` Tax float64 `json:"tax"` TaxRate float64 `json:"tax_rate"` UpdatedAt string `json:"updated_at"` URL string `json:"url"` Variants []interface{} `json:"variants"` }
type ProductDescription ¶
type Profile ¶
type Profile struct { Active bool `json:"active"` AvatarURL string `json:"avatar_url"` Contact struct { Contact []Contact `json:"contact"` } `json:"contact"` CreatedAt string `json:"created_at"` Currency string `json:"currency"` DisplayName string `json:"display_name"` ID string `json:"id"` Language string `json:"language"` Locale string `json:"locale"` OriginalReference string `json:"original_reference"` PlatformID string `json:"platform_id"` PlatformName string `json:"platform_name"` SourceID string `json:"source_id"` Status string `json:"status"` Type string `json:"type"` UpdatedAt string `json:"updated_at"` URL string `json:"url"` }
type TokenPermissions ¶
type Transaction ¶
type Transaction struct { Billing Billing `json:"billing"` Buyer Buyer `json:"buyer"` CreatedAt string `json:"created_at"` Currency string `json:"currency"` ID string `json:"id"` OriginalReference string `json:"original_reference"` Products []Product `json:"products"` Shipping struct { Address Address `json:"address"` } `json:"shipping"` SourceID string `json:"source_id"` Status struct { Global string `json:"global"` Payment string `json:"payment"` Shipping string `json:"shipping"` } `json:"status"` TotalPrice float64 `json:"total_price"` TotalPriceNet float64 `json:"total_price_net"` TotalTax float64 `json:"total_tax"` UpdatedAt string `json:"updated_at"` }
type Transactions ¶
type Transactions struct { Transactions []Transaction `json:"documents"` NumDocumentsFound float64 `json:"num_documents_found"` NumDocumentsReturned float64 `json:"num_documents_returned"` }
type User ¶
type User struct { UUID string `json:"uuid"` Username string `json:"username"` FirstName string `json:"first_name"` LastName string `json:"last_name"` MiddleName string `json:"middle_name"` NameFormat string `json:"name_format"` Locale string `json:"locale"` Email string `json:"email"` PreferredCurrency string `json:"preferred_currency"` }
Click to show internal directories.
Click to hide internal directories.