package
0.0.0-20250220150502-33a7d9c4e252
Repository: https://github.com/gearment/go-etsy.git
Documentation: pkg.go.dev

# README

Go API client for goEtsy

Etsy's Open API provides a simple RESTful interface for various Etsy.com features. The API endpoints are meant to replace Etsy's Open API v2, which is scheduled to end service in 2022.

All of the endpoints are callable and the majority of the API endpoints are now in a beta phase. This means we do not expect to make any breaking changes before our general release. A handful of endpoints are currently interface stubs (labeled “Feedback Only”) and returns a \"501 Not Implemented\" response code when called.

If you'd like to report an issue or provide feedback on the API design, please add an issue in Github.

© 2021-2024 Etsy, Inc. All Rights Reserved. Use of this code is subject to Etsy's API Developer Terms of Use.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 3.0.0
  • Package version: 1.0.0
  • Build date: 2025-02-20T21:58:10.698549923+07:00[Asia/Saigon]
  • Generator version: 7.8.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import goEtsy "github.com/gearment/go-etsy/client"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value goEtsy.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), goEtsy.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value goEtsy.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), goEtsy.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using goEtsy.ContextOperationServerIndices and goEtsy.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), goEtsy.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), goEtsy.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://openapi.etsy.com

ClassMethodHTTP requestDescription
BuyerTaxonomyAPIGetBuyerTaxonomyNodesGet /v3/application/buyer-taxonomy/nodes
BuyerTaxonomyAPIGetPropertiesByBuyerTaxonomyIdGet /v3/application/buyer-taxonomy/nodes/{taxonomy_id}/properties
LedgerEntryAPIGetShopPaymentAccountLedgerEntriesGet /v3/application/shops/{shop_id}/payment-account/ledger-entries
LedgerEntryAPIGetShopPaymentAccountLedgerEntryGet /v3/application/shops/{shop_id}/payment-account/ledger-entries/{ledger_entry_id}
OtherAPIPingGet /v3/application/openapi-ping
OtherAPITokenScopesPost /v3/application/scopes
PaymentAPIGetPaymentAccountLedgerEntryPaymentsGet /v3/application/shops/{shop_id}/payment-account/ledger-entries/payments
PaymentAPIGetPaymentsGet /v3/application/shops/{shop_id}/payments
PaymentAPIGetShopPaymentByReceiptIdGet /v3/application/shops/{shop_id}/receipts/{receipt_id}/payments
ReviewAPIGetReviewsByListingGet /v3/application/listings/{listing_id}/reviews
ReviewAPIGetReviewsByShopGet /v3/application/shops/{shop_id}/reviews
SellerTaxonomyAPIGetPropertiesByTaxonomyIdGet /v3/application/seller-taxonomy/nodes/{taxonomy_id}/properties
SellerTaxonomyAPIGetSellerTaxonomyNodesGet /v3/application/seller-taxonomy/nodes
ShopAPIFindShopsGet /v3/application/shops
ShopAPIGetShopGet /v3/application/shops/{shop_id}
ShopAPIGetShopByOwnerUserIdGet /v3/application/users/{user_id}/shops
ShopAPIUpdateShopPut /v3/application/shops/{shop_id}
ShopHolidayPreferencesAPIGetHolidayPreferencesGet /v3/application/shops/{shop_id}/holiday-preferences
ShopHolidayPreferencesAPIUpdateHolidayPreferencesPut /v3/application/shops/{shop_id}/holiday-preferences/{holiday_id}
ShopListingAPICreateDraftListingPost /v3/application/shops/{shop_id}/listings
ShopListingAPIDeleteListingDelete /v3/application/listings/{listing_id}
ShopListingAPIDeleteListingPropertyDelete /v3/application/shops/{shop_id}/listings/{listing_id}/properties/{property_id}
ShopListingAPIFindAllActiveListingsByShopGet /v3/application/shops/{shop_id}/listings/active
ShopListingAPIFindAllListingsActiveGet /v3/application/listings/active
ShopListingAPIGetFeaturedListingsByShopGet /v3/application/shops/{shop_id}/listings/featured
ShopListingAPIGetListingGet /v3/application/listings/{listing_id}
ShopListingAPIGetListingPropertiesGet /v3/application/shops/{shop_id}/listings/{listing_id}/properties
ShopListingAPIGetListingPropertyGet /v3/application/listings/{listing_id}/properties/{property_id}
ShopListingAPIGetListingsByListingIdsGet /v3/application/listings/batch
ShopListingAPIGetListingsByShopGet /v3/application/shops/{shop_id}/listings
ShopListingAPIGetListingsByShopReceiptGet /v3/application/shops/{shop_id}/receipts/{receipt_id}/listings
ShopListingAPIGetListingsByShopReturnPolicyGet /v3/application/shops/{shop_id}/policies/return/{return_policy_id}/listings
ShopListingAPIGetListingsByShopSectionIdGet /v3/application/shops/{shop_id}/shop-sections/listings
ShopListingAPIUpdateListingPatch /v3/application/shops/{shop_id}/listings/{listing_id}
ShopListingAPIUpdateListingDeprecatedPut /v3/application/shops/{shop_id}/listings/{listing_id}
ShopListingAPIUpdateListingPropertyPut /v3/application/shops/{shop_id}/listings/{listing_id}/properties/{property_id}
ShopListingFileAPIDeleteListingFileDelete /v3/application/shops/{shop_id}/listings/{listing_id}/files/{listing_file_id}
ShopListingFileAPIGetAllListingFilesGet /v3/application/shops/{shop_id}/listings/{listing_id}/files
ShopListingFileAPIGetListingFileGet /v3/application/shops/{shop_id}/listings/{listing_id}/files/{listing_file_id}
ShopListingFileAPIUploadListingFilePost /v3/application/shops/{shop_id}/listings/{listing_id}/files
ShopListingImageAPIDeleteListingImageDelete /v3/application/shops/{shop_id}/listings/{listing_id}/images/{listing_image_id}
ShopListingImageAPIGetListingImageGet /v3/application/listings/{listing_id}/images/{listing_image_id}
ShopListingImageAPIGetListingImageDeprecatedGet /v3/application/shops/{shop_id}/listings/{listing_id}/images/{listing_image_id}
ShopListingImageAPIGetListingImagesGet /v3/application/listings/{listing_id}/images
ShopListingImageAPIGetListingImagesDeprecatedGet /v3/application/shops/{shop_id}/listings/{listing_id}/images
ShopListingImageAPIUploadListingImagePost /v3/application/shops/{shop_id}/listings/{listing_id}/images
ShopListingInventoryAPIGetListingInventoryGet /v3/application/listings/{listing_id}/inventory
ShopListingInventoryAPIUpdateListingInventoryPut /v3/application/listings/{listing_id}/inventory
ShopListingOfferingAPIGetListingOfferingGet /v3/application/listings/{listing_id}/products/{product_id}/offerings/{product_offering_id}
ShopListingProductAPIGetListingProductGet /v3/application/listings/{listing_id}/inventory/products/{product_id}
ShopListingTranslationAPICreateListingTranslationPost /v3/application/shops/{shop_id}/listings/{listing_id}/translations/{language}
ShopListingTranslationAPIGetListingTranslationGet /v3/application/shops/{shop_id}/listings/{listing_id}/translations/{language}
ShopListingTranslationAPIUpdateListingTranslationPut /v3/application/shops/{shop_id}/listings/{listing_id}/translations/{language}
ShopListingVariationImageAPIGetListingVariationImagesGet /v3/application/shops/{shop_id}/listings/{listing_id}/variation-images
ShopListingVariationImageAPIUpdateVariationImagesPost /v3/application/shops/{shop_id}/listings/{listing_id}/variation-images
ShopListingVideoAPIDeleteListingVideoDelete /v3/application/shops/{shop_id}/listings/{listing_id}/videos/{video_id}
ShopListingVideoAPIGetListingVideoGet /v3/application/listings/{listing_id}/videos/{video_id}
ShopListingVideoAPIGetListingVideosGet /v3/application/listings/{listing_id}/videos
ShopListingVideoAPIUploadListingVideoPost /v3/application/shops/{shop_id}/listings/{listing_id}/videos
ShopProductionPartnerAPIGetShopProductionPartnersGet /v3/application/shops/{shop_id}/production-partners
ShopReceiptAPICreateReceiptShipmentPost /v3/application/shops/{shop_id}/receipts/{receipt_id}/tracking
ShopReceiptAPIGetShopReceiptGet /v3/application/shops/{shop_id}/receipts/{receipt_id}
ShopReceiptAPIGetShopReceiptsGet /v3/application/shops/{shop_id}/receipts
ShopReceiptAPIUpdateShopReceiptPut /v3/application/shops/{shop_id}/receipts/{receipt_id}
ShopReceiptTransactionsAPIGetShopReceiptTransactionGet /v3/application/shops/{shop_id}/transactions/{transaction_id}
ShopReceiptTransactionsAPIGetShopReceiptTransactionsByListingGet /v3/application/shops/{shop_id}/listings/{listing_id}/transactions
ShopReceiptTransactionsAPIGetShopReceiptTransactionsByReceiptGet /v3/application/shops/{shop_id}/receipts/{receipt_id}/transactions
ShopReceiptTransactionsAPIGetShopReceiptTransactionsByShopGet /v3/application/shops/{shop_id}/transactions
ShopReturnPolicyAPIConsolidateShopReturnPoliciesPost /v3/application/shops/{shop_id}/policies/return/consolidate
ShopReturnPolicyAPICreateShopReturnPolicyPost /v3/application/shops/{shop_id}/policies/return
ShopReturnPolicyAPIDeleteShopReturnPolicyDelete /v3/application/shops/{shop_id}/policies/return/{return_policy_id}
ShopReturnPolicyAPIGetShopReturnPoliciesGet /v3/application/shops/{shop_id}/policies/return
ShopReturnPolicyAPIGetShopReturnPolicyGet /v3/application/shops/{shop_id}/policies/return/{return_policy_id}
ShopReturnPolicyAPIUpdateShopReturnPolicyPut /v3/application/shops/{shop_id}/policies/return/{return_policy_id}
ShopSectionAPICreateShopSectionPost /v3/application/shops/{shop_id}/sections
ShopSectionAPIDeleteShopSectionDelete /v3/application/shops/{shop_id}/sections/{shop_section_id}
ShopSectionAPIGetShopSectionGet /v3/application/shops/{shop_id}/sections/{shop_section_id}
ShopSectionAPIGetShopSectionsGet /v3/application/shops/{shop_id}/sections
ShopSectionAPIUpdateShopSectionPut /v3/application/shops/{shop_id}/sections/{shop_section_id}
ShopShippingProfileAPICreateShopShippingProfilePost /v3/application/shops/{shop_id}/shipping-profiles
ShopShippingProfileAPICreateShopShippingProfileDestinationPost /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}/destinations
ShopShippingProfileAPICreateShopShippingProfileUpgradePost /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}/upgrades
ShopShippingProfileAPIDeleteShopShippingProfileDelete /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}
ShopShippingProfileAPIDeleteShopShippingProfileDestinationDelete /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}/destinations/{shipping_profile_destination_id}
ShopShippingProfileAPIDeleteShopShippingProfileUpgradeDelete /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}/upgrades/{upgrade_id}
ShopShippingProfileAPIGetShippingCarriersGet /v3/application/shipping-carriers
ShopShippingProfileAPIGetShopShippingProfileGet /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}
ShopShippingProfileAPIGetShopShippingProfileDestinationsByShippingProfileGet /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}/destinations
ShopShippingProfileAPIGetShopShippingProfileUpgradesGet /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}/upgrades
ShopShippingProfileAPIGetShopShippingProfilesGet /v3/application/shops/{shop_id}/shipping-profiles
ShopShippingProfileAPIUpdateShopShippingProfilePut /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}
ShopShippingProfileAPIUpdateShopShippingProfileDestinationPut /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}/destinations/{shipping_profile_destination_id}
ShopShippingProfileAPIUpdateShopShippingProfileUpgradePut /v3/application/shops/{shop_id}/shipping-profiles/{shipping_profile_id}/upgrades/{upgrade_id}
UserAPIGetMeGet /v3/application/users/me
UserAPIGetUserGet /v3/application/users/{user_id}
UserAddressAPIDeleteUserAddressDelete /v3/application/user/addresses/{user_address_id}
UserAddressAPIGetUserAddressGet /v3/application/user/addresses/{user_address_id}
UserAddressAPIGetUserAddressesGet /v3/application/user/addresses

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

api_key

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: x-api-key and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		goEtsy.ContextAPIKeys,
		map[string]goEtsy.APIKey{
			"x-api-key": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

oauth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://www.etsy.com/oauth/connect
  • Scopes:
  • address_r: see billing and shipping addresses
  • address_w: update billing and shipping addresses
  • billing_r: see all billing statement data
  • cart_r: read shopping carts
  • cart_w: add/remove from shopping carts
  • email_r: read a user profile
  • favorites_r: see private favorites
  • favorites_w: add/remove favorites
  • feedback_r: see purchase info in feedback
  • listings_d: delete listings
  • listings_r: see all listings (including expired etc)
  • listings_w: create/edit listings
  • profile_r: see all profile data
  • profile_w: update user profile, avatar, etc
  • recommend_r: see recommended listings
  • recommend_w: accept/reject recommended listings
  • shops_r: see private shop info
  • shops_w: update shop
  • transactions_r: see all checkout/payment data
  • transactions_w: update receipts

Example

auth := context.WithValue(context.Background(), goEtsy.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, goEtsy.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]