ecwid

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

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

Go to latest
Published: Mar 7, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

LICENSE Go Report Card Codecov Travis (.org) Godocs

Golang wrapper for Ecwid API

Now in alpha stage. Not ready for production.

Ecwid REST API documentation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountName       string   `json:"accountName"`
	AccountNickName   string   `json:"accountNickName"`
	AccountEmail      string   `json:"accountEmail"`
	AvailableFeatures []string `json:"availableFeatures"`
	WhiteLabel        bool     `json:"whiteLabel"`
}

Account - store owner’s account data

type Attribute

type Attribute struct {
	ID    ID     `json:"id,omitempty"`    // ID cannot be set to 0 if 'omitempty', but ID is always not 0
	Alias string `json:"alias,omitempty"` // Alias for system attributes like UPC or Brand
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
	Type  string `json:"type,omitempty"` // Type is one of CUSTOM, UPC, BRAND, GENDER, AGE_GROUP, COLOR, SIZE, PRICE_PER_UNIT, UNITS_IN_PRODUCT
	Show  string `json:"show,omitempty"` // Show is ine of NOTSHOW, DESCR, PRICE
}

Attribute (or AttributeValue in Ecwid) like a key -> value

type Attributes

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

Attributes just a wrapper for []Attribute with Get, Delete, Append, Copy, Compare

func (*Attributes) Append

func (av *Attributes) Append(a *Attribute) *Attribute

Append Attribute to Attributes and returns its pointer

func (*Attributes) CopyTo

func (av *Attributes) CopyTo(dest *Attributes)

CopyTo just make a copy of []Attribute

func (*Attributes) Delete

func (av *Attributes) Delete(a *Attribute) bool

Delete deletes Attribute from Attributes return true if found and deleted

func (*Attributes) GetByID

func (av *Attributes) GetByID(id ID) *Attribute

GetByID is same as Get, just by ID not by Name

func (*Attributes) GetByName

func (av *Attributes) GetByName(name string) *Attribute

GetByName attribute pointer by name. returns nil if not found or *Attribute else

func (*Attributes) IsEqualTo

func (av *Attributes) IsEqualTo(dest *Attributes) bool

IsEqualTo compares all []Attribute values without its order

func (*Attributes) MarshalJSON

func (av *Attributes) MarshalJSON() ([]byte, error)

MarshalJSON marshal as []Attribute

func (*Attributes) UnmarshalJSON

func (av *Attributes) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal as []Attribute

type CategoriesInfo

type CategoriesInfo struct {
	ID      ID   `json:"id"`
	Enabled bool `json:"enabled"`
}

CategoriesInfo ...

type CategoriesSearchResponse

type CategoriesSearchResponse struct {
	SearchResponse
	Items []*Category `json:"items"`
}

CategoriesSearchResponse is basic details of found categories

type Category

type Category struct {
	NewCategory
	ID                  ID            `json:"id"`
	HdThumbnailURL      string        `json:"hdThumbnailUrl"`
	ThumbnailURL        string        `json:"thumbnailUrl"`
	ImageURL            string        `json:"imageUrl"`
	OriginalImageURL    string        `json:"originalImageUrl"`
	URL                 string        `json:"url"`
	ProductCount        uint          `json:"productCount"`
	EnabledProductCount uint          `json:"enabledProductCount"`
	OriginalImage       *ImageDetails `json:"originalImage"`
}

Category https://developers.ecwid.com/api-documentation/categories#get-categories

type Client

type Client struct {
	*resty.Client
}

Client is Ecwid API client

func New

func New(storeID ID, token string) *Client

New method creates a new ecwid client based on resty.Client

func (*Client) Categories

func (c *Client) Categories(ctx context.Context, filter map[string]string) <-chan *Category

Categories 'iterable' by filtered store categories

func (*Client) CategoriesSearch

func (c *Client) CategoriesSearch(filter map[string]string) (*CategoriesSearchResponse, error)

CategoriesSearch search or filter categories in a store catalog The response provides basic details of found categories

func (*Client) CategoriesTrampoline

func (c *Client) CategoriesTrampoline(filter map[string]string, fn func(uint, *Category) error) error

CategoriesTrampoline call on each category

func (*Client) CategoryAdd

func (c *Client) CategoryAdd(category *NewCategory) (ID, error)

CategoryAdd creates a new category in an Ecwid store returns new categoryId

func (*Client) CategoryDelete

func (c *Client) CategoryDelete(categoryID ID) error

CategoryDelete delete a category from an Ecwid store referring to its ID

func (*Client) CategoryGet

func (c *Client) CategoryGet(categoryID ID) (*Category, error)

CategoryGet gets all details of a specific category in an Ecwid store by its ID

func (*Client) CategoryUpdate

func (c *Client) CategoryUpdate(categoryID ID, category *NewCategory) error

CategoryUpdate update an existing category in an Ecwid store referring to its ID

func (*Client) OrderGet

func (c *Client) OrderGet(orderID ID) (*Order, error)

OrderGet gets all details of a specific order in an Ecwid store by its ID

func (*Client) OrderUpdate

func (c *Client) OrderUpdate(orderID ID, order *NewOrder) error

OrderUpdate update an existing order in an Ecwid store referring to its ID

func (*Client) Orders

func (c *Client) Orders(ctx context.Context, filter map[string]string) <-chan *Order

Orders 'iterable' by filtered store orders

func (*Client) OrdersSearch

func (c *Client) OrdersSearch(filter map[string]string) (*OrdersSearchResponse, error)

OrdersSearch search or filter orders in a store filter: keywords totalFrom totalTo createdFrom createdTo updatedFrom updatedTo couponCode orderId vendorOrderId email customerId paymentMethod shippingMethod paymentStatus fulfillmentStatus acceptMarketing refererId productId offset limit

func (*Client) OrdersTrampoline

func (c *Client) OrdersTrampoline(filter map[string]string, fn func(uint, *Order) error) error

OrdersTrampoline call on each order

func (*Client) ProductAdd

func (c *Client) ProductAdd(product *NewProduct) (ID, error)

ProductAdd creates a new product in an Ecwid store returns new productId

func (*Client) ProductDelete

func (c *Client) ProductDelete(productID ID) error

ProductDelete delete a product from an Ecwid store referring to its ID

func (*Client) ProductGet

func (c *Client) ProductGet(productID ID) (*Product, error)

ProductGet gets all details of a specific product in an Ecwid store by its ID

func (*Client) ProductImageDelete

func (c *Client) ProductImageDelete(productID ID) error

ProductImageDelete deletes the main image of a product in an Ecwid store

func (*Client) ProductImageGalleryDelete

func (c *Client) ProductImageGalleryDelete(productID, fieldID ID) error

ProductImageGalleryDelete deletes image from product gallery by image id

func (*Client) ProductImageGalleryDeleteAll

func (c *Client) ProductImageGalleryDeleteAll(productID ID) (uint, error)

ProductImageGalleryDeleteAll deletes all images from product gallery

func (*Client) ProductImageGalleryUpload

func (c *Client) ProductImageGalleryUpload(productID ID, image io.Reader, imageTitle string) (ID, error)

ProductImageGalleryUpload uploads image to product gallery from stream

func (*Client) ProductImageGalleryUploadByURL

func (c *Client) ProductImageGalleryUploadByURL(productID ID, imageURL, imageTitle string) (ID, error)

ProductImageGalleryUploadByURL uploads image to product gallery from external url

func (*Client) ProductImageGalleryUploadFile

func (c *Client) ProductImageGalleryUploadFile(productID ID, filename string, imageTitle string) (ID, error)

ProductImageGalleryUploadFile uploads image to product gallery from local file

func (*Client) ProductImageUpload

func (c *Client) ProductImageUpload(productID ID, image io.Reader) (ID, error)

ProductImageUpload uploads product image from stream

func (*Client) ProductImageUploadByURL

func (c *Client) ProductImageUploadByURL(productID ID, imageURL string) (ID, error)

ProductImageUploadByURL uploads product image from external resource

func (*Client) ProductImageUploadFile

func (c *Client) ProductImageUploadFile(productID ID, filename string) (ID, error)

ProductImageUploadFile uploads product image from local image file

func (*Client) ProductInventoryAdjust

func (c *Client) ProductInventoryAdjust(productID ID, quantityDelta int) (int, error)

ProductInventoryAdjust increase or decrease the product’s stock quantity by a delta quantity

func (*Client) ProductTypeAdd

func (c *Client) ProductTypeAdd(ProductType *ProductType) (ID, error)

ProductTypeAdd creates a new product type in an Ecwid store returns new productClassID

func (*Client) ProductTypeDelete

func (c *Client) ProductTypeDelete(productClassID ID) error

ProductTypeDelete deletes a specific product type and its assigned attributes. The products that belong to this type will not be removed. They will be re-assigned to the General type.

func (*Client) ProductTypeGet

func (c *Client) ProductTypeGet(productClassID ID) (*ProductType, error)

ProductTypeGet gets the full details of a specific product type referring to its ID

func (*Client) ProductTypeUpdate

func (c *Client) ProductTypeUpdate(productClassID ID, ProductType *ProductType) error

ProductTypeUpdate updates the details of a specific product type referring to its ID. If you need to update existing product attributes, refer to their IDs in your request. If you want to add new product attributes to existing product type, send your new attributes AND all existing attributes for that product type. Otherwise you will reset the existing attributes in that product type.

func (*Client) ProductTypesGet

func (c *Client) ProductTypesGet() (*ProductTypesResponse, error)

ProductTypesGet gets all product types present in an Ecwid store

func (*Client) ProductUpdate

func (c *Client) ProductUpdate(productID ID, product *NewProduct) error

ProductUpdate update an existing product in an Ecwid store referring to its ID

func (*Client) ProductVariationGet

func (c *Client) ProductVariationGet(productID, variationID ID) (*ProductVariation, error)

ProductVariationGet a specific product variation details referring to its ID

func (*Client) ProductVariationUpdate

func (c *Client) ProductVariationUpdate(productID, variationID ID, productVariation *NewProductVariation) error

ProductVariationUpdate update a specific product variation details referring to its ID

func (*Client) ProductVariationsGet

func (c *Client) ProductVariationsGet(productID ID) ([]ProductVariation, error)

ProductVariationsGet all variations of a specific product in an Ecwid store by its ID

