sales

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sales provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetOrderMetricsRequest

func NewGetOrderMetricsRequest(server string, params *GetOrderMetricsParams) (*http.Request, error)

NewGetOrderMetricsRequest generates requests for GetOrderMetrics

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn

	// A callback for modifying response which are generated after receive from the network.
	ResponseEditors []ResponseEditorFn

	// The user agent header identifies your application, its version number, and the platform and programming language you are using.
	// You must include a user agent header in each request submitted to the sales partner API.
	UserAgent string
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetOrderMetrics

func (c *Client) GetOrderMetrics(ctx context.Context, params *GetOrderMetricsParams) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetOrderMetrics request
	GetOrderMetrics(ctx context.Context, params *GetOrderMetricsParams) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

func WithResponseEditorFn

func WithResponseEditorFn(fn ResponseEditorFn) ClientOption

WithResponseEditorFn allows setting up a callback function, which will be called right after receive the response.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetOrderMetricsWithResponse

func (c *ClientWithResponses) GetOrderMetricsWithResponse(ctx context.Context, params *GetOrderMetricsParams) (*GetOrderMetricsResp, error)

GetOrderMetricsWithResponse request returning *GetOrderMetricsResp

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetOrderMetricsWithResponse request
	GetOrderMetricsWithResponse(ctx context.Context, params *GetOrderMetricsParams) (*GetOrderMetricsResp, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type Decimal

type Decimal = string

Decimal A decimal number with no loss of precision. Useful when precision loss is unnaceptable, as with currencies. Follows RFC7159 for number representation.

type Error

type Error struct {
	// Code An error code that identifies the type of error that occured.
	Code string `json:"code"`

	// Details Additional details that can help the caller understand or fix the issue.
	Details *string `json:"details,omitempty"`

	// Message A message that describes the error condition in a human-readable form.
	Message string `json:"message"`
}

Error Error response returned when the request is unsuccessful.

type ErrorList

type ErrorList = []Error

ErrorList A list of error responses returned when a request is unsuccessful.

type GetOrderMetricsParams

type GetOrderMetricsParams struct {
	// MarketplaceIds A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified.
	//
	// For example, ATVPDKIKX0DER indicates the US marketplace.
	MarketplaceIds []string `form:"marketplaceIds" json:"marketplaceIds"`

	// Interval A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.
	Interval string `form:"interval" json:"interval"`

	// GranularityTimeZone An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone.
	GranularityTimeZone *string `form:"granularityTimeZone,omitempty" json:"granularityTimeZone,omitempty"`

	// Granularity The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity=Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date don’t align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.
	Granularity GetOrderMetricsParamsGranularity `form:"granularity" json:"granularity"`

	// BuyerType Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers.
	BuyerType *GetOrderMetricsParamsBuyerType `form:"buyerType,omitempty" json:"buyerType,omitempty"`

	// FulfillmentNetwork Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network.
	FulfillmentNetwork *string `form:"fulfillmentNetwork,omitempty" json:"fulfillmentNetwork,omitempty"`

	// FirstDayOfWeek Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
	FirstDayOfWeek *GetOrderMetricsParamsFirstDayOfWeek `form:"firstDayOfWeek,omitempty" json:"firstDayOfWeek,omitempty"`

	// Asin Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
	Asin *string `form:"asin,omitempty" json:"asin,omitempty"`

	// Sku Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.
	Sku *string `form:"sku,omitempty" json:"sku,omitempty"`

	// AmazonProgram Filters the results by the Amazon program that you specify. Do not include this filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns order metrics for the Amazon Haul program only.
	AmazonProgram *GetOrderMetricsParamsAmazonProgram `form:"amazonProgram,omitempty" json:"amazonProgram,omitempty"`
}

GetOrderMetricsParams defines parameters for GetOrderMetrics.

type GetOrderMetricsParamsAmazonProgram

type GetOrderMetricsParamsAmazonProgram string

GetOrderMetricsParamsAmazonProgram defines parameters for GetOrderMetrics.

const (
	AmazonHaul GetOrderMetricsParamsAmazonProgram = "AmazonHaul"
)

Defines values for GetOrderMetricsParamsAmazonProgram.

type GetOrderMetricsParamsBuyerType

type GetOrderMetricsParamsBuyerType string

GetOrderMetricsParamsBuyerType defines parameters for GetOrderMetrics.

Defines values for GetOrderMetricsParamsBuyerType.

type GetOrderMetricsParamsFirstDayOfWeek

type GetOrderMetricsParamsFirstDayOfWeek string

GetOrderMetricsParamsFirstDayOfWeek defines parameters for GetOrderMetrics.

const (
	Monday GetOrderMetricsParamsFirstDayOfWeek = "Monday"
	Sunday GetOrderMetricsParamsFirstDayOfWeek = "Sunday"
)

Defines values for GetOrderMetricsParamsFirstDayOfWeek.

type GetOrderMetricsParamsGranularity

type GetOrderMetricsParamsGranularity string

GetOrderMetricsParamsGranularity defines parameters for GetOrderMetrics.

Defines values for GetOrderMetricsParamsGranularity.

type GetOrderMetricsResp

type GetOrderMetricsResp struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *GetOrderMetricsResponse
	JSON400      *GetOrderMetricsResponse
	JSON403      *GetOrderMetricsResponse
	JSON404      *GetOrderMetricsResponse
	JSON413      *GetOrderMetricsResponse
	JSON415      *GetOrderMetricsResponse
	JSON429      *GetOrderMetricsResponse
	JSON500      *GetOrderMetricsResponse
	JSON503      *GetOrderMetricsResponse
}

