Documentation
¶
Overview ¶
Package goshopee provides methods for making requests to Shopee's Open API.
Index ¶
- Constants
- func CheckResponseError(r *http.Response) error
- func MakeAuthToken(url, requestBody, pKey string) string
- func ToMapData(in interface{}) (map[string]interface{}, error)
- func VerifyPushMsg(url, requestBody, pKey, authorization string) (result bool)
- type AddVariationsReponse
- type AddVariationsRequest
- type Address
- type App
- type Attribute
- type AttributeAdded
- type Branch
- type Client
- func (c *Client) AuthURL() string
- func (c *Client) CreateAndDo(method, relPath string, data, options, resource interface{}) error
- func (c *Client) Delete(path string) error
- func (c *Client) Get(path string, resource, options interface{}) error
- func (c *Client) NewRequest(method, relPath string, body, options interface{}) (*http.Request, error)
- func (c *Client) Post(path string, data, resource interface{}) error
- func (c *Client) Put(path string, data, resource interface{}) error
- func (c *Client) Token() string
- type DaysToShipLimits
- type DeleteVariationRequest
- type DeleteVariationResponse
- type Discount
- type DiscountActionResponse
- type DiscountItem
- type DiscountResponse
- type DiscountResponseError
- type DiscountService
- type DiscountServiceOp
- func (s *DiscountServiceOp) AddDiscount(sid uint64, req map[string]interface{}) (*DiscountResponse, error)
- func (s *DiscountServiceOp) AddDiscountItem(sid, discountID uint64, req map[string]interface{}) (*DiscountResponse, error)
- func (s *DiscountServiceOp) DeleteDiscount(sid, discountID uint64) (*DiscountActionResponse, error)
- func (s *DiscountServiceOp) DeleteDiscountItem(sid, discountID, itemID, variationID uint64) (*DiscountActionResponse, error)
- func (s *DiscountServiceOp) UpdateDiscount(sid, discountID uint64, req map[string]interface{}) (*DiscountActionResponse, error)
- func (s *DiscountServiceOp) UpdateDiscountItems(sid, discountID uint64, req map[string]interface{}) (*DiscountResponse, error)
- type DiscountVariation
- type Error
- type GetLogisticInfoResponse
- type GetLogisticInfoResponseDropoff
- type GetLogisticInfoResponsePickup
- type Image
- type Item
- type ItemAttribute
- type ItemAttributeService
- type ItemAttributeServiceOp
- type ItemAttributeValue
- type ItemAttributesResponse
- type ItemBase
- type ItemCategoriesResponse
- type ItemCategory
- type ItemCategoryService
- type ItemCategoryServiceOp
- type ItemDeleteResponse
- type ItemDetailResponse
- type ItemOper
- type ItemOperResponse
- type ItemPriceOper
- type ItemPriceOperResponse
- type ItemResponse
- type ItemService
- type ItemServiceOp
- func (s *ItemServiceOp) AddTierVariation(sid, itemid uint64, variations []TierVariationOperDef) ([]Variation, error)
- func (s *ItemServiceOp) Count(interface{}) (int, error)
- func (s *ItemServiceOp) Create(newItem ItemOper) (*Item, error)
- func (s *ItemServiceOp) Delete(sid, itemid uint64) error
- func (s *ItemServiceOp) Get(sid, itemid uint64) (*Item, error)
- func (s *ItemServiceOp) GetVariations(sid, itemid uint64) ([]TierVariation, []Variation, error)
- func (s *ItemServiceOp) InitTierVariation(sid, itemid uint64, tierVariations []TierVariation, ...) ([]Variation, error)
- func (s *ItemServiceOp) List(options interface{}) ([]Item, error)
- func (s *ItemServiceOp) ListWithPagination(sid uint64, offset, limit uint32, options interface{}) ([]Item, *Pagination, error)
- func (s *ItemServiceOp) UnlistItem(sid, itemid uint64, unlist bool) ([]UnlistItemSuccess, []UnlistItemFailed, error)
- func (s *ItemServiceOp) Update(updItem ItemBase) (*Item, error)
- func (s *ItemServiceOp) UpdatePrice(sid, itemid uint64, price float64) (*ItemPriceOper, error)
- func (s *ItemServiceOp) UpdateStock(sid, itemid uint64, stock uint32) (*ItemStockOper, error)
- func (s *ItemServiceOp) UpdateTierVariationIndex(sid, itemid uint64, variations []TierVariationIndexOperDef) error
- func (s *ItemServiceOp) UpdateTierVariationList(sid, itemid uint64, tierVariations []TierVariation) error
- type ItemStockOper
- type ItemStockOperResponse
- type ItemsResponse
- type LeveledLogger
- type LeveledLoggerInterface
- type ListReponse
- type Logistic
- type LogisticInitResponse
- type LogisticService
- type LogisticServiceOp
- func (s *LogisticServiceOp) GetLogisticInfo(sid uint64, ordersn string) (*GetLogisticInfoResponse, error)
- func (s *LogisticServiceOp) GetParameterForInit(sid uint64, ordersn string) (*map[string]interface{}, error)
- func (s *LogisticServiceOp) Init(sid uint64, ordersn string, params map[string]interface{}) (string, error)
- func (s *LogisticServiceOp) List(sid uint64) ([]Logistic, error)
- type Option
- type Order
- type OrderCancelResponse
- type OrderItem
- type OrderService
- type OrderServiceOp
- func (s *OrderServiceOp) Cancel(sid uint64, ordersn, reason string, options map[string]interface{}) error
- func (s *OrderServiceOp) Count(interface{}) (int, error)
- func (s *OrderServiceOp) Create(Order) (*Order, error)
- func (s *OrderServiceOp) Delete(int64) error
- func (s *OrderServiceOp) Get(sid uint64, ordersn string) (*Order, error)
- func (s *OrderServiceOp) GetMulti(sid uint64, orders []string) ([]Order, []string, error)
- func (s *OrderServiceOp) List(sid uint64) ([]Order, error)
- func (s *OrderServiceOp) ListWithPagination(sid uint64, offset, limit uint32, options map[string]interface{}) ([]Order, *Pagination, error)
- func (s *OrderServiceOp) Update(Order) (*Order, error)
- type OrdersDetailResponse
- type OrdersResponse
- type Pagination
- type RateLimitError
- type RateLimitInfo
- type RecipientAddress
- type ResponseDecodingError
- type ResponseError
- type SIPAffiliateShop
- type Shop
- type ShopService
- type ShopServiceOp
- type TierVariation
- type TierVariationIndexOperDef
- type TierVariationOperDef
- type TierVariationOperResponse
- type UnlistItemFailed
- type UnlistItemSuccess
- type UnlistResponse
- type UpdateVariationPriceRequest
- type UpdateVariationPriceResponse
- type UpdateVariationStockRequest
- type UpdateVariationStockResponse
- type Variation
- type VariationPriceRequest
- type VariationPriceResponse
- type VariationPriceResponseBatchResult
- type VariationPriceResponseBatchResultFailure
- type VariationPriceResponseBatchResultModification
- type VariationService
- type VariationServiceOp
- func (s *VariationServiceOp) Create(sid, itemID uint64, newItem Variation) (*Variation, error)
- func (s *VariationServiceOp) Delete(sid, itemID, variationID uint64) error
- func (s *VariationServiceOp) UpdateVariationPrice(sid, itemID uint64, updItem Variation) (*Variation, error)
- func (s *VariationServiceOp) UpdateVariationPriceBatch(sid uint64, params []VariationPriceRequest) (*VariationPriceResponse, error)
- func (s *VariationServiceOp) UpdateVariationStock(sid, itemID uint64, updItem Variation) (*Variation, error)
- type Wholesale
Constants ¶
const ( LevelError = iota + 1 LevelWarn LevelInfo LevelDebug )
const (
UserAgent = "goshopee/1.0.0"
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponseError ¶
func MakeAuthToken ¶
func VerifyPushMsg ¶
Types ¶
type AddVariationsReponse ¶
type AddVariationsRequest ¶
type App ¶
type App struct { PartnerID int // `env:"SHOPEE_PARTNER_ID"` PartnerKey string // `env:"SHOPEE_PARTNER_KEY"` AuthURL string // `env:"SHOPEE_AUTH_URL"` RedirectURL string // `env:"SHOPEE_REDIRECT_URL"` APIURL string // `env:"SHOPEE_API_URL"` Client *Client }
App represents basic app settings such as Api key, secret, scope, and redirect url. See oauth.go for OAuth related helper functions.
type AttributeAdded ¶
type Client ¶
type Client struct { Client *http.Client RateLimits RateLimitInfo // Services used for communicating with the API Shop ShopService Item ItemService Variation VariationService ItemCategory ItemCategoryService ItemAttribute ItemAttributeService Order OrderService Logistic LogisticService Discount DiscountService // contains filtered or unexported fields }
Client manages communication with the Shopify API.
func NewClient ¶
NewClient returns a new Shopify API client with an already authenticated shopname and token. The shopName parameter is the shop's myshopify domain, e.g. "theshop.myshopify.com", or simply "theshop" a.NewClient(shopName, token, opts) is equivalent to NewClient(a, shopName, token, opts)
func (*Client) CreateAndDo ¶
CreateAndDo performs a web request to Shopify with the given method (GET, POST, PUT, DELETE) and relative path (e.g. "/admin/orders.json"). The data, options and resource arguments are optional and only relevant in certain situations. If the data argument is non-nil, it will be used as the body of the request for POST and PUT requests. The options argument is used for specifying request options such as search parameters like created_at_min Any data returned from Shopify will be marshalled into resource argument.
func (*Client) Get ¶
Get performs a GET request for the given path and saves the result in the given resource.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, relPath string, body, options interface{}) (*http.Request, error)
Creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
func (*Client) Post ¶
Post performs a POST request for the given path and saves the result in the given resource.
type DaysToShipLimits ¶
type DeleteVariationRequest ¶
type DeleteVariationResponse ¶
type DiscountActionResponse ¶
type DiscountItem ¶
type DiscountItem struct { ID uint64 `json:"item_id"` Name string `json:"item_name"` PurchaseLimit uint32 `json:"purchase_limit"` OriginalPrice float64 `json:"item_original_price"` PromotionPrice float64 `json:"item_promotion_price"` Stock uint32 `json:"stock"` InflatedOriginalPrice float64 `json:"item_inflated_original_price"` InflatedPromotionPrice float64 `json:"item_inflated_promotion_price"` Variations []DiscountVariation `json:"variations"` }
type DiscountResponse ¶
type DiscountResponse struct { DiscountID uint64 `json:"discount_id"` Count uint32 `json:"count"` Warning string `json:"warning"` RequestID string `json:"request_id"` Errors []DiscountResponseError `json:"errors"` }
type DiscountResponseError ¶
type DiscountService ¶
type DiscountService interface { AddDiscount(uint64, map[string]interface{}) (*DiscountResponse, error) DeleteDiscount(uint64, uint64) (*DiscountActionResponse, error) AddDiscountItem(uint64, uint64, map[string]interface{}) (*DiscountResponse, error) DeleteDiscountItem(uint64, uint64, uint64, uint64) (*DiscountActionResponse, error) UpdateDiscount(uint64, uint64, map[string]interface{}) (*DiscountActionResponse, error) UpdateDiscountItems(uint64, uint64, map[string]interface{}) (*DiscountResponse, error) }
DiscountService: https://open.shopee.com/documents?module=1&type=1&id=361&version=1
type DiscountServiceOp ¶
type DiscountServiceOp struct {
// contains filtered or unexported fields
}
DiscountServiceOp handles communication with the product related methods of the Shopee API.
func (*DiscountServiceOp) AddDiscount ¶
func (s *DiscountServiceOp) AddDiscount(sid uint64, req map[string]interface{}) (*DiscountResponse, error)
func (*DiscountServiceOp) AddDiscountItem ¶
func (s *DiscountServiceOp) AddDiscountItem(sid, discountID uint64, req map[string]interface{}) (*DiscountResponse, error)
func (*DiscountServiceOp) DeleteDiscount ¶
func (s *DiscountServiceOp) DeleteDiscount(sid, discountID uint64) (*DiscountActionResponse, error)
func (*DiscountServiceOp) DeleteDiscountItem ¶
func (s *DiscountServiceOp) DeleteDiscountItem(sid, discountID, itemID, variationID uint64) (*DiscountActionResponse, error)
func (*DiscountServiceOp) UpdateDiscount ¶
func (s *DiscountServiceOp) UpdateDiscount(sid, discountID uint64, req map[string]interface{}) (*DiscountActionResponse, error)
func (*DiscountServiceOp) UpdateDiscountItems ¶
func (s *DiscountServiceOp) UpdateDiscountItems(sid, discountID uint64, req map[string]interface{}) (*DiscountResponse, error)
type DiscountVariation ¶
type DiscountVariation struct { ID uint64 `json:"variation_id"` Name string `json:"variation_name"` OriginalPrice float64 `json:"variation_original_price"` PromotionPrice float64 `json:"variation_promotion_price"` Stock uint32 `json:"variation_stock"` InflatedOriginalPrice float64 `json:"variation_inflated_original_price"` InflatedPromotionPrice float64 `json:"variation_inflated_promotion_price"` }
type Error ¶
type Error struct { RequestID string `json:"request_id"` Error string `json:"error"` Message string `json:"msg"` }
Error {"msg": "package_width should bigger than 1", "request_id": "2894fe4fc158a114ea4bfbbd391820c4", "error": "error_param"}
type GetLogisticInfoResponse ¶
type GetLogisticInfoResponse struct { Pickup GetLogisticInfoResponsePickup `json:"pickup"` Dropoff GetLogisticInfoResponseDropoff `json:"dropoff"` InfoNeeded map[string][]string `json:"info_needed"` RequestID string `json:"request_id"` }
type GetLogisticInfoResponseDropoff ¶
type GetLogisticInfoResponseDropoff struct {
BranchList []Branch `json:"branch_list"`
}
type GetLogisticInfoResponsePickup ¶
type GetLogisticInfoResponsePickup struct {
AddressList []Address `json:"address_list"`
}
type ItemAttribute ¶
type ItemAttributeService ¶
type ItemAttributeService interface {
List(cid uint64, options map[string]interface{}) ([]ItemAttribute, error)
}
type ItemAttributeServiceOp ¶
type ItemAttributeServiceOp struct {
// contains filtered or unexported fields
}
ItemAttributeServiceOp handles communication with the product related methods of the Shopee API.
func (*ItemAttributeServiceOp) List ¶
func (s *ItemAttributeServiceOp) List(cid uint64, options map[string]interface{}) ([]ItemAttribute, error)
List xxx
type ItemAttributeValue ¶
type ItemAttributesResponse ¶
type ItemAttributesResponse struct { Attributes []ItemAttribute `json:"attributes"` RequestID string `json:"request_id"` }
type ItemBase ¶
type ItemBase struct { ItemID uint64 `json:"item_id"` ShopID uint64 `json:"shopid"` ItemSKU string `json:"item_sku"` Status string `json:"status"` Name string `json:"name"` Description string `json:"description"` Currency string `json:"currency"` HasVariation bool `json:"has_variation"` Price float64 `json:"price"` Stock uint32 `json:"stock"` CreateTime uint32 `json:"create_time"` UpdateTime uint32 `json:"update_time"` Weight float64 `json:"weight"` CategoryID uint64 `json:"category_id"` OriginalPrice float64 `json:"original_price"` Variations []Variation `json:"variations,omitempty"` Attributes []Attribute `json:"attributes"` Logistics []Logistic `json:"logistics"` Wholesales []Wholesale `json:"wholesales,omitempty"` RatingStar float64 `json:"rating_star"` CMTCount uint32 `json:"cmt_count"` Sales uint32 `json:"sales"` Views uint32 `json:"views"` Likes uint32 `json:"likes"` PackageLength float64 `json:"package_length"` PackageWidth float64 `json:"package_width"` PackageHeight float64 `json:"package_height"` DaysToShip uint32 `json:"days_to_ship"` SizeChart string `json:"size_chart"` Condition string `json:"condition"` DiscountID uint64 `json:"discount_id"` Is2tierItem bool `json:"is_2tier_item"` Tenures []uint32 `json:"tenures"` ReservedStock uint32 `json:"reserved_stock"` IsPreOrder bool `json:"is_pre_order"` InflatedPrice float64 `json:"inflated_price"` InflatedOriginalPrice float64 `json:"inflated_original_price"` SipItemPrice float64 `json:"sip_item_price"` PriceSource string `json:"price_source"` }
Item from https://open.shopee.com/documents?module=2&type=1&id=374
type ItemCategoriesResponse ¶
type ItemCategoriesResponse struct { Categories []ItemCategory `json:"categories"` RequestID string `json:"request_id"` }
type ItemCategory ¶
type ItemCategory struct { ID uint64 `json:"category_id"` ParentID uint64 `json:"parent_id"` Name string `json:"category_name"` HasChildren bool `json:"has_children"` DaysToShipLimits *DaysToShipLimits `json:"days_to_ship_limits"` }
type ItemCategoryService ¶
type ItemCategoryService interface {
List(sid uint64, options map[string]interface{}) ([]ItemCategory, error)
}
type ItemCategoryServiceOp ¶
type ItemCategoryServiceOp struct {
// contains filtered or unexported fields
}
ItemCategoryServiceOp handles communication with the product related methods of the Shopee API.
func (*ItemCategoryServiceOp) List ¶
func (s *ItemCategoryServiceOp) List(sid uint64, options map[string]interface{}) ([]ItemCategory, error)
List xxx
type ItemDeleteResponse ¶
type ItemDetailResponse ¶
type ItemOper ¶
ItemOper from https://open.shopee.com/documents?module=2&type=1&id=365
type ItemOperResponse ¶
type ItemPriceOper ¶
type ItemPriceOperResponse ¶
type ItemPriceOperResponse struct { Item *ItemPriceOper `json:"item"` RequestID string `json:"request_id"` }
type ItemResponse ¶
type ItemService ¶
type ItemService interface { List(interface{}) ([]Item, error) ListWithPagination(sid uint64, offset, limit uint32, options interface{}) ([]Item, *Pagination, error) Count(interface{}) (int, error) Get(uint64, uint64) (*Item, error) Create(newItem ItemOper) (*Item, error) Update(ItemBase) (*Item, error) UpdatePrice(sid, itemid uint64, price float64) (*ItemPriceOper, error) UpdateStock(sid, itemid uint64, stock uint32) (*ItemStockOper, error) Delete(sid, itemid uint64) error UnlistItem(sid, itemid uint64, unlist bool) ([]UnlistItemSuccess, []UnlistItemFailed, error) InitTierVariation(sid, itemid uint64, tierVariations []TierVariation, variations []TierVariationOperDef) ([]Variation, error) AddTierVariation(sid, itemid uint64, variations []TierVariationOperDef) ([]Variation, error) GetVariations(sid, itemid uint64) ([]TierVariation, []Variation, error) UpdateTierVariationList(sid, itemid uint64, tierVariations []TierVariation) error UpdateTierVariationIndex(sid, itemid uint64, variations []TierVariationIndexOperDef) error }
type ItemServiceOp ¶
type ItemServiceOp struct {
// contains filtered or unexported fields
}
ItemServiceOp handles communication with the product related methods of the Shopee API.
func (*ItemServiceOp) AddTierVariation ¶
func (s *ItemServiceOp) AddTierVariation(sid, itemid uint64, variations []TierVariationOperDef) ([]Variation, error)
func (*ItemServiceOp) Count ¶
func (s *ItemServiceOp) Count(interface{}) (int, error)
func (*ItemServiceOp) Create ¶
func (s *ItemServiceOp) Create(newItem ItemOper) (*Item, error)
Create https://open.shopee.com/documents?module=2&type=1&id=365
func (*ItemServiceOp) Delete ¶
func (s *ItemServiceOp) Delete(sid, itemid uint64) error
Delete https://open.shopee.com/documents?module=2&type=1&id=369
func (*ItemServiceOp) GetVariations ¶
func (s *ItemServiceOp) GetVariations(sid, itemid uint64) ([]TierVariation, []Variation, error)
func (*ItemServiceOp) InitTierVariation ¶
func (s *ItemServiceOp) InitTierVariation(sid, itemid uint64, tierVariations []TierVariation, variations []TierVariationOperDef) ([]Variation, error)
func (*ItemServiceOp) List ¶
func (s *ItemServiceOp) List(options interface{}) ([]Item, error)
func (*ItemServiceOp) ListWithPagination ¶
func (s *ItemServiceOp) ListWithPagination(sid uint64, offset, limit uint32, options interface{}) ([]Item, *Pagination, error)
ListWithPagination https://open.shopee.com/documents?module=2&type=1&id=375
func (*ItemServiceOp) UnlistItem ¶
func (s *ItemServiceOp) UnlistItem(sid, itemid uint64, unlist bool) ([]UnlistItemSuccess, []UnlistItemFailed, error)
UnlistItem https://open.shopee.com/documents?module=2&type=1&id=431
func (*ItemServiceOp) Update ¶
func (s *ItemServiceOp) Update(updItem ItemBase) (*Item, error)
Update https://open.shopee.com/documents?module=2&type=1&id=376
func (*ItemServiceOp) UpdatePrice ¶
func (s *ItemServiceOp) UpdatePrice(sid, itemid uint64, price float64) (*ItemPriceOper, error)
UpdatePrice https://open.shopee.com/documents?module=2&type=1&id=377
func (*ItemServiceOp) UpdateStock ¶
func (s *ItemServiceOp) UpdateStock(sid, itemid uint64, stock uint32) (*ItemStockOper, error)
UpdateStock https://open.shopee.com/documents?module=2&type=1&id=378
func (*ItemServiceOp) UpdateTierVariationIndex ¶
func (s *ItemServiceOp) UpdateTierVariationIndex(sid, itemid uint64, variations []TierVariationIndexOperDef) error
func (*ItemServiceOp) UpdateTierVariationList ¶
func (s *ItemServiceOp) UpdateTierVariationList(sid, itemid uint64, tierVariations []TierVariation) error
type ItemStockOper ¶
type ItemStockOperResponse ¶
type ItemStockOperResponse struct { Item *ItemStockOper `json:"item"` RequestID string `json:"request_id"` }
type ItemsResponse ¶
type ItemsResponse struct { Items []Item `json:"items"` More bool `json:"more"` Total uint32 `json:"total"` RequestID string `json:"request_id"` }
ItemsResponse Represents the result from the GetItemsList endpoint https://open.shopee.com/documents?module=2&type=1&id=375
type LeveledLogger ¶
type LeveledLogger struct { // Level is the minimum logging level that will be emitted by this logger. // // For example, a Level set to LevelWarn will emit warnings and errors, but // not informational or debug messages. // // Always set this with a constant like LevelWarn because the individual // values are not guaranteed to be stable. Level int // contains filtered or unexported fields }
It prints warnings and errors to `os.Stderr` and other messages to `os.Stdout`.
func (*LeveledLogger) Debugf ¶
func (l *LeveledLogger) Debugf(format string, v ...interface{})
Debugf logs a debug message using Printf conventions.
func (*LeveledLogger) Errorf ¶
func (l *LeveledLogger) Errorf(format string, v ...interface{})
Errorf logs a warning message using Printf conventions.
func (*LeveledLogger) Infof ¶
func (l *LeveledLogger) Infof(format string, v ...interface{})
Infof logs an informational message using Printf conventions.
func (*LeveledLogger) Warnf ¶
func (l *LeveledLogger) Warnf(format string, v ...interface{})
Warnf logs a warning message using Printf conventions.
type LeveledLoggerInterface ¶
type ListReponse ¶
type LogisticInitResponse ¶
type LogisticService ¶
type LogisticServiceOp ¶
type LogisticServiceOp struct {
// contains filtered or unexported fields
}
LogisticServiceOp handles communication with the logistics related methods of the Shopee API.
func (*LogisticServiceOp) GetLogisticInfo ¶
func (s *LogisticServiceOp) GetLogisticInfo(sid uint64, ordersn string) (*GetLogisticInfoResponse, error)
GetLogisticInfo https://open.shopee.com/documents?module=3&type=1&id=417
func (*LogisticServiceOp) GetParameterForInit ¶
func (s *LogisticServiceOp) GetParameterForInit(sid uint64, ordersn string) (*map[string]interface{}, error)
GetParameterForInit https://open.shopee.com/documents?module=3&type=1&id=386
func (*LogisticServiceOp) Init ¶
func (s *LogisticServiceOp) Init(sid uint64, ordersn string, params map[string]interface{}) (string, error)
Init https://open.shopee.com/documents?module=3&type=1&id=389
func (*LogisticServiceOp) List ¶
func (s *LogisticServiceOp) List(sid uint64) ([]Logistic, error)
List https://open.shopee.com/documents?module=3&type=1&id=384
type Option ¶
type Option func(c *Client)
Option is used to configure client with options
func WithLogger ¶
func WithLogger(logger LeveledLoggerInterface) Option
func WithVersion ¶
WithVersion optionally sets the api-version if the passed string is valid
type Order ¶
type Order struct { OrderSN string `json:"ordersn"` BuyerUsername string `json:"buyer_username"` RecipientAddress *RecipientAddress `json:"recipient_address"` Status string `json:"order_status"` Currency string `json:"currency"` TrackingNo string `json:"tracking_no"` EscrowAmount string `json:"escrow_amount"` TotalAmount string `json:"total_amount"` Country string `json:"country"` ServiceCode string `json:"service_code"` EstimatedShippingFee string `json:"estimated_shipping_fee"` PaymentMethod string `json:"payment_method"` ShippingCarrier string `json:"shipping_carrier"` COD bool `json:"cod"` // This value indicates whether the order was a COD (cash on delivery) order. DaysToShip uint32 `json:"days_to_ship"` // Shipping preparation time set by the seller when listing item on Shopee. ActualShippingCost string `json:"actual_shipping_cost"` // The actual shipping cost of the order if available from external logistics partners. GoodsToDeclare bool `json:"goods_to_declare"` MessageToSeller string `json:"message_to_seller"` Note string `json:"note"` NoteUpdateTime int64 `json:"note_update_time"` CreateTime int64 `json:"create_time"` UpdateTime int64 `json:"update_time"` Items []OrderItem `json:"items"` PayTime *int64 `json:"pay_time"` // The time when the order status is updated from UNPAID to PAID. This value is NULL when order is not paid yet. DropShipper string `json:"dropshipper"` CreditCardNumber string `json:"credit_card_number"` DropShipperPhone string `json:"dropshipper_phone"` ShipByDate int64 `json:"ship_by_date"` IsSplitUp bool `json:"is_split_up"` BuyerCancelReason interface{} `json:"buyer_cancel_reason"` // Cancel order is number, eg. 0, other is string CancelBy string `json:"cancel_by"` FmTN string `json:"fm_tn"` // The first-mile tracking number. CancelReason interface{} `json:"cancel_reason"` // Cancel order is number, eg. 0, other is string EscrowTax string `json:"escrow_tax"` IsActualShippingFeeConfirmed bool `json:"is_actual_shipping_fee_confirmed"` }
Order https://open.shopee.com/documents?module=4&type=1&id=397
type OrderCancelResponse ¶
type OrderItem ¶
type OrderItem struct { ItemID uint64 `json:"item_id"` ItemName string `json:"item_name"` ItemSKU string `json:"item_sku"` VariationID uint64 `json:"variation_id"` VariationName string `json:"variation_name"` VariationSKU string `json:"variation_sku"` VariationQuantity uint32 `json:"variation_quantity_purchased"` VariationDiscountedPrice string `json:"variation_discounted_price"` VariationOriginalPrice string `json:"variation_original_price"` IsWholesale bool `json:"is_wholesale"` Weight float64 `json:"weight"` IsAddOnDeal bool `json:"is_add_on_deal"` IsMainItem bool `json:"is_main_item"` AddOnDealID uint64 `json:"add_on_deal_id"` PromotionType string `json:"promotion_type"` PromotionID uint32 `json:"promotion_id"` }
type OrderService ¶
type OrderService interface { List(uint64) ([]Order, error) ListWithPagination(sid uint64, offset, limit uint32, options map[string]interface{}) ([]Order, *Pagination, error) Count(interface{}) (int, error) Get(sid uint64, ordersn string) (*Order, error) GetMulti(sid uint64, orders []string) ([]Order, []string, error) Create(Order) (*Order, error) Update(Order) (*Order, error) Cancel(sid uint64, ordersn, reason string, options map[string]interface{}) error Delete(int64) error }
type OrderServiceOp ¶
type OrderServiceOp struct {
// contains filtered or unexported fields
}
OrderServiceOp handles communication with the product related methods of the Shopee API.
func (*OrderServiceOp) Cancel ¶
func (s *OrderServiceOp) Cancel(sid uint64, ordersn, reason string, options map[string]interface{}) error
Cancel https://open.shopee.com/documents?module=4&type=1&id=395
func (*OrderServiceOp) Count ¶
func (s *OrderServiceOp) Count(interface{}) (int, error)
func (*OrderServiceOp) Create ¶
func (s *OrderServiceOp) Create(Order) (*Order, error)
Create https://open.shopee.com/documents?module=2&type=1&id=365
func (*OrderServiceOp) Delete ¶
func (s *OrderServiceOp) Delete(int64) error
func (*OrderServiceOp) Get ¶
func (s *OrderServiceOp) Get(sid uint64, ordersn string) (*Order, error)
func (*OrderServiceOp) ListWithPagination ¶
func (s *OrderServiceOp) ListWithPagination(sid uint64, offset, limit uint32, options map[string]interface{}) ([]Order, *Pagination, error)
ListWithPagination https://open.shopee.com/documents?module=4&type=1&id=399
func (*OrderServiceOp) Update ¶
func (s *OrderServiceOp) Update(Order) (*Order, error)
Update https://open.shopee.com/documents?module=2&type=1&id=376
type OrdersDetailResponse ¶
type OrdersDetailResponse struct { Orders []Order `json:"orders"` Errors []string `json:"errors"` RequestID string `json:"request_id"` }
OrdersDetailResponse https://open.shopee.com/documents?module=4&type=1&id=397
type OrdersResponse ¶
type OrdersResponse struct { Orders []Order `json:"orders"` More bool `json:"more"` RequestID string `json:"request_id"` }
OrdersResponse Represents shopee.orders.GetOrdersList https://open.shopee.com/documents?module=4&type=1&id=399
type Pagination ¶
type Pagination struct { Offset uint32 `json:"offset"` PageSize uint32 `json:"page_size"` Total uint32 `json:"total"` More bool `json:"more"` }
Pagination of results
type RateLimitError ¶
type RateLimitError struct { ResponseError RetryAfter int }
An error specific to a rate-limiting response. Embeds the ResponseError to allow consumers to handle it the same was a normal ResponseError.
type RateLimitInfo ¶
type RecipientAddress ¶
type RecipientAddress struct { Town string `json:"town"` City string `json:"city"` Name string `json:"name"` District string `json:"district"` Country string `json:"country"` Zipcode string `json:"zipcode"` FullAddress string `json:"full_address"` Phone string `json:"phone"` State string `json:"state"` }
type ResponseDecodingError ¶
ResponseDecodingError occurs when the response body from Shopify could not be parsed.
func (ResponseDecodingError) Error ¶
func (e ResponseDecodingError) Error() string
type ResponseError ¶
A general response error that follows a similar layout to Shopify's response errors, i.e. either a single message or a list of messages.
func (ResponseError) Error ¶
func (e ResponseError) Error() string
func (ResponseError) GetErrors ¶
func (e ResponseError) GetErrors() []string
GetErrors returns response errors list
func (ResponseError) GetMessage ¶
func (e ResponseError) GetMessage() string
GetMessage returns response error message
func (ResponseError) GetStatus ¶
func (e ResponseError) GetStatus() int
GetStatus returns http response status
type SIPAffiliateShop ¶
type Shop ¶
type Shop struct { ID uint64 `json:"shop_id"` Name string `json:"shop_name"` Country string `json:"country"` Description string `json:"shop_description"` Videos []string `json:"videos"` Images []string `json:"images"` DisableMakeOffer uint32 `json:"disable_make_offer"` EnableDisplayUnitNo bool `json:"enable_display_unitno"` ItemLimit uint32 `json:"item_limit"` RequestID string `json:"request_id"` Status string `json:"status"` InstallmentStatus uint32 `json:"installment_status"` SIPAffiliateShops []SIPAffiliateShop `json:"sip_a_shops"` IsCB bool `json:"is_cb"` NonPreOrderDTS int `json:"non_pre_order_dts"` AuthTime int64 `json:"auth_time"` ExpireTime int64 `json:"expire_time"` }
Shop https://open.shopee.com/documents?module=6&type=1&id=410
{ "shop_id": 220006999, "shop_name": "roxieshopify.sg", "country": "SG", "shop_description": "", "videos": [], "images": [], "disable_make_offer": 0, "enable_display_unitno": false, "item_limit": 10000, "request_id": "541bb4a26f490b8244c9ea7b5a94cb5c", "status": "NORMAL", "installment_status": 0, "sip_a_shops": [], "is_cb": true, "non_pre_order_dts": 3, "auth_time": 1593507209, "expire_time": 1625043209 }
type ShopService ¶
type ShopServiceOp ¶
type ShopServiceOp struct {
// contains filtered or unexported fields
}
ShopServiceOp handles communication with the product related methods of the Shopee API.
type TierVariation ¶
TierVariation 2-tier variation https://open.shopee.com/documents?module=2&type=1&id=422
type TierVariationOperDef ¶
type TierVariationOperResponse ¶
type TierVariationOperResponse struct { RequestID string `json:"request_id"` ItemID uint64 `json:"item_id"` // help doc is uint32, in fact is uint64 TierVariation []TierVariation `json:"tier_variation,omitempty"` VariationIDList []Variation `json:"variation_id_list"` }
type UnlistItemFailed ¶
type UnlistItemSuccess ¶
type UnlistResponse ¶
type UnlistResponse struct { Failed []UnlistItemFailed `json:"failed"` Success []UnlistItemSuccess `json:"success"` RequestID string `json:"request_id"` }
type Variation ¶
type Variation struct { ID uint64 `json:"variation_id"` Name string `json:"name"` Stock uint32 `json:"stock"` ReservedStock uint32 `json:"reserved_stock"` Price float64 `json:"price"` VariationSKU string `json:"variation_sku"` Status string `json:"status"` CreateTime uint32 `json:"create_time"` UpdateTime uint32 `json:"update_time"` OriginalPrice float64 `json:"original_price"` InflatedOriginalPrice float64 `json:"inflated_original_price"` InflatedPrice float64 `json:"inflated_price"` DiscountID uint64 `json:"discount_id"` ModifiedTime uint32 `json:"modified_time"` ItemID uint64 `json:"item_id"` TierIndex []uint32 `json:"tier_index,omitempty"` }
type VariationPriceRequest ¶
type VariationPriceResponse ¶
type VariationPriceResponse struct { RequestID string `json:"request_id"` Result VariationPriceResponseBatchResult `json:"batch_result"` }
{"batch_result": {"failures": [{"item_id": 100926704, "error_description": "mst shop not found", "variation_id": 5249278}, {"item_id": 100926704, "error_description": "mst shop not found", "variation_id": 5249278}, {"item_id": 100926704, "error_description": "mst shop not found", "variation_id": 5249278}, {"item_id": 100926704, "error_description": "mst shop not found", "variation_id": 5249278}], "modifications": []}, "request_id": "6e0276c51cf3944d0ce518643c9ba149"}
type VariationPriceResponseBatchResult ¶
type VariationPriceResponseBatchResult struct { Modifications []VariationPriceResponseBatchResultModification `json:"modifications"` Failures []VariationPriceResponseBatchResultFailure `json:"failures"` }
type VariationService ¶
type VariationService interface { Create(uint64, uint64, Variation) (*Variation, error) Delete(uint64, uint64, uint64) error UpdateVariationPrice(uint64, uint64, Variation) (*Variation, error) UpdateVariationStock(uint64, uint64, Variation) (*Variation, error) UpdateVariationPriceBatch(uint64, []VariationPriceRequest) (*VariationPriceResponse, error) }
type VariationServiceOp ¶
type VariationServiceOp struct {
// contains filtered or unexported fields
}
VariationServiceOp handles communication with the product related methods of the Shopee API.
func (*VariationServiceOp) Create ¶
func (s *VariationServiceOp) Create(sid, itemID uint64, newItem Variation) (*Variation, error)
Create https://open.shopee.com/documents?module=2&type=1&id=368
func (*VariationServiceOp) Delete ¶
func (s *VariationServiceOp) Delete(sid, itemID, variationID uint64) error
Delete https://open.shopee.com/documents?module=2&type=1&id=371
func (*VariationServiceOp) UpdateVariationPrice ¶
func (s *VariationServiceOp) UpdateVariationPrice(sid, itemID uint64, updItem Variation) (*Variation, error)
UpdateVariationPrice https://open.shopee.com/documents?module=2&type=1&id=379
func (*VariationServiceOp) UpdateVariationPriceBatch ¶
func (s *VariationServiceOp) UpdateVariationPriceBatch(sid uint64, params []VariationPriceRequest) (*VariationPriceResponse, error)
func (*VariationServiceOp) UpdateVariationStock ¶
func (s *VariationServiceOp) UpdateVariationStock(sid, itemID uint64, updItem Variation) (*Variation, error)
UpdateVariationStock https://open.shopee.com/documents?module=2&type=1&id=380