Documentation ¶
Overview ¶
Package sales provides primitives to interact the openapi HTTP API.
Code generated by go-sdk-codegen DO NOT EDIT.
Package sales provides primitives to interact the openapi HTTP API.
Code generated by go-sdk-codegen DO NOT EDIT.
Index ¶
- func NewGetOrderMetricsRequest(endpoint string, params *GetOrderMetricsParams) (*http.Request, error)
- type Client
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- type ClientWithResponsesInterface
- type Decimal
- type Error
- type ErrorList
- type GetOrderMetricsParams
- type GetOrderMetricsResp
- type GetOrderMetricsResponse
- type HttpRequestDoer
- type Money
- type OrderMetricsInterval
- type OrderMetricsList
- type RequestBeforeFn
- type ResponseAfterFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGetOrderMetricsRequest ¶
func NewGetOrderMetricsRequest(endpoint 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. Endpoint string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A callback for modifying requests which are generated before sending over // the network. RequestBefore RequestBeforeFn // A callback for modifying response which are generated before sending over // the network. ResponseAfter ResponseAfterFn // 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(endpoint string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) GetOrderMetrics ¶
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 ¶
ClientOption allows setting custom parameters during construction
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 WithRequestBefore ¶
func WithRequestBefore(fn RequestBeforeFn) ClientOption
WithRequestBefore allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
func WithResponseAfter ¶
func WithResponseAfter(fn ResponseAfterFn) ClientOption
WithResponseAfter allows setting up a callback function, which will be called right after get response the request. This can be used to log.
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
WithUserAgent set up useragent add user agent to every request automatically
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(endpoint 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 *GetOrderMetricsResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // GetOrderMetrics request GetOrderMetricsWithResponse(ctx context.Context, params *GetOrderMetricsParams) (*GetOrderMetricsResp, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type Error ¶
type Error struct { // An error code that identifies the type of error that occured. Code string `json:"code"` // Additional details that can help the caller understand or fix the issue. Details *string `json:"details,omitempty"` // A message that describes the error condition in a human-readable form. Message string `json:"message"` }
Error defines model for Error.
type GetOrderMetricsParams ¶
type GetOrderMetricsParams struct { // A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace. MarketplaceIds []string `json:"marketplaceIds"` // 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 `json:"interval"` // 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 `json:"granularityTimeZone,omitempty"` // 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 string `json:"granularity"` // 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 *string `json:"buyerType,omitempty"` // 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 `json:"fulfillmentNetwork,omitempty"` // 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 *string `json:"firstDayOfWeek,omitempty"` // 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 `json:"asin,omitempty"` // 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 `json:"sku,omitempty"` }
GetOrderMetricsParams defines parameters for GetOrderMetrics.
type GetOrderMetricsResp ¶
type GetOrderMetricsResp struct { Body []byte HTTPResponse *http.Response Model *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 { // A list of error responses returned when a request is unsuccessful. Errors *ErrorList `json:"errors,omitempty"` // A set of order metrics, each scoped to a particular time interval. Payload *OrderMetricsList `json:"payload,omitempty"` }
GetOrderMetricsResponse defines model for GetOrderMetricsResponse.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type Money ¶
type Money struct { // A decimal number with no loss of precision. Useful when precision loss is unacceptable, as with currencies. Follows RFC7159 for number representation. <br>**Pattern** : `^-?(0|([1-9]\d*))(\.\d+)?([eE][+-]?\d+)?$`. Amount Decimal `json:"amount"` // Three-digit currency code. In ISO 4217 format. CurrencyCode string `json:"currencyCode"` }
Money defines model for Money.
type OrderMetricsInterval ¶
type OrderMetricsInterval struct { // The currency type and the amount. AverageUnitPrice Money `json:"averageUnitPrice"` // 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"` // The number of orders based on the specified filters. OrderCount int `json:"orderCount"` // The number of order items based on the specified filters. OrderItemCount int `json:"orderItemCount"` // The currency type and the amount. TotalSales Money `json:"totalSales"` // The number of units in orders based on the specified filters. UnitCount int `json:"unitCount"` }
OrderMetricsInterval defines model for OrderMetricsInterval.
type OrderMetricsList ¶
type OrderMetricsList []OrderMetricsInterval
OrderMetricsList defines model for OrderMetricsList.
type RequestBeforeFn ¶
RequestBeforeFn is the function signature for the RequestBefore callback function