func (*Client) Products

func (c *Client) Products(ctx context.Context, filter map[string]string) <-chan *Product

Products 'iterable' by filtered store products

func (*Client) ProductsSearch

func (c *Client) ProductsSearch(filter map[string]string) (*ProductsSearchResponse, error)

ProductsSearch search or filter products in a store catalog

func (*Client) ProductsTrampoline

func (c *Client) ProductsTrampoline(filter map[string]string, fn func(uint, *Product) error) error

ProductsTrampoline call on each product

func (*Client) StoreProfileGet

func (c *Client) StoreProfileGet() (*StoreProfile, error)

StoreProfileGet returns basic information about an Ecwid store: settings, store location, email, etc.

type CreditCardStatus

type CreditCardStatus struct {
	AVSMessage string `json:"avsMessage"` // Address verification status returned by the payment system.
	CVVMessage string `json:"cvvMessage"` // Credit card verification status returned by the payment system.
}

CreditCardStatus contains status of credit card payment

type DateTime

type DateTime string // TODO DateTime => time.Date + Marshal|Unmarshal|String

DateTime some like "2015-09-20 19:59:43 +0000"

type DiscountCouponCatalogLimit

type DiscountCouponCatalogLimit struct {
	ProductIDs  []ID `json:"products"`
	CategoryIDs []ID `json:"categories"`
}

DiscountCouponCatalogLimit contains products and categories IDs the coupon can be applied to

type DiscountCouponInfo

type DiscountCouponInfo struct {
	Name             string                     `json:"name"`             // Coupon title in store control panel
	Code             string                     `json:"code"`             // Coupon code
	Type             DiscountCouponType         `json:"discountType"`     // Discount type: ABS, PERCENT, SHIPPING, ABS_AND_SHIPPING, PERCENT_AND_SHIPPING
	Status           DiscountCouponStatus       `json:"status"`           // Discount coupon state: ACTIVE, PAUSED, EXPIRED or USEDUP
	Discount         float32                    `json:"discount"`         // Discount amount
	LaunchDate       string                     `json:"launchDate"`       // The date of coupon launch, e.g. 2014-06-06 08:00:00 +0000
	ExpirationDate   string                     `json:"expirationDate"`   // Coupon expiration date, e.g. 2014-06-06 08:00:00 +0000
	TotalLimit       float32                    `json:"totalLimit"`       // The minimum order subtotal the coupon applies to
	UsesLimit        DiscountCouponUseLimit     `json:"usesLimit"`        // Number of uses limitation: UNLIMITED, ONCEPERCUSTOMER, SINGLE
	ApplicationLimit string                     `json:"applicationLimit"` // Application limit for discount coupons. Possible values: "UNLIMITED", "NEW_CUSTOMER_ONLY", "REPEAT_CUSTOMER_ONLY"
	CreationDate     string                     `json:"creationDate"`     // Coupon creation date
	OrderCount       uint                       `json:"orderCount"`       // Number of uses
	CatalogLimit     DiscountCouponCatalogLimit `json:"catalogLimit"`     // Products and categories the coupon can be applied to
}

DiscountCouponInfo contains information about applied coupon

type DiscountCouponStatus

type DiscountCouponStatus string

DiscountCouponStatus ACTIVE, PAUSED, EXPIRED or USEDUP

const (
	DiscountCouponActive  DiscountCouponStatus = "ACTIVE"
	DiscountCouponPaused  DiscountCouponStatus = "PAUSED"
	DiscountCouponExpired DiscountCouponStatus = "EXPIRED"
	DiscountCouponUsedup  DiscountCouponStatus = "USEDUP"
)

DiscountCouponStatus statuses

type DiscountCouponType

type DiscountCouponType string

DiscountCouponType ABS, PERCENT, SHIPPING, ABS_AND_SHIPPING, PERCENT_AND_SHIPPING

const (
	DiscountCouponAbs                DiscountCouponType = "ABS"
	DiscountCouponPercent            DiscountCouponType = "PERCENT"
	DiscountCouponShipping           DiscountCouponType = "SHIPPING"
	DiscountCouponAbsAndShipping     DiscountCouponType = "ABS_AND_SHIPPING"
	DiscountCouponPercentAndShipping DiscountCouponType = "PERCENT_AND_SHIPPING"
)

DiscountCouponType types

type DiscountCouponUseLimit

type DiscountCouponUseLimit string

DiscountCouponUseLimit UNLIMITED, ONCEPERCUSTOMER, SINGLE

const (
	DiscountCouponUnlimited       DiscountCouponUseLimit = "UNLIMITED"
	DiscountCouponOncePerCustomer DiscountCouponUseLimit = "ONCEPERCUSTOMER"
	DiscountCouponSingle          DiscountCouponUseLimit = "SINGLE"
)

DiscountCouponUseLimit limits

type DiscountInfo

type DiscountInfo struct {
	Value       float32          `json:"value"`       // Discount value
	Type        DiscountInfoType `json:"type"`        // Discount type: ABS or PERCENT
	Base        DiscountInfoBase `json:"base"`        // Discount base, one of ON_TOTAL, ON_MEMBERSHIP, ON_TOTAL_AND_MEMBERSHIP, CUSTOM
	OrderTotal  float32          `json:"orderTotal"`  // Minimum order subtotal the discount applies to
	Description string           `json:"description"` // Description of a discount (for discounts with base == CUSTOM)
}

