seller-partner-api-sdk

module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT

README

seller-partner-api-sdk

amazon seller partner api by golang

Getting Started

package main

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"net/http/httputil"

	"github.com/aws/aws-sdk-go-v2/aws"
	"github.com/aws/smithy-go/logging"
	"github.com/google/uuid"
	order "github.com/oh0123/seller-partner-api-sdk/codegen/ordersv0"
	sign "github.com/oh0123/seller-partner-api-sdk/pkg/sign"
)

func main() {
	cfg := sign.SignConfig{
		AccessKeyID: "XXXX",
		SecretKey:   "XXXX",
		Region:      "XXXX",
		RoleArn:     "XXXX",
		MaxRetry:    1,
		LogMode:     []aws.ClientLogMode{},
		Logger:      logging.Nop{},
	}

	signer := sign.NewSigner(cfg)

	endpoint := "XXXX"

	reqEditor := order.WithRequestEditorFn(func(ctx context.Context, req *http.Request) error {
		req.Header.Add("X-Amzn-Requestid", uuid.New().String())
		if err := signer.Sign(req); err != nil {
			return fmt.Errorf("sign error: %s", err)
		}
		dump, err := httputil.DumpRequest(req, true)
		if err != nil {
			return fmt.Errorf("dump request error: %s", err)
		}
		log.Printf("DumpRequest = %s", dump)
		return nil
	})

	rsqEditor := order.WithResponseEditorFn(func(ctx context.Context, rsp *http.Response) error {
		dump, err := httputil.DumpResponse(rsp, true)
		if err != nil {
			return fmt.Errorf("dump response error: %s", err)
		}
		log.Printf("DumpResponse = %s", dump)
		return nil
	})

	client, err := order.NewClientWithResponses(endpoint, reqEditor, rsqEditor)
	if err != nil {
		log.Fatal(err)
	}

	p := order.GetOrdersParams{
		MarketplaceIds: []string{"XXXX"},
	}

	response, err := client.GetOrdersWithResponse(context.Background(), &p)
	if err != nil {
		log.Fatal(err)
	}
	log.Println(response.HTTPResponse.StatusCode)
}

Directories

