vendorTransactionStatus

package
v2.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package vendorTransactionStatus provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var (
	JSONMarshal    = json.Marshal
	JSONUnmarshal  = json.Unmarshal
	JSONNewDecoder = func(r io.Reader) interface{ Decode(v any) error } { return json.NewDecoder(r) }
	JSONNewEncoder = func(w io.Writer) interface{ Encode(v any) error } { return json.NewEncoder(w) }
)
View Source
var DefaultRetryOptions = RetryOptions{
	MaxRetries: 3,
	RetryOn: func(resp *http.Response, err error) bool {
		if err != nil {
			return true
		}

		if resp.StatusCode == 429 || resp.StatusCode >= 500 {
			return true
		}
		return false
	},
	Backoff: func(attempt int, resp *http.Response) time.Duration {

		return time.Duration(100*(1<<uint(attempt))) * time.Millisecond
	},
}

DefaultRetryOptions provides a basic DIY example for SP-API retries.

Functions

func NewGetTransactionRequest

func NewGetTransactionRequest(server string, transactionId string) (*http.Request, error)

NewGetTransactionRequest generates requests for GetTransaction

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// The user agent header identifies your application, its version number, and the platform and programming language you are using.
	// You must include a user agent header in each request submitted to the sales partner API.
	UserAgent string
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetTransaction

func (c *Client) GetTransaction(ctx context.Context, transactionId string) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetTransaction request
	GetTransaction(ctx context.Context, transactionId string) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetTransactionWithResponse

func (c *ClientWithResponses) GetTransactionWithResponse(ctx context.Context, transactionId string) (*GetTransactionResp, error)

GetTransactionWithResponse request returning *GetTransactionResp

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetTransactionWithResponse request
	GetTransactionWithResponse(ctx context.Context, transactionId string) (*GetTransactionResp, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type Error

type Error struct {
	// Code An error code that identifies the type of error that occurred.
	Code string `json:"code"`

	// Details Additional details that can help the caller understand or fix the issue.
	Details *string `json:"details,omitempty"`

	// Message A message that describes the error condition.
	Message string `json:"message"`
}

Error Error response returned when the request is unsuccessful.

type ErrorList

type ErrorList = []Error

ErrorList A list of error responses returned when a request is unsuccessful.

type GetTransactionResp

type GetTransactionResp struct {
	Body         []byte // Might be nil if decoded via streaming
	HTTPResponse *http.Response
	JSON200      *GetTransactionResponse
	JSON400      *GetTransactionResponse
	JSON401      *GetTransactionResponse
	JSON403      *GetTransactionResponse
	JSON404      *GetTransactionResponse
	JSON415      *GetTransactionResponse
	JSON429      *GetTransactionResponse
	JSON500      *GetTransactionResponse
	JSON503      *GetTransactionResponse
}

func ParseGetTransactionResp

func ParseGetTransactionResp(rsp *http.Response) (*GetTransactionResp, error)

ParseGetTransactionResp parses an HTTP response from a GetTransactionWithResponse call

func (GetTransactionResp) Status

func (r GetTransactionResp) Status() string

Status returns HTTPResponse.Status

func (GetTransactionResp) StatusCode

func (r GetTransactionResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetTransactionResponse

type GetTransactionResponse struct {
	// Errors A list of error responses returned when a request is unsuccessful.
	Errors *ErrorList `json:"errors,omitempty"`

	// TransactionStatusRenamedByExtension Represents the status of a transaction.
	TransactionStatusRenamedByExtension *TransactionStatusRenamedByExtension `json:"payload,omitempty"`
}

GetTransactionResponse The response schema for the getTransaction operation.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type RetryOptions

type RetryOptions struct {
	MaxRetries int
	// RetryOn returns true if the request should be retried.
	RetryOn func(resp *http.Response, err error) bool
	// Backoff returns the duration to wait before the next retry.
	// It can use the attempt count or inspect response headers (e.g., x-amzn-RateLimit-Limit).
	Backoff func(attempt int, resp *http.Response) time.Duration
}

RetryOptions defines the configuration for RetryTransport. It allows users to DIY their retry strategy, such as exponential backoff or header-based rate-limit backoff.

type RetryTransport

type RetryTransport struct {
	Next    http.RoundTripper
	Options RetryOptions
}

RetryTransport is an http.RoundTripper that retries requests based on RetryOptions.

func (*RetryTransport) RoundTrip

func (t *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper

type Transaction

type Transaction struct {
	// Errors A list of error responses returned when a request is unsuccessful.
	Errors *ErrorList `json:"errors,omitempty"`

	// Status Current processing status of the transaction.
	Status TransactionStatus `json:"status"`

	// TransactionId The unique identifier returned in the 'transactionId' field in response to the post request of a specific transaction.
	TransactionId string `json:"transactionId"`
}

Transaction The transaction status.

type TransactionStatus

type TransactionStatus string

TransactionStatus Current processing status of the transaction.

const (
	Failure    TransactionStatus = "Failure"
	Processing TransactionStatus = "Processing"
	Success    TransactionStatus = "Success"
)

Defines values for TransactionStatus.

type TransactionStatusRenamedByExtension

type TransactionStatusRenamedByExtension struct {
	// TransactionStatus The transaction status.
	TransactionStatus *Transaction `json:"transactionStatus,omitempty"`
}

TransactionStatusRenamedByExtension Represents the status of a transaction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL