Time format fixes and optional fields (#91)
This commit is contained in:
@@ -163,7 +163,7 @@ type GetStocksOnWarehousesParams 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
|
// 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"`
|
||||||
|
|
||||||
// Warehouse type filter:
|
// Warehouse type filter
|
||||||
WarehouseType WarehouseType `json:"warehouse_type" default:"ALL"`
|
WarehouseType WarehouseType `json:"warehouse_type" default:"ALL"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,15 +113,15 @@ type ListCancellationsParams struct {
|
|||||||
|
|
||||||
type ListCancellationsFilter struct {
|
type ListCancellationsFilter struct {
|
||||||
// Filter by cancellation initiator
|
// Filter by cancellation initiator
|
||||||
CancellationInitiator []string `json:"cancellation_initiator"`
|
CancellationInitiator []string `json:"cancellation_initiator,omitempty"`
|
||||||
|
|
||||||
// Filter by shipment number.
|
// Filter by shipment number.
|
||||||
//
|
//
|
||||||
// Optional parameter. You can pass several values here
|
// Optional parameter. You can pass several values here
|
||||||
PostingNumber string `json:"posting_number"`
|
PostingNumber string `json:"posting_number,omitempty"`
|
||||||
|
|
||||||
// Filter by cancellation request status
|
// Filter by cancellation request status
|
||||||
State string `json:"state"`
|
State string `json:"state,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListCancellationWith struct {
|
type ListCancellationWith struct {
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ func (c Chats) Create(ctx context.Context, params *CreateNewChatParams) (*Create
|
|||||||
|
|
||||||
type MarkAsReadParams struct {
|
type MarkAsReadParams struct {
|
||||||
// Chat identifier
|
// Chat identifier
|
||||||
Chatid string `json:"chat_id"`
|
ChatId string `json:"chat_id"`
|
||||||
|
|
||||||
// Message identifier
|
// Message identifier
|
||||||
FromMessageId uint64 `json:"from_message_id"`
|
FromMessageId uint64 `json:"from_message_id"`
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ func TestMarkAsRead(t *testing.T) {
|
|||||||
http.StatusOK,
|
http.StatusOK,
|
||||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||||
&MarkAsReadParams{
|
&MarkAsReadParams{
|
||||||
Chatid: "99feb3fc-a474-469f-95d5-268b470cc607",
|
ChatId: "99feb3fc-a474-469f-95d5-268b470cc607",
|
||||||
FromMessageId: 3000000000118032000,
|
FromMessageId: 3000000000118032000,
|
||||||
},
|
},
|
||||||
`{
|
`{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ type FBO struct {
|
|||||||
|
|
||||||
type GetFBOShipmentsListParams struct {
|
type GetFBOShipmentsListParams struct {
|
||||||
// Sorting direction
|
// Sorting direction
|
||||||
Direction string `json:"dir,omitempty"`
|
Direction Order `json:"dir,omitempty"`
|
||||||
|
|
||||||
// Shipment search filter
|
// Shipment search filter
|
||||||
Filter GetFBOShipmentsListFilter `json:"filter"`
|
Filter GetFBOShipmentsListFilter `json:"filter"`
|
||||||
@@ -35,13 +35,13 @@ type GetFBOShipmentsListParams struct {
|
|||||||
// Shipment search filter
|
// Shipment search filter
|
||||||
type GetFBOShipmentsListFilter struct {
|
type GetFBOShipmentsListFilter struct {
|
||||||
// Period start in YYYY-MM-DD format
|
// Period start in YYYY-MM-DD format
|
||||||
Since time.Time `json:"since"`
|
Since *core.TimeFormat `json:"since,omitempty"`
|
||||||
|
|
||||||
// Shipment status
|
// Shipment status
|
||||||
Status string `json:"status"`
|
Status string `json:"status,omitempty"`
|
||||||
|
|
||||||
// Period end in YYYY-MM-DD format
|
// Period end in YYYY-MM-DD format
|
||||||
To time.Time `json:"to"`
|
To *core.TimeFormat `json:"to,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additional fields to add to the response
|
// Additional fields to add to the response
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ func TestGetFBOShipmentsList(t *testing.T) {
|
|||||||
&GetFBOShipmentsListParams{
|
&GetFBOShipmentsListParams{
|
||||||
Direction: "ASC",
|
Direction: "ASC",
|
||||||
Filter: GetFBOShipmentsListFilter{
|
Filter: GetFBOShipmentsListFilter{
|
||||||
Since: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-09-01T00:00:00.000Z"),
|
Since: core.NewTimeFormat(core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-09-01T00:00:00.000Z"), "2006-01-02T15:04:05Z"),
|
||||||
Status: "awaiting_packaging",
|
Status: "awaiting_packaging",
|
||||||
To: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-11-17T10:44:12.828Z"),
|
To: core.NewTimeFormat(core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-11-17T10:44:12.828Z"), "2006-01-02T15:04:05Z"),
|
||||||
},
|
},
|
||||||
Limit: 5,
|
Limit: 5,
|
||||||
Offset: 0,
|
Offset: 0,
|
||||||
|
|||||||
16
ozon/fbs.go
16
ozon/fbs.go
@@ -37,18 +37,18 @@ type ListUnprocessedShipmentsFilter struct {
|
|||||||
// Filter by the time by which the seller should pack the order. Period start.
|
// Filter by the time by which the seller should pack the order. Period start.
|
||||||
//
|
//
|
||||||
// Format: YYYY-MM-DDThh: mm:ss. mcsZ. Example: 2020-03-18T07:34:50.359 Z
|
// Format: YYYY-MM-DDThh: mm:ss. mcsZ. Example: 2020-03-18T07:34:50.359 Z
|
||||||
CutoffFrom time.Time `json:"cutoff_from"`
|
CutoffFrom *core.TimeFormat `json:"cutoff_from,omitempty"`
|
||||||
|
|
||||||
// Filter by the time by which the seller should pack the order. Period end.
|
// Filter by the time by which the seller should pack the order. Period end.
|
||||||
//
|
//
|
||||||
// Format: YYYY-MM-DDThh: mm:ss. mcsZ. Example: 2020-03-18T07:34:50.359 Z
|
// Format: YYYY-MM-DDThh: mm:ss. mcsZ. Example: 2020-03-18T07:34:50.359 Z
|
||||||
CutoffTo time.Time `json:"cutoff_to"`
|
CutoffTo *core.TimeFormat `json:"cutoff_to,omitempty"`
|
||||||
|
|
||||||
// Minimum date when shipment should be handed over for delivery
|
// Minimum date when shipment should be handed over for delivery
|
||||||
DeliveringDateFrom time.Time `json:"delivering_date_from"`
|
DeliveringDateFrom *core.TimeFormat `json:"delivering_date_from,omitempty"`
|
||||||
|
|
||||||
// Maximum date when shipment should be handed over for delivery
|
// Maximum date when shipment should be handed over for delivery
|
||||||
DeliveringDateTo time.Time `json:"delivering_date_to"`
|
DeliveringDateTo *core.TimeFormat `json:"delivering_date_to,omitempty"`
|
||||||
|
|
||||||
// Delivery method identifier
|
// Delivery method identifier
|
||||||
DeliveryMethodId []int64 `json:"delivery_method_id"`
|
DeliveryMethodId []int64 `json:"delivery_method_id"`
|
||||||
@@ -58,7 +58,7 @@ type ListUnprocessedShipmentsFilter struct {
|
|||||||
// Default value is all.
|
// Default value is all.
|
||||||
//
|
//
|
||||||
// The FBP scheme is available only for sellers from China
|
// The FBP scheme is available only for sellers from China
|
||||||
FBPFilter FBPFilter `json:"fbpFilter"`
|
FBPFilter FBPFilter `json:"fbpFilter" default:"all"`
|
||||||
|
|
||||||
// Delivery service identifier
|
// Delivery service identifier
|
||||||
ProviderId []int64 `json:"provider_id"`
|
ProviderId []int64 `json:"provider_id"`
|
||||||
@@ -511,7 +511,7 @@ func (c FBS) ListUnprocessedShipments(ctx context.Context, params *ListUnprocess
|
|||||||
|
|
||||||
type GetFBSShipmentsListParams struct {
|
type GetFBSShipmentsListParams struct {
|
||||||
// Sorting direction
|
// Sorting direction
|
||||||
Direction string `json:"dir,omitempty"`
|
Direction Order `json:"dir,omitempty"`
|
||||||
|
|
||||||
// Filter
|
// Filter
|
||||||
Filter GetFBSShipmentsListFilter `json:"filter"`
|
Filter GetFBSShipmentsListFilter `json:"filter"`
|
||||||
@@ -532,12 +532,12 @@ type GetFBSShipmentsListFilter struct {
|
|||||||
// Delivery method identifier
|
// Delivery method identifier
|
||||||
DeliveryMethodId []int64 `json:"delivery_method_id"`
|
DeliveryMethodId []int64 `json:"delivery_method_id"`
|
||||||
|
|
||||||
// Filter for shipments delivered from partner warehouse (FBP). You can pass one of the following values:
|
// Filter for shipments delivered from partner warehouse (FBP)
|
||||||
//
|
//
|
||||||
// Default value is all.
|
// Default value is all.
|
||||||
//
|
//
|
||||||
// The FBP scheme is available only for sellers from China
|
// The FBP scheme is available only for sellers from China
|
||||||
FBPFilter FBPFilter `json:"fbpFilter"`
|
FBPFilter FBPFilter `json:"fbpFilter" default:"all"`
|
||||||
|
|
||||||
// Order identifier
|
// Order identifier
|
||||||
OrderId int64 `json:"order_id"`
|
OrderId int64 `json:"order_id"`
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ func TestListUnprocessedShipments(t *testing.T) {
|
|||||||
&ListUnprocessedShipmentsParams{
|
&ListUnprocessedShipmentsParams{
|
||||||
Direction: "ASC",
|
Direction: "ASC",
|
||||||
Filter: ListUnprocessedShipmentsFilter{
|
Filter: ListUnprocessedShipmentsFilter{
|
||||||
CutoffFrom: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-08-24T14:15:22Z"),
|
CutoffFrom: core.NewTimeFormat(core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-08-24T14:15:22Z"), "2006-01-02T15:04:05Z"),
|
||||||
CutoffTo: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-08-31T14:15:22Z"),
|
CutoffTo: core.NewTimeFormat(core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-08-31T14:15:22Z"), "2006-01-02T15:04:05Z"),
|
||||||
Status: "awaiting_packaging",
|
Status: "awaiting_packaging",
|
||||||
},
|
},
|
||||||
Limit: 100,
|
Limit: 100,
|
||||||
|
|||||||
@@ -99,13 +99,13 @@ func (c Products) GetStocksInfo(ctx context.Context, params *GetStocksInfoParams
|
|||||||
|
|
||||||
type GetProductDetailsParams struct {
|
type GetProductDetailsParams struct {
|
||||||
// Product identifier in the seller's system
|
// Product identifier in the seller's system
|
||||||
OfferId string `json:"offer_id"`
|
OfferId string `json:"offer_id,omitempty"`
|
||||||
|
|
||||||
// Product identifier
|
// Product identifier
|
||||||
ProductId int64 `json:"product_id"`
|
ProductId int64 `json:"product_id,omitempty"`
|
||||||
|
|
||||||
// Product identifier in the Ozon system, SKU
|
// Product identifier in the Ozon system, SKU
|
||||||
SKU int64 `json:"sku"`
|
SKU int64 `json:"sku,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetProductDetailsResponse struct {
|
type GetProductDetailsResponse struct {
|
||||||
|
|||||||
@@ -526,10 +526,10 @@ type GetShipmentReportFilter struct {
|
|||||||
OfferId string `json:"offer_id"`
|
OfferId string `json:"offer_id"`
|
||||||
|
|
||||||
// Order processing start date and time
|
// Order processing start date and time
|
||||||
ProcessedAtFrom time.Time `json:"processed_at_from"`
|
ProcessedAtFrom *core.TimeFormat `json:"processed_at_from,omitempty"`
|
||||||
|
|
||||||
// Time when the order appeared in your personal account
|
// Time when the order appeared in your personal account
|
||||||
ProcessedAtTo time.Time `json:"processed_at_to"`
|
ProcessedAtTo *core.TimeFormat `json:"processed_at_to,omitempty"`
|
||||||
|
|
||||||
// Product identifier in the Ozon system, SKU
|
// Product identifier in the Ozon system, SKU
|
||||||
SKU []int64 `json:"sku"`
|
SKU []int64 `json:"sku"`
|
||||||
|
|||||||
@@ -437,8 +437,8 @@ func TestGetShipmentReport(t *testing.T) {
|
|||||||
&GetShipmentReportParams{
|
&GetShipmentReportParams{
|
||||||
Filter: &GetShipmentReportFilter{
|
Filter: &GetShipmentReportFilter{
|
||||||
DeliverySchema: []string{"fbs", "fbo", "crossborder"},
|
DeliverySchema: []string{"fbs", "fbo", "crossborder"},
|
||||||
ProcessedAtFrom: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-09-02T17:10:54.861Z"),
|
ProcessedAtFrom: core.NewTimeFormat(core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-09-02T17:10:54.861Z"), "2006-01-02T15:04:05Z"),
|
||||||
ProcessedAtTo: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-11-02T17:10:54.861Z"),
|
ProcessedAtTo: core.NewTimeFormat(core.TimeFromString(t, "2006-01-02T15:04:05Z", "2021-11-02T17:10:54.861Z"), "2006-01-02T15:04:05Z"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
`{
|
`{
|
||||||
|
|||||||
Reference in New Issue
Block a user