func (c *ClientWithResponses) GetFeedsWithResponse(ctx context.Context, params *GetFeedsParams) (*GetFeedsResp, error) {
	rsp, err := c.GetFeeds(ctx, params)
	if err != nil {
		return nil, err
	}
	return ParseGetFeedsResp(rsp)
}
GetFeedsWithResponse request returning *GetFeedsResponse
package feeds
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 {
	CreateFeedDocumentWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error)
	CreateFeedDocument(ctx context.Context, body CreateFeedDocumentJSONRequestBody) (*http.Response, error)
	GetFeedDocument(ctx context.Context, feedDocumentId string) (*http.Response, error)
	GetFeeds(ctx context.Context, params *GetFeedsParams) (*http.Response, error)
	CreateFeedWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error)
	CreateFeed(ctx context.Context, body CreateFeedJSONRequestBody) (*http.Response, error)
	CancelFeed(ctx context.Context, feedId string) (*http.Response, error)
	GetFeed(ctx context.Context, feedId string) (*http.Response, error)
}
func (c *Client) CreateFeedDocumentWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateFeedDocumentRequestWithBody(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) CreateFeedDocument(ctx context.Context, body CreateFeedDocumentJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateFeedDocumentRequest(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) GetFeedDocument(ctx context.Context, feedDocumentId string) (*http.Response, error) {
	req, err := NewGetFeedDocumentRequest(c.Endpoint, feedDocumentId)
	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) GetFeeds(ctx context.Context, params *GetFeedsParams) (*http.Response, error) {
	req, err := NewGetFeedsRequest(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) CreateFeedWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateFeedRequestWithBody(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) CreateFeed(ctx context.Context, body CreateFeedJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateFeedRequest(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) CancelFeed(ctx context.Context, feedId string) (*http.Response, error) {
	req, err := NewCancelFeedRequest(c.Endpoint, feedId)
	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) GetFeed(ctx context.Context, feedId string) (*http.Response, error) {
	req, err := NewGetFeedRequest(c.Endpoint, feedId)
	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 NewCreateFeedDocumentRequest(endpoint string, body CreateFeedDocumentJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewCreateFeedDocumentRequestWithBody(endpoint, "application/json", bodyReader)
}
func NewCreateFeedDocumentRequestWithBody(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("/feeds/2020-09-04/documents")
	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
}
func NewGetFeedDocumentRequest(endpoint string, feedDocumentId string) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "feedDocumentId", feedDocumentId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/feeds/2020-09-04/documents/%s", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewGetFeedsRequest(endpoint string, params *GetFeedsParams) (*http.Request, error) {
	var err error
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/feeds/2020-09-04/feeds")
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	queryValues := queryUrl.Query()
	if params.FeedTypes != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "feedTypes", *params.FeedTypes); 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.MarketplaceIds != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "marketplaceIds", *params.MarketplaceIds); err != nil {
			return nil, err
		} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
			return nil, err
		} else {
			for k, v := range parsed {
				for _, v2 := range v {
					queryValues.Add(k, v2)
				}
			}
		}
	}
	if params.PageSize != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "pageSize", *params.PageSize); 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.ProcessingStatuses != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "processingStatuses", *params.ProcessingStatuses); 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.CreatedSince != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "createdSince", *params.CreatedSince); 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.CreatedUntil != nil {
		if queryFrag, err := runtime.StyleParam("form", true, "createdUntil", *params.CreatedUntil); 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)
				}
			}
		}
	}
	queryUrl.RawQuery = queryValues.Encode()
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewCreateFeedRequest(endpoint string, body CreateFeedJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewCreateFeedRequestWithBody(endpoint, "application/json", bodyReader)
}
func NewCreateFeedRequestWithBody(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("/feeds/2020-09-04/feeds")
	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
}
func NewCancelFeedRequest(endpoint string, feedId string) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "feedId", feedId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/feeds/2020-09-04/feeds/%s", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("DELETE", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewGetFeedRequest(endpoint string, feedId string) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "feedId", feedId)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/feeds/2020-09-04/feeds/%s", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
type ClientWithResponses struct {
	ClientInterface
}
func NewClientWithResponses(endpoint string, opts ...ClientOption) (*ClientWithResponses, error) {
	client, err := NewClient(endpoint, opts...)
	if err != nil {
		return nil, err
	}
	return &ClientWithResponses{client}, nil
}
func WithBaseURL(baseURL string) ClientOption {
	return func(c *Client) error {
		newBaseURL, err := url.Parse(baseURL)
		if err != nil {
			return err
		}
		c.Endpoint = newBaseURL.String()
		return nil
	}
}
type ClientWithResponsesInterface interface {
	CreateFeedDocumentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateFeedDocumentResp, error)
	CreateFeedDocumentWithResponse(ctx context.Context, body CreateFeedDocumentJSONRequestBody) (*CreateFeedDocumentResp, error)
	GetFeedDocumentWithResponse(ctx context.Context, feedDocumentId string) (*GetFeedDocumentResp, error)
	GetFeedsWithResponse(ctx context.Context, params *GetFeedsParams) (*GetFeedsResp, error)
	CreateFeedWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateFeedResp, error)
	CreateFeedWithResponse(ctx context.Context, body CreateFeedJSONRequestBody) (*CreateFeedResp, error)
	CancelFeedWithResponse(ctx context.Context, feedId string) (*CancelFeedResp, error)
	GetFeedWithResponse(ctx context.Context, feedId string) (*GetFeedResp, error)
}
type CreateFeedDocumentResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *CreateFeedDocumentResponse
}
func (r CreateFeedDocumentResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
func (r CreateFeedDocumentResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
type GetFeedDocumentResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetFeedDocumentResponse
}
func (r GetFeedDocumentResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
func (r GetFeedDocumentResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
type GetFeedsResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetFeedsResponse
}
func (r GetFeedsResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
func (r GetFeedsResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
type CreateFeedResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *CreateFeedResponse
}
func (r CreateFeedResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
func (r CreateFeedResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
type CancelFeedResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *CancelFeedResponse
}
func (r CancelFeedResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
func (r CancelFeedResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
type GetFeedResp struct {
	Body         []byte
	HTTPResponse *http.Response
	Model        *GetFeedResponse
}
func (r GetFeedResp) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
func (r GetFeedResp) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
func (c *ClientWithResponses) CreateFeedDocumentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateFeedDocumentResp, error) {
	rsp, err := c.CreateFeedDocumentWithBody(ctx, contentType, body)
	if err != nil {
		return nil, err
	}
	return ParseCreateFeedDocumentResp(rsp)
}
func (c *ClientWithResponses) CreateFeedDocumentWithResponse(ctx context.Context, body CreateFeedDocumentJSONRequestBody) (*CreateFeedDocumentResp, error) {
	rsp, err := c.CreateFeedDocument(ctx, body)
	if err != nil {
		return nil, err
	}
	return ParseCreateFeedDocumentResp(rsp)
}
func (c *ClientWithResponses) GetFeedDocumentWithResponse(ctx context.Context, feedDocumentId string) (*GetFeedDocumentResp, error) {
	rsp, err := c.GetFeedDocument(ctx, feedDocumentId)
	if err != nil {
		return nil, err
	}
	return ParseGetFeedDocumentResp(rsp)
}