// Package fbaInbound provides primitives to interact the openapi HTTP API.
//
// Code generated by go-sdk-codegen DO NOT EDIT.
package fbaInbound

import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	runt "runtime"
	"strings"

	"github.com/amzapi/selling-partner-api-sdk/pkg/runtime"
)

// RequestBeforeFn  is the function signature for the RequestBefore callback function
type RequestBeforeFn func(ctx context.Context, req *http.Request) error

// ResponseAfterFn  is the function signature for the ResponseAfter callback function
type ResponseAfterFn func(ctx context.Context, rsp *http.Response) error

// Doer performs HTTP requests.
//
// The standard http.Client implements this interface.
type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

// Client which conforms to the OpenAPI3 specification for this service.
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
}

// ClientOption allows setting custom parameters during construction
type ClientOption func(*Client) error

// Creates a new Client, with reasonable defaults
func NewClient(endpoint string, opts ...ClientOption) (*Client, error) {
	// create a client with sane default values
	client := Client{
		Endpoint: endpoint,
	}
	// mutate client and add all optional params
	for _, o := range opts {
		if err := o(&client); err != nil {
			return nil, err
		}
	}
	// ensure the endpoint URL always has a trailing slash
	if !strings.HasSuffix(client.Endpoint, "/") {
		client.Endpoint += "/"
	}
	// create httpClient, if not already present
	if client.Client == nil {
		client.Client = http.DefaultClient
	}
	// setting the default useragent
	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
}

// WithHTTPClient allows overriding the default Doer, which is
// automatically created using http.Client. This is useful for tests.
func WithHTTPClient(doer HttpRequestDoer) ClientOption {
	return func(c *Client) error {
		c.Client = doer
		return nil
	}
}

// WithUserAgent set up useragent
// add user agent to every request automatically
func WithUserAgent(userAgent string) ClientOption {
	return func(c *Client) error {
		c.UserAgent = userAgent
		return nil
	}
}

// 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 WithRequestBefore(fn RequestBeforeFn) ClientOption {
	return func(c *Client) error {
		c.RequestBefore = fn
		return nil
	}
}

// WithResponseAfter allows setting up a callback function, which will be
// called right after get response the request. This can be used to log.
func WithResponseAfter(fn ResponseAfterFn) ClientOption {
	return func(c *Client) error {
		c.ResponseAfter = fn
		return nil
	}
}

// The interface specification for the client above.
type ClientInterface interface {
	// GetInboundGuidance request
	GetInboundGuidance(ctx context.Context, params *GetInboundGuidanceParams) (*http.Response, error)

	// CreateInboundShipmentPlan request  with any body
	CreateInboundShipmentPlanWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error)

	CreateInboundShipmentPlan(ctx context.Context, body CreateInboundShipmentPlanJSONRequestBody) (*http.Response, error)

	// GetPrepInstructions request
	GetPrepInstructions(ctx context.Context, params *GetPrepInstructionsParams) (*http.Response, error)

	// GetShipmentItems request
	GetShipmentItems(ctx context.Context, params *GetShipmentItemsParams) (*http.Response, error)

	// GetShipments request
	GetShipments(ctx context.Context, params *GetShipmentsParams) (*http.Response, error)

	// CreateInboundShipment request  with any body
	CreateInboundShipmentWithBody(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*http.Response, error)

	CreateInboundShipment(ctx context.Context, shipmentId string, body CreateInboundShipmentJSONRequestBody) (*http.Response, error)

	// UpdateInboundShipment request  with any body
	UpdateInboundShipmentWithBody(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*http.Response, error)

	UpdateInboundShipment(ctx context.Context, shipmentId string, body UpdateInboundShipmentJSONRequestBody) (*http.Response, error)

	// GetBillOfLading request
	GetBillOfLading(ctx context.Context, shipmentId string) (*http.Response, error)

	// GetShipmentItemsByShipmentId request
	GetShipmentItemsByShipmentId(ctx context.Context, shipmentId string, params *GetShipmentItemsByShipmentIdParams) (*http.Response, error)

	// GetLabels request
	GetLabels(ctx context.Context, shipmentId string, params *GetLabelsParams) (*http.Response, error)

	// GetPreorderInfo request
	GetPreorderInfo(ctx context.Context, shipmentId string, params *GetPreorderInfoParams) (*http.Response, error)

	// ConfirmPreorder request
	ConfirmPreorder(ctx context.Context, shipmentId string, params *ConfirmPreorderParams) (*http.Response, error)

	// GetTransportDetails request
	GetTransportDetails(ctx context.Context, shipmentId string) (*http.Response, error)

	// PutTransportDetails request  with any body
	PutTransportDetailsWithBody(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*http.Response, error)

	PutTransportDetails(ctx context.Context, shipmentId string, body PutTransportDetailsJSONRequestBody) (*http.Response, error)

	// ConfirmTransport request
	ConfirmTransport(ctx context.Context, shipmentId string) (*http.Response, error)

	// EstimateTransport request
	EstimateTransport(ctx context.Context, shipmentId string) (*http.Response, error)

	// VoidTransport request
	VoidTransport(ctx context.Context, shipmentId string) (*http.Response, error)
}

