Documentation
¶
Index ¶
- Constants
- func BuildRequestBody(o options, keys ...RequestBodyKey) map[string]interface{}
- func FetchImage(url string) (image.Image, error)
- func GenerateMockup(i image.Image, t *model.MockupTemplates) (image.Image, error)
- func GetOptions(opts ...RequestOption) options
- func NewHTTPError(err error, context any) error
- type HTTPError
- type PrintfulClient
- func (c *PrintfulClient) AddFile(url string, opts ...RequestOption) (*model.File, error)
- func (c *PrintfulClient) CalculateShippingRates(recipient model.ShippingRatesAddress, ...) ([]model.ShippingRate, error)
- func (c *PrintfulClient) CreateOrder(recipient model.Address, items []model.CatalogItem, opts ...RequestOption) (*model.Order, error)
- func (c *PrintfulClient) Get(path string, headers map[string]string, ctx context.Context) (*http.Response, error)
- func (c *PrintfulClient) GetCatalogCategories(opts ...RequestOption) ([]model.Category, error)
- func (c *PrintfulClient) GetCatalogProduct(productId int, opts ...RequestOption) (*model.Product, error)
- func (c *PrintfulClient) GetCatalogProducts(opts ...RequestOption) ([]model.Product, error)
- func (c *PrintfulClient) GetCatalogVariants(productId int, opts ...RequestOption) ([]model.Variant, error)
- func (c *PrintfulClient) GetCountries(opts ...RequestOption) ([]model.Country, error)
- func (c *PrintfulClient) GetMockupStyles(productId int, opts ...RequestOption) ([]model.MockupStyles, error)
- func (c *PrintfulClient) GetMockupTemplates(productId int, opts ...RequestOption) ([]model.MockupTemplates, error)
- func (c *PrintfulClient) GetProductPrices(productId int, opts ...RequestOption) (*model.ProductPrices, error)
- func (c *PrintfulClient) GetVariantPrices(varianttId int, opts ...RequestOption) (*model.VariantPrice, error)
- func (c *PrintfulClient) Post(path string, headers map[string]string, body map[string]interface{}, ...) (*http.Response, error)
- func (c *PrintfulClient) SetAccessToken(accessToken string)
- type RequestBodyKey
- type RequestOption
- func SetFileRole(role string) RequestOption
- func SetFileVisible(visible bool) RequestOption
- func SetFilename(filename string) RequestOption
- func SetOrderCustomization(customization *model.Customization) RequestOption
- func SetOrderExternalID(externalID string) RequestOption
- func SetOrderRetailCosts(retailCosts *model.RetailCosts2) RequestOption
- func SetOrderShippingMethod(shippingMethod string) RequestOption
- func SetURL(url string) RequestOption
- func WithCategories(categories ...int) RequestOption
- func WithColors(colors ...string) RequestOption
- func WithCurrency(currency string) RequestOption
- func WithLanguage(language string) RequestOption
- func WithLimit(limit uint) RequestOption
- func WithOffset(offset uint) RequestOption
- func WithOnlyNew() RequestOption
- func WithPlacements(placements ...string) RequestOption
- func WithSellingRegionName(sellingRegionName string) RequestOption
- func WithSortDirection(sortDirection SortDirection) RequestOption
- func WithSortType(sortType SortType) RequestOption
- func WithTechniques(techniques ...Technique) RequestOption
- func WithTimeout(timeout time.Duration) RequestOption
- type SortDirection
- type SortType
- type Technique
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 GenerateMockup ¶ added in v0.2.8
func GetOptions ¶ added in v0.2.0
func GetOptions(opts ...RequestOption) options
func NewHTTPError ¶ added in v0.2.0
Types ¶
type HTTPError ¶ added in v0.2.0
type HTTPError struct {
// contains filtered or unexported fields
}
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) 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) 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" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.