Skip to content

Commit

Permalink
Update December 25, 2023 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
diPhantxm authored Dec 26, 2023
1 parent ebafb17 commit c36446b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 18 deletions.
14 changes: 10 additions & 4 deletions ozon/categories.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
Expand Down Expand Up @@ -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.
Expand All @@ -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"`
Expand Down Expand Up @@ -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{}

Expand Down
24 changes: 13 additions & 11 deletions ozon/categories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestGetProductTree(t *testing.T) {
`{
"result": [
{
"category_id": 0,
"description_category_id": 0,
"category_name": "string",
"children": [],
"disabled": true,
Expand Down Expand Up @@ -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": [
Expand All @@ -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
}
]
}`,
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion ozon/products.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down Expand Up @@ -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{}

Expand Down
23 changes: 21 additions & 2 deletions ozon/products_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -141,6 +141,7 @@ func TestGetProductDetails(t *testing.T) {
"reserved": 0
},
"currency_code": "RUB",
"description_category_id": 12,
"marketing_price": "",
"min_price": "",
"old_price": "",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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": "",
Expand Down

0 comments on commit c36446b

Please sign in to comment.