Make fields optional in method params (#62)
This commit is contained in:
@@ -165,7 +165,7 @@ type GetStocksOnWarehousesParams struct {
|
||||
Offset int64 `json:"offset"`
|
||||
|
||||
// Warehouse type filter:
|
||||
WarehouseType WarehouseType `json:"warehouse_type"`
|
||||
WarehouseType WarehouseType `json:"warehouse_type" default:"ALL"`
|
||||
}
|
||||
|
||||
type GetStocksOnWarehousesResponse struct {
|
||||
|
||||
@@ -83,7 +83,7 @@ type CancellationInfoState struct {
|
||||
|
||||
// Method for getting information about a rFBS cancellation request
|
||||
func (c Cancellations) GetInfo(ctx context.Context, params *GetCancellationInfoParams) (*GetCancellationInfoResponse, error) {
|
||||
url := "/v1/delivery-method/list"
|
||||
url := "/v1/conditional-cancellation/get"
|
||||
|
||||
resp := &GetCancellationInfoResponse{}
|
||||
|
||||
@@ -98,17 +98,17 @@ func (c Cancellations) GetInfo(ctx context.Context, params *GetCancellationInfoP
|
||||
|
||||
type ListCancellationsParams struct {
|
||||
// Filters
|
||||
Filter ListCancellationsFilter `json:"filter"`
|
||||
Filter *ListCancellationsFilter `json:"filter,omitempty"`
|
||||
|
||||
// Number of cancellation requests in the response
|
||||
Limit int32 `json:"limit"`
|
||||
Limit int32 `json:"limit,omitempty"`
|
||||
|
||||
// Number of elements that will be skipped in the response.
|
||||
// For example, if offset=10, the response will start with the 11th element found
|
||||
Offset int32 `json:"offset"`
|
||||
Offset int32 `json:"offset,omitempty"`
|
||||
|
||||
// Additional information
|
||||
With ListCancellationWith `json:"with"`
|
||||
With *ListCancellationWith `json:"with,omitempty"`
|
||||
}
|
||||
|
||||
type ListCancellationsFilter struct {
|
||||
@@ -173,7 +173,7 @@ type ApproveRejectCancellationsParams struct {
|
||||
CancellationId int64 `json:"cancellation_id"`
|
||||
|
||||
// Comment
|
||||
Comment string `json:"comment"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
type ApproveRejectCancellationsResponse struct {
|
||||
|
||||
@@ -98,13 +98,13 @@ func TestListCancellations(t *testing.T) {
|
||||
http.StatusOK,
|
||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||
&ListCancellationsParams{
|
||||
Filter: ListCancellationsFilter{
|
||||
Filter: &ListCancellationsFilter{
|
||||
CancellationInitiator: []string{"CLIENT"},
|
||||
State: "ALL",
|
||||
},
|
||||
Limit: 2,
|
||||
Offset: 0,
|
||||
With: ListCancellationWith{
|
||||
With: &ListCancellationWith{
|
||||
Counters: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -67,7 +67,7 @@ type GetCategoryAttributesParams struct {
|
||||
DescriptionCategoryId int64 `json:"description_category_id"`
|
||||
|
||||
// Response language
|
||||
Language Language `json:"language"`
|
||||
Language Language `json:"language,omitempty"`
|
||||
|
||||
// Product type identifier
|
||||
TypeId int64 `json:"type_id"`
|
||||
@@ -158,7 +158,7 @@ type GetAttributeDictionaryParams struct {
|
||||
DescriptionCategoryId int64 `json:"description_category_id"`
|
||||
|
||||
// Response language
|
||||
Language Language `json:"language"`
|
||||
Language Language `json:"language,omitempty"`
|
||||
|
||||
// Identifier of the directory to start the response with.
|
||||
// If `last_value_id` is 10, the response will contain directories starting from the 11th
|
||||
@@ -168,7 +168,7 @@ type GetAttributeDictionaryParams struct {
|
||||
//
|
||||
// - maximum—5000,
|
||||
// - minimum—1.
|
||||
Limit int64 `json:"limit"`
|
||||
Limit int64 `json:"limit,omitempty"`
|
||||
|
||||
// Product type identifier
|
||||
TypeId int64 `json:"type_id"`
|
||||
|
||||
@@ -121,7 +121,7 @@ type ListOfCertifiedCategoriesResultCert struct {
|
||||
|
||||
// List of certified categories
|
||||
func (c Certificates) ListOfCertifiedCategories(ctx context.Context, params *ListOfCertifiedCategoriesParams) (*ListOfCertifiedCategoriesResponse, error) {
|
||||
url := "/v1/product/certificate/types"
|
||||
url := "/v1/product/certification/list"
|
||||
|
||||
resp := &ListOfCertifiedCategoriesResponse{}
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ type Chats struct {
|
||||
|
||||
type ListChatsParams struct {
|
||||
// Chats filter
|
||||
Filter ListChatsFilter `json:"filter"`
|
||||
Filter *ListChatsFilter `json:"filter,omitempty"`
|
||||
|
||||
// Number of values in the response. The default value is 30. The maximum value is 1000
|
||||
Limit int64 `json:"limit" default:"30"`
|
||||
|
||||
// Number of elements that will be skipped in the response.
|
||||
// For example, if offset=10, the response will start with the 11th element found
|
||||
Offset int64 `json:"offset"`
|
||||
Offset int64 `json:"offset,omitempty"`
|
||||
}
|
||||
|
||||
type ListChatsFilter struct {
|
||||
@@ -240,7 +240,7 @@ type UpdateChatParams struct {
|
||||
FromMessageId uint64 `json:"from_message_id"`
|
||||
|
||||
// Number of messages in the response
|
||||
Limit int64 `json:"limit"`
|
||||
Limit int64 `json:"limit,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateChatResponse struct {
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestListChats(t *testing.T) {
|
||||
http.StatusOK,
|
||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||
&ListChatsParams{
|
||||
Filter: ListChatsFilter{
|
||||
Filter: &ListChatsFilter{
|
||||
ChatStatus: "Opened",
|
||||
UnreadOnly: true,
|
||||
},
|
||||
|
||||
12
ozon/fbo.go
12
ozon/fbo.go
@@ -14,7 +14,7 @@ type FBO struct {
|
||||
|
||||
type GetFBOShipmentsListParams struct {
|
||||
// Sorting direction
|
||||
Direction string `json:"dir"`
|
||||
Direction string `json:"dir,omitempty"`
|
||||
|
||||
// Shipment search filter
|
||||
Filter GetFBOShipmentsListFilter `json:"filter"`
|
||||
@@ -23,13 +23,13 @@ type GetFBOShipmentsListParams struct {
|
||||
Limit int64 `json:"limit"`
|
||||
|
||||
// Number of elements that will be skipped in the response. For example, if offset=10, the response will start with the 11th element found
|
||||
Offset int64 `json:"offset"`
|
||||
Offset int64 `json:"offset,omitempty"`
|
||||
|
||||
// true if the address transliteration from Cyrillic to Latin is enabled
|
||||
Translit bool `json:"translit"`
|
||||
Translit bool `json:"translit,omitempty"`
|
||||
|
||||
// Additional fields to add to the response
|
||||
With GetFBOShipmentsListWith `json:"with"`
|
||||
With *GetFBOShipmentsListWith `json:"with,omitempty"`
|
||||
}
|
||||
|
||||
// Shipment search filter
|
||||
@@ -185,10 +185,10 @@ type GetShipmentDetailsParams struct {
|
||||
PostingNumber string `json:"posting_number"`
|
||||
|
||||
// true if the address transliteration from Cyrillic to Latin is enabled
|
||||
Translit bool `json:"translit"`
|
||||
Translit bool `json:"translit,omitempty"`
|
||||
|
||||
// Additional fields to add to the response
|
||||
With GetShipmentDetailsWith `json:"with"`
|
||||
With *GetShipmentDetailsWith `json:"with,omitempty"`
|
||||
}
|
||||
|
||||
type GetShipmentDetailsWith struct {
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestGetFBOShipmentsList(t *testing.T) {
|
||||
Limit: 5,
|
||||
Offset: 0,
|
||||
Translit: true,
|
||||
With: GetFBOShipmentsListWith{
|
||||
With: &GetFBOShipmentsListWith{
|
||||
AnalyticsData: true,
|
||||
FinancialData: true,
|
||||
},
|
||||
@@ -165,7 +165,7 @@ func TestGetShipmentDetails(t *testing.T) {
|
||||
&GetShipmentDetailsParams{
|
||||
PostingNumber: "50520644-0012-7",
|
||||
Translit: true,
|
||||
With: GetShipmentDetailsWith{
|
||||
With: &GetShipmentDetailsWith{
|
||||
AnalyticsData: true,
|
||||
FinancialData: true,
|
||||
},
|
||||
|
||||
18
ozon/fbs.go
18
ozon/fbs.go
@@ -14,7 +14,7 @@ type FBS struct {
|
||||
|
||||
type ListUnprocessedShipmentsParams struct {
|
||||
// Sorting direction
|
||||
Direction Order `json:"dir"`
|
||||
Direction Order `json:"dir,omitempty"`
|
||||
|
||||
// Request filter
|
||||
Filter ListUnprocessedShipmentsFilter `json:"filter"`
|
||||
@@ -27,10 +27,10 @@ type ListUnprocessedShipmentsParams struct {
|
||||
|
||||
// Number of elements that will be skipped in the response.
|
||||
// For example, if `offset` = 10, the response will start with the 11th element found
|
||||
Offset int64 `json:"offset"`
|
||||
Offset int64 `json:"offset,omitempty"`
|
||||
|
||||
// Additional fields that should be added to the response
|
||||
With ListUnprocessedShipmentsWith `json:"with"`
|
||||
With *ListUnprocessedShipmentsWith `json:"with,omitempty"`
|
||||
}
|
||||
|
||||
type ListUnprocessedShipmentsFilter struct {
|
||||
@@ -511,9 +511,9 @@ func (c FBS) ListUnprocessedShipments(ctx context.Context, params *ListUnprocess
|
||||
|
||||
type GetFBSShipmentsListParams struct {
|
||||
// Sorting direction
|
||||
Direction string `json:"direction"`
|
||||
Direction string `json:"dir,omitempty"`
|
||||
|
||||
//Filter
|
||||
// Filter
|
||||
Filter GetFBSShipmentsListFilter `json:"filter"`
|
||||
|
||||
// Number of shipments in the response:
|
||||
@@ -522,10 +522,10 @@ type GetFBSShipmentsListParams struct {
|
||||
Limit int64 `json:"limit"`
|
||||
|
||||
// Number of elements that will be skipped in the response. For example, if offset=10, the response will start with the 11th element found
|
||||
Offset int64 `json:"offset"`
|
||||
Offset int64 `json:"offset,omitempty"`
|
||||
|
||||
// Additional fields that should be added to the response
|
||||
With GetFBSShipmentsListWith `json:"with"`
|
||||
With *GetFBSShipmentsListWith `json:"with,omitempty"`
|
||||
}
|
||||
|
||||
type GetFBSShipmentsListFilter struct {
|
||||
@@ -625,7 +625,7 @@ type PackOrderParams struct {
|
||||
PostingNumber string `json:"posting_number"`
|
||||
|
||||
// Additional information
|
||||
With PackOrderWith `json:"with"`
|
||||
With *PackOrderWith `json:"with,omitempty"`
|
||||
}
|
||||
|
||||
type PackOrderPackage struct {
|
||||
@@ -865,7 +865,7 @@ type GetShipmentDataByIdentifierParams struct {
|
||||
PostingNumber string `json:"posting_number"`
|
||||
|
||||
// Additional fields that should be added to the response
|
||||
With GetShipmentDataByIdentifierWith `json:"with"`
|
||||
With *GetShipmentDataByIdentifierWith `json:"with,omitempty"`
|
||||
}
|
||||
|
||||
type GetShipmentDataByIdentifierWith struct {
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestListUnprocessedShipments(t *testing.T) {
|
||||
Status: "awaiting_packaging",
|
||||
},
|
||||
Limit: 100,
|
||||
With: ListUnprocessedShipmentsWith{
|
||||
With: &ListUnprocessedShipmentsWith{
|
||||
AnalyticsData: true,
|
||||
Barcodes: true,
|
||||
FinancialData: true,
|
||||
@@ -210,7 +210,7 @@ func TestGetFBSShipmentsList(t *testing.T) {
|
||||
},
|
||||
Limit: 0,
|
||||
Offset: 0,
|
||||
With: GetFBSShipmentsListWith{
|
||||
With: &GetFBSShipmentsListWith{
|
||||
AnalyticsData: true,
|
||||
FinancialData: true,
|
||||
Translit: true,
|
||||
@@ -330,7 +330,7 @@ func TestPackOrder(t *testing.T) {
|
||||
},
|
||||
},
|
||||
PostingNumber: "89491381-0072-1",
|
||||
With: PackOrderWith{
|
||||
With: &PackOrderWith{
|
||||
AdditionalData: true,
|
||||
},
|
||||
},
|
||||
@@ -556,7 +556,7 @@ func TestGetShipmentDataByIdentifier(t *testing.T) {
|
||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||
&GetShipmentDataByIdentifierParams{
|
||||
PostingNumber: "57195475-0050-3",
|
||||
With: GetShipmentDataByIdentifierWith{},
|
||||
With: &GetShipmentDataByIdentifierWith{},
|
||||
},
|
||||
`{
|
||||
"result": {
|
||||
|
||||
@@ -1356,10 +1356,10 @@ type GetDescriptionOfProductParams struct {
|
||||
Limit int64 `json:"limit"`
|
||||
|
||||
// The parameter by which the products will be sorted
|
||||
SortBy string `json:"sort_by"`
|
||||
SortBy string `json:"sort_by,omitempty"`
|
||||
|
||||
// Sorting direction
|
||||
SortDirection string `json:"sort_direction"`
|
||||
SortDirection string `json:"sort_dir,omitempty"`
|
||||
}
|
||||
|
||||
type GetDescriptionOfProductFilter struct {
|
||||
|
||||
@@ -154,7 +154,7 @@ type ProductsAvailableForPromotionParams struct {
|
||||
|
||||
// Number of elements that will be skipped in the response.
|
||||
// For example, if offset=10, the response will start with the 11th element found
|
||||
Offset float64 `json:"offset"`
|
||||
Offset float64 `json:"offset,omitempty"`
|
||||
}
|
||||
|
||||
type ProductsAvailableForPromotionResponse struct {
|
||||
@@ -218,7 +218,7 @@ type ProductsInPromotionParams struct {
|
||||
Limit float64 `json:"limit"`
|
||||
|
||||
// Number of elements that will be skipped in the response. For example, if offset=10, the response will start with the 11th element found
|
||||
Offset float64 `json:"offset"`
|
||||
Offset float64 `json:"offset,omitempty"`
|
||||
}
|
||||
|
||||
type ProductsInPromotionResponse struct {
|
||||
@@ -355,7 +355,7 @@ type ProductsAvailableForHotSalePromotionParams struct {
|
||||
Limit float64 `json:"limit"`
|
||||
|
||||
// Number of elements that will be skipped in the response. For example, if offset=10, the response will start with the 11th element found
|
||||
Offset float64 `json:"offset"`
|
||||
Offset float64 `json:"offset,omitempty"`
|
||||
}
|
||||
|
||||
type ProductsAvailableForHotSalePromotionResponse struct {
|
||||
|
||||
@@ -450,7 +450,7 @@ func (c Reports) GetProducts(ctx context.Context, params *GetProductsReportParam
|
||||
|
||||
type GetReturnsReportParams struct {
|
||||
// Filter
|
||||
Filter GetReturnsReportsFilter `json:"filter"`
|
||||
Filter *GetReturnsReportsFilter `json:"filter,omitempty"`
|
||||
|
||||
// Default: "DEFAULT"
|
||||
// Response language:
|
||||
@@ -501,7 +501,7 @@ func (c Reports) GetReturns(ctx context.Context, params *GetReturnsReportParams)
|
||||
|
||||
type GetShipmentReportParams struct {
|
||||
// Filter
|
||||
Filter GetShipmentReportFilter `json:"filter"`
|
||||
Filter *GetShipmentReportFilter `json:"filter,omitempty"`
|
||||
|
||||
// Default: "DEFAULT"
|
||||
// Response language:
|
||||
|
||||
@@ -375,7 +375,7 @@ func TestGetReturnsReport(t *testing.T) {
|
||||
http.StatusOK,
|
||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||
&GetReturnsReportParams{
|
||||
Filter: GetReturnsReportsFilter{
|
||||
Filter: &GetReturnsReportsFilter{
|
||||
DeliverySchema: "fbs",
|
||||
},
|
||||
},
|
||||
@@ -435,7 +435,7 @@ func TestGetShipmentReport(t *testing.T) {
|
||||
http.StatusOK,
|
||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||
&GetShipmentReportParams{
|
||||
Filter: GetShipmentReportFilter{
|
||||
Filter: &GetShipmentReportFilter{
|
||||
DeliverySchema: []string{"fbs", "fbo", "crossborder"},
|
||||
ProcessedAtFrom: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-09-02T17:10:54.861Z"),
|
||||
ProcessedAtTo: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-11-02T17:10:54.861Z"),
|
||||
|
||||
@@ -14,7 +14,7 @@ type Returns struct {
|
||||
|
||||
type GetFBOReturnsParams struct {
|
||||
// Filter
|
||||
Filter GetFBOReturnsFilter `json:"filter"`
|
||||
Filter *GetFBOReturnsFilter `json:"filter,omitempty"`
|
||||
|
||||
// Identifier of the last value on the page. Leave this field blank in the first request.
|
||||
//
|
||||
@@ -95,7 +95,7 @@ func (c Returns) GetFBOReturns(ctx context.Context, params *GetFBOReturnsParams)
|
||||
|
||||
type GetFBSReturnsParams struct {
|
||||
// Filter
|
||||
Filter GetFBSReturnsFilter `json:"filter"`
|
||||
Filter *GetFBSReturnsFilter `json:"filter,omitempty"`
|
||||
|
||||
// Number of values in the response:
|
||||
// - maximum — 1000,
|
||||
@@ -264,7 +264,7 @@ func (c Returns) GetFBSReturns(ctx context.Context, params *GetFBSReturnsParams)
|
||||
|
||||
type GetRFBSReturnsParams struct {
|
||||
// Filter
|
||||
Filter GetRFBSReturnsFilter `json:"filter"`
|
||||
Filter *GetRFBSReturnsFilter `json:"filter,omitempty"`
|
||||
|
||||
// Identifier of the last value on the page.
|
||||
// Leave this field blank in the first request
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestGetFBOReturns(t *testing.T) {
|
||||
http.StatusOK,
|
||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||
&GetFBOReturnsParams{
|
||||
Filter: GetFBOReturnsFilter{
|
||||
Filter: &GetFBOReturnsFilter{
|
||||
PostingNumber: "some number",
|
||||
},
|
||||
LastId: 123,
|
||||
@@ -105,7 +105,7 @@ func TestGetFBSReturns(t *testing.T) {
|
||||
http.StatusOK,
|
||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||
&GetFBSReturnsParams{
|
||||
Filter: GetFBSReturnsFilter{
|
||||
Filter: &GetFBSReturnsFilter{
|
||||
PostingNumber: []string{"07402477-0022-2"},
|
||||
Status: "returned_to_seller",
|
||||
},
|
||||
@@ -212,7 +212,7 @@ func TestGetRFBSReturns(t *testing.T) {
|
||||
&GetRFBSReturnsParams{
|
||||
LastId: 999,
|
||||
Limit: 555,
|
||||
Filter: GetRFBSReturnsFilter{
|
||||
Filter: &GetRFBSReturnsFilter{
|
||||
OfferId: "123",
|
||||
PostingNumber: "111",
|
||||
GroupState: []RFBSReturnsGroupState{RFBSReturnsGroupStateAll},
|
||||
|
||||
@@ -102,7 +102,7 @@ func (c Warehouses) GetListOfWarehouses(ctx context.Context) (*GetListOfWarehous
|
||||
|
||||
type GetListOfDeliveryMethodsParams struct {
|
||||
// Search filter for delivery methods
|
||||
Filter GetListOfDeliveryMethodsFilter `json:"filter"`
|
||||
Filter *GetListOfDeliveryMethodsFilter `json:"filter,omitempty"`
|
||||
|
||||
// Number of items in a response. Maximum is 50, minimum is 1
|
||||
Limit int64 `json:"limit"`
|
||||
|
||||
@@ -99,7 +99,7 @@ func TestGetListOfDeliveryMethods(t *testing.T) {
|
||||
http.StatusOK,
|
||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||
&GetListOfDeliveryMethodsParams{
|
||||
Filter: GetListOfDeliveryMethodsFilter{
|
||||
Filter: &GetListOfDeliveryMethodsFilter{
|
||||
WarehouseId: 15588127982000,
|
||||
},
|
||||
Limit: 100,
|
||||
|
||||
Reference in New Issue
Block a user