Compare commits
	
		
			2 Commits
		
	
	
		
			1.18.1
			...
			update-feb
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					dcf366d7d4 | ||
| 
						 | 
					f5d2d0197b | 
@@ -200,12 +200,9 @@ type GetStocksOnWarehousesResultRow struct {
 | 
			
		||||
 | 
			
		||||
	// Name of the warehouse where the products are stored
 | 
			
		||||
	WarehouseName string `json:"warehouse_name"`
 | 
			
		||||
 | 
			
		||||
	// Number of days the stock will last based on your average daily sales
 | 
			
		||||
	IDC float64 `json:"idc"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Report on stocks and products movement at Ozon warehouses
 | 
			
		||||
// Method for getting a report on leftover stocks and products movement at Ozon warehouses
 | 
			
		||||
func (c Analytics) GetStocksOnWarehouses(ctx context.Context, params *GetStocksOnWarehousesParams) (*GetStocksOnWarehousesResponse, error) {
 | 
			
		||||
	url := "/v2/analytics/stock_on_warehouses"
 | 
			
		||||
 | 
			
		||||
@@ -340,3 +337,114 @@ func (c Analytics) Stock(ctx context.Context, params *GetStockManagementParams)
 | 
			
		||||
 | 
			
		||||
	return resp, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetProductQueriesParams struct {
 | 
			
		||||
	// Date when analytics generation starts
 | 
			
		||||
	DateFrom string `json:"date_from"`
 | 
			
		||||
 | 
			
		||||
	//Date when analytics generation ends
 | 
			
		||||
	DateTo string `json:"date_to"`
 | 
			
		||||
 | 
			
		||||
	// Number of page returned in the request
 | 
			
		||||
	Page int32 `json:"page"`
 | 
			
		||||
 | 
			
		||||
	// Number of items on the pag
 | 
			
		||||
	PageSize int32 `json:"page_size"`
 | 
			
		||||
 | 
			
		||||
	// List of SKUs—product identifiers in the Ozon system.
 | 
			
		||||
	// Analytics on requests is returned for them.
 | 
			
		||||
	// Maximum value is 1,000 SKUs
 | 
			
		||||
	SKUs []string `json:"skus"`
 | 
			
		||||
 | 
			
		||||
	// Parameter by which products are sorted
 | 
			
		||||
	SortBy string `json:"sort_by"`
 | 
			
		||||
 | 
			
		||||
	// Sorting direction
 | 
			
		||||
	SortDir string `json:"sort_dir"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetProductQueriesResponse struct {
 | 
			
		||||
	core.CommonResponse
 | 
			
		||||
 | 
			
		||||
	// Period for which the analytics is generated
 | 
			
		||||
	AnalyticsPeriod AnalyticsPeriod `json:"analytics_period"`
 | 
			
		||||
 | 
			
		||||
	// Product list
 | 
			
		||||
	Items []GetProductQueriesItem `json:"items"`
 | 
			
		||||
 | 
			
		||||
	// Number of pages
 | 
			
		||||
	PageCount int64 `json:"page_count"`
 | 
			
		||||
 | 
			
		||||
	// Total number of queries
 | 
			
		||||
	Total int64 `json:"total"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type AnalyticsPeriod struct {
 | 
			
		||||
	// Date when analytics generation starts
 | 
			
		||||
	DateFrom string `json:"date_from"`
 | 
			
		||||
 | 
			
		||||
	// Date when analytics generation ends
 | 
			
		||||
	DateTo string `json:"date_to"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetProductQueriesItem struct {
 | 
			
		||||
	// Category name
 | 
			
		||||
	Category string `json:"category"`
 | 
			
		||||
 | 
			
		||||
	// Currency
 | 
			
		||||
	Currency string `json:"currency"`
 | 
			
		||||
 | 
			
		||||
	// Sales by queries
 | 
			
		||||
	GMV float64 `json:"gmv"`
 | 
			
		||||
 | 
			
		||||
	// Product name
 | 
			
		||||
	Name string `json:"name"`
 | 
			
		||||
 | 
			
		||||
	// Product identifier in the seller's system
 | 
			
		||||
	OfferId string `json:"offer_id"`
 | 
			
		||||
 | 
			
		||||
	// Average product position. Available only with the Premium or Premium Plus subscription, otherwise the field returns empty
 | 
			
		||||
	Position float64 `json:"position"`
 | 
			
		||||
 | 
			
		||||
	// Product identifier in the Ozon system, SKU
 | 
			
		||||
	SKU int64 `json:"sku"`
 | 
			
		||||
 | 
			
		||||
	// Number of customers who searched for your product on Ozon
 | 
			
		||||
	UniqueSearchUsers int64 `json:"unique_search_users"`
 | 
			
		||||
 | 
			
		||||
	// Number of customers who have seen your product on Ozon.
 | 
			
		||||
	// Available only with the Premium or Premium Plus subscription,
 | 
			
		||||
	// otherwise the field returns empty
 | 
			
		||||
	UniqueViewUsers int64 `json:"unique_view_users"`
 | 
			
		||||
 | 
			
		||||
	// Conversion from product views.
 | 
			
		||||
	// Available only with the Premium or Premium Plus subscription,
 | 
			
		||||
	// otherwise the field returns empty
 | 
			
		||||
	ViewConversion float64 `json:"view_conversion"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Use the method to get data about your product queries.
 | 
			
		||||
// Full analytics is available with the Premium and Premium Plus subscription.
 | 
			
		||||
// Without subscription, you can see a part of the metrics.
 | 
			
		||||
// The method is similar to the Products in Search → Queries for my product tab in your personal account.
 | 
			
		||||
//
 | 
			
		||||
// You can view analytics by queries for certain dates.
 | 
			
		||||
// To do this, specify the interval in the date_from and date_to fields.
 | 
			
		||||
// Data for the last month are available in any interval except for
 | 
			
		||||
// three days from the current date because these days the calculation is performed.
 | 
			
		||||
// Analytics for dates later than a month ago is available only with
 | 
			
		||||
// the Premium and Premium Plus subscription, and only by weeks.
 | 
			
		||||
// Specify the date_from parameter in the request
 | 
			
		||||
func (c Analytics) GetProductQueries(ctx context.Context, params *GetProductQueriesParams) (*GetProductQueriesResponse, error) {
 | 
			
		||||
	url := "/v1/analytics/product-queries"
 | 
			
		||||
 | 
			
		||||
	resp := &GetProductQueriesResponse{}
 | 
			
		||||
 | 
			
		||||
	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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -277,3 +277,74 @@ func TestGetStock(t *testing.T) {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestGetProductQueries(t *testing.T) {
 | 
			
		||||
	t.Parallel()
 | 
			
		||||
 | 
			
		||||
	tests := []struct {
 | 
			
		||||
		statusCode int
 | 
			
		||||
		headers    map[string]string
 | 
			
		||||
		params     *GetProductQueriesParams
 | 
			
		||||
		response   string
 | 
			
		||||
	}{
 | 
			
		||||
		// Test Ok
 | 
			
		||||
		{
 | 
			
		||||
			http.StatusOK,
 | 
			
		||||
			map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
 | 
			
		||||
			&GetProductQueriesParams{
 | 
			
		||||
				Page:     1,
 | 
			
		||||
				PageSize: 10,
 | 
			
		||||
				SKUs:     []string{"string"},
 | 
			
		||||
			},
 | 
			
		||||
			`{
 | 
			
		||||
				"analytics_period": {
 | 
			
		||||
				  "date_from": "string",
 | 
			
		||||
				  "date_to": "string"
 | 
			
		||||
				},
 | 
			
		||||
				"items": [
 | 
			
		||||
				  {
 | 
			
		||||
					"category": "string",
 | 
			
		||||
					"currency": "string",
 | 
			
		||||
					"gmv": 0,
 | 
			
		||||
					"name": "string",
 | 
			
		||||
					"offer_id": "string",
 | 
			
		||||
					"position": 0,
 | 
			
		||||
					"sku": 0,
 | 
			
		||||
					"unique_search_users": 0,
 | 
			
		||||
					"unique_view_users": 0,
 | 
			
		||||
					"view_conversion": 0
 | 
			
		||||
				  }
 | 
			
		||||
				],
 | 
			
		||||
				"page_count": 0,
 | 
			
		||||
				"total": 0
 | 
			
		||||
			}`,
 | 
			
		||||
		},
 | 
			
		||||
		// Test No Client-Id or Api-Key
 | 
			
		||||
		{
 | 
			
		||||
			http.StatusUnauthorized,
 | 
			
		||||
			map[string]string{},
 | 
			
		||||
			&GetProductQueriesParams{},
 | 
			
		||||
			`{
 | 
			
		||||
				"code": 16,
 | 
			
		||||
				"message": "Client-Id and Api-Key headers are required"
 | 
			
		||||
			}`,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, test := range tests {
 | 
			
		||||
		c := NewMockClient(core.NewMockHttpHandler(test.statusCode, test.response, test.headers))
 | 
			
		||||
 | 
			
		||||
		ctx, _ := context.WithTimeout(context.Background(), testTimeout)
 | 
			
		||||
		resp, err := c.Analytics().GetProductQueries(ctx, test.params)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			t.Error(err)
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		compareJsonResponse(t, test.response, &GetProductQueriesResponse{})
 | 
			
		||||
 | 
			
		||||
		if resp.StatusCode != test.statusCode {
 | 
			
		||||
			t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -362,11 +362,7 @@ type ListTransactionsResultOperationItem struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ListTransactionsResultOperationPosting struct {
 | 
			
		||||
	// Delivery scheme:
 | 
			
		||||
	//   - FBO — delivery to Ozon warehouse
 | 
			
		||||
	//   - FBS — delivery from seller's warehouse
 | 
			
		||||
	//   - RFBS — delivery service of seller's choice
 | 
			
		||||
	//   - Crossborder — delivery from abroad
 | 
			
		||||
	// Delivery scheme
 | 
			
		||||
	DeliverySchema string `json:"delivery_schema"`
 | 
			
		||||
 | 
			
		||||
	// Date the product was accepted for processing
 | 
			
		||||
 
 | 
			
		||||
@@ -1564,6 +1564,9 @@ type GetDescriptionOfProductResult struct {
 | 
			
		||||
	// Barcode
 | 
			
		||||
	Barcode string `json:"barcode"`
 | 
			
		||||
 | 
			
		||||
	// All product's barcodes
 | 
			
		||||
	Barcodes []string `json:"barcodes"`
 | 
			
		||||
 | 
			
		||||
	// Category identifier
 | 
			
		||||
	DescriptionCategoryId int64 `json:"description_category_id"`
 | 
			
		||||
 | 
			
		||||
@@ -1603,6 +1606,12 @@ type GetDescriptionOfProductResult struct {
 | 
			
		||||
	// Array of PDF files
 | 
			
		||||
	PDFList []GetDescriptionOfProductResultPDF `json:"pdf_list"`
 | 
			
		||||
 | 
			
		||||
	// Link to the main product image
 | 
			
		||||
	PrimaryImage string `json:"primary_image"`
 | 
			
		||||
 | 
			
		||||
	// Product identifier in the Ozon system, SKU
 | 
			
		||||
	SKU int64 `json:"sku"`
 | 
			
		||||
 | 
			
		||||
	// Product type identifier
 | 
			
		||||
	TypeId int64 `json:"type_id"`
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1370,37 +1370,33 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
				  {
 | 
			
		||||
					"id": 213761435,
 | 
			
		||||
					"barcode": "",
 | 
			
		||||
					"description_category_id": 17038062,
 | 
			
		||||
					"barcodes": [
 | 
			
		||||
					  "123124123",
 | 
			
		||||
					  "123342455"
 | 
			
		||||
					],
 | 
			
		||||
					"name": "Пленка защитная для Xiaomi Redmi Note 10 Pro 5G",
 | 
			
		||||
					"offer_id": "21470",
 | 
			
		||||
					"type_id": 124572394,
 | 
			
		||||
					"height": 10,
 | 
			
		||||
					"depth": 210,
 | 
			
		||||
					"width": 140,
 | 
			
		||||
					"dimension_unit": "mm",
 | 
			
		||||
					"weight": 50,
 | 
			
		||||
					"weight_unit": "g",
 | 
			
		||||
					"primary_image": "https://cdn1.ozone.ru/s3/multimedia-4/6804736960.jpg",
 | 
			
		||||
					"sku": 423434534,
 | 
			
		||||
					"model_info": {
 | 
			
		||||
					  "model_id": 43445453,
 | 
			
		||||
					  "count": 4
 | 
			
		||||
					},
 | 
			
		||||
					"images": [
 | 
			
		||||
					  {
 | 
			
		||||
						"file_name": "https://cdn1.ozone.ru/s3/multimedia-f/6190456071.jpg",
 | 
			
		||||
						"default": true,
 | 
			
		||||
						"index": 0
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"file_name": "https://cdn1.ozone.ru/s3/multimedia-7/6190456099.jpg",
 | 
			
		||||
						"default": false,
 | 
			
		||||
						"index": 1
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"file_name": "https://cdn1.ozone.ru/s3/multimedia-9/6190456065.jpg",
 | 
			
		||||
						"default": false,
 | 
			
		||||
						"index": 2
 | 
			
		||||
					  }
 | 
			
		||||
					  "https://cdn1.ozone.ru/s3/multimedia-4/6804736960.jpg",
 | 
			
		||||
					  "https://cdn1.ozone.ru/s3/multimedia-j/6835412647.jpg"
 | 
			
		||||
					],
 | 
			
		||||
					"images360": [],
 | 
			
		||||
					"pdf_list": [],
 | 
			
		||||
					"attributes": [
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 5219,
 | 
			
		||||
						"id": 5219,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1410,7 +1406,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 11051,
 | 
			
		||||
						"id": 11051,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1420,7 +1416,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 10100,
 | 
			
		||||
						"id": 10100,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1430,7 +1426,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 11794,
 | 
			
		||||
						"id": 11794,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1440,7 +1436,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 9048,
 | 
			
		||||
						"id": 9048,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1450,7 +1446,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 5076,
 | 
			
		||||
						"id": 5076,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1460,7 +1456,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 9024,
 | 
			
		||||
						"id": 9024,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1470,7 +1466,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 10015,
 | 
			
		||||
						"id": 10015,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1480,7 +1476,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 85,
 | 
			
		||||
						"id": 85,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1490,7 +1486,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 9461,
 | 
			
		||||
						"id": 9461,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1500,7 +1496,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 4180,
 | 
			
		||||
						"id": 4180,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1510,7 +1506,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 4191,
 | 
			
		||||
						"id": 4191,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1520,7 +1516,7 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
						]
 | 
			
		||||
					  },
 | 
			
		||||
					  {
 | 
			
		||||
						"attribute_id": 8229,
 | 
			
		||||
						"id": 8229,
 | 
			
		||||
						"complex_id": 0,
 | 
			
		||||
						"values": [
 | 
			
		||||
						  {
 | 
			
		||||
@@ -1531,7 +1527,8 @@ func TestGetDescriptionOfProduct(t *testing.T) {
 | 
			
		||||
					  }
 | 
			
		||||
					],
 | 
			
		||||
					"complex_attributes": [],
 | 
			
		||||
					"color_image": ""
 | 
			
		||||
					"color_image": "",
 | 
			
		||||
					"description_category_id": 71107562
 | 
			
		||||
				  }
 | 
			
		||||
				],
 | 
			
		||||
				"total": 1,
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,8 @@ type GetListOfWarehousesResultFirstMile struct {
 | 
			
		||||
	FirstMileType string `json:"first_mile_type"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// You do not need to specify any parameters in the request. Your company will be identified by the Warehouses ID
 | 
			
		||||
// Method returns the list of FBS and rFBS warehouses.
 | 
			
		||||
// To get the list of FBO warehouses, use the /v1/cluster/list method.
 | 
			
		||||
func (c Warehouses) GetListOfWarehouses(ctx context.Context) (*GetListOfWarehousesResponse, error) {
 | 
			
		||||
	url := "/v1/warehouse/list"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user