func (c *Client) GetInboundGuidance(ctx context.Context, params *GetInboundGuidanceParams) (*http.Response, error) {
	req, err := NewGetInboundGuidanceRequest(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) CreateInboundShipmentPlanWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateInboundShipmentPlanRequestWithBody(c.Endpoint, 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) CreateInboundShipmentPlan(ctx context.Context, body CreateInboundShipmentPlanJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateInboundShipmentPlanRequest(c.Endpoint, 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) GetPrepInstructions(ctx context.Context, params *GetPrepInstructionsParams) (*http.Response, error) {
	req, err := NewGetPrepInstructionsRequest(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) GetShipmentItems(ctx context.Context, params *GetShipmentItemsParams) (*http.Response, error) {
	req, err := NewGetShipmentItemsRequest(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) GetShipments(ctx context.Context, params *GetShipmentsParams) (*http.Response, error) {
	req, err := NewGetShipmentsRequest(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) CreateInboundShipmentWithBody(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateInboundShipmentRequestWithBody(c.Endpoint, shipmentId, 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) CreateInboundShipment(ctx context.Context, shipmentId string, body CreateInboundShipmentJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateInboundShipmentRequest(c.Endpoint, shipmentId, 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) UpdateInboundShipmentWithBody(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewUpdateInboundShipmentRequestWithBody(c.Endpoint, shipmentId, 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) UpdateInboundShipment(ctx context.Context, shipmentId string, body UpdateInboundShipmentJSONRequestBody) (*http.Response, error) {
	req, err := NewUpdateInboundShipmentRequest(c.Endpoint, shipmentId, 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) GetBillOfLading(ctx context.Context, shipmentId string) (*http.Response, error) {
	req, err := NewGetBillOfLadingRequest(c.Endpoint, shipmentId)
	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) GetShipmentItemsByShipmentId(ctx context.Context, shipmentId string, params *GetShipmentItemsByShipmentIdParams) (*http.Response, error) {
	req, err := NewGetShipmentItemsByShipmentIdRequest(c.Endpoint, shipmentId, 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) GetLabels(ctx context.Context, shipmentId string, params *GetLabelsParams) (*http.Response, error) {
	req, err := NewGetLabelsRequest(c.Endpoint, shipmentId, 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) GetPreorderInfo(ctx context.Context, shipmentId string, params *GetPreorderInfoParams) (*http.Response, error) {
	req, err := NewGetPreorderInfoRequest(c.Endpoint, shipmentId, 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) ConfirmPreorder(ctx context.Context, shipmentId string, params *ConfirmPreorderParams) (*http.Response, error) {
	req, err := NewConfirmPreorderRequest(c.Endpoint, shipmentId, 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) GetTransportDetails(ctx context.Context, shipmentId string) (*http.Response, error) {
	req, err := NewGetTransportDetailsRequest(c.Endpoint, shipmentId)
	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) PutTransportDetailsWithBody(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewPutTransportDetailsRequestWithBody(c.Endpoint, shipmentId, 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) PutTransportDetails(ctx context.Context, shipmentId string, body PutTransportDetailsJSONRequestBody) (*http.Response, error) {
	req, err := NewPutTransportDetailsRequest(c.Endpoint, shipmentId, 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) ConfirmTransport(ctx context.Context, shipmentId string) (*http.Response, error) {
	req, err := NewConfirmTransportRequest(c.Endpoint, shipmentId)
	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) EstimateTransport(ctx context.Context, shipmentId string) (*http.Response, error) {
	req, err := NewEstimateTransportRequest(c.Endpoint, shipmentId)
	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) VoidTransport(ctx context.Context, shipmentId string) (*http.Response, error) {
	req, err := NewVoidTransportRequest(c.Endpoint, shipmentId)
	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
}

// NewGetInboundGuidanceRequest generates requests for GetInboundGuidance
func NewGetInboundGuidanceRequest(endpoint string, params *GetInboundGuidanceParams) (*http.Request, error) {
	var err error

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/itemsGuidance")
	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, "MarketplaceId", params.MarketplaceId); 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.SellerSKUList != nil {

		if queryFrag, err := runtime.StyleParam("form", true, "SellerSKUList", *params.SellerSKUList); 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.ASINList != nil {

		if queryFrag, err := runtime.StyleParam("form", true, "ASINList", *params.ASINList); 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
}

// NewCreateInboundShipmentPlanRequest calls the generic CreateInboundShipmentPlan builder with application/json body
func NewCreateInboundShipmentPlanRequest(endpoint string, body CreateInboundShipmentPlanJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewCreateInboundShipmentPlanRequestWithBody(endpoint, "application/json", bodyReader)
}

// NewCreateInboundShipmentPlanRequestWithBody generates requests for CreateInboundShipmentPlan with any type of body
func NewCreateInboundShipmentPlanRequestWithBody(endpoint string, contentType string, body io.Reader) (*http.Request, error) {
	var err error

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/plans")
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}

	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("POST", queryUrl.String(), body)
	if err != nil {
		return nil, err
	}

	req.Header.Add("Content-Type", contentType)
	return req, nil
}

// NewGetPrepInstructionsRequest generates requests for GetPrepInstructions
func NewGetPrepInstructionsRequest(endpoint string, params *GetPrepInstructionsParams) (*http.Request, error) {
	var err error

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/prepInstructions")
	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, "ShipToCountryCode", params.ShipToCountryCode); 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.SellerSKUList != nil {

		if queryFrag, err := runtime.StyleParam("form", true, "SellerSKUList", *params.SellerSKUList); 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.ASINList != nil {

		if queryFrag, err := runtime.StyleParam("form", true, "ASINList", *params.ASINList); 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
}

// NewGetShipmentItemsRequest generates requests for GetShipmentItems
func NewGetShipmentItemsRequest(endpoint string, params *GetShipmentItemsParams) (*http.Request, error) {
	var err error

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipmentItems")
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}

	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}

	queryValues := queryUrl.Query()

	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 queryFrag, err := runtime.StyleParam("form", true, "QueryType", params.QueryType); 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 queryFrag, err := runtime.StyleParam("form", true, "MarketplaceId", params.MarketplaceId); 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
}

// NewGetShipmentsRequest generates requests for GetShipments
func NewGetShipmentsRequest(endpoint string, params *GetShipmentsParams) (*http.Request, error) {
	var err error

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments")
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}

	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}

	queryValues := queryUrl.Query()

	if params.ShipmentStatusList != nil {

		if queryFrag, err := runtime.StyleParam("form", true, "ShipmentStatusList", *params.ShipmentStatusList); 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.ShipmentIdList != nil {

		if queryFrag, err := runtime.StyleParam("form", true, "ShipmentIdList", *params.ShipmentIdList); 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 queryFrag, err := runtime.StyleParam("form", true, "QueryType", params.QueryType); 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 queryFrag, err := runtime.StyleParam("form", true, "MarketplaceId", params.MarketplaceId); 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
}

// NewCreateInboundShipmentRequest calls the generic CreateInboundShipment builder with application/json body
func NewCreateInboundShipmentRequest(endpoint string, shipmentId string, body CreateInboundShipmentJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewCreateInboundShipmentRequestWithBody(endpoint, shipmentId, "application/json", bodyReader)
}

// NewCreateInboundShipmentRequestWithBody generates requests for CreateInboundShipment with any type of body
func NewCreateInboundShipmentRequestWithBody(endpoint string, shipmentId string, contentType string, body io.Reader) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}

	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("POST", queryUrl.String(), body)
	if err != nil {
		return nil, err
	}

	req.Header.Add("Content-Type", contentType)
	return req, nil
}

// NewUpdateInboundShipmentRequest calls the generic UpdateInboundShipment builder with application/json body
func NewUpdateInboundShipmentRequest(endpoint string, shipmentId string, body UpdateInboundShipmentJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewUpdateInboundShipmentRequestWithBody(endpoint, shipmentId, "application/json", bodyReader)
}

// NewUpdateInboundShipmentRequestWithBody generates requests for UpdateInboundShipment with any type of body
func NewUpdateInboundShipmentRequestWithBody(endpoint string, shipmentId string, contentType string, body io.Reader) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}

	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("PUT", queryUrl.String(), body)
	if err != nil {
		return nil, err
	}

	req.Header.Add("Content-Type", contentType)
	return req, nil
}

// NewGetBillOfLadingRequest generates requests for GetBillOfLading
func NewGetBillOfLadingRequest(endpoint string, shipmentId string) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/billOfLading", 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
}

// NewGetShipmentItemsByShipmentIdRequest generates requests for GetShipmentItemsByShipmentId
func NewGetShipmentItemsByShipmentIdRequest(endpoint string, shipmentId string, params *GetShipmentItemsByShipmentIdParams) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/items", 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, "MarketplaceId", params.MarketplaceId); 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
}

// NewGetLabelsRequest generates requests for GetLabels
func NewGetLabelsRequest(endpoint string, shipmentId string, params *GetLabelsParams) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/labels", 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, "PageType", params.PageType); 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, "LabelType", params.LabelType); 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.NumberOfPackages != nil {

		if queryFrag, err := runtime.StyleParam("form", true, "NumberOfPackages", *params.NumberOfPackages); 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.PackageLabelsToPrint != nil {

		if queryFrag, err := runtime.StyleParam("form", true, "PackageLabelsToPrint", *params.PackageLabelsToPrint); 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.NumberOfPallets != nil {

		if queryFrag, err := runtime.StyleParam("form", true, "NumberOfPallets", *params.NumberOfPallets); 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
}

// NewGetPreorderInfoRequest generates requests for GetPreorderInfo
func NewGetPreorderInfoRequest(endpoint string, shipmentId string, params *GetPreorderInfoParams) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/preorder", 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, "MarketplaceId", params.MarketplaceId); 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
}

// NewConfirmPreorderRequest generates requests for ConfirmPreorder
func NewConfirmPreorderRequest(endpoint string, shipmentId string, params *ConfirmPreorderParams) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/preorder/confirm", 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, "NeedByDate", params.NeedByDate); 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, "MarketplaceId", params.MarketplaceId); 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("PUT", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}

	return req, nil
}

// NewGetTransportDetailsRequest generates requests for GetTransportDetails
func NewGetTransportDetailsRequest(endpoint string, shipmentId string) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/transport", 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
}

// NewPutTransportDetailsRequest calls the generic PutTransportDetails builder with application/json body
func NewPutTransportDetailsRequest(endpoint string, shipmentId string, body PutTransportDetailsJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewPutTransportDetailsRequestWithBody(endpoint, shipmentId, "application/json", bodyReader)
}

// NewPutTransportDetailsRequestWithBody generates requests for PutTransportDetails with any type of body
func NewPutTransportDetailsRequestWithBody(endpoint string, shipmentId string, contentType string, body io.Reader) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/transport", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}

	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("PUT", queryUrl.String(), body)
	if err != nil {
		return nil, err
	}

	req.Header.Add("Content-Type", contentType)
	return req, nil
}

// NewConfirmTransportRequest generates requests for ConfirmTransport
func NewConfirmTransportRequest(endpoint string, shipmentId string) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/transport/confirm", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}

	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("POST", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}

	return req, nil
}

// NewEstimateTransportRequest generates requests for EstimateTransport
func NewEstimateTransportRequest(endpoint string, shipmentId string) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/transport/estimate", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}

	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("POST", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}

	return req, nil
}

// NewVoidTransportRequest generates requests for VoidTransport
func NewVoidTransportRequest(endpoint string, shipmentId string) (*http.Request, error) {
	var err error

	var pathParam0 string

	pathParam0, err = runtime.StyleParam("simple", false, "shipmentId", shipmentId)
	if err != nil {
		return nil, err
	}

	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	basePath := fmt.Sprintf("/fba/inbound/v0/shipments/%s/transport/void", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}

	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("POST", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}

	return req, nil
}

// ClientWithResponses builds on ClientInterface to offer response payloads
type ClientWithResponses struct {
	ClientInterface
}

// NewClientWithResponses creates a new ClientWithResponses, which wraps
// Client with return type handling
func NewClientWithResponses(endpoint string, opts ...ClientOption) (*ClientWithResponses, error) {
	client, err := NewClient(endpoint, opts...)
	if err != nil {
		return nil, err
	}
	return &ClientWithResponses{client}, nil
}

// WithBaseURL overrides the baseURL.
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
	}
}

// ClientWithResponsesInterface is the interface specification for the client with responses above.
type ClientWithResponsesInterface interface {
	// GetInboundGuidance request
	GetInboundGuidanceWithResponse(ctx context.Context, params *GetInboundGuidanceParams) (*GetInboundGuidanceResp, error)

	// CreateInboundShipmentPlan request  with any body
	CreateInboundShipmentPlanWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateInboundShipmentPlanResp, error)

	CreateInboundShipmentPlanWithResponse(ctx context.Context, body CreateInboundShipmentPlanJSONRequestBody) (*CreateInboundShipmentPlanResp, error)

	// GetPrepInstructions request
	GetPrepInstructionsWithResponse(ctx context.Context, params *GetPrepInstructionsParams) (*GetPrepInstructionsResp, error)

	// GetShipmentItems request
	GetShipmentItemsWithResponse(ctx context.Context, params *GetShipmentItemsParams) (*GetShipmentItemsResp, error)

	// GetShipments request
	GetShipmentsWithResponse(ctx context.Context, params *GetShipmentsParams) (*GetShipmentsResp, error)

	// CreateInboundShipment request  with any body
	CreateInboundShipmentWithBodyWithResponse(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*CreateInboundShipmentResp, error)

	CreateInboundShipmentWithResponse(ctx context.Context, shipmentId string, body CreateInboundShipmentJSONRequestBody) (*CreateInboundShipmentResp, error)

	// UpdateInboundShipment request  with any body
	UpdateInboundShipmentWithBodyWithResponse(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*UpdateInboundShipmentResp, error)

	UpdateInboundShipmentWithResponse(ctx context.Context, shipmentId string, body UpdateInboundShipmentJSONRequestBody) (*UpdateInboundShipmentResp, error)

	// GetBillOfLading request
	GetBillOfLadingWithResponse(ctx context.Context, shipmentId string) (*GetBillOfLadingResp, error)

	// GetShipmentItemsByShipmentId request
	GetShipmentItemsByShipmentIdWithResponse(ctx context.Context, shipmentId string, params *GetShipmentItemsByShipmentIdParams) (*GetShipmentItemsByShipmentIdResp, error)

	// GetLabels request
	GetLabelsWithResponse(ctx context.Context, shipmentId string, params *GetLabelsParams) (*GetLabelsResp, error)

	// GetPreorderInfo request
	GetPreorderInfoWithResponse(ctx context.Context, shipmentId string, params *GetPreorderInfoParams) (*GetPreorderInfoResp, error)

	// ConfirmPreorder request
	ConfirmPreorderWithResponse(ctx context.Context, shipmentId string, params *ConfirmPreorderParams) (*ConfirmPreorderResp, error)

	// GetTransportDetails request
	GetTransportDetailsWithResponse(ctx context.Context, shipmentId string) (*GetTransportDetailsResp, error)

	// PutTransportDetails request  with any body
	PutTransportDetailsWithBodyWithResponse(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*PutTransportDetailsResp, error)

	PutTransportDetailsWithResponse(ctx context.Context, shipmentId string, body PutTransportDetailsJSONRequestBody) (*PutTransportDetailsResp, error)

	// ConfirmTransport request
	ConfirmTransportWithResponse(ctx context.Context, shipmentId string) (*ConfirmTransportResp, error)

	// EstimateTransport request
	EstimateTransportWithResponse(ctx context.Context, shipmentId string) (*EstimateTransportResp, error)

	// VoidTransport request
	VoidTransportWithResponse(ctx context.Context, shipmentId string) (*VoidTransportResp, error)
}

type GetInboundGuidanceResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetInboundGuidanceResponse
}

// Status returns HTTPResponse.Status
func (r GetInboundGuidanceResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r GetInboundGuidanceResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type CreateInboundShipmentPlanResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *CreateInboundShipmentPlanResponse
}

// Status returns HTTPResponse.Status
func (r CreateInboundShipmentPlanResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r CreateInboundShipmentPlanResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type GetPrepInstructionsResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetPrepInstructionsResponse
}

// Status returns HTTPResponse.Status
func (r GetPrepInstructionsResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r GetPrepInstructionsResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type GetShipmentItemsResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetShipmentItemsResponse
}

// Status returns HTTPResponse.Status
func (r GetShipmentItemsResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r GetShipmentItemsResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type GetShipmentsResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetShipmentsResponse
}

// Status returns HTTPResponse.Status
func (r GetShipmentsResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r GetShipmentsResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type CreateInboundShipmentResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *InboundShipmentResponse
}

// Status returns HTTPResponse.Status
func (r CreateInboundShipmentResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r CreateInboundShipmentResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type UpdateInboundShipmentResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *InboundShipmentResponse
}

// Status returns HTTPResponse.Status
func (r UpdateInboundShipmentResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r UpdateInboundShipmentResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type GetBillOfLadingResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetBillOfLadingResponse
}