Path Synopsis
codegen
FbaInboundEligibilityv1
Package fbaInboundEligibilityv1 provides primitives to interact with the openapi HTTP API.
Package fbaInboundEligibilityv1 provides primitives to interact with the openapi HTTP API.
FbaInventoryv1
Package fbaInventoryv1 provides primitives to interact with the openapi HTTP API.
Package fbaInventoryv1 provides primitives to interact with the openapi HTTP API.
FbaSmallAndLightv1
Package fbaSmallAndLightv1 provides primitives to interact with the openapi HTTP API.
Package fbaSmallAndLightv1 provides primitives to interact with the openapi HTTP API.
Feeds20210630
Package feeds20210630 provides primitives to interact with the openapi HTTP API.
Package feeds20210630 provides primitives to interact with the openapi HTTP API.
ProductTypeDefinitions20200901
Package productTypeDefinitions20200901 provides primitives to interact with the openapi HTTP API.
Package productTypeDefinitions20200901 provides primitives to interact with the openapi HTTP API.
aplusContent20201101
Package aplusContent20201101 provides primitives to interact with the openapi HTTP API.
Package aplusContent20201101 provides primitives to interact with the openapi HTTP API.
authorizationv1
Package authorizationv1 provides primitives to interact with the openapi HTTP API.
Package authorizationv1 provides primitives to interact with the openapi HTTP API.
catalogItems20220401
Package catalogItems20220401 provides primitives to interact with the openapi HTTP API.
Package catalogItems20220401 provides primitives to interact with the openapi HTTP API.
easyShip20220323
Package easyShip20220323 provides primitives to interact with the openapi HTTP API.
Package easyShip20220323 provides primitives to interact with the openapi HTTP API.
financesv0
Package financesv0 provides primitives to interact with the openapi HTTP API.
Package financesv0 provides primitives to interact with the openapi HTTP API.
fulfillmentInboundv0
Package fulfillmentInboundv0 provides primitives to interact with the openapi HTTP API.
Package fulfillmentInboundv0 provides primitives to interact with the openapi HTTP API.
fulfillmentOutbound20200701
Package fulfillmentOutbound20200701 provides primitives to interact with the openapi HTTP API.
Package fulfillmentOutbound20200701 provides primitives to interact with the openapi HTTP API.
listingsItems20210801
Package listingsItems20210801 provides primitives to interact with the openapi HTTP API.
Package listingsItems20210801 provides primitives to interact with the openapi HTTP API.
listingsRestrictions20210801
Package listingsRestrictions20210801 provides primitives to interact with the openapi HTTP API.
Package listingsRestrictions20210801 provides primitives to interact with the openapi HTTP API.
merchantFulfillmentv0
Package merchantFulfillmentv0 provides primitives to interact with the openapi HTTP API.
Package merchantFulfillmentv0 provides primitives to interact with the openapi HTTP API.
messagingv1
Package messagingv1 provides primitives to interact with the openapi HTTP API.
Package messagingv1 provides primitives to interact with the openapi HTTP API.
notificationsv1
Package notificationsv1 provides primitives to interact with the openapi HTTP API.
Package notificationsv1 provides primitives to interact with the openapi HTTP API.
ordersv0
Package ordersv0 provides primitives to interact with the openapi HTTP API.
Package ordersv0 provides primitives to interact with the openapi HTTP API.
productFeesv0
Package productFeesv0 provides primitives to interact with the openapi HTTP API.
Package productFeesv0 provides primitives to interact with the openapi HTTP API.
productPricingv20220501
Package productPricingv20220501 provides primitives to interact with the openapi HTTP API.
Package productPricingv20220501 provides primitives to interact with the openapi HTTP API.
replenishment20221107
Package replenishment20221107 provides primitives to interact with the openapi HTTP API.
Package replenishment20221107 provides primitives to interact with the openapi HTTP API.
reports20210630
Package reports20210630 provides primitives to interact with the openapi HTTP API.
Package reports20210630 provides primitives to interact with the openapi HTTP API.
salesv1
Package salesv1 provides primitives to interact with the openapi HTTP API.
Package salesv1 provides primitives to interact with the openapi HTTP API.
sellersv1
Package sellersv1 provides primitives to interact with the openapi HTTP API.
Package sellersv1 provides primitives to interact with the openapi HTTP API.
servicesv1
Package servicesv1 provides primitives to interact with the openapi HTTP API.
Package servicesv1 provides primitives to interact with the openapi HTTP API.
shipmentInvoicingv0
Package shipmentInvoicingv0 provides primitives to interact with the openapi HTTP API.
Package shipmentInvoicingv0 provides primitives to interact with the openapi HTTP API.
shippingv1
Package shippingv1 provides primitives to interact with the openapi HTTP API.
Package shippingv1 provides primitives to interact with the openapi HTTP API.
solicitationsv1
Package solicitationsv1 provides primitives to interact with the openapi HTTP API.
Package solicitationsv1 provides primitives to interact with the openapi HTTP API.
tokens20210301
Package tokens20210301 provides primitives to interact with the openapi HTTP API.
Package tokens20210301 provides primitives to interact with the openapi HTTP API.
uploads20201101
Package uploads20201101 provides primitives to interact with the openapi HTTP API.
Package uploads20201101 provides primitives to interact with the openapi HTTP API.
vendorDirectFulfillmentInventoryv1
Package vendorDirectFulfillmentInventoryv1 provides primitives to interact with the openapi HTTP API.
Package vendorDirectFulfillmentInventoryv1 provides primitives to interact with the openapi HTTP API.
vendorDirectFulfillmentOrders20211228
Package vendorDirectFulfillmentOrders20211228 provides primitives to interact with the openapi HTTP API.
Package vendorDirectFulfillmentOrders20211228 provides primitives to interact with the openapi HTTP API.
vendorDirectFulfillmentOrdersv1
Package vendorDirectFulfillmentOrdersv1 provides primitives to interact with the openapi HTTP API.
Package vendorDirectFulfillmentOrdersv1 provides primitives to interact with the openapi HTTP API.
vendorDirectFulfillmentPaymentsv1
Package vendorDirectFulfillmentPaymentsv1 provides primitives to interact with the openapi HTTP API.
Package vendorDirectFulfillmentPaymentsv1 provides primitives to interact with the openapi HTTP API.
vendorDirectFulfillmentShipping20211228
Package vendorDirectFulfillmentShipping20211228 provides primitives to interact with the openapi HTTP API.
Package vendorDirectFulfillmentShipping20211228 provides primitives to interact with the openapi HTTP API.
vendorDirectFulfillmentShippingv1
Package vendorDirectFulfillmentShippingv1 provides primitives to interact with the openapi HTTP API.
Package vendorDirectFulfillmentShippingv1 provides primitives to interact with the openapi HTTP API.
vendorInvoicesv1
Package vendorInvoicesv1 provides primitives to interact with the openapi HTTP API.
Package vendorInvoicesv1 provides primitives to interact with the openapi HTTP API.
vendorOrdersv1
Package vendorOrdersv1 provides primitives to interact with the openapi HTTP API.
Package vendorOrdersv1 provides primitives to interact with the openapi HTTP API.
vendorShipmentsv1
Package vendorShipmentsv1 provides primitives to interact with the openapi HTTP API.
Package vendorShipmentsv1 provides primitives to interact with the openapi HTTP API.
pkg

Jump to

Keyboard shortcuts

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