refactoring. put methods to individual structures

This commit is contained in:
diPhantxm
2023-03-15 21:38:17 +03:00
parent 2e60a17c56
commit 2566f85da3
17 changed files with 148 additions and 55 deletions

View File

@@ -7,6 +7,10 @@ import (
core "github.com/diphantxm/ozon-api-client"
)
type Analytics struct {
client *core.Client
}
type GetAnalyticsDataParams struct {
// Date from which the data will be in the report
DateFrom time.Time `json:"date_from"`
@@ -90,7 +94,7 @@ type GetAnalyticsDataResponse struct {
}
// Specify the period and metrics that are required. The response will contain analytical data grouped by the `dimensions` parameter.
func (c Client) GetAnalyticsData(params *GetAnalyticsDataParams) (*GetAnalyticsDataResponse, error) {
func (c Analytics) GetAnalyticsData(params *GetAnalyticsDataParams) (*GetAnalyticsDataResponse, error) {
url := "/v1/analytics/data"
resp := &GetAnalyticsDataResponse{}
@@ -152,7 +156,7 @@ type GetStocksOnWarehousesResponse struct {
}
// Report on stocks and products movement at Ozon warehouses
func (c Client) GetStocksOnWarehouses(params *GetStocksOnWarehousesParams) (*GetStocksOnWarehousesResponse, error) {
func (c Analytics) GetStocksOnWarehouses(params *GetStocksOnWarehousesParams) (*GetStocksOnWarehousesResponse, error) {
url := "/v2/analytics/stock_on_warehouses"
resp := &GetStocksOnWarehousesResponse{}