// Status returns HTTPResponse.Status
func (r GetBillOfLadingResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r GetBillOfLadingResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type GetShipmentItemsByShipmentIdResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetShipmentItemsResponse
}

// Status returns HTTPResponse.Status
func (r GetShipmentItemsByShipmentIdResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r GetShipmentItemsByShipmentIdResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type GetLabelsResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetLabelsResponse
}

// Status returns HTTPResponse.Status
func (r GetLabelsResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r GetLabelsResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type GetPreorderInfoResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetPreorderInfoResponse
}

// Status returns HTTPResponse.Status
func (r GetPreorderInfoResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r GetPreorderInfoResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type ConfirmPreorderResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *ConfirmPreorderResponse
}

// Status returns HTTPResponse.Status
func (r ConfirmPreorderResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r ConfirmPreorderResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type GetTransportDetailsResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetTransportDetailsResponse
}

// Status returns HTTPResponse.Status
func (r GetTransportDetailsResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r GetTransportDetailsResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type PutTransportDetailsResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *PutTransportDetailsResponse
}

// Status returns HTTPResponse.Status
func (r PutTransportDetailsResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r PutTransportDetailsResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type ConfirmTransportResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *ConfirmTransportResponse
}

// Status returns HTTPResponse.Status
func (r ConfirmTransportResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r ConfirmTransportResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type EstimateTransportResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *EstimateTransportResponse
}

