printfulsdk

package module
v0.2.20 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

README

go-printful-sdk

Wrapper for the Printful API V2

Documentation

Index

Constants

View Source
const (
	TemplatePositioningOverlay    string = "overlay"
	TemplatePositioningBackground string = "background"
)
View Source
const PRINTFUL_APPROVAL_SHEETS_ENDPOINT = "https://api.printful.com/v2/approval-sheets"
View Source
const PRINTFUL_CATALOG_PRODUCTS = "https://api.printful.com/v2/catalog-products"
View Source
const PRINTFUL_CATALOG_VARIANTS = "https://api.printful.com/v2/catalog-variants"
View Source
const PRINTFUL_COUNTRIES = "https://api.printful.com/v2/countries"
View Source
const PRINTFUL_FILES_ENDPOINT = "https://api.printful.com/v2/files"
View Source
const PRINTFUL_MOCKUP_ENDPOINT = "https://api.printful.com/v2/mockup-tasks"
View Source
const PRINTFUL_ORDERS_ENDPOINT = "https://api.printful.com/v2/orders"
View Source
const PRINTFUL_SHIPPING_RATES_ENDPOINT = "https://api.printful.com/v2/shipping-rates"
View Source
const PRINTFUL_STORES_ENDPOINT = "https://api.printful.com/v2/stores"

Variables

This section is empty.

Functions

func BuildRequestBody added in v0.2.0

func BuildRequestBody(o options, keys ...RequestBodyKey) map[string]interface{}

func FetchImage added in v0.2.8

func FetchImage(url string) (image.Image, error)

func GenerateMockup added in v0.2.8

func GenerateMockup(i image.Image, t *model.MockupTemplates) (image.Image, error)

func GetOptions added in v0.2.0

func GetOptions(opts ...RequestOption) options

func NewHTTPError added in v0.2.0

func NewHTTPError(err error, context any) error

Types

type HTTPError added in v0.2.0

type HTTPError struct {
	// contains filtered or unexported fields
}

func (*HTTPError) Error added in v0.2.0

func (e *HTTPError) Error() string

func (*HTTPError) Unwrap added in v0.2.0

func (e *HTTPError) Unwrap() error

type PrintfulClient

type PrintfulClient struct {
	// contains filtered or unexported fields
}

func NewPrintfulClient

func NewPrintfulClient(accessToken string) *PrintfulClient

func (*PrintfulClient) AddFile added in v0.2.0

func (c *PrintfulClient) AddFile(url string, opts ...RequestOption) (*model.File, error)

func (*PrintfulClient) CalculateShippingRates added in v0.2.11

func (c *PrintfulClient) CalculateShippingRates(recipient model.ShippingRatesAddress, items []model.CatalogOrWarehouseShippingRateItem, opts ...RequestOption) ([]model.ShippingRate, error)

func (*PrintfulClient) CreateOrder added in v0.2.2

func (c *PrintfulClient) CreateOrder(recipient model.Address, items []model.CatalogItem, opts ...RequestOption) (*model.Order, error)

func (*PrintfulClient) Get added in v0.2.6

func (c *PrintfulClient) Get(path string, headers map[string]string, ctx context.Context) (*http.Response, error)

func (*PrintfulClient) GetCatalogCategories added in v0.2.5

func (c *PrintfulClient) GetCatalogCategories(opts ...RequestOption) ([]model.Category, error)

func (*PrintfulClient) GetCatalogProduct added in v0.2.8

func (c *PrintfulClient) GetCatalogProduct(productId int, opts ...RequestOption) (*model.Product, error)

func (*PrintfulClient) GetCatalogProducts

func (c *PrintfulClient) GetCatalogProducts(opts ...RequestOption) ([]model.Product, error)

func (*PrintfulClient) GetCatalogVariants

func (c *PrintfulClient) GetCatalogVariants(productId int, opts ...RequestOption) ([]model.Variant, error)

func (*PrintfulClient) GetCountries