DiscountInfo contains information about applied discounts (coupons are not included)

type DiscountInfoBase

type DiscountInfoBase string

DiscountInfoBase ABS or PERCENT

const (
	DiscountInfoAbs     DiscountInfoBase = "ABS"
	DiscountInfoPercent DiscountInfoBase = "PERCENT"
)

DiscountInfoBase bases

type DiscountInfoType

type DiscountInfoType string

DiscountInfoType ON_TOTAL, ON_MEMBERSHIP, ON_TOTAL_AND_MEMBERSHIP, CUSTOM

const (
	DiscountInfoOnTotal              DiscountInfoType = "ON_TOTAL"
	DiscountInfoOnMembership         DiscountInfoType = "ON_MEMBERSHIP"
	DiscountInfoOnTotalAndMembership DiscountInfoType = "ON_TOTAL_AND_MEMBERSHIP"
	DiscountInfoCustom               DiscountInfoType = "CUSTOM"
)

DiscountInfoType types

type ExtraFieldsInfo

type ExtraFieldsInfo map[string]string

ExtraFieldsInfo Additional optional information about order. Total storage of extra fields cannot exceed 8Kb

type FulfillmentStatus

type FulfillmentStatus string

FulfillmentStatus type alias to string

const (
	FulfillmentAwaiting       FulfillmentStatus = "AWAITING_PROCESSING"
	FulfillmentProcessing     FulfillmentStatus = "PROCESSING"
	FulfillmentShipped        FulfillmentStatus = "SHIPPED"
	FulfillmentDelivered      FulfillmentStatus = "DELIVERED"
	FulfillmentWillNotDeliver FulfillmentStatus = "WILL_NOT_DELIVER"
	FulfillmentReturned       FulfillmentStatus = "RETURNED"
	FulfillmentReadyForPickup FulfillmentStatus = "READY_FOR_PICKUP"
)

Fulfillment statuses

type GeneralInfo

type GeneralInfo struct {
	StoreID     ID              `json:"storeId"`
	StoreURL    string          `json:"storeUrl"`
	StarterSite InstantSiteInfo `json:"starterSite"`
}

GeneralInfo - store basic data

type HandlingFeeInfo

type HandlingFeeInfo struct {
	Name        string  `json:"name"`        //	Handling fee name set by store admin. E.g. Wrapping
	Value       float32 `json:"value"`       //	Handling fee value
	Description string  `json:"description"` //	Handling fee description for customer
}

HandlingFeeInfo contains handling fee details

type ID

type ID uint64

ID object identifier. Like a NULL if zero or negative.

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal negative as zero

type ImageDetails

type ImageDetails struct {
	URL    string `json:"url"`
	Width  uint   `json:"width"`
	Height uint   `json:"height"`
}

ImageDetails is thumbnail image data. The thumbnail size is specified in the store settings.

type InstantSiteInfo

type InstantSiteInfo struct {
	EcwidSubdomain string `json:"ecwidSubdomain"`
	CustomDomain   string `json:"customDomain"`
	GeneratedURL   string `json:"generatedUrl"`
	StoreLogoURL   string `json:"storeLogoUrl"`
}

InstantSiteInfo - details of Ecwid Instant site for account

type ModifierType

type ModifierType string

ModifierType - price modifier type

const (
	ModifierPercent  ModifierType = "PERCENT"
	ModifierAbsolute ModifierType = "ABSOLUTE"
)

ModifierType types

type NewCategory

type NewCategory struct {
	Name        string        `json:"name,omitempty"`
	ParentID    ID            `json:"parentId"`
	OrderBy     int           `json:"orderBy"`
	Description template.HTML `json:"description,omitempty"`
	Enabled     bool          `json:"enabled"`
	ProductIDs  []ID          `json:"productIds,omitempty"`
}

NewCategory https://developers.ecwid.com/api-documentation/categories#add-new-category

type NewOrder

