Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c0e18681b | ||
|
|
895ef8be52 | ||
|
|
ccd3610c76 | ||
|
|
090b2afb63 | ||
|
|
823386edf2 | ||
|
|
5ecf131061 |
@@ -4,6 +4,7 @@
|
|||||||
- [x] Product category tree
|
- [x] Product category tree
|
||||||
- [x] Category characteristics list
|
- [x] Category characteristics list
|
||||||
- [x] Characteristics value directory
|
- [x] Characteristics value directory
|
||||||
|
- [x] Search characteristics value directory
|
||||||
|
|
||||||
## Uploading and updating products
|
## Uploading and updating products
|
||||||
- [x] Create or update a product
|
- [x] Create or update a product
|
||||||
|
|||||||
@@ -200,6 +200,9 @@ type GetStocksOnWarehousesResultRow struct {
|
|||||||
|
|
||||||
// Name of the warehouse where the products are stored
|
// Name of the warehouse where the products are stored
|
||||||
WarehouseName string `json:"warehouse_name"`
|
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
|
// Report on stocks and products movement at Ozon warehouses
|
||||||
|
|||||||
@@ -224,3 +224,63 @@ func (c *Categories) AttributesDictionary(ctx context.Context, params *GetAttrib
|
|||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SearchAttributeDictionaryParams struct {
|
||||||
|
// Characteristics identifier
|
||||||
|
AttributeId int64 `json:"attribute_id"`
|
||||||
|
|
||||||
|
// Category identifier
|
||||||
|
DescriptionCategoryId int64 `json:"description_category_id"`
|
||||||
|
|
||||||
|
// The value to be searched for
|
||||||
|
// - minimum—2 characters
|
||||||
|
Value string `json:"value"`
|
||||||
|
|
||||||
|
// Number of values in the response:
|
||||||
|
//
|
||||||
|
// - maximum—100,
|
||||||
|
// - minimum—1.
|
||||||
|
Limit int64 `json:"limit,omitempty"`
|
||||||
|
|
||||||
|
// Product type identifier
|
||||||
|
TypeId int64 `json:"type_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SearchAttributeDictionaryResponse struct {
|
||||||
|
core.CommonResponse
|
||||||
|
|
||||||
|
// Characteristic values
|
||||||
|
Result []SearchAttributeDictionaryResult `json:"result"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SearchAttributeDictionaryResult struct {
|
||||||
|
// Characteristic value identifier
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
|
||||||
|
// Additional description
|
||||||
|
Info string `json:"info"`
|
||||||
|
|
||||||
|
// Image link
|
||||||
|
Picture string `json:"picture"`
|
||||||
|
|
||||||
|
// Product characteristic value
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns found characteristics value directory.
|
||||||
|
//
|
||||||
|
// To check if an attribute has a nested directory,
|
||||||
|
// use the `/v1/description-category/attribute` method.
|
||||||
|
func (c *Categories) SearchAttributesDictionary(ctx context.Context, params *SearchAttributeDictionaryParams) (*SearchAttributeDictionaryResponse, error) {
|
||||||
|
url := "/v1/description-category/attribute/values/search"
|
||||||
|
|
||||||
|
resp := &SearchAttributeDictionaryResponse{}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -203,3 +203,71 @@ func TestGetAttributeDictionary(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSearchAttributeDictionary(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
statusCode int
|
||||||
|
headers map[string]string
|
||||||
|
params *SearchAttributeDictionaryParams
|
||||||
|
response string
|
||||||
|
}{
|
||||||
|
// Test Ok
|
||||||
|
{
|
||||||
|
http.StatusOK,
|
||||||
|
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||||
|
&SearchAttributeDictionaryParams{
|
||||||
|
AttributeId: 123456,
|
||||||
|
DescriptionCategoryId: 12,
|
||||||
|
Value: "34",
|
||||||
|
Limit: 5,
|
||||||
|
TypeId: 6,
|
||||||
|
},
|
||||||
|
`{
|
||||||
|
"has_next": true,
|
||||||
|
"result": [
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"info": "string",
|
||||||
|
"picture": "string",
|
||||||
|
"value": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
// Test No Client-Id or Api-Key
|
||||||
|
{
|
||||||
|
http.StatusUnauthorized,
|
||||||
|
map[string]string{},
|
||||||
|
&SearchAttributeDictionaryParams{},
|
||||||
|
`{
|
||||||
|
"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.Categories().SearchAttributesDictionary(ctx, test.params)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
compareJsonResponse(t, test.response, &GetAttributeDictionaryResponse{})
|
||||||
|
|
||||||
|
if resp.StatusCode != test.statusCode {
|
||||||
|
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
if resp.StatusCode == http.StatusOK {
|
||||||
|
if len(resp.Result) > int(test.params.Limit) {
|
||||||
|
t.Errorf("Length of response result is bigger than limit")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ type ListChatsResponse struct {
|
|||||||
core.CommonResponse
|
core.CommonResponse
|
||||||
|
|
||||||
// Chats data
|
// Chats data
|
||||||
Chats []ListChatsChat `json:"chats"`
|
Chats []ListChatsChatData `json:"chats"`
|
||||||
|
|
||||||
// Total number of chats
|
// Total number of chats
|
||||||
TotalChatsCount int64 `json:"total_chats_count"`
|
TotalChatsCount int64 `json:"total_chats_count"`
|
||||||
@@ -48,20 +48,6 @@ type ListChatsResponse struct {
|
|||||||
TotalUnreadCount int64 `json:"total_unread_count"`
|
TotalUnreadCount int64 `json:"total_unread_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListChatsChat struct {
|
|
||||||
// Chat data
|
|
||||||
Chat ListChatsChatData `json:"chat"`
|
|
||||||
|
|
||||||
// Identifier of the first unread chat message
|
|
||||||
FirstUnreadMessageId string `json:"first_unread_message_id"`
|
|
||||||
|
|
||||||
// Identifier of the last message in the chat
|
|
||||||
LastMessageId string `json:"last_message_id"`
|
|
||||||
|
|
||||||
// Number of unread messages in the chat
|
|
||||||
UnreadCount int64 `json:"unread_count"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ListChatsChatData struct {
|
type ListChatsChatData struct {
|
||||||
// Chat identifier
|
// Chat identifier
|
||||||
ChatId string `json:"chat_id"`
|
ChatId string `json:"chat_id"`
|
||||||
@@ -79,6 +65,15 @@ type ListChatsChatData struct {
|
|||||||
|
|
||||||
// Chat creation date
|
// Chat creation date
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
|
||||||
|
// Identifier of the first unread chat message
|
||||||
|
FirstUnreadMessageId uint64 `json:"first_unread_message_id"`
|
||||||
|
|
||||||
|
// Identifier of the last message in the chat
|
||||||
|
LastMessageId uint64 `json:"last_message_id"`
|
||||||
|
|
||||||
|
// Number of unread messages in the chat
|
||||||
|
UnreadCount int64 `json:"unread_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns information about chats by specified filters
|
// Returns information about chats by specified filters
|
||||||
|
|||||||
@@ -32,15 +32,13 @@ func TestListChats(t *testing.T) {
|
|||||||
`{
|
`{
|
||||||
"chats": [
|
"chats": [
|
||||||
{
|
{
|
||||||
"chat": {
|
"chat_id": "5e767w03-b400-4y1b-a841-75319ca8a5c8",
|
||||||
"created_at": "2022-07-22T08:07:19.581Z",
|
"chat_status": "Opened",
|
||||||
"chat_id": "5e767w03-b400-4y1b-a841-75319ca8a5c8",
|
"chat_type": "Seller_Support",
|
||||||
"chat_status": "Opened",
|
"created_at": "2022-07-22T08:07:19.581Z",
|
||||||
"chat_type": "Seller_Support"
|
"unread_count": 1,
|
||||||
},
|
"last_message_id": 3000000000128004274,
|
||||||
"first_unread_message_id": "3000000000118021931",
|
"first_unread_message_id": 3000000000118021931
|
||||||
"last_message_id": "30000000001280042740",
|
|
||||||
"unread_count": 1
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"total_chats_count": 25,
|
"total_chats_count": 25,
|
||||||
@@ -77,10 +75,10 @@ func TestListChats(t *testing.T) {
|
|||||||
|
|
||||||
if resp.StatusCode == http.StatusOK {
|
if resp.StatusCode == http.StatusOK {
|
||||||
if len(resp.Chats) > 0 {
|
if len(resp.Chats) > 0 {
|
||||||
if resp.Chats[0].Chat.ChatStatus == "" {
|
if resp.Chats[0].ChatStatus == "" {
|
||||||
t.Errorf("Chat status cannot be empty")
|
t.Errorf("Chat status cannot be empty")
|
||||||
}
|
}
|
||||||
if resp.Chats[0].Chat.ChatType == "" {
|
if resp.Chats[0].ChatType == "" {
|
||||||
t.Errorf("Chat type cannot be empty")
|
t.Errorf("Chat type cannot be empty")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,24 +126,6 @@ const (
|
|||||||
type SupplyRequestState string
|
type SupplyRequestState string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// request draft. Only for supplies via vDC
|
|
||||||
Draft SupplyRequestState = "DRAFT"
|
|
||||||
|
|
||||||
// selecting supply options. Only for supplies via vDC
|
|
||||||
SupplyVariantsArranging SupplyRequestState = "SUPPLY_VARIANTS_ARRANGING"
|
|
||||||
|
|
||||||
// no supply options, the request is archived. Only for supplies via vDC
|
|
||||||
HasNoSupplyVariantsArchive SupplyRequestState = "HAS_NO_SUPPLY_VARIANTS_ARCHIVE"
|
|
||||||
|
|
||||||
// no supply options. Only for supplies via vDC
|
|
||||||
HasNoSupplyVariantsNew SupplyRequestState = "HAS_NO_SUPPLY_VARIANTS_NEW"
|
|
||||||
|
|
||||||
// supply being approved. Only for supplies via vDC
|
|
||||||
SupplyVariantsConfirmation SupplyRequestState = "SUPPLY_VARIANTS_CONFIRMATION"
|
|
||||||
|
|
||||||
// time reservation
|
|
||||||
TimeslotBooking SupplyRequestState = "TIMESLOT_BOOKING"
|
|
||||||
|
|
||||||
// filling in the data
|
// filling in the data
|
||||||
DATA_FILLING SupplyRequestState = "DATA_FILLING"
|
DATA_FILLING SupplyRequestState = "DATA_FILLING"
|
||||||
|
|
||||||
@@ -808,6 +790,9 @@ const (
|
|||||||
|
|
||||||
// reissue of returns at the pick-up point
|
// reissue of returns at the pick-up point
|
||||||
TransactionServiceRedistributionReturnsPVZ TransactionOperationService = "MarketplaceServiceItemRedistributionReturnsPVZ"
|
TransactionServiceRedistributionReturnsPVZ TransactionOperationService = "MarketplaceServiceItemRedistributionReturnsPVZ"
|
||||||
|
|
||||||
|
// Agregator 3PL Globalagency service tariffication
|
||||||
|
TransactionServiceAgencyFeeAggregator3PLGlobal TransactionOperationService = "OperationMarketplaceAgencyFeeAggregator3PLGlobal "
|
||||||
)
|
)
|
||||||
|
|
||||||
type PaymentTypeGroupName string
|
type PaymentTypeGroupName string
|
||||||
|
|||||||
@@ -747,6 +747,9 @@ type CreateOrUpdateProductItem struct {
|
|||||||
// Category identifier
|
// Category identifier
|
||||||
DescriptionCategoryId int64 `json:"description_category_id"`
|
DescriptionCategoryId int64 `json:"description_category_id"`
|
||||||
|
|
||||||
|
// New category identifier. Specify it if you want to change the current product category
|
||||||
|
NewDescriptinoCategoryId int64 `json:"new_description_category_id"`
|
||||||
|
|
||||||
// Marketing color.
|
// Marketing color.
|
||||||
//
|
//
|
||||||
// Pass the link to the image in the public cloud storage. The image format is JPG
|
// Pass the link to the image in the public cloud storage. The image format is JPG
|
||||||
@@ -1799,7 +1802,7 @@ type ListGeoRestrictionsRestriction struct {
|
|||||||
OrderNumber int64 `json:"order_number"`
|
OrderNumber int64 `json:"order_number"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a list of geo-restrictions for services
|
// Deprecated: Get a list of geo-restrictions for services
|
||||||
func (c Products) ListGeoRestrictions(ctx context.Context, params *ListGeoRestrictionsParams) (*ListGeoRestrictionsResponse, error) {
|
func (c Products) ListGeoRestrictions(ctx context.Context, params *ListGeoRestrictionsParams) (*ListGeoRestrictionsResponse, error) {
|
||||||
url := "/v1/products/geo-restrictions-catalog-by-filter"
|
url := "/v1/products/geo-restrictions-catalog-by-filter"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user