func NewCreateAmazonMotorsRequest(endpoint string, amazonOrderId string, params *CreateAmazonMotorsParams, body CreateAmazonMotorsJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewCreateAmazonMotorsRequestWithBody(endpoint, amazonOrderId, params, "application/json", bodyReader)
}
NewCreateAmazonMotorsRequest calls the generic CreateAmazonMotors builder with application/json body
package messaging
import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"io"
	"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 {
	GetMessagingActionsForOrder(ctx context.Context, amazonOrderId string, params *GetMessagingActionsForOrderParams) (*http.Response, error)
	GetAttributes(ctx context.Context, amazonOrderId string, params *GetAttributesParams) (*http.Response, error)
	CreateAmazonMotorsWithBody(ctx context.Context, amazonOrderId string, params *CreateAmazonMotorsParams, contentType string, body io.Reader) (*http.Response, error)
	CreateAmazonMotors(ctx context.Context, amazonOrderId string, params *CreateAmazonMotorsParams, body CreateAmazonMotorsJSONRequestBody) (*http.Response, error)
	ConfirmCustomizationDetailsWithBody(ctx context.Context, amazonOrderId string, params *ConfirmCustomizationDetailsParams, contentType string, body io.Reader) (*http.Response, error)
	ConfirmCustomizationDetails(ctx context.Context, amazonOrderId string, params *ConfirmCustomizationDetailsParams, body ConfirmCustomizationDetailsJSONRequestBody) (*http.Response, error)
	CreateConfirmDeliveryDetailsWithBody(ctx context.Context, amazonOrderId string, params *CreateConfirmDeliveryDetailsParams, contentType string, body io.Reader) (*http.Response, error)
	CreateConfirmDeliveryDetails(ctx context.Context, amazonOrderId string, params *CreateConfirmDeliveryDetailsParams, body CreateConfirmDeliveryDetailsJSONRequestBody) (*http.Response, error)
	CreateConfirmOrderDetailsWithBody(ctx context.Context, amazonOrderId string, params *CreateConfirmOrderDetailsParams, contentType string, body io.Reader) (*http.Response, error)
	CreateConfirmOrderDetails(ctx context.Context, amazonOrderId string, params *CreateConfirmOrderDetailsParams, body CreateConfirmOrderDetailsJSONRequestBody) (*http.Response, error)
	CreateConfirmServiceDetailsWithBody(ctx context.Context, amazonOrderId string, params *CreateConfirmServiceDetailsParams, contentType string, body io.Reader) (*http.Response, error)
	CreateConfirmServiceDetails(ctx context.Context, amazonOrderId string, params *CreateConfirmServiceDetailsParams, body CreateConfirmServiceDetailsJSONRequestBody) (*http.Response, error)
	CreateDigitalAccessKeyWithBody(ctx context.Context, amazonOrderId string, params *CreateDigitalAccessKeyParams, contentType string, body io.Reader) (*http.Response, error)
	CreateDigitalAccessKey(ctx context.Context, amazonOrderId string, params *CreateDigitalAccessKeyParams, body CreateDigitalAccessKeyJSONRequestBody) (*http.Response, error)
	CreateLegalDisclosureWithBody(ctx context.Context, amazonOrderId string, params *CreateLegalDisclosureParams, contentType string, body io.Reader) (*http.Response, error)
	CreateLegalDisclosure(ctx context.Context, amazonOrderId string, params *CreateLegalDisclosureParams, body CreateLegalDisclosureJSONRequestBody) (*http.Response, error)
	CreateNegativeFeedbackRemoval(ctx context.Context, amazonOrderId string, params *CreateNegativeFeedbackRemovalParams) (*http.Response, error)
	CreateUnexpectedProblemWithBody(ctx context.Context, amazonOrderId string, params *CreateUnexpectedProblemParams, contentType string, body io.Reader) (*http.Response, error)
	CreateUnexpectedProblem(ctx context.Context, amazonOrderId string, params *CreateUnexpectedProblemParams, body CreateUnexpectedProblemJSONRequestBody) (*http.Response, error)
	CreateWarrantyWithBody(ctx context.Context, amazonOrderId string, params *CreateWarrantyParams, contentType string, body io.Reader) (*http.Response, error)
	CreateWarranty(ctx context.Context, amazonOrderId string, params *CreateWarrantyParams, body CreateWarrantyJSONRequestBody) (*http.Response, error)
}
func (c *Client) GetMessagingActionsForOrder(ctx context.Context, amazonOrderId string, params *GetMessagingActionsForOrderParams) (*http.Response, error) {
	req, err := NewGetMessagingActionsForOrderRequest(c.Endpoint, amazonOrderId, 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) GetAttributes(ctx context.Context, amazonOrderId string, params *GetAttributesParams) (*http.Response, error) {
	req, err := NewGetAttributesRequest(c.Endpoint, amazonOrderId, 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) CreateAmazonMotorsWithBody(ctx context.Context, amazonOrderId string, params *CreateAmazonMotorsParams, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateAmazonMotorsRequestWithBody(c.Endpoint, amazonOrderId, params, contentType, body)
	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) CreateAmazonMotors(ctx context.Context, amazonOrderId string, params *CreateAmazonMotorsParams, body CreateAmazonMotorsJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateAmazonMotorsRequest(c.Endpoint, amazonOrderId, params, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) ConfirmCustomizationDetailsWithBody(ctx context.Context, amazonOrderId string, params *ConfirmCustomizationDetailsParams, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewConfirmCustomizationDetailsRequestWithBody(c.Endpoint, amazonOrderId, params, contentType, body)
	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) ConfirmCustomizationDetails(ctx context.Context, amazonOrderId string, params *ConfirmCustomizationDetailsParams, body ConfirmCustomizationDetailsJSONRequestBody) (*http.Response, error) {
	req, err := NewConfirmCustomizationDetailsRequest(c.Endpoint, amazonOrderId, params, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CreateConfirmDeliveryDetailsWithBody(ctx context.Context, amazonOrderId string, params *CreateConfirmDeliveryDetailsParams, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateConfirmDeliveryDetailsRequestWithBody(c.Endpoint, amazonOrderId, params, contentType, body)
	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) CreateConfirmDeliveryDetails(ctx context.Context, amazonOrderId string, params *CreateConfirmDeliveryDetailsParams, body CreateConfirmDeliveryDetailsJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateConfirmDeliveryDetailsRequest(c.Endpoint, amazonOrderId, params, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CreateConfirmOrderDetailsWithBody(ctx context.Context, amazonOrderId string, params *CreateConfirmOrderDetailsParams, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateConfirmOrderDetailsRequestWithBody(c.Endpoint, amazonOrderId, params, contentType, body)
	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) CreateConfirmOrderDetails(ctx context.Context, amazonOrderId string, params *CreateConfirmOrderDetailsParams, body CreateConfirmOrderDetailsJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateConfirmOrderDetailsRequest(c.Endpoint, amazonOrderId, params, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CreateConfirmServiceDetailsWithBody(ctx context.Context, amazonOrderId string, params *CreateConfirmServiceDetailsParams, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateConfirmServiceDetailsRequestWithBody(c.Endpoint, amazonOrderId, params, contentType, body)
	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) CreateConfirmServiceDetails(ctx context.Context, amazonOrderId string, params *CreateConfirmServiceDetailsParams, body CreateConfirmServiceDetailsJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateConfirmServiceDetailsRequest(c.Endpoint, amazonOrderId, params, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CreateDigitalAccessKeyWithBody(ctx context.Context, amazonOrderId string, params *CreateDigitalAccessKeyParams, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateDigitalAccessKeyRequestWithBody(c.Endpoint, amazonOrderId, params, contentType, body)
	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) CreateDigitalAccessKey(ctx context.Context, amazonOrderId string, params *CreateDigitalAccessKeyParams, body CreateDigitalAccessKeyJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateDigitalAccessKeyRequest(c.Endpoint, amazonOrderId, params, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CreateLegalDisclosureWithBody(ctx context.Context, amazonOrderId string, params *CreateLegalDisclosureParams, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateLegalDisclosureRequestWithBody(c.Endpoint, amazonOrderId, params, contentType, body)
	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) CreateLegalDisclosure(ctx context.Context, amazonOrderId string, params *CreateLegalDisclosureParams, body CreateLegalDisclosureJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateLegalDisclosureRequest(c.Endpoint, amazonOrderId, params, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CreateNegativeFeedbackRemoval(ctx context.Context, amazonOrderId string, params *CreateNegativeFeedbackRemovalParams) (*http.Response, error) {
	req, err := NewCreateNegativeFeedbackRemovalRequest(c.Endpoint, amazonOrderId, 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) CreateUnexpectedProblemWithBody(ctx context.Context, amazonOrderId string, params *CreateUnexpectedProblemParams, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateUnexpectedProblemRequestWithBody(c.Endpoint, amazonOrderId, params, contentType, body)
	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) CreateUnexpectedProblem(ctx context.Context, amazonOrderId string, params *CreateUnexpectedProblemParams, body CreateUnexpectedProblemJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateUnexpectedProblemRequest(c.Endpoint, amazonOrderId, params, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CreateWarrantyWithBody(ctx context.Context, amazonOrderId string, params *CreateWarrantyParams, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateWarrantyRequestWithBody(c.Endpoint, amazonOrderId, params, contentType, body)
	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) CreateWarranty(ctx context.Context, amazonOrderId string, params *CreateWarrantyParams, body CreateWarrantyJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateWarrantyRequest(c.Endpoint, amazonOrderId, params, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestBefore != nil {
		err = c.RequestBefore(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func NewGetMessagingActionsForOrderRequest(endpoint string, amazonOrderId string, params *GetMessagingActionsForOrderParams) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "amazonOrderId", amazonOrderId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/messaging/v1/orders/%s", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	queryValues := queryUrl.Query()
	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)
			}
		}
	}
	queryUrl.RawQuery = queryValues.Encode()
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewGetAttributesRequest(endpoint string, amazonOrderId string, params *GetAttributesParams) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "amazonOrderId", amazonOrderId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/messaging/v1/orders/%s/attributes", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	queryValues := queryUrl.Query()
	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)
			}
		}
	}
	queryUrl.RawQuery = queryValues.Encode()
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}