walmart_client

package module
v0.0.0-...-56aca34 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthenticateBasePath   = "/v3/token"
	GetTokenDetailBasePath = "/v3/token/detail"
)
View Source
const (
	RequestAuthContentType = "application/x-www-form-urlencoded"
	RequestContentType     = "application/json"
	RequestAccept          = "application/json"

	BaseUrlProd    = "https://marketplace.walmartapis.com/"
	BaseUrlSandbox = "https://sandbox.walmartapis.com"

	GetAccessTokenUri = "v3/token"
)
View Source
const (
	FulfillmentBasePath                      = "/v3/fulfillment"
	FulfillmentInboundShipmentBasePath       = FulfillmentBasePath + "/inbound-shipments"
	FulfillmentInboundShipmentErrorsBasePath = FulfillmentBasePath + "/inbound-shipment-errors"
	FulfillmentInboundShipmentItemsBasePath  = FulfillmentBasePath + "/inbound-shipment-items"
	FulfillmentShipmentQuantitiesBasePath    = FulfillmentBasePath + "/shipment-quantities"
	FulfillmentShipmentLabelBasePath         = FulfillmentBasePath + "/label"
	FulfillmentShipmentTrackingBasePath      = FulfillmentBasePath + "/shipment-tracking"
)
View Source
const (
	GetInventoryBasePath    = "/v3/inventory"
	UpdateInventoryBasePath = "/v3/inventory"
)
View Source
const (
	AcknowledgeOrderBasePath  = "/v3/orders/%s/acknowledge"
	ShipOrderBasePath         = "/v3/orders/%s/shipping"
	CancelOrderBasePath       = "/v3/orders/%s/cancel"
	GetReleasedOrdersBasePath = "/v3/orders/released"
	GetAllOrdersBasePath      = "/v3/orders"
)
View Source
const (
	FeedBasePath = "/v3/feeds"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int64  `json:"expires_in"`
}

type AuthService

type AuthService interface {
	Authenticate(ctx context.Context) (*AuthResponse, error)
	GetTokenDetail(ctx context.Context) (*GetTokenDetailResponse, error)
}

func NewAuthService

func NewAuthService(client *Client) AuthService

type Callback

type Callback func(c *Client)

func BeforeRequest

func BeforeRequest(funcs ...func(ctx context.Context, c *Client) error) Callback

type Client

type Client struct {
	Config Config
	Token  *Token

	InventoryService
	AuthService
	OrderService
	FeedService
	FulfillmentService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(client *http.Client, conf Config, callbacks ...Callback) *Client

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, uri string, content interface{}) (*Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, uri string, options interface{}) (*Response, error)

func (Client) GetHost

func (c Client) GetHost() string

func (Client) GetRequestHeaders

func (c Client) GetRequestHeaders() http.Header

func (*Client) Post

func (c *Client) Post(ctx context.Context, uri string, content interface{}) (*Response, error)

func (*Client) Put

func (c *Client) Put(ctx context.Context, uri string, content interface{}) (*Response, error)

func (*Client) SetAccessToken

func (c *Client) SetAccessToken(accessToken string, expireAt *string)

type Config

type Config struct {
	SandboxMode   bool
	WMServiceName string
	ClientID      string
	ClientSecret  string
}

type FeedService

type FeedService interface {
	ConvertItemsForWFS(ctx context.Context, content feed_dto.ConvertItemsPayload) (*feed_dto.ConvertItemsResponse, error)
}

func NewFeedService

func NewFeedService(client *Client) FeedService

type GetTokenDetailResponse

type GetTokenDetailResponse struct {
	ExpireAt string `json:"expire_at"`
	IssuedAt string `json:"issued_at"`
	IsValid  bool   `json:"is_valid"`
	Scopes   struct {
		Reports   string `json:"reports"`
		Item      string `json:"item"`
		Price     string `json:"price"`
		Lagtime   string `json:"lagtime"`
		Feeds     string `json:"feeds"`
		Returns   string `json:"returns"`
		Orders    string `json:"orders"`
		Inventory string `json:"inventory"`
		Content   string `json:"content"`
	} `json:"scopes"`
}

type InventoryService

type InventoryService interface {
	GetInventory(ctx context.Context, params inventory_dto.InventoryGetParams) (*inventory_dto.InventoryResponse, error)
	UpdateInventory(ctx context.Context, content inventory_dto.InventoryUpdatePayload) (*inventory_dto.InventoryResponse, error)
}

func NewInventoryService

func NewInventoryService(client *Client) InventoryService

type OrderService

type OrderService interface {
	Acknowledge(ctx context.Context, purchaseOrderID string) (*order_dto.OrderResponse, error)
	Ship(ctx context.Context, purchaseOrderID string, payload order_dto.OrderShipmentPayload) (*order_dto.OrderResponse, error)
	Cancel(ctx context.Context, purchaseOrderID string, payload order_dto.OrderCancellationPayload) (*order_dto.OrderResponse, error)
	GetReleasedOrders(ctx context.Context, params *order_dto.GetReleasedOrdersParams, nextCursor *string) (*order_dto.OrdersResponse, error)
	GetAllOrders(ctx context.Context, params *order_dto.GetAllOrdersParams, nextCursor *string) (*order_dto.OrdersResponse, error)
}

func NewOrderService

func NewOrderService(client *Client) OrderService

type Response

type Response struct {
	StatusCode int
	Body       []byte
}

func (Response) Decode

func (r Response) Decode(output interface{}) error

type Token

type Token struct {
	AccessToken string
	ExpireAt    time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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