Update December 25, 2023 (#57)

This commit is contained in:
Kirill
2023-12-27 00:04:03 +03:00
committed by GitHub
parent ebafb17c9d
commit c36446bb59
4 changed files with 48 additions and 18 deletions

View File

@@ -25,7 +25,7 @@ type GetProductTreeResponse struct {
type GetProductTreeResult struct {
// Category identifier
CategoryId int64 `json:"category_id"`
DescriptionCategoryId int64 `json:"description_category_id"`
// Category name
CategoryName string `json:"category_name"`
@@ -64,7 +64,7 @@ func (c *Categories) Tree(ctx context.Context, params *GetProductTreeParams) (*G
type GetCategoryAttributesParams struct {
// Category identifier
CategoryId int64 `json:"category_id"`
DescriptionCategoryId int64 `json:"description_category_id"`
// Response language
Language Language `json:"language"`
@@ -123,6 +123,12 @@ type GetCategoryAttributesResult struct {
// Characteristic type
Type string `json:"type"`
// Complex attribute identifier
AttributeComplexId int64 `json:"attribute_complex_id"`
// Maximum number of values for attribute
MaxValueCount int64 `json:"max_value_count"`
}
// Getting characteristics for specified product category and type.
@@ -149,7 +155,7 @@ type GetAttributeDictionaryParams struct {
AttributeId int64 `json:"attribute_id"`
// Category identifier
CategoryId int64 `json:"category_id"`
DescriptionCategoryId int64 `json:"description_category_id"`
// Response language
Language Language `json:"language"`
@@ -200,7 +206,7 @@ type GetAttributeDictionaryResult struct {
// To check if an attribute has a nested directory,
// use the `/v1/description-category/attribute` method.
func (c *Categories) AttributesDictionary(ctx context.Context, params *GetAttributeDictionaryParams) (*GetAttributeDictionaryResponse, error) {
url := "/v1/description-category/attribute"
url := "/v1/description-category/attribute/values"
resp := &GetAttributeDictionaryResponse{}

View File

@@ -27,7 +27,7 @@ func TestGetProductTree(t *testing.T) {
`{
"result": [
{
"category_id": 0,
"description_category_id": 0,
"category_name": "string",
"children": [],
"disabled": true,
@@ -81,9 +81,9 @@ func TestGetCategoryAttributes(t *testing.T) {
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
&GetCategoryAttributesParams{
CategoryId: 12345,
Language: English,
TypeId: 2,
DescriptionCategoryId: 12345,
Language: English,
TypeId: 2,
},
`{
"result": [
@@ -97,7 +97,9 @@ func TestGetCategoryAttributes(t *testing.T) {
"is_collection": true,
"is_required": true,
"name": "string",
"type": "string"
"type": "string",
"attribute_complex_id": 0,
"max_value_count": 0
}
]
}`,
@@ -146,12 +148,12 @@ func TestGetAttributeDictionary(t *testing.T) {
http.StatusOK,
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
&GetAttributeDictionaryParams{
AttributeId: 123456,
CategoryId: 12,
Language: English,
LastValueId: 1,
Limit: 5,
TypeId: 6,
AttributeId: 123456,
DescriptionCategoryId: 12,
Language: English,
LastValueId: 1,
Limit: 5,
TypeId: 6,
},
`{
"has_next": true,

View File

@@ -130,6 +130,9 @@ type ProductDetails struct {
// Category identifier
DescriptionCategoryId int64 `json:"description_category_id"`
// Product type identifier
TypeId int64 `json:"type_id"`
// Marketing color
ColorImage string `json:"color_image"`
@@ -888,7 +891,7 @@ type CreateOrUpdateProductResult struct {
// This method allows you to create products and update their details
func (c Products) CreateOrUpdateProduct(ctx context.Context, params *CreateOrUpdateProductParams) (*CreateOrUpdateProductResponse, error) {
url := "/v2/product/import"
url := "/v3/product/import"
resp := &CreateOrUpdateProductResponse{}

View File

@@ -127,7 +127,7 @@ func TestGetProductDetails(t *testing.T) {
"7533900005"
],
"buybox_price": "",
"description_category_id": 17038062,
"type_id": 0,
"created_at": "2021-10-21T15:48:03.529178Z",
"images": [
"https://cdn1.ozone.ru/s3/multimedia-5/6088931525.jpg",
@@ -141,6 +141,7 @@ func TestGetProductDetails(t *testing.T) {
"reserved": 0
},
"currency_code": "RUB",
"description_category_id": 12,
"marketing_price": "",
"min_price": "",
"old_price": "",
@@ -1378,6 +1379,7 @@ func TestListProductsByIDs(t *testing.T) {
],
"buybox_price": "",
"description_category_id": 93726157,
"type_id": 0,
"created_at": "2021-06-03T03:40:05.871465Z",
"images": [],
"has_discounted_item": true,
@@ -1420,7 +1422,24 @@ func TestListProductsByIDs(t *testing.T) {
"active_product": false,
"reasons": {}
},
"price_index": "0.00",
"price_indexes": {
"external_index_data": {
"minimal_price": "string",
"minimal_price_currency": "string",
"price_index_value": 0
},
"ozon_index_data": {
"minimal_price": "string",
"minimal_price_currency": "string",
"price_index_value": 0
},
"price_index": "WITHOUT_INDEX",
"self_marketplaces_index_data": {
"minimal_price": "string",
"minimal_price_currency": "string",
"price_index_value": 0
}
},
"images360": [],
"is_kgt": false,
"color_image": "",