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) AddPricingFromStruct(p interface{})
- func (self *Api) AddRequestFromStruct(req interface{})
- func (self *Api) CatalogRequestConfirm(o string)
- func (self *Api) ConfirmCatalogRequest(catIDs []string)
- func (self *Api) Execute(jsonReturn ...bool) (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 (self *Api) UpdateOrderStatus(o string, p string, q string)
- type Attributes
- type ByID
- type ByName
- type C
- type CV3Data
- type CatalogRequest
- type CatalogRequests
- type Categories
- type Category
- type Confirm
- type ConfirmCatalogRequest
- type Credentials
- type Custom
- type CustomField
- type DependancyProducts
- type Discount
- type DiscountTable
- type DiscountTables
- type Discounts
- type Document
- type ElectronicDelivery
- type GiftCertificate
- type Image
- type Images
- type InventoryControl
- type Meta
- type Order
- type OrderStatus
- type Orders
- type Package
- type Price
- type Pricing
- type PricingCall
- type ProdCategories
- type Product
- type ProductCall
- type ProductGroup
- type ProductGroups
- type ProductIDs
- type Products
- type ReqDiscountTables
- type ReqPricing
- type ReqProductGroups
- type Request
- type RequestBody
- type Retail
- type SKU
- type ShipTo
- type ShipToProduct
- type Shipping
- type Special
- type SubCategory
- type SubProduct
- type SubProducts
- type Subscription
- type TotalOrderDiscount
- type VisaCheckoutInfo
- 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) AddPricingFromStruct ¶
func (self *Api) AddPricingFromStruct(p interface{})
AddPricingFromStruct marshals a passed in struct and adds it to the pricing fields
func (*Api) AddRequestFromStruct ¶
func (self *Api) AddRequestFromStruct(req interface{})
AddRequestFromStruct marshals a passed in struct and adds it to the request fields
func (*Api) CatalogRequestConfirm ¶
CatalogRequest Set request to catalogRequestConfirm->CatalogRequestID(o)
func (*Api) ConfirmCatalogRequest ¶
ConfirmCatalogRequest will set the catalog requests to confrimed OrderStatus
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
type Attributes ¶
type Attributes struct { Active string `xml:"active,attr,omitempty"` Values []string `xml:"Value,omitempty"` }
Attributes holds product attribute information
type ByID ¶
type ByID struct {
ID []string `xml:"ID,omitemtpy"`
}
ByID holds ID request data for pricing calls to cv3 WebServiceChunkFunc
type ByName ¶
type ByName struct {
Name []string `xml:"Name,omitempty"`
}
ByName holds name request data for pricing calls to cv3 WebServiceChunkFunc
type C ¶
type C struct { // XMLName xml.Name `xml:"CV3Data"` CV3Data RequestBody Confirms []Confirm `xml:"confirm" json:"confirm"` OrderStatuses []OrderStatus `xml:"orders" json:"orders"` Products Products `xml:"products" json:"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"` Pricing PricingCall `xml:"pricing"` }
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 ConfirmCatalogRequest ¶
type ConfirmCatalogRequest struct { XMLName xml.Name `xml:"catalogRequestConfirm"` CatalogRequestID []string `xml:"CatalogRequestID"` }
ConfirmCatalogRequest is the struct to send the confirm catalog database
type Credentials ¶
type Credentials struct { XMLName xml.Name `xml:"authenticate"` User string `xml:"user"` Password string `xml:"pass"` ServiceID string `xml:"serviceID"` }
Credentials struct
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 Discount ¶
type Discount struct { Delete string `xml:"delete,attr,omitempty"` Qty string `xml:"Qty"` Amount string `xml:"Amount"` Type string `xml:"Type"` }
Discount is the struct to hold data for the discount tables for the cv3 CV3WebService
type DiscountTable ¶
type DiscountTable struct { Delete string `xml:"delete,attr"` Name string `xml:"Name"` Description string `xml:"Description"` Discounts Discounts `xml:"Discounts"` AdditionalDiscount Discount `xml:"AdditionalDiscount"` }
DiscountTable is the struct to hold discount table data for the cv3 CV3WebService
type DiscountTables ¶
type DiscountTables struct { ReplaceExisting string `xml:"replace_existing,attr"` DiscountTable []DiscountTable `xml:"DiscountTable"` }
DiscountTables is the struct to hold discountTable data for CV3's webservice
type Discounts ¶
type Discounts struct {
Discount []Discount `xml:"Discount"`
}
Discounts is the struct to hold discount table data for the cv3 RunWebServiceProductChunkFunction
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 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 {
ImageSetThumb1 string `xml:"Thumbnail,omitempty"`
}
Image is the struct for marshalling and unmarshalling cv3's Images node
type Images ¶
type Images struct {
Images []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 int `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 Order ¶
type Order struct { 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"` AdditionalPayMethod string `xml:"additionalPayMethod"` 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"` //CC 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"` CCTransactionID string `xml:"billing>CCInfo>transactionID"` //GC GiftCertificate string `xml:"billing>GCInfo>giftCertificate"` GCTotalAmountUsed string `xml:"billing>GCInfo>totalAmountUsed"` GCAmountUsed string `xml:"billing>GCInfo>amountUsed"` //EC ECAccountName string `xml:"billing>ECInfo>accountName"` ECRoutingNumber string `xml:"billing>ECInfo>routingNumber"` ECAccountNumber string `xml:"billing>ECInfo>accountNumber"` ECBankName string `xml:"billing>ECInfo>bankName"` PurchaseOrder string `xml:"purchaseOrder"` PayPalBuyer string `xml:"payPalInfo>Buyer"` PayPalAmount string `xml:"payPalInfo>Amount"` PayPalTransactionID string `xml:"payPalInfo>TransactionID"` AmazonOrderIDs string `xml:"amazonOrderIDsz"` ShipTos []ShipTo `xml:"shipTos>shipTo"` CustomFields []CustomField `xml:"customFields>customField"` TotalOrderDiscount TotalOrderDiscount `xml:"totalOrderDiscount"` VisaCheckoutInfo VisaCheckoutInfo `xml:"visaCheckoutInfo"` }
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 PricingCall ¶
type PricingCall struct {
Pricing string `xml:",innerxml"`
}
Pricing will hold pricing import reqCustomerInformation
type ProdCategories ¶
type ProdCategories struct {
IDs []string `xml:"ID,omitempty"`
}
ProdCategories is the struct for marshalling and unmarshalling cv3's Categories node
type Product ¶
type Product struct { XMLName xml.Name `xml:"product"` Inactive string `xml:"inactive,attr" json:"inactive,attr"` New string `xml:"new,attr,omitempty"` Sku string `xml:"SKU" json:"SKU"` ProdId string `xml:"ProdID,omitempty"` Name string `xml:"Name,omitempty"` UrlName string `xml:"URLName,omitempty"` InventoryControl InventoryControl `xml:"InventoryControl,omitempty"` Retail Retail `xml:"Retail,omitempty"` Wholesale Wholesale `xml:"Wholesale,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"` DefaultCategory string `xml:"DefaultCategory,omitempty"` Attributes Attributes `xml:"Attributes,omitempty"` Rating string `xml:"Rating,omitempty"` }
Product is the struct used when unmarshaling inventory items
type ProductCall ¶
type ProductCall struct {
ProductCall string `xml:",innerxml"`
}
ProductCall struct
type ProductGroup ¶
type ProductGroup struct { Delete string `xml:"delete,attr"` Name string `xml:"Name"` Description string `xml:"Description"` DiscountTable string `xml:"DiscountTable"` Type string `xml:"Type"` Products []SKU `xml:"Products"` }
ProductGroup is the struct to hold product group data for the cv3 webservice calls
type ProductGroups ¶
type ProductGroups struct {
ProductGroup []ProductGroup `xml:"ProductGroup"`
}
ProductGroups is the struct to hold data for the cv3 webservice productGroup calls
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" json:"products"` }
Products data sructure for Products
type ReqDiscountTables ¶
type ReqDiscountTables struct { XMLName xml.Name `xml:"reqDiscountTables"` ReturnAll string `xml:"return_all,attr"` ByName *ByName `xml:"ByName,omitempty"` ByID *ByID `xml:"ByID,omitempty"` }
ReqDiscountTables is the struct for requesting discount tables from the cv3 web service
type ReqPricing ¶
ReqPricing is the struct to hold various pricing requests from the cv3 web serviceID
type ReqProductGroups ¶
type ReqProductGroups struct { XMLName xml.Name `xml:"reqProductGroups"` ReturnAll string `xml:"return_all,attr"` ByName *ByName `xml:"ByName,omitempty"` ByID *ByID `xml:"ByIDomitempty"` }
ReqProductGroups is the struct to hold data for the product group request to cv3's WebServiceChunkFunc
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"` }
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"` Start string `xml:"Start,omitempty"` End string `xml:"End,omitempty"` Text string `xml:"Text,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"` 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"` Attributes Attributes `xml:"Attributes,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
type TotalOrderDiscount ¶
type VisaCheckoutInfo ¶
type VisaCheckoutInfo struct { Amount string `xml:"Amount"` TransactionID string `xml:"TransactionID"` }
VisaCheckoutInfo holds the visa checkout info in the order