func (c *PrintfulClient) GetCountries(opts ...RequestOption) ([]model.Country, error)

func (*PrintfulClient) GetMockupStyles added in v0.1.0

func (c *PrintfulClient) GetMockupStyles(productId int, opts ...RequestOption) ([]model.MockupStyles, error)

func (*PrintfulClient) GetMockupTemplates

func (c *PrintfulClient) GetMockupTemplates(productId int, opts ...RequestOption) ([]model.MockupTemplates, error)

func (*PrintfulClient) GetProductPrices

func (c *PrintfulClient) GetProductPrices(productId int, opts ...RequestOption) (*model.ProductPrices, error)

func (*PrintfulClient) GetVariantPrices

func (c *PrintfulClient) GetVariantPrices(varianttId int, opts ...RequestOption) (*model.VariantPrice, error)

func (*PrintfulClient) Post added in v0.2.6

func (c *PrintfulClient) Post(path string, headers map[string]string, body map[string]interface{}, ctx context.Context) (*http.Response, error)

func (*PrintfulClient) SetAccessToken

func (c *PrintfulClient) SetAccessToken(accessToken string)

Change access token. Any queued request still uses the old token

type RequestBodyKey added in v0.2.0

type RequestBodyKey int64
const (
	FileRole RequestBodyKey = iota
	URL
	Filename
	FileVisible
	OrderExternalID
	OrderShippingMethod
	OrderCustomization
	OrderRetailCosts
	OrderCurrency
)

type RequestOption added in v0.2.15

type RequestOption func(*options)

func SetFileRole added in v0.2.0

func SetFileRole(role string) RequestOption

func SetFileVisible added in v0.2.0

func SetFileVisible(visible bool) RequestOption

func SetFilename added in v0.2.0

func SetFilename(filename string) RequestOption

func SetOrderCustomization added in v0.2.2

func SetOrderCustomization(customization *model.Customization) RequestOption

func SetOrderExternalID added in v0.2.2

func SetOrderExternalID(externalID string) RequestOption

func SetOrderRetailCosts added in v0.2.2

func SetOrderRetailCosts(retailCosts *model.RetailCosts2) RequestOption

func SetOrderShippingMethod added in v0.2.2

func SetOrderShippingMethod(shippingMethod string) RequestOption

func SetURL added in v0.2.0

func SetURL(url string) RequestOption

func WithCategories

func WithCategories(categories ...int) RequestOption

func WithColors

func WithColors(colors ...string) RequestOption

func WithCurrency

func WithCurrency(currency string) RequestOption

func WithLanguage

func WithLanguage(language string) RequestOption

func WithLimit

func WithLimit(limit uint) RequestOption

func WithOffset

func WithOffset(offset uint) RequestOption

func WithOnlyNew

func WithOnlyNew() RequestOption

func WithPlacements

func WithPlacements(placements ...string) RequestOption

func WithSellingRegionName

func WithSellingRegionName(sellingRegionName string) RequestOption

func WithSortDirection

func WithSortDirection(sortDirection SortDirection) RequestOption

func WithSortType

func WithSortType(sortType SortType) RequestOption

func WithTechniques

func WithTechniques(techniques ...Technique) RequestOption

func WithTimeout

func WithTimeout(timeout time.Duration) RequestOption

type SortDirection

type SortDirection string
const (
	SortAscending  SortDirection = "ascending"
	SortDescending SortDirection = "descending"
)

type SortType

type SortType string
const (
	SortNew        SortType = "new"
	SortRating     SortType = "rating"
	SortPrice      SortType = "price"
	SortBestseller SortType = "bestseller"
)

type Technique

type Technique string
const (
	Dtg         Technique = "dtg"
	Digital     Technique = "digital"
	CutSew      Technique = "cut-sew"
	Uv          Technique = "uv"
	Embroidery  Technique = "embroidery"
	Sublimation Technique = "sublimation"
	DtFilm      Technique = "dtfilm"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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