func (r GetOrderResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
Status returns HTTPResponse.Status
package ordersV0
import (
	"context"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	runt "runtime"
	"strings"
	"gopkg.me/selling-partner-api-sdk/pkg/runtime"
)
type RequestBeforeFn func(ctx context.Context, req *http.Request) error
type ResponseAfterFn func(ctx context.Context, rsp *http.Response) error
type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}
type Client struct {
	Endpoint string
	Client HttpRequestDoer
	RequestBefore RequestBeforeFn
	ResponseAfter ResponseAfterFn
	UserAgent string
}
type ClientOption func(*Client) error
func NewClient(endpoint string, opts ...ClientOption) (*Client, error) {
	client := Client{
		Endpoint: endpoint,
	}
	for _, o := range opts {
		if err := o(&client); err != nil {
			return nil, err
		}
	}
	if !strings.HasSuffix(client.Endpoint, "/") {
		client.Endpoint += "/"
	}
	if client.Client == nil {
		client.Client = http.DefaultClient
	}
	if client.UserAgent == "" {
		client.UserAgent = fmt.Sprintf("selling-partner-api-sdk/v1.0 (Language=%s; Platform=%s-%s)", strings.Replace(runt.Version(), "go", "go/", -1), runt.GOOS, runt.GOARCH)
	}
	return &client, nil
}
func WithHTTPClient(doer HttpRequestDoer) ClientOption {
	return func(c *Client) error {
		c.Client = doer
		return nil
	}
}
func WithUserAgent(userAgent string) ClientOption {
	return func(c *Client) error {
		c.UserAgent = userAgent
		return nil
	}
}
func WithRequestBefore(fn RequestBeforeFn) ClientOption {
	return func(c *Client) error {
		c.RequestBefore = fn
		return nil
	}
}
func WithResponseAfter(fn ResponseAfterFn) ClientOption {
	return func(c *Client) error {
		c.ResponseAfter = fn
		return nil
	}
}
type ClientInterface interface {
	GetOrders(ctx context.Context, params *GetOrdersParams) (*http.Response, error)
	GetOrder(ctx context.Context, orderId string) (*http.Response, error)
	GetOrderAddress(ctx context.Context, orderId string) (*http.Response, error)
	GetOrderBuyerInfo(ctx context.Context, orderId string) (*http.Response, error)
	GetOrderItems(ctx context.Context, orderId string, params *GetOrderItemsParams) (*http.Response, error)
	GetOrderItemsBuyerInfo(ctx context.Context, orderId string, params *GetOrderItemsBuyerInfoParams) (*http.Response, error)
}
func (c *Client) GetOrders(ctx context.Context, params *GetOrdersParams) (*http.Response, error) {
	req, err := NewGetOrdersRequest(c.Endpoint, params)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	req.Header.Set("User-Agent", c.UserAgent)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	rsp, err := c.Client.Do(req)
	if err != nil {
		return nil, err
	}
	if c.ResponseAfter != nil {
		err = c.ResponseAfter(ctx, rsp)
		if err != nil {
			return nil, err
		}
	}
	return rsp, nil
}
func (c *Client) GetOrder(ctx context.Context, orderId string) (*http.Response, error) {
	req, err := NewGetOrderRequest(c.Endpoint, orderId)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	req.Header.Set("User-Agent", c.UserAgent)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	rsp, err := c.Client.Do(req)
	if err != nil {
		return nil, err
	}
	if c.ResponseAfter != nil {
		err = c.ResponseAfter(ctx, rsp)
		if err != nil {
			return nil, err
		}
	}
	return rsp, nil
}
func (c *Client) GetOrderAddress(ctx context.Context, orderId string) (*http.Response, error) {
	req, err := NewGetOrderAddressRequest(c.Endpoint, orderId)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	req.Header.Set("User-Agent", c.UserAgent)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	rsp, err := c.Client.Do(req)
	if err != nil {
		return nil, err
	}
	if c.ResponseAfter != nil {
		err = c.ResponseAfter(ctx, rsp)
		if err != nil {
			return nil, err
		}
	}
	return rsp, nil
}
func (c *Client) GetOrderBuyerInfo(ctx context.Context, orderId string) (*http.Response, error) {
	req, err := NewGetOrderBuyerInfoRequest(c.Endpoint, orderId)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	req.Header.Set("User-Agent", c.UserAgent)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	rsp, err := c.Client.Do(req)
	if err != nil {
		return nil, err
	}
	if c.ResponseAfter != nil {
		err = c.ResponseAfter(ctx, rsp)
		if err != nil {
			return nil, err
		}
	}
	return rsp, nil
}
func (c *Client) GetOrderItems(ctx context.Context, orderId string, params *GetOrderItemsParams) (*http.Response, error) {
	req, err := NewGetOrderItemsRequest(c.Endpoint, orderId, params)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	req.Header.Set("User-Agent", c.UserAgent)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	rsp, err := c.Client.Do(req)
	if err != nil {
		return nil, err
	}
	if c.ResponseAfter != nil {
		err = c.ResponseAfter(ctx, rsp)
		if err != nil {
			return nil, err
		}
	}
	return rsp, nil
}
func (c *Client) GetOrderItemsBuyerInfo(ctx context.Context, orderId string, params *GetOrderItemsBuyerInfoParams) (*http.Response, error) {
	req, err := NewGetOrderItemsBuyerInfoRequest(c.Endpoint, orderId, params)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	req.Header.Set("User-Agent", c.UserAgent)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	rsp, err := c.Client.Do(req)
	if err != nil {
		return nil, err
	}
	if c.ResponseAfter != nil {
		err = c.ResponseAfter(ctx, rsp)
		if err != nil {
			return nil, err
		}
	}
	return rsp, nil
}
func NewGetOrdersRequest(endpoint string, params *GetOrdersParams) (*http.Request, error) {
	var err error
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/orders/v0/orders")
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	queryValues := queryUrl.Query()
	if params.CreatedAfter != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "CreatedAfter", *params.CreatedAfter); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.CreatedBefore != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "CreatedBefore", *params.CreatedBefore); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.LastUpdatedAfter != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "LastUpdatedAfter", *params.LastUpdatedAfter); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.LastUpdatedBefore != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "LastUpdatedBefore", *params.LastUpdatedBefore); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.OrderStatuses != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "OrderStatuses", *params.OrderStatuses); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if queryFrag, err := runtime.StyleParam("form", true, "MarketplaceIds", params.MarketplaceIds); err != nil {
		return nil, err
	} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
		return nil, err
	} else {
		for k, v := range parsed {
			for _, v2 := range v {
				queryValues.Add(k, v2)
			}
		}
	}
	if params.FulfillmentChannels != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "FulfillmentChannels", *params.FulfillmentChannels); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.PaymentMethods != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "PaymentMethods", *params.PaymentMethods); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.BuyerEmail != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "BuyerEmail", *params.BuyerEmail); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.SellerOrderId != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "SellerOrderId", *params.SellerOrderId); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.MaxResultsPerPage != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "MaxResultsPerPage", *params.MaxResultsPerPage); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.EasyShipShipmentStatuses != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "EasyShipShipmentStatuses", *params.EasyShipShipmentStatuses); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.NextToken != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "NextToken", *params.NextToken); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.AmazonOrderIds != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "AmazonOrderIds", *params.AmazonOrderIds); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	queryUrl.RawQuery = queryValues.Encode()
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewGetOrderRequest(endpoint string, orderId string) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "orderId", orderId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/orders/v0/orders/%s", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewGetOrderAddressRequest(endpoint string, orderId string) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "orderId", orderId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/orders/v0/orders/%s/address", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewGetOrderBuyerInfoRequest(endpoint string, orderId string) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "orderId", orderId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/orders/v0/orders/%s/buyerInfo", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewGetOrderItemsRequest(endpoint string, orderId string, params *GetOrderItemsParams) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "orderId", orderId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/orders/v0/orders/%s/orderItems", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	queryValues := queryUrl.Query()
	if params.NextToken != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "NextToken", *params.NextToken); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	queryUrl.RawQuery = queryValues.Encode()
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewGetOrderItemsBuyerInfoRequest(endpoint string, orderId string, params *GetOrderItemsBuyerInfoParams) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "orderId", orderId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/orders/v0/orders/%s/orderItems/buyerInfo", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	queryValues := queryUrl.Query()
	if params.NextToken != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "NextToken", *params.NextToken); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	queryUrl.RawQuery = queryValues.Encode()
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
type ClientWithResponses struct {
	ClientInterface
}
func NewClientWithResponses(endpoint string, opts ...ClientOption) (*ClientWithResponses, error) {
	client, err := NewClient(endpoint, opts...)
	if err != nil {
		return nil, err
	}
	return &ClientWithResponses{client}, nil
}
func WithBaseURL(baseURL string) ClientOption {
	return func(c *Client) error {
		newBaseURL, err := url.Parse(baseURL)
		if err != nil {
			return err
		}
		c.Endpoint = newBaseURL.String()
		return nil
	}
}
type ClientWithResponsesInterface interface {
	GetOrdersWithResponse(ctx context.Context, params *GetOrdersParams) (*GetOrdersResp, error)
	GetOrderWithResponse(ctx context.Context, orderId string) (*GetOrderResp, error)
	GetOrderAddressWithResponse(ctx context.Context, orderId string) (*GetOrderAddressResp, error)
	GetOrderBuyerInfoWithResponse(ctx context.Context, orderId string) (*GetOrderBuyerInfoResp, error)
	GetOrderItemsWithResponse(ctx context.Context, orderId string, params *GetOrderItemsParams) (*GetOrderItemsResp, error)
	GetOrderItemsBuyerInfoWithResponse(ctx context.Context, orderId string, params *GetOrderItemsBuyerInfoParams) (*GetOrderItemsBuyerInfoResp, error)
}
type GetOrdersResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetOrdersResponse
}
func (r GetOrdersResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
func (r GetOrdersResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
type GetOrderResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetOrderResponse
}