// Status returns HTTPResponse.Status
func (r EstimateTransportResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r EstimateTransportResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

type VoidTransportResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *VoidTransportResponse
}

// Status returns HTTPResponse.Status
func (r VoidTransportResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}

// StatusCode returns HTTPResponse.StatusCode
func (r VoidTransportResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}

// GetInboundGuidanceWithResponse request returning *GetInboundGuidanceResponse
func (c *ClientWithResponses) GetInboundGuidanceWithResponse(ctx context.Context, params *GetInboundGuidanceParams) (*GetInboundGuidanceResp, error) {
	rsp, err := c.GetInboundGuidance(ctx, params)
	if err != nil {
		return nil, err
	}
	return ParseGetInboundGuidanceResp(rsp)
}

// CreateInboundShipmentPlanWithBodyWithResponse request with arbitrary body returning *CreateInboundShipmentPlanResponse
func (c *ClientWithResponses) CreateInboundShipmentPlanWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateInboundShipmentPlanResp, error) {
	rsp, err := c.CreateInboundShipmentPlanWithBody(ctx, contentType, body)
	if err != nil {
		return nil, err
	}
	return ParseCreateInboundShipmentPlanResp(rsp)
}

func (c *ClientWithResponses) CreateInboundShipmentPlanWithResponse(ctx context.Context, body CreateInboundShipmentPlanJSONRequestBody) (*CreateInboundShipmentPlanResp, error) {
	rsp, err := c.CreateInboundShipmentPlan(ctx, body)
	if err != nil {
		return nil, err
	}
	return ParseCreateInboundShipmentPlanResp(rsp)
}