type NewOrder struct {
	Subtotal                        float32             `json:"subtotal,omitempty"`
	Total                           float32             `json:"total,omitempty"`
	Email                           string              `json:"email,omitempty"`
	PaymentMethod                   string              `json:"paymentMethod,omitempty"`
	PaymentModule                   string              `json:"paymentModule,omitempty"`
	Tax                             float32             `json:"tax,omitempty"`
	CustomerTaxExempt               bool                `json:"customerTaxExempt,omitempty"`
	CustomerTaxID                   string              `json:"customerTaxId,omitempty"`
	CustomerTaxIDValid              bool                `json:"customerTaxIdValid,omitempty"`
	ReversedTaxApplied              bool                `json:"reversedTaxApplied,omitempty"`
	IPAddress                       string              `json:"ipAddress,omitempty"`
	CouponDiscount                  float32             `json:"couponDiscount,omitempty"`
	PaymentStatus                   PaymentStatus       `json:"paymentStatus,omitempty"`
	FulfillmentStatus               FulfillmentStatus   `json:"fulfillmentStatus,omitempty"`
	RefererURL                      string              `json:"refererUrl,omitempty"`
	OrderComments                   string              `json:"orderComments,omitempty"`
	VolumeDiscount                  float32             `json:"volumeDiscount,omitempty"`
	CustomerID                      ID                  `json:"customerId,omitempty"`
	Hidden                          bool                `json:"hidden,omitempty"`
	MembershipBasedDiscount         float32             `json:"membershipBasedDiscount,omitempty"`
	TotalAndMembershipBasedDiscount float32             `json:"totalAndMembershipBasedDiscount,omitempty"`
	Discount                        float32             `json:"discount,omitempty"`
	GlobalReferer                   string              `json:"globalReferer,omitempty"`
	CreateDate                      DateTime            `json:"createDate,omitempty"`
	CustomerGroup                   string              `json:"customerGroup,omitempty"`
	DiscountCoupon                  *DiscountCouponInfo `json:"discountCoupon,omitempty"`
	Items                           []*OrderItem        `json:"items,omitempty"`
	BillingPerson                   *PersonInfo         `json:"billingPerson,omitempty"`
	ShippingPerson                  *PersonInfo         `json:"shippingPerson,omitempty"`
	ShippingOption                  *ShippingOptionInfo `json:"shippingOption,omitempty"`
	HandlingFee                     *HandlingFeeInfo    `json:"handlingFee,omitempty"`
	AdditionalInfo                  map[string]string   `json:"additionalInfo,omitempty"`
	PaymentParams                   map[string]string   `json:"paymentParams,omitempty"`
	DiscountInfo                    []*DiscountInfo     `json:"discountInfo,omitempty"`
	TrackingNumber                  string              `json:"trackingNumber,omitempty"`
	PaymentMessage                  string              `json:"paymentMessage,omitempty"`
	ExternalTransactionID           string              `json:"externalTransactionId,omitempty"`
	AffiliateID                     string              `json:"affiliateId,omitempty"`
	CreditCardStatus                *CreditCardStatus   `json:"creditCardStatus,omitempty"`
	PrivateAdminNotes               string              `json:"privateAdminNotes,omitempty"`
	PickupTime                      DateTime            `json:"pickupTime,omitempty"`
	AcceptMarketing                 bool                `json:"acceptMarketing,omitempty"`
	DisableAllCustomerNotifications bool                `json:"disableAllCustomerNotifications,omitempty"`
	ExternalFulfillment             bool                `json:"externalFulfillment,omitempty"`
	ExternalOrderID                 string              `json:"externalOrderId,omitempty"`
}

NewOrder https://developers.ecwid.com/api-documentation/orders#create-order

type NewProduct

type NewProduct struct {
	Name                  string             `json:"name,omitempty"` // mandatory for ProductAdd
	Sku                   string             `json:"sku,omitempty"`
	Quantity              int                `json:"quantity"`
	Unlimited             bool               `json:"unlimited"`
	Price                 float32            `json:"price,omitempty"`
	CompareToPrice        float32            `json:"compareToPrice,omitempty"`
	IsShippingRequired    bool               `json:"isShippingRequired"`
	Weight                float32            `json:"weight,omitempty"`
	ProductClassID        ID                 `json:"productClassId"`
	Created               DateTime           `json:"created,omitempty"`
	Enabled               bool               `json:"enabled"`
	WarningLimit          uint               `json:"warningLimit"`
	FixedShippingRateOnly bool               `json:"fixedShippingRateOnly"`
	FixedShippingRate     float32            `json:"fixedShippingRate,omitempty"`
	Description           template.HTML      `json:"description,omitempty"`
	SeoTitle              string             `json:"seoTitle,omitempty"`
	SeoDescription        string             `json:"seoDescription,omitempty"`
	DefaultCategoryID     ID                 `json:"defaultCategoryId"`
	ShowOnFrontpage       int                `json:"showOnFrontpage,omitempty"`
	CategoryIDs           []ID               `json:"categoryIds,omitempty"`
	WholesalePrices       []WholesalePrice   `json:"wholesalePrices,omitempty"`
	Options               []ProductOption    `json:"options,omitempty"`
	Attributes            Attributes         `json:"attributes,omitempty"`
	Tax                   *TaxInfo           `json:"tax"`
	Shipping              *ShippingSettings  `json:"shipping"`
	RelatedProducts       *RelatedProducts   `json:"relatedProducts"`
	Dimensions            *ProductDimensions `json:"dimensions"`
	Media                 *ProductMedia      `json:"media"` // ProductUpdate, ProductGet ProductsSearch

}

NewProduct https://developers.ecwid.com/api-documentation/products#add-a-product

type NewProductVariation

type NewProductVariation struct {
	Sku                string  `json:"sku,omitempty"`
	Quantity           uint    `json:"quantity"`
	Unlimited          bool    `json:"unlimited"`
	Price              float32 `json:"price,omitempty"`
	Weight             float32 `json:"weight,omitempty"`
	WarningLimit       uint    `json:"warningLimit"`
	CompareToPrice     float32 `json:"compareToPrice,omitempty"`
	IsShippingRequired bool    `json:"isShippingRequired"`

	Options         []OptionValue    `json:"options,omitempty"`
	WholesalePrices []WholesalePrice `json:"wholesalePrices,omitempty"`
	Attributes      Attributes       `json:"attributes,omitempty"`
}

NewProductVariation ...

type OptionValue

type OptionValue struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

OptionValue is set of options that identifies this variation.

type Order

type Order struct {
	NewOrder
	OrderID           ID               `json:"orderNumber"`
	VendorOrderNumber string           `json:"vendorOrderNumber"`
	USDTotal          float32          `json:"usdTotal"`
	UpdateDate        DateTime         `json:"updateDate"`
	CreateTimestamp   uint64           `json:"createTimestamp"`
	UpdateTimestamp   uint64           `json:"updateTimestamp"`
	CustomerGroupID   ID               `json:"customerGroupId"`
	PredictedPackages PredictedPackage `json:"predictedPackages"`
	ExtraFields       ExtraFieldsInfo  `json:"extraFields,omitempty"`
	RefundedAmount    float32          `json:"refundedAmount"`
	Refunds           []RefundsInfo    `json:"refunds"`
	RefererID         string           `json:"refererId"`
	TaxesOnShipping   []TaxOnShipping  `json:"taxesOnShipping,omitempty"` // only in Get ???
}

Order https://developers.ecwid.com/api-documentation/orders#get-order-details

type OrderItem

type OrderItem struct {
	Name                  string            `json:"name"`
	Quantity              uint              `json:"quantity"`
	ProductID             ID                `json:"productId"`
	CategoryID            ID                `json:"categoryId"`
	Price                 float32           `json:"price"`
	ProductPrice          float32           `json:"productPrice"`
	Weight                float32           `json:"weight"`
	Sku                   string            `json:"sku"`
	ShortDescription      string            `json:"shortDescription"`
	Tax                   float32           `json:"tax"`
	Shipping              float32           `json:"shipping"`
	QuantityInStock       uint              `json:"quantityInStock"`
	IsShippingRequired    bool              `json:"isShippingRequired"`
	TrackQuantity         bool              `json:"trackQuantity"`
	FixedShippingRateOnly bool              `json:"fixedShippingRateOnly"`
	FixedShippingRate     float32           `json:"fixedShippingRate"`
	Digital               bool              `json:"digital"`
	CouponApplied         bool              `json:"couponApplied"`
	SelectedOptions       []OrderItemOption `json:"selectedOptions"`
	Taxes                 []OrderItemTax    `json:"taxes"`
	Dimensions            ProductDimensions `json:"dimensions"`
}

OrderItem contains order items

type OrderItemOption

type OrderItemOption struct {
	Name       string                `json:"name"`
	Type       string                `json:"type"`
	Value      string                `json:"value"`
	Files      []OrderItemOptionFile `json:"files"`
	Selections []SelectionInfo       `json:"selections"`
}

OrderItemOption contains product options values selected by the customer

type OrderItemOptionFile

type OrderItemOptionFile struct {
	ID   ID     `json:"id"`
	Name string `json:"name"`
	Size uint   `json:"size"`
	URL  string `json:"url"`
}

OrderItemOptionFile contains Attached files if OrderOptionType is FILES

type OrderItemTax

type OrderItemTax struct {
	Name                    string  `json:"name"`
	Value                   float32 `json:"value"`
	Total                   float32 `json:"total"`
	TaxOnDiscountedSubtotal float32 `json:"taxOnDiscountedSubtotal"`
	TaxOnShipping           float32 `json:"taxOnShipping"`
	IncludeInPrice          bool    `json:"includeInPrice"`
}

OrderItemTax - taxes applied to this order item

type OrderOptionType

type OrderOptionType string

OrderOptionType of OrderItemOption

const (
	OptionChoice  OrderOptionType = "CHOICE"  // dropdown or radio button
	OptionChoices OrderOptionType = "CHOICES" // checkboxes
	OptionText    OrderOptionType = "TEXT"    // text input and text area
	OptionDate    OrderOptionType = "DATE"    // date/time
	OptionFiles   OrderOptionType = "FILES"   // upload file option
)

OrderOptionType types

type OrdersSearchResponse

type OrdersSearchResponse struct {
	SearchResponse
	Items []*Order `json:"items"`
}

OrdersSearchResponse https://developers.ecwid.com/api-documentation/orders#search-orders

type PaymentStatus

type PaymentStatus string

PaymentStatus type alias to string

const (
	PaymentAwaiting          PaymentStatus = "AWAITING_PAYMENT"
	PaymentPaid              PaymentStatus = "PAID"
	PaymentCancelled         PaymentStatus = "CANCELLED"
	PaymentRefunded          PaymentStatus = "REFUNDED"
	PaymentPartiallyRefunded PaymentStatus = "PARTIALLY_REFUNDED"
	PaymentIncomplete        PaymentStatus = "INCOMPLETE"
)

Payment statuses

type PersonInfo

type PersonInfo struct {
	Name                string `json:"name"`                // Full name
	CompanyName         string `json:"companyName"`         // Company name
	Street              string `json:"street"`              // Address line 1 and address line 2, separated by ’\n’
	City                string `json:"city"`                // City
	CountryCode         string `json:"countryCode"`         // Two-letter country code
	CountryName         string `json:"countryName"`         // Country name
	PostalCode          string `json:"postalCode"`          // Postal/ZIP code
	StateOrProvinceCode string `json:"stateOrProvinceCode"` // State code, e.g. NY
	StateOrProvinceName string `json:"stateOrProvinceName"` // State/province name, e.g. New York
	Phone               string `json:"phone"`               // Phone number
}

PersonInfo contains name and address of the customer

type PredictedPackage

type PredictedPackage struct {
	ProductDimensions
	Weight        float32 `json:"weight"`        // Total weight of a predicted package
	DeclaredValue float32 `json:"declaredValue"` // Declared value of a predicted package (subtotal of items in package)
}

PredictedPackage contains predicted information about the package to ship items in to customer

type Product

type Product struct {
	NewProduct
	ID                                     ID                 `json:"id"`
	InStock                                bool               `json:"inStock"`
	DefaultDisplayedPrice                  float32            `json:"defaultDisplayedPrice"`
	DefaultDisplayedPriceFormatted         string             `json:"defaultDisplayedPriceFormatted"`
	CompareToPriceFormatted                string             `json:"compareToPriceFormatted"`
	CompareToPriceDiscount                 float32            `json:"compareToPriceDiscount"`
	CompareToPriceDiscountFormatted        string             `json:"compareToPriceDiscountFormatted"`
	CompareToPriceDiscountPercent          float32            `json:"compareToPriceDiscountPercent"`
	CompareToPriceDiscountPercentFormatted string             `json:"compareToPriceDiscountPercentFormatted"`
	URL                                    string             `json:"url"`
	Updated                                DateTime           `json:"updated"`
	CreateTimestamp                        uint64             `json:"createTimestamp"`
	UpdateTimestamp                        uint64             `json:"updateTimestamp"`
	DefaultCombinationID                   ID                 `json:"defaultCombinationId"`
	IsSampleProduct                        bool               `json:"isSampleProduct"`
	Combinations                           []ProductVariation `json:"combinations"`
	Categories                             []CategoriesInfo   `json:"categories"`
}

Product https://developers.ecwid.com/api-documentation/products#get-a-product

type ProductDimensions

type ProductDimensions struct {
	Length float32 `json:"length"`
	Width  float32 `json:"width"`
	Height float32 `json:"height"`
}

ProductDimensions is product dimensions info

type ProductImage

type ProductImage struct {
	ID               *string `json:"id"`
	OrderBy          *uint   `json:"orderBy"`
	IsMain           *bool   `json:"isMain"`
	Image160pxURL    string  `json:"image160pxUrl,omitempty"`
	Image400pxURL    string  `json:"image400pxUrl,omitempty"`
	Image800pxURL    string  `json:"image800pxUrl,omitempty"`
	Image1500pxURL   string  `json:"image1500pxUrl,omitempty"`
	ImageOriginalURL string  `json:"imageOriginalUrl,omitempty"`
}

ProductImage contains images of product and their details

type ProductMedia

type ProductMedia struct {
	Images []ProductImage `json:"images,omitempty"`
}

ProductMedia contains media files for a product (images)

type ProductOption

type ProductOption struct {
	Type          ProductOptionType     `json:"type,omitempty"` // TODO One of SELECT, RADIO, CHECKBOX, TEXTFIELD, TEXTAREA, DATE, FILES
	Name          string                `json:"name,omitempty"`
	Required      bool                  `json:"required"`
	Choices       []ProductOptionChoice `json:"choices,omitempty"`
	DefaultChoice uint                  `json:"defaultChoice"`
}

ProductOption ...

type ProductOptionChoice

type ProductOptionChoice struct {
	Text              string       `json:"text,omitempty"`
	PriceModifier     int          `json:"priceModifier"`
	PriceModifierType ModifierType `json:"priceModifierType,omitempty"`
}

ProductOptionChoice - possible option selections for the types SELECT, CHECKBOX or RADIO. This field is omitted for the product option with no selection (e.g. text, datepicker or upload file options)

type ProductOptionType

type ProductOptionType string

ProductOptionType ...

const (
	ProductOptionSelect    ProductOptionType = "SELECT"
	ProductOptionRadio     ProductOptionType = "RADIO"
	ProductOptionCheckbox  ProductOptionType = "CHECKBOX"
	ProductOptionTextfield ProductOptionType = "TEXTFIELD"
	ProductOptionTextarea  ProductOptionType = "TEXTAREA"
	ProductOptionDate      ProductOptionType = "DATE"
	ProductOptionFiles     ProductOptionType = "FILES"
)

ProductOptionType types

type ProductType

type ProductType struct {
	ID         ID         `json:"id,omitempty"` // mandatory for update
	Name       string     `json:"name,omitempty"`
	Attributes Attributes `json:"attributes,omitempty"`
}

ProductType https://developers.ecwid.com/api-documentation/product-types#get-product-type

type ProductVariation

type ProductVariation struct {
	*NewProductVariation
	ID                ID   `json:"id"`
	CombinationNumber uint `json:"combinationNumber"`

	ThumbnailURL      string `json:"thumbnailUrl,omitempty"`
	ImageURL          string `json:"imageUrl,omitempty"`
	SmallThumbnailURL string `json:"smallThumbnailUrl,omitempty"`
	HdThumbnailURL    string `json:"hdThumbnailUrl,omitempty"`
	OriginalImageURL  string `json:"originalImageUrl,omitempty"`
}

ProductVariation ...

type ProductsSearchResponse

type ProductsSearchResponse struct {
	SearchResponse
	Items []*Product `json:"items"`
}

ProductsSearchResponse https://developers.ecwid.com/api-documentation/products#search-products

type RefundsInfo

type RefundsInfo struct {
	Date   DateTime `json:"date"`   //The date/time of a refund, e.g 2014-06-06 18:57:19 +0000
	Source string   `json:"source"` //What action triggered refund. Possible values: "CP" - changed my merchant in Ecwid CP, "API" - changed by another app, "External" - refund made from payment processor website
	Reason string   `json:"reason"` //A text reason for a refund. 256 characters max
	Amount float32  `json:"amount"` //Amount of this specific refund (not total amount refunded for order. see redundedAmount field)
}

RefundsInfo contains description of all refunds made to order

type RelatedCategory

type RelatedCategory struct {
	Enabled      bool `json:"enabled"`
	CategoryID   ID   `json:"categoryId"`
	ProductCount uint `json:"productCount"`
}

RelatedCategory describes the “N random related products from a category” option

type RelatedProducts

type RelatedProducts struct {
	ProductIDs      []ID            `json:"productIds,omitempty"`
	RelatedCategory RelatedCategory `json:"relatedCategory"`
}

RelatedProducts related or “You may also like” products of the product

type SearchResponse

type SearchResponse struct {
	Total  uint `json:"total"`
	Count  uint `json:"count"`
	Offset uint `json:"offset"`
	Limit  uint `json:"limit"`
}

SearchResponse - common parts of all search funcs

type SelectionInfo

type SelectionInfo struct {
	SelectionTitle        string       `json:"selectionTitle"`
	SelectionModifier     float32      `json:"selectionModifier"` // Money or Percent
	SelectionModifierType ModifierType `json:"selectionModifierType"`
}

SelectionInfo contains details of selected product options. If sent in update order request, other fields will be regenerated based on information in this field

type ShippingOptionInfo

type ShippingOptionInfo struct {
	ShippingCarrierName  string  `json:"shippingCarrierName"`  // Optional. Is present for orders made with carriers, e.g. USPS or shipping applications.
	ShippingMethodName   string  `json:"shippingMethodName"`   // Shipping option name
	ShippingRate         float32 `json:"shippingRate"`         // Rate
	EstimatedTransitTime string  `json:"estimatedTransitTime"` // Delivery time estimation. Possible formats: number “5”, several days estimate “4-9”
	IsPickup             bool    `json:"isPickup"`             // true if selected shipping option is local pickup. false otherwise
	PickupInstruction    string  `json:"pickupInstruction"`    // Instruction for customer on how to receive their products
}

ShippingOptionInfo contains information about selected shipping option

type ShippingSettings

type ShippingSettings struct {
	Type            ShippingSettingsType `json:"type,omitempty"` // TODO One of: "GLOBAL_METHODS", "SELECTED_METHODS", "FLAT_RATE", "FREE_SHIPPING". "GLOBAL_METHODS"
	MethodMarkup    float32              `json:"methodMarkup,omitempty"`
	FlatRate        float32              `json:"flatRate,omitempty"`
	DisabledMethods []string             `json:"disabledMethods,omitempty"`
	EnabledMethods  []string             `json:"enabledMethods,omitempty"`
}

ShippingSettings of product

type ShippingSettingsType

type ShippingSettingsType string

ShippingSettingsType ...

const (
	ShippingSettingGlobalMethods   ShippingSettingsType = "GLOBAL_METHODS"
	ShippingSettingSelectedMethods ShippingSettingsType = "SELECTED_METHODS"
	ShippingSettingFlatFate        ShippingSettingsType = "FLAT_RATE"
	ShippingSettingFreeShipping    ShippingSettingsType = "FREE_SHIPPING"
)

ShippingSettingsType types

type StoreProfile

type StoreProfile struct {
	GeneralInfo GeneralInfo `json:"generalInfo"`
	Account     Account     `json:"account"`
}

StoreProfile contains a basic information about an Ecwid store: settings, store location, email, etc.

type TaxInfo

type TaxInfo struct {
	DefaultLocationIncludedTaxRate uint `json:"defaultLocationIncludedTaxRate"` // ???
	EnabledManualTaxes             []ID `json:"enabledManualTaxes,omitempty"`
}

TaxInfo contains detailed information about product’s taxes

type TaxOnShipping

type TaxOnShipping struct {
	Name  string  `json:"name"`
	Value float32 `json:"value"`
	Total float32 `json:"total"`
}

TaxOnShipping taxes applied to shipping 'as is’. null for old orders, [] for orders with taxes applied to subtotal only. Are not recalculated if order is updated later manually. Is calculated like: (shippingRate + handlingFee)*(taxValue/100)

type Timestamp

type Timestamp uint64 // TODO Timestamp => time.Date + Marshal|Unmarshal|String

Timestamp is unix timestamp

type WholesalePrice

type WholesalePrice struct {
	Quantity uint    `json:"quantity"`
	Price    float32 `json:"price,omitempty"`
}

WholesalePrice is element of array of variation’s wholesale price tiers (quantity limit and price).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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