Documentation ¶
Overview ¶
Package cv3go is used to connect to the CV3 API
Index ¶
- func CheckUTF8(b []byte) []byte
- func PrintToFile(b []byte, fileName string)
- func StringToIntSlice(strs []string) []int
- type Api
- func (self *Api) CatalogRequestConfirm(o string)
- func (self *Api) Execute() (n []byte)
- func (self *Api) GetAllCategories(isTopLevel bool)
- func (self *Api) GetAllCategoriesExcept(exceptIDs []string)
- func (self *Api) GetCatalogRequestsNew() CatalogRequests
- func (self *Api) GetCustomerGroups()
- func (self *Api) GetOrdersNew()
- func (self *Api) GetOrdersRange(o string, p string)
- func (self *Api) GetProductIds() ProductIDs
- func (self *Api) GetProductRange(start string, end string)
- func (self *Api) GetProductSKU(o string, t bool)
- func (self *Api) GetProductSKUs(o []string, t bool)
- func (self *Api) GetProductSingle(o []string)
- func (self *Api) GetProductSingleBySKU(o string)
- func (self *Api) GetProductSkus()
- func (self *Api) OrderConfirm(o []string)
- func (self *Api) PushInventory(o string, t bool)
- func (self *Api) SetCredentials(username, password, serviceID string)
- func (self *Api) UnmarshalCategories(n []byte) Categories
- func (self *Api) UnmarshalInventory(n []byte) Products
- func (self *Api) UnmarshalOrders(n []byte) Orders
- func (self *Api) UnmarshalProduct(n []byte) Product
- func (a *Api) UpdateOrderStatus(os []OrdStatus)
- func (api *Api) UpdateProducts(products []Product, createNew bool)
- type Attribute
- type C
- type CV3Data
- type CatalogRequest
- type CatalogRequests
- type Categories
- type Category
- type Confirm
- type Credentials
- func (c *Credentials) GetPendingOrders() (*Orders, error)
- func (c *Credentials) GetPendingOrdersWithProducts() (*Orders, error)
- func (c *Credentials) RemoveOrdersFromPending(orders *Orders) error
- func (c *Credentials) UpdateOrderStatus(status []OrdStatus) error
- func (c *Credentials) UpdateProducts(products []Product, createNew bool) error
- type Custom
- type CustomField
- type DependancyProducts
- type Document
- type ElectronicDelivery
- type GiftCardPayment
- type GiftCertificate
- type Image
- type Images
- type InventoryControl
- type Meta
- type OrdStatus
- type Order
- type OrderStatus
- type Orders
- type Package
- type Price
- type Pricing
- type ProdCategories
- type ProdCustomField
- type Product
- type ProductCall
- type ProductIDs
- type Products
- type Request
- type RequestBody
- type Retail
- type ShipTo
- type ShipToProduct
- type Shipping
- type Special
- type SubCategory
- type SubProduct
- type SubProducts
- type Subscription
- type TotalOrderDiscount
- type Weight
- type WholeSale
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckUTF8 ¶
CheckUTF8 converts []byte to []rune to string to []byte to make sure only utf8 characters are used.
func PrintToFile ¶
PrintToFile will print the passed in []bytes to a file
func StringToIntSlice ¶
StringToIntSlice converts a slice of strings into a sorted slice of inherits used in GetAllCategoriesExcept()
Types ¶
type Api ¶
type Api struct { Debug bool // contains filtered or unexported fields }
Api is the struct to send api calls
func (*Api) CatalogRequestConfirm ¶
CatalogRequest Set request to catalogRequestConfirm->CatalogRequestID(o)
func (*Api) Execute ¶
Execute Sends the request, return the response Note, one of the above requests must be set up first, and the credentials must be set up for this to work
func (*Api) GetAllCategories ¶
GetAllCategories uses reqCategoryRange with no end set
func (*Api) GetAllCategoriesExcept ¶
GetAllCategoriesExcept uses reqCategoryRange with a passed in slice of ids to skip
func (*Api) GetCatalogRequestsNew ¶
func (self *Api) GetCatalogRequestsNew() CatalogRequests
GetCatalogRequestsNew Set the request to reqCatalogRequests->reqNew
func (*Api) GetCustomerGroups ¶
func (self *Api) GetCustomerGroups()
GetCustomerGroups Set the request to reqCustomerInformation
func (*Api) GetOrdersNew ¶
func (self *Api) GetOrdersNew()
GetOrdersNew Set the request to reqOrders->reqOrderNew
func (*Api) GetOrdersRange ¶
GetOrdersRange Set the request to reqOrders->reqOrderOutOfStockPointRange from o to p
func (*Api) GetProductIds ¶
func (self *Api) GetProductIds() ProductIDs
GetProductIds Set the request to reqProductIDs
func (*Api) GetProductRange ¶
GetProductRange Set the request to reqProducts->reqProductRange using start and end to dictate the range
func (*Api) GetProductSKU ¶
GetProductSKU Set the request to reqProducts->reqProductSKU containing string(o) as the data
func (*Api) GetProductSKUs ¶
GetProductSKUs gets the product skus
func (*Api) GetProductSingle ¶
GetProductSingle Set the request to reqProducts->reqProductSingle containing string(o) as the data
func (*Api) GetProductSingleBySKU ¶
GetProductSingleBySKU is from Ben, to get a singlee product by sku
func (*Api) GetProductSkus ¶
func (self *Api) GetProductSkus()
GetProductSkus Set the request to reqProductSKU
func (*Api) OrderConfirm ¶
OrderConfirm Set request to orderConfirm->orderConf using string o as contents
func (*Api) PushInventory ¶
PushInventory Set the request to an inventory update call using o as the data
func (*Api) SetCredentials ¶
SetCredentials Set the credentials of the API
func (*Api) UnmarshalCategories ¶
func (self *Api) UnmarshalCategories(n []byte) Categories
UnmarshalCategories
func (*Api) UnmarshalInventory ¶
UnmarshalInventory Convert an XML response containing Inventory to a Products object
func (*Api) UnmarshalOrders ¶
UnmarshalOrders Convert an XML response containing order to an Orders object
func (*Api) UnmarshalProduct ¶
UnmarshalProduct Convert an XML response containing a single product to a Product object
func (*Api) UpdateOrderStatus ¶
UpdateOrderStatus Set request to status->[orderID(o),status(p),tracking(q)]
func (*Api) UpdateProducts ¶
UpdateProducts sends any fields that need updating, fields not sent remain current values, the second value notes if we should ignore new products
type Attribute ¶
type Attribute struct { Active string `xml:"active,attr,omitempty"` Values []string `xml:"Value,omitempty"` }
Attribute holds product attribute information
type C ¶
type C struct { // XMLName xml.Name `xml:"CV3Data"` CV3Data RequestBody Confirms []Confirm `xml:"confirm"` OrderStatuses []OrderStatus `xml:"orders"` Products Products `xml:"products"` }
C s
type CV3Data ¶
type CV3Data struct { // XMLName xml.Name `xml:"CV3Data"` CV3Data RequestBody Confirms []Confirm `xml:"confirm"` OrderStatuses []OrderStatus `xml:"orders"` Products []ProductCall `xml:"products"` }
CV3Data struct
type CatalogRequest ¶
type CatalogRequest struct { CatalogId string `xml:"id,attr"` DateRequested string `xml:"DateRequested"` Source string `xml:"Source"` Type string `xml:"Type"` FirstName string `xml:"CustomerInformation>FirstName"` LastName string `xml:"CustomerInformation>LastName"` Company string `xml:"CustomerInformation>Company"` Email string `xml:"CustomerInformation>Email"` Phone string `xml:"CustomerInformation>Phone"` Address string `xml:"CustomerInformation>Address>Address1"` Address2 string `xml:"CustomerInformation>Address>Address2"` City string `xml:"CustomerInformation>Address>City"` State string `xml:"CustomerInformation>Address>State"` PostalCode string `xml:"CustomerInformation>Address>PostalCode"` Country string `xml:"CustomerInformation>Address>Country"` }
type CatalogRequests ¶
type CatalogRequests struct {
CatalogRequests []CatalogRequest `xml:"catalogRequests>CatalogRequest"`
}
type Categories ¶
type Categories struct {
Categories []Category `xml:"categories>category"`
}
Categories data sructure for Categories
type Category ¶
type Category struct { Invisible string `xml:"invisible,attr"` TopLevel string //not sent in xml, set in cv3Intigration.getCategories.go Featured string `xml:"featured,attr"` Name string `xml:"Name,omitempty"` ID string `xml:"ID,omitempty"` URLName string `xml:"URLName,omitempty"` Description string `xml:"Description,omitempty"` MetaTitle string `xml:"MetaTitle,omitempty"` MetaDescription string `xml:"MetaDescription,omitempty"` MetaKeywords string `xml:"MetaKeyword,omitempty"` Template string `xml:"Template,omitempty"` NumProductsPerPage string `xml:"NumProductsPerPage,omitempty"` Products []string `xml:"Products>SKU,omitempty"` FeaturedProducts []string `xml:"FeaturedProducts>SKU,omitempty"` CustomFields []Custom `xml:"Custom,omitempty"` SubCategories []SubCategory `xml:"SubCategories>SubCategory"` }
Category is the struct used when unmarshaling categories
type Credentials ¶
type Credentials struct { XMLName xml.Name `xml:"authenticate"` User string `xml:"user"` Password string `xml:"pass"` ServiceID string `xml:"serviceID"` Debug bool }
Credentials struct
func (*Credentials) GetPendingOrders ¶
func (c *Credentials) GetPendingOrders() (*Orders, error)
func (*Credentials) GetPendingOrdersWithProducts ¶
func (c *Credentials) GetPendingOrdersWithProducts() (*Orders, error)
func (*Credentials) RemoveOrdersFromPending ¶
func (c *Credentials) RemoveOrdersFromPending(orders *Orders) error
func (*Credentials) UpdateOrderStatus ¶
func (c *Credentials) UpdateOrderStatus(status []OrdStatus) error
func (*Credentials) UpdateProducts ¶
func (c *Credentials) UpdateProducts(products []Product, createNew bool) error
UpdateProducts matches on sku and submits any updates to the products to CV3. The first option sets whether new products should be created if the sku doesn't exist
type CustomField ¶
type CustomField struct {
Value string `xml:",innerxml"`
}
type DependancyProducts ¶
type DependancyProducts struct { Type string `xml:"type,attr,omitempty"` SKUs []string `xml:"SKU,omitempty"` }
DependancyProducts holds the sku of the product that is depended upon
type Document ¶
type Document struct { DaysAvailable string `xml:"DaysAvailable,omitempty"` Description string `xml:"Description,omitempty"` }
Document holds information dealing with the electronic delivery
type ElectronicDelivery ¶
type ElectronicDelivery struct { Active string `xml:"active,attr,omitempty"` Document Document `xml:"Document,omitempty"` }
ElectronicDelivery holds the information about the products electronic delivery
type GiftCardPayment ¶
type GiftCertificate ¶
type GiftCertificate struct { Active string `xml:"active,attr,omitempty"` DaysAvailable string `xml:"DaysAvailable,omitempty"` Value string `xml:"Value,omitempty"` }
GiftCertificate hold information about gift certificates
type Image ¶
type Image struct { ImageSetThumb string `xml:"Thumbnail,omitempty"` ImageSetLarge string `xml:"Large,omitempty"` ImageSetPoprUp string `xml:"PopUp,omitempty"` }
Image is the struct for marshalling and unmarshalling cv3's Images node
type Images ¶
type Images struct {
Image []Image `xml:"Image,omitempty"`
}
Images is the struct for marshalling and unmarshalling cv3's Images node
type InventoryControl ¶
type InventoryControl struct { InventoryControlExempt string `xml:"inventory_control_exempt,attr,omitempty"` InventoryStatus string `xml:"Status,omitempty"` InventoryOnHand string `xml:"Inventory,omitempty"` OnOrder string `xml:"OnOrder,omitempty"` InventoryBackorderedDate string `xml:"InventoryBackorderedDate,omitempty"` OutOfStock string `xml:"OutOfStockPoint,omitempty"` }
InventoryControl struct for marshalling and unmarshalling cv3's xml node of InventoryControl
type Meta ¶
type Meta struct { MetaKeywords string `xml:"Keyword,omitempty"` MetaTitle string `xml:"Title,omitempty"` MetaDescription string `xml:"Description,omitempty"` }
Meta is the struct for marshalling and unmarshalling the cv3's Meta node
type OrdStatus ¶
type OrdStatus struct { OrderID string Status string Tracking string CustomerNumber string SendTrackingNotification bool }
OrdStatus holds our data to update orders with new tracking info. It is named badly because I can't figure out what the existing OrderStatus struct is doing.
type Order ¶
type Order struct { SubTotal string OrderID string `xml:"orderID"` PriceCategory string `xml:"priceCategory"` TotalPrice string `xml:"totalPrice"` TotalShipping string `xml:"totalShipping"` TotalTax string `xml:"totalTax"` DateOrdered string `xml:"dateOrdered"` TimeOrdered string `xml:"timeOrdered"` PayMethod string `xml:"payMethod"` SourceCode string `xml:"sourceCode"` PromoCode string `xml:"promoCode"` Comments string `xml:"comments"` IP string `xml:"IP"` BillingCompany string `xml:"billing>company"` BillingFirstName string `xml:"billing>firstName"` BillingLastName string `xml:"billing>lastName"` BillingTitle string `xml:"billing>title"` BillingAddress string `xml:"billing>address1"` BillingAddress2 string `xml:"billing>address2"` BillingCity string `xml:"billing>city"` BillingState string `xml:"billing>state"` BillingZip string `xml:"billing>zip"` BillingCountry string `xml:"billing>country"` BillingEmail string `xml:"billing>email"` BillingPhone string `xml:"billing>phone"` BillingOptOut string `xml:"billing>optOut"` BillingTransactionID string `xml:"billing>CCInfo>transactionID"` MemberID string `xml:"billing>memberID"` CCType string `xml:"billing>CCInfo>CCType"` CCName string `xml:"billing>CCInfo>CCName"` CCNum string `xml:"billing>CCInfo>CCNum"` CCExpM string `xml:"billing>CCInfo>CCExpM"` CCExpY string `xml:"billing>CCInfo>CCExpY"` AuthCode string `xml:"billing>CCInfo>authCode"` AuthAmount string `xml:"billing>CCInfo>authAmount"` RequestToken string `xml:"billing>CCInfo>token"` PurchaseOrder string `xml:"purchaseOrder"` PayPalBuyer string `xml:"payPalInfo>Buyer"` PayPalAmount string `xml:"payPalInfo>Amount"` PayPalTransactionID string `xml:"payPalInfo>TransactionID"` ShipTos []ShipTo `xml:"shipTos>shipTo"` CustomFields []CustomField `xml:"customFields>customField"` TotalOrderDiscount TotalOrderDiscount `xml:"totalOrderDiscount"` GiftCardPayments []GiftCardPayment `xml:"billing>GCInfo>giftCertificateUsed"` GiftCardPaymentsTotal string `xml:"billing>GCInfo>totalAmountUsed"` }
type OrderStatus ¶
type OrderStatus struct {
OrderStatus string `xml:",innerxml"`
}
OrderStatus struct
type Package ¶
type Package struct { ShipsInOwnBox string `xml:"ships_in_own_box,attr,omitempty"` Length string `xml:"Length,omitempty"` Width string `xml:"Width,omitempty"` Height string `xml:"Height,omitempty"` }
Package hold the shipping package information
type Pricing ¶
type Pricing struct { PriceCategory string `xml:"price_category,attr,omitempty"` StandardPrice string `xml:"StandardPrice,omitempty"` SpecialPrice string `xml:"SpecialPrice,omitempty"` }
Pricing is the struct for marshalling and unmarshalling cv3's price node
type ProdCategories ¶
type ProdCategories struct {
IDs []string `xml:"ID,omitempty"`
}
ProdCategories is the struct for marshalling and unmarshalling cv3's Categories node
type ProdCustomField ¶
CustomFields struct for marshalling and unmarshalling cv3's xml nodes of Custom Fields
type Product ¶
type Product struct { XMLName xml.Name `xml:"product"` Inactive string `xml:"inactive,attr"` OutOfSeason string `xml:"out_of_season,attr,omitempty"` Sku string `xml:"SKU"` ProdId string `xml:"ProdID,omitempty"` Name string `xml:"Name,omitempty"` UrlName string `xml:"URLName,omitempty"` Brand string `xml:"Brand,omitempty"` Retail *Retail `xml:"Retail,omitempty"` WholeSale *WholeSale `xml:"Wholesale,omitempty"` Special *Special `xml:"Special,omitempty"` Weight *Weight `xml:"Weight,omitempty"` Shipping *Shipping `xml:"Shipping,omitempty"` InventoryControl *InventoryControl `xml:"InventoryControl,omitempty"` SubProducts *SubProducts `xml:"SubProducts,omitempty"` Description string `xml:"Description,omitempty"` Keywords string `xml:"Keywords,omitempty"` Meta *Meta `xml:"Meta,omitempty"` Images *Images `xml:"Images,omitempty"` Categories *ProdCategories `xml:"Categories,omitempty"` ProdCustomFields []ProdCustomField `xml:"Custom,omitempty"` ParentSKU string `xml:"ParentSKU,omitempty"` }
Product is the struct used when unmarshaling inventory items
type ProductCall ¶
type ProductCall struct {
ProductCall string `xml:",innerxml"`
}
ProductCall struct
type ProductIDs ¶
type ProductIDs struct {
ID []string `xml:"productIDs>ID"`
}
ProductIDs struct to hold product IDs
type Products ¶
type Products struct { XMLName xml.Name `xml:"products"` Products []Product `xml:"product,omitempty"` }
Products data sructure for Products
type RequestBody ¶
type RequestBody struct { XMLName xml.Name `xml:"request"` Auth Credentials Requests []Request `xml:"requests"` }
RequestBody struct
type Retail ¶
type Retail struct { Active string `xml:"active,attr,omitempty"` Price []Pricing `xml:"Price,omitempty"` }
Retail is the struct for marshalling and unmarshalling cv3's retail node
type ShipTo ¶
type ShipTo struct { Name string `xml:"name"` FirstName string `xml:"firstName"` LastName string `xml:"lastName"` Company string `xml:"company"` Title string `xml:"title"` Address string `xml:"address1"` Address2 string `xml:"address2"` City string `xml:"city"` State string `xml:"state"` Zip string `xml:"zip"` Country string `xml:"country"` Phone string `xml:"phone"` Tax string `xml:"tax"` Shipping string `xml:"shipping"` Message string `xml:"message"` ShipMethod string `xml:"shipMethod"` ShipMethodCode string `xml:"shipMethodCode"` ShipOn string `xml:"shipOn"` GiftWrap string `xml:"giftWrap"` ShipToProducts []ShipToProduct `xml:"shipToProducts>shipToProduct"` ShipEmail string `xml:"shipEmail"` }
type ShipToProduct ¶
type ShipToProduct struct { SKU string `xml:"SKU"` Quantity string `xml:"quantity"` Price string `xml:"price"` Product Product }
data structures for Orders
type Shipping ¶
type Shipping struct { ShipPreference string `xml:"ShipPreference,omitempty"` FixedRate string `xml:"FixedRate,omitempty"` Package Package `xml:"Package,omitempty"` }
Shipping hold the products shipping information
type Special ¶
type Special struct { Ongoing string `xml:"ongoing,attr,omitempty"` AllowFree string `xml:"allow_free,attr,omitempty"` Start string `xml:"Start,omitempty"` End string `xml:"End,omitempty"` }
Special hold the pricing information for a special sale
type SubCategory ¶
type SubCategory struct { Name string `xml:"Name"` ID string `xml:"ID"` Invisible string `xml:"invisible,attr"` }
SubCategory is the struct to hold the Subcategories
type SubProduct ¶
type SubProduct struct { XMLName xml.Name `xml:"SubProduct"` Active string `xml:"active,attr,omitempty"` Inactive string `xml:"inactive,attr,omitempty"` OutOfSeason string `xml:"out_of_season,attr,omitempty"` TaxExempt string `xml:"tax_exempt,attr,omitempty"` GoogleCheckoutExempt string `xml:"google_checkout_exempt,attr,omitempty"` Sku string `xml:"SKU,omitempty"` AltID string `xml:"AltID,omitempty"` ProdId string `xml:"ProdID,omitempty"` Name string `xml:"Name,omitempty"` Image string `xml:"Image,omitempty"` Retail Retail `xml:"Retail,omitempty"` WholeSale WholeSale `xml:"WholeSale,omitempty"` Special Special `xml:"Special,omitempty"` Weight Weight `xml:"Weight,omitempty"` Shipping Shipping `xml:"Shipping,omitempty"` GiftCertificate GiftCertificate `xml:"GiftCertificate,omitempty"` Subscription Subscription `xml:"Subscription,omitempty"` ElectronicDelivery ElectronicDelivery `xml:"ElectronicDelivery,omitempty"` Attribute Attribute `xml:"Attribute,omitempty"` InventoryControl InventoryControl `xml:"InventoryControl,omitempty"` }
SubProduct TODO good description
type SubProducts ¶
type SubProducts struct { SubProducts []SubProduct `xml:"SubProduct,omitempty"` Active string `xml:"active,attr"` }
SubProducts is an array of type SubProduct
type Subscription ¶
type Subscription struct { Active string `xml:"active,attr,omitempty"` Price string `xml:"Price,omitempty"` }
Subscription hold the product subscription information