// GetPrepInstructionsWithResponse request returning *GetPrepInstructionsResponse
func (c *ClientWithResponses) GetPrepInstructionsWithResponse(ctx context.Context, params *GetPrepInstructionsParams) (*GetPrepInstructionsResp, error) {
	rsp, err := c.GetPrepInstructions(ctx, params)
	if err != nil {
		return nil, err
	}
	return ParseGetPrepInstructionsResp(rsp)
}

// GetShipmentItemsWithResponse request returning *GetShipmentItemsResponse
func (c *ClientWithResponses) GetShipmentItemsWithResponse(ctx context.Context, params *GetShipmentItemsParams) (*GetShipmentItemsResp, error) {
	rsp, err := c.GetShipmentItems(ctx, params)
	if err != nil {
		return nil, err
	}
	return ParseGetShipmentItemsResp(rsp)
}

// GetShipmentsWithResponse request returning *GetShipmentsResponse
func (c *ClientWithResponses) GetShipmentsWithResponse(ctx context.Context, params *GetShipmentsParams) (*GetShipmentsResp, error) {
	rsp, err := c.GetShipments(ctx, params)
	if err != nil {
		return nil, err
	}
	return ParseGetShipmentsResp(rsp)
}

// CreateInboundShipmentWithBodyWithResponse request with arbitrary body returning *CreateInboundShipmentResponse
func (c *ClientWithResponses) CreateInboundShipmentWithBodyWithResponse(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*CreateInboundShipmentResp, error) {
	rsp, err := c.CreateInboundShipmentWithBody(ctx, shipmentId, contentType, body)
	if err != nil {
		return nil, err
	}
	return ParseCreateInboundShipmentResp(rsp)
}

func (c *ClientWithResponses) CreateInboundShipmentWithResponse(ctx context.Context, shipmentId string, body CreateInboundShipmentJSONRequestBody) (*CreateInboundShipmentResp, error) {
	rsp, err := c.CreateInboundShipment(ctx, shipmentId, body)
	if err != nil {
		return nil, err
	}
	return ParseCreateInboundShipmentResp(rsp)
}

// UpdateInboundShipmentWithBodyWithResponse request with arbitrary body returning *UpdateInboundShipmentResponse
func (c *ClientWithResponses) UpdateInboundShipmentWithBodyWithResponse(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*UpdateInboundShipmentResp, error) {
	rsp, err := c.UpdateInboundShipmentWithBody(ctx, shipmentId, contentType, body)
	if err != nil {
		return nil, err
	}
	return ParseUpdateInboundShipmentResp(rsp)
}

func (c *ClientWithResponses) UpdateInboundShipmentWithResponse(ctx context.Context, shipmentId string, body UpdateInboundShipmentJSONRequestBody) (*UpdateInboundShipmentResp, error) {
	rsp, err := c.UpdateInboundShipment(ctx, shipmentId, body)
	if err != nil {
		return nil, err
	}
	return ParseUpdateInboundShipmentResp(rsp)
}

// GetBillOfLadingWithResponse request returning *GetBillOfLadingResponse
func (c *ClientWithResponses) GetBillOfLadingWithResponse(ctx context.Context, shipmentId string) (*GetBillOfLadingResp, error) {
	rsp, err := c.GetBillOfLading(ctx, shipmentId)
	if err != nil {
		return nil, err
	}
	return ParseGetBillOfLadingResp(rsp)
}

// GetShipmentItemsByShipmentIdWithResponse request returning *GetShipmentItemsByShipmentIdResponse
func (c *ClientWithResponses) GetShipmentItemsByShipmentIdWithResponse(ctx context.Context, shipmentId string, params *GetShipmentItemsByShipmentIdParams) (*GetShipmentItemsByShipmentIdResp, error) {
	rsp, err := c.GetShipmentItemsByShipmentId(ctx, shipmentId, params)
	if err != nil {
		return nil, err
	}
	return ParseGetShipmentItemsByShipmentIdResp(rsp)
}

// GetLabelsWithResponse request returning *GetLabelsResponse
func (c *ClientWithResponses) GetLabelsWithResponse(ctx context.Context, shipmentId string, params *GetLabelsParams) (*GetLabelsResp, error) {
	rsp, err := c.GetLabels(ctx, shipmentId, params)
	if err != nil {
		return nil, err
	}
	return ParseGetLabelsResp(rsp)
}

// GetPreorderInfoWithResponse request returning *GetPreorderInfoResponse
func (c *ClientWithResponses) GetPreorderInfoWithResponse(ctx context.Context, shipmentId string, params *GetPreorderInfoParams) (*GetPreorderInfoResp, error) {
	rsp, err := c.GetPreorderInfo(ctx, shipmentId, params)
	if err != nil {
		return nil, err
	}
	return ParseGetPreorderInfoResp(rsp)
}

// ConfirmPreorderWithResponse request returning *ConfirmPreorderResponse
func (c *ClientWithResponses) ConfirmPreorderWithResponse(ctx context.Context, shipmentId string, params *ConfirmPreorderParams) (*ConfirmPreorderResp, error) {
	rsp, err := c.ConfirmPreorder(ctx, shipmentId, params)
	if err != nil {
		return nil, err
	}
	return ParseConfirmPreorderResp(rsp)
}

// GetTransportDetailsWithResponse request returning *GetTransportDetailsResponse
func (c *ClientWithResponses) GetTransportDetailsWithResponse(ctx context.Context, shipmentId string) (*GetTransportDetailsResp, error) {
	rsp, err := c.GetTransportDetails(ctx, shipmentId)
	if err != nil {
		return nil, err
	}
	return ParseGetTransportDetailsResp(rsp)
}

// PutTransportDetailsWithBodyWithResponse request with arbitrary body returning *PutTransportDetailsResponse
func (c *ClientWithResponses) PutTransportDetailsWithBodyWithResponse(ctx context.Context, shipmentId string, contentType string, body io.Reader) (*PutTransportDetailsResp, error) {
	rsp, err := c.PutTransportDetailsWithBody(ctx, shipmentId, contentType, body)
	if err != nil {
		return nil, err
	}
	return ParsePutTransportDetailsResp(rsp)
}

func (c *ClientWithResponses) PutTransportDetailsWithResponse(ctx context.Context, shipmentId string, body PutTransportDetailsJSONRequestBody) (*PutTransportDetailsResp, error) {
	rsp, err := c.PutTransportDetails(ctx, shipmentId, body)
	if err != nil {
		return nil, err
	}
	return ParsePutTransportDetailsResp(rsp)
}

// ConfirmTransportWithResponse request returning *ConfirmTransportResponse
func (c *ClientWithResponses) ConfirmTransportWithResponse(ctx context.Context, shipmentId string) (*ConfirmTransportResp, error) {
	rsp, err := c.ConfirmTransport(ctx, shipmentId)
	if err != nil {
		return nil, err
	}
	return ParseConfirmTransportResp(rsp)
}

// EstimateTransportWithResponse request returning *EstimateTransportResponse
func (c *ClientWithResponses) EstimateTransportWithResponse(ctx context.Context, shipmentId string) (*EstimateTransportResp, error) {
	rsp, err := c.EstimateTransport(ctx, shipmentId)
	if err != nil {
		return nil, err
	}
	return ParseEstimateTransportResp(rsp)
}

// VoidTransportWithResponse request returning *VoidTransportResponse
func (c *ClientWithResponses) VoidTransportWithResponse(ctx context.Context, shipmentId string) (*VoidTransportResp, error) {
	rsp, err := c.VoidTransport(ctx, shipmentId)
	if err != nil {
		return nil, err
	}
	return ParseVoidTransportResp(rsp)
}

