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 Finance struct {
client *core.Client
}
type ReportOnSoldProductsParams struct {
// Time period in the `YYYY-MM` format
Date string `json:"date"`
@@ -141,7 +145,7 @@ type ReportOnSoldProductsResponse struct {
// Returns information on products sold and returned within a month. Canceled or non-purchased products are not included.
//
// Report is returned no later than the 5th day of the next month
func (c Client) ReportOnSoldProducts(params *ReportOnSoldProductsParams) (*ReportOnSoldProductsResponse, error) {
func (c Finance) ReportOnSoldProducts(params *ReportOnSoldProductsParams) (*ReportOnSoldProductsResponse, error) {
url := "/v1/finance/realization"
resp := &ReportOnSoldProductsResponse{}
@@ -229,7 +233,7 @@ type GetTotalTransactionsSumResponse struct {
}
// Returns total sums for transactions for specified period
func (c Client) GetTotalTransactionsSum(params *GetTotalTransactionsSumParams) (*GetTotalTransactionsSumResponse, error) {
func (c Finance) GetTotalTransactionsSum(params *GetTotalTransactionsSumParams) (*GetTotalTransactionsSumResponse, error) {
url := "/v3/finance/transaction/totals"
resp := &GetTotalTransactionsSumResponse{}