Update December 17, 2024 (#129)
This commit is contained in:
186
ozon/products.go
186
ozon/products.go
@@ -105,28 +105,7 @@ func (c Products) GetStocksInfo(ctx context.Context, params *GetStocksInfoParams
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
type GetProductDetailsParams struct {
|
||||
// Product identifier in the seller's system
|
||||
OfferId string `json:"offer_id,omitempty"`
|
||||
|
||||
// Product identifier
|
||||
ProductId int64 `json:"product_id,omitempty"`
|
||||
|
||||
// Product identifier in the Ozon system, SKU
|
||||
SKU int64 `json:"sku,omitempty"`
|
||||
}
|
||||
|
||||
type GetProductDetailsResponse struct {
|
||||
core.CommonResponse
|
||||
|
||||
// Request results
|
||||
Result ProductDetails `json:"result"`
|
||||
}
|
||||
|
||||
type ProductDetails struct {
|
||||
// Barcode
|
||||
Barcode string `json:"barcode"`
|
||||
|
||||
// All product barcodes
|
||||
Barcodes []string `json:"barcodes"`
|
||||
|
||||
@@ -138,11 +117,20 @@ type ProductDetails struct {
|
||||
// Category identifier
|
||||
DescriptionCategoryId int64 `json:"description_category_id"`
|
||||
|
||||
// Markdown product stocks at the Ozon warehouse
|
||||
DiscountedFBOStocks int32 `json:"discounted_fbo_stocks"`
|
||||
|
||||
// Details on errors when creating or validating a product
|
||||
Errors []ProductDetailsError `json:"errors"`
|
||||
|
||||
// Indication that the product has similar markdown products at the Ozon warehouse
|
||||
HasDiscountedFBOItem bool `json:"has_discounted_fbo_item"`
|
||||
|
||||
// Product type identifier
|
||||
TypeId int64 `json:"type_id"`
|
||||
|
||||
// Marketing color
|
||||
ColorImage string `json:"color_image"`
|
||||
ColorImage []string `json:"color_image"`
|
||||
|
||||
// Commission fees details
|
||||
Commissions []ProductDetailCommission `json:"commissions"`
|
||||
@@ -166,7 +154,7 @@ type ProductDetails struct {
|
||||
Images []string `json:"images"`
|
||||
|
||||
// Main product image
|
||||
PrimaryImage string `json:"primary_image"`
|
||||
PrimaryImage []string `json:"primary_image"`
|
||||
|
||||
// Array of 360 images
|
||||
Images360 []string `json:"images360"`
|
||||
@@ -260,20 +248,112 @@ type ProductDetails struct {
|
||||
|
||||
// 'true' if the item is archived automatically.
|
||||
IsArchivedAuto bool `json:"is_autoarchived"`
|
||||
|
||||
// Product status details
|
||||
Statuses ProductDetailsStatus `json:"statuses"`
|
||||
|
||||
// Product model details
|
||||
ModelInfo ProductDetailsModelInfo `json:"model_info"`
|
||||
|
||||
// Indication of a super product
|
||||
IsSuper bool `json:"is_super"`
|
||||
}
|
||||
|
||||
type ProductDetailsError struct {
|
||||
// Characteristic identifier
|
||||
AttributeId int64 `json:"attribute_id"`
|
||||
|
||||
// Error code
|
||||
Code string `json:"code"`
|
||||
|
||||
// Field in which the error occurred
|
||||
Field string `json:"field"`
|
||||
|
||||
// Error level description
|
||||
Level string `json:"level"`
|
||||
|
||||
// Status of the product with the error
|
||||
State string `json:"state"`
|
||||
|
||||
// Error description
|
||||
Texts ProductDetailsErrorText `json:"texts"`
|
||||
}
|
||||
|
||||
type ProductDetailsErrorText struct {
|
||||
// Attribute name
|
||||
AttributeName string `json:"attribute_name"`
|
||||
|
||||
// Error description
|
||||
Description string `json:"description"`
|
||||
|
||||
// Error code in the Ozon system
|
||||
HintCode string `json:"hint_code"`
|
||||
|
||||
// Error message
|
||||
Message string `json:"message"`
|
||||
|
||||
// Short description of the error
|
||||
ShortDescription string `json:"short_description"`
|
||||
|
||||
// Parameters in which the error occurred
|
||||
Params []NameValue `json:"params"`
|
||||
}
|
||||
|
||||
type NameValue struct {
|
||||
Name string `json:"name"`
|
||||
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
type ProductDetailsStatus struct {
|
||||
// true, if the product is created correctly
|
||||
IsCreated bool `json:"is_created"`
|
||||
|
||||
// Moderation status
|
||||
ModerateStatus string `json:"moderate_status"`
|
||||
|
||||
// Product status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Product status description
|
||||
Description string `json:"status_description"`
|
||||
|
||||
// Status of the product where the error occurred
|
||||
Failed string `json:"status_failed"`
|
||||
|
||||
// Product status name
|
||||
Name string `json:"status_name"`
|
||||
|
||||
// Status description
|
||||
Tooltip string `json:"status_tooltip"`
|
||||
|
||||
// Time of the last status change
|
||||
UpdatedAt time.Time `json:"status_updated_at"`
|
||||
|
||||
// Validation status
|
||||
ValidationStatus string `json:"validation_status"`
|
||||
}
|
||||
|
||||
type ProductDetailsModelInfo struct {
|
||||
// Number of products in the response
|
||||
Count int64 `json:"count"`
|
||||
|
||||
// Identifier of the product model
|
||||
ModelId int64 `json:"model_id"`
|
||||
}
|
||||
|
||||
type ProductDetailCommission struct {
|
||||
// Delivery cost
|
||||
DeliveryAmount float64 `json:"deliveryAmount"`
|
||||
DeliveryAmount float64 `json:"delivery_amount"`
|
||||
|
||||
// Commission percentage
|
||||
Percent float64 `json:"percent"`
|
||||
|
||||
// Return cost
|
||||
ReturnAmount float64 `json:"returnAmount"`
|
||||
ReturnAmount float64 `json:"return_amount"`
|
||||
|
||||
// Sale scheme
|
||||
SaleSchema string `json:"saleSchema"`
|
||||
SaleSchema string `json:"sale_schema"`
|
||||
|
||||
// Commission fee amount
|
||||
Value float64 `json:"value"`
|
||||
@@ -286,8 +366,8 @@ type ProductDetailPriceIndex struct {
|
||||
// Competitors' product price on Ozon
|
||||
OzonIndexData ProductDetailPriceIndexOzon `json:"ozon_index_data"`
|
||||
|
||||
// Resulting price index of the product
|
||||
PriceIndex string `json:"price_index"`
|
||||
// Types of price index
|
||||
ColorIndex string `json:"color_index"`
|
||||
|
||||
// Price of your product on other marketplaces
|
||||
SelfMarketplaceIndexData ProductDetailPriceIndexSelfMarketplace `json:"self_marketplaces_index_data"`
|
||||
@@ -365,25 +445,42 @@ type ProductDetailStatus struct {
|
||||
}
|
||||
|
||||
type ProductDetailSource struct {
|
||||
// Indication that the source is taken into account when calculating the market value
|
||||
IsEnabled bool `json:"is_enabled"`
|
||||
// Product creation date
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
// Product identifier in the Ozon system, SKU
|
||||
SKU int64 `json:"sku"`
|
||||
|
||||
// Link to the source
|
||||
Source string `json:"source"`
|
||||
|
||||
// Package type
|
||||
ShipmentType string `json:"shipment_type"`
|
||||
|
||||
// List of MOQs with products
|
||||
QuantCode string `json:"quant_code"`
|
||||
}
|
||||
|
||||
type ProductDetailStock struct {
|
||||
// Supply expected
|
||||
Coming int32 `json:"coming"`
|
||||
// true, if there are stocks at the warehouses
|
||||
HasStock bool `json:"has_stock"`
|
||||
|
||||
// Status of product stocks
|
||||
Stocks []ProductDetailStockStock `json:"stocks"`
|
||||
}
|
||||
|
||||
type ProductDetailStockStock struct {
|
||||
// Product identifier in the Ozon system, SKU
|
||||
SKU int64 `json:"sku"`
|
||||
|
||||
// Currently at the warehouse
|
||||
Present int32 `json:"present"`
|
||||
|
||||
// Reserved
|
||||
Reserved int32 `json:"reserved"`
|
||||
|
||||
// Sales scheme
|
||||
Source string `json:"source"`
|
||||
}
|
||||
|
||||
type ProductDetailVisibilityDetails struct {
|
||||
@@ -438,24 +535,6 @@ type GetProductDetailsResponseItemError struct {
|
||||
OptionalDescriptionElements map[string]string `json:"optional_description_elements"`
|
||||
}
|
||||
|
||||
// Get product details
|
||||
//
|
||||
// Check a minimum product price with all promotions applied in your personal account.
|
||||
// The min_price parameter from the method response is in development and returns 0
|
||||
func (c Products) GetProductDetails(ctx context.Context, params *GetProductDetailsParams) (*GetProductDetailsResponse, error) {
|
||||
url := "/v2/product/info"
|
||||
|
||||
resp := &GetProductDetailsResponse{}
|
||||
|
||||
response, err := c.client.Request(ctx, http.MethodPost, url, params, resp, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.CopyCommonResponse(&resp.CommonResponse)
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
type UpdateStocksParams struct {
|
||||
// Stock details
|
||||
Stocks []UpdateStocksStock `json:"stocks"`
|
||||
@@ -1374,11 +1453,6 @@ type ListProductsByIDsParams struct {
|
||||
type ListProductsByIDsResponse struct {
|
||||
core.CommonResponse
|
||||
|
||||
// Request results
|
||||
Result ListProductsByIDsResult `json:"result"`
|
||||
}
|
||||
|
||||
type ListProductsByIDsResult struct {
|
||||
// Data array
|
||||
Items []ProductDetails `json:"items"`
|
||||
}
|
||||
@@ -1389,7 +1463,7 @@ type ListProductsByIDsResult struct {
|
||||
//
|
||||
// For each shipment in the items array the fields match the ones recieved in the /v2/product/info method
|
||||
func (c Products) ListProductsByIDs(ctx context.Context, params *ListProductsByIDsParams) (*ListProductsByIDsResponse, error) {
|
||||
url := "/v2/product/info/list"
|
||||
url := "/v3/product/info/list"
|
||||
|
||||
resp := &ListProductsByIDsResponse{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user