// ParseGetInboundGuidanceResp parses an HTTP response from a GetInboundGuidanceWithResponse call
func ParseGetInboundGuidanceResp(rsp *http.Response) (*GetInboundGuidanceResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &GetInboundGuidanceResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest GetInboundGuidanceResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseCreateInboundShipmentPlanResp parses an HTTP response from a CreateInboundShipmentPlanWithResponse call
func ParseCreateInboundShipmentPlanResp(rsp *http.Response) (*CreateInboundShipmentPlanResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &CreateInboundShipmentPlanResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest CreateInboundShipmentPlanResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseGetPrepInstructionsResp parses an HTTP response from a GetPrepInstructionsWithResponse call
func ParseGetPrepInstructionsResp(rsp *http.Response) (*GetPrepInstructionsResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &GetPrepInstructionsResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest GetPrepInstructionsResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseGetShipmentItemsResp parses an HTTP response from a GetShipmentItemsWithResponse call
func ParseGetShipmentItemsResp(rsp *http.Response) (*GetShipmentItemsResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &GetShipmentItemsResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest GetShipmentItemsResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseGetShipmentsResp parses an HTTP response from a GetShipmentsWithResponse call
func ParseGetShipmentsResp(rsp *http.Response) (*GetShipmentsResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &GetShipmentsResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest GetShipmentsResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseCreateInboundShipmentResp parses an HTTP response from a CreateInboundShipmentWithResponse call
func ParseCreateInboundShipmentResp(rsp *http.Response) (*CreateInboundShipmentResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &CreateInboundShipmentResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest InboundShipmentResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseUpdateInboundShipmentResp parses an HTTP response from a UpdateInboundShipmentWithResponse call
func ParseUpdateInboundShipmentResp(rsp *http.Response) (*UpdateInboundShipmentResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &UpdateInboundShipmentResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest InboundShipmentResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseGetBillOfLadingResp parses an HTTP response from a GetBillOfLadingWithResponse call
func ParseGetBillOfLadingResp(rsp *http.Response) (*GetBillOfLadingResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &GetBillOfLadingResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest GetBillOfLadingResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseGetShipmentItemsByShipmentIdResp parses an HTTP response from a GetShipmentItemsByShipmentIdWithResponse call
func ParseGetShipmentItemsByShipmentIdResp(rsp *http.Response) (*GetShipmentItemsByShipmentIdResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &GetShipmentItemsByShipmentIdResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest GetShipmentItemsResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseGetLabelsResp parses an HTTP response from a GetLabelsWithResponse call
func ParseGetLabelsResp(rsp *http.Response) (*GetLabelsResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &GetLabelsResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest GetLabelsResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseGetPreorderInfoResp parses an HTTP response from a GetPreorderInfoWithResponse call
func ParseGetPreorderInfoResp(rsp *http.Response) (*GetPreorderInfoResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &GetPreorderInfoResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest GetPreorderInfoResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseConfirmPreorderResp parses an HTTP response from a ConfirmPreorderWithResponse call
func ParseConfirmPreorderResp(rsp *http.Response) (*ConfirmPreorderResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &ConfirmPreorderResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest ConfirmPreorderResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseGetTransportDetailsResp parses an HTTP response from a GetTransportDetailsWithResponse call
func ParseGetTransportDetailsResp(rsp *http.Response) (*GetTransportDetailsResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &GetTransportDetailsResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest GetTransportDetailsResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParsePutTransportDetailsResp parses an HTTP response from a PutTransportDetailsWithResponse call
func ParsePutTransportDetailsResp(rsp *http.Response) (*PutTransportDetailsResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &PutTransportDetailsResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest PutTransportDetailsResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseConfirmTransportResp parses an HTTP response from a ConfirmTransportWithResponse call
func ParseConfirmTransportResp(rsp *http.Response) (*ConfirmTransportResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &ConfirmTransportResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest ConfirmTransportResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseEstimateTransportResp parses an HTTP response from a EstimateTransportWithResponse call
func ParseEstimateTransportResp(rsp *http.Response) (*EstimateTransportResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &EstimateTransportResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest EstimateTransportResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}

// ParseVoidTransportResp parses an HTTP response from a VoidTransportWithResponse call
func ParseVoidTransportResp(rsp *http.Response) (*VoidTransportResp, error) {
	bodyBytes, err := ioutil.ReadAll(rsp.Body)
	defer rsp.Body.Close()
	if err != nil {
		return nil, err
	}

	response := &VoidTransportResp{
		Body:         bodyBytes,
		HTTPResponse: rsp,
	}

	var dest VoidTransportResponse
	if err := json.Unmarshal(bodyBytes, &dest); err != nil {
		return nil, err
	}

	response.Model = &dest

	if rsp.StatusCode >= 300 {
		err = fmt.Errorf(rsp.Status)
	}

	return response, err
}