func ParseGetOrderMetricsResp

func ParseGetOrderMetricsResp(rsp *http.Response) (*GetOrderMetricsResp, error)

ParseGetOrderMetricsResp parses an HTTP response from a GetOrderMetricsWithResponse call

func (GetOrderMetricsResp) Status

func (r GetOrderMetricsResp) Status() string

Status returns HTTPResponse.Status

func (GetOrderMetricsResp) StatusCode

func (r GetOrderMetricsResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetOrderMetricsResponse

type GetOrderMetricsResponse struct {
	// Errors A list of error responses returned when a request is unsuccessful.
	Errors *ErrorList `json:"errors,omitempty"`

	// Payload A set of order metrics, each scoped to a particular time interval.
	Payload *OrderMetricsList `json:"payload,omitempty"`
}

GetOrderMetricsResponse The response schema for the getOrderMetrics operation.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Money

type Money struct {
	// Amount A decimal number with no loss of precision. Useful when precision loss is unnaceptable, as with currencies. Follows RFC7159 for number representation.
	Amount Decimal `json:"amount"`

	// CurrencyCode Three-digit currency code. In ISO 4217 format.
	CurrencyCode string `json:"currencyCode"`
}

Money The currency type and the amount.

type OrderMetricsInterval

type OrderMetricsInterval struct {
	// AverageUnitPrice The currency type and the amount.
	AverageUnitPrice Money `json:"averageUnitPrice"`

	// Interval The interval of time based on requested granularity (ex. Hour, Day, etc.) If this is the first or the last interval from the list, it might contain incomplete data if the requested interval doesn't align with the requested granularity (ex. request interval 2018-09-01T02:00:00Z--2018-09-04T19:00:00Z and granularity day will result in Sept 1st UTC day and Sept 4th UTC days having partial data).
	Interval string `json:"interval"`

	// OrderCount The number of orders based on the specified filters.
	OrderCount int `json:"orderCount"`

	// OrderItemCount The number of order items based on the specified filters.
	OrderItemCount int `json:"orderItemCount"`

	// TotalSales The currency type and the amount.
	TotalSales Money `json:"totalSales"`

	// UnitCount The number of units in orders based on the specified filters.
	UnitCount int `json:"unitCount"`
}

OrderMetricsInterval Contains order metrics.

type OrderMetricsList

type OrderMetricsList = []OrderMetricsInterval

OrderMetricsList A set of order metrics, each scoped to a particular time interval.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type ResponseEditorFn

type ResponseEditorFn func(ctx context.Context, rsp *http.Response) error

ResponseEditorFn is the function signature for the ResponseEditor callback function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL