Documentation ¶
Index ¶
- Constants
- Variables
- func CheckResponse(r *http.Response) error
- type AddressError
- type AppliedDiscount
- type Billing
- type BillingAddress
- type BillingService
- func (c *BillingService) Activate(ctx context.Context, billing *Billing) (*Billing, *http.Response, error)
- func (c *BillingService) Cancel(ctx context.Context, billing *Billing) (*Billing, *http.Response, error)
- func (c *BillingService) Create(ctx context.Context, billing *Billing) (*Billing, *http.Response, error)
- func (c *BillingService) CreateUsageCharge(ctx context.Context, charge *UsageCharge) (*UsageCharge, *http.Response, error)
- func (c *BillingService) Get(ctx context.Context, billing *Billing) (*Billing, *http.Response, error)
- func (c *BillingService) Update(ctx context.Context, billing *Billing) (*Billing, *http.Response, error)
- type BillingStatus
- type BillingType
- type Checkout
- type CheckoutRequest
- type CheckoutService
- func (c *CheckoutService) Create(ctx context.Context, checkout *Checkout) (*Checkout, *http.Response, error)
- func (c *CheckoutService) CreateOrUpdate(ctx context.Context, checkout *Checkout) (*Checkout, *http.Response, error)
- func (c *CheckoutService) Get(ctx context.Context, token string) (*Checkout, *http.Response, error)
- func (c *CheckoutService) ListShippingRates(ctx context.Context, token string) ([]*CheckoutShipping, *http.Response, error)
- func (c *CheckoutService) Payment(ctx context.Context, token string, payment *Payment) (*Payment, *http.Response, error)
- func (c *CheckoutService) Update(ctx context.Context, checkout *Checkout) (*Checkout, *http.Response, error)
- type CheckoutShipping
- type Client
- type CollectionList
- type CollectionListImage
- type CollectionListParam
- type CollectionListService
- func (p *CollectionListService) Get(ctx context.Context, ID int64) (*CollectionList, *http.Response, error)
- func (p *CollectionListService) List(ctx context.Context, params *CollectionListParam) ([]*CollectionList, *http.Response, error)
- func (p *CollectionListService) ListProductIDs(ctx context.Context, ID int64) ([]int64, *http.Response, error)
- type CollectionListSortOrder
- type CustomCollection
- type CustomCollectionImage
- type CustomCollectionParam
- type CustomCollectionService
- type CustomerAddress
- type DiscountCode
- type DiscountCodeError
- type DiscountCodeRequest
- type DiscountCodeService
- func (s *DiscountCodeService) Create(ctx context.Context, discountCode *DiscountCode) (*DiscountCode, *http.Response, error)
- func (s *DiscountCodeService) Delete(ctx context.Context, discountCode *DiscountCode) (*DiscountCode, *http.Response, error)
- func (s *DiscountCodeService) Get(ctx context.Context, discountCode *DiscountCode) (*DiscountCode, *http.Response, error)
- type EmailError
- type ErrorResponse
- type LineItem
- type LineItemError
- type Option
- type Options
- type Payment
- type PaymentRequest
- type PaymentToken
- type Policy
- type PolicyService
- type PriceRule
- type PriceRuleParam
- type PriceRuleService
- func (p *PriceRuleService) CreatePriceRule(ctx context.Context, rule *PriceRule) (*PriceRule, *http.Response, error)
- func (p *PriceRuleService) Get(ctx context.Context, ID int64) (*PriceRule, *http.Response, error)
- func (p *PriceRuleService) List(ctx context.Context, params *PriceRuleParam) ([]*PriceRule, *http.Response, error)
- func (p *PriceRuleService) ListDiscountCodes(ctx context.Context, ID int64) ([]*DiscountCode, *http.Response, error)
- type PriceRuleTargetSelection
- type PriceRuleTargetType
- type PriceRuleValueType
- type Product
- type ProductImage
- type ProductList
- type ProductListParam
- type ProductListService
- func (p *ProductListService) Count(ctx context.Context) (int, *http.Response, error)
- func (p *ProductListService) Get(ctx context.Context, params *ProductListParam) ([]*ProductList, *http.Response, error)
- func (p *ProductListService) GetProduct(ctx context.Context, ID int64) (*ProductList, *http.Response, error)
- type ProductOption
- type ProductService
- func (p *ProductService) GetImages(ctx context.Context, productID int64) ([]*ProductImage, *http.Response, error)
- func (p *ProductService) GetStock(ctx context.Context, variantID int64) (int, *http.Response, error)
- func (p *ProductService) GetVariant(ctx context.Context, variantID int64) (*ProductVariant, *http.Response, error)
- func (p *ProductService) List(ctx context.Context) ([]*Product, *http.Response, error)
- type ProductVariant
- type RecurringBillingRequest
- type RequestDetail
- type ShippingLine
- type ShippingRate
- type ShippingRateRequest
- type ShippingZone
- type ShippingZoneCountry
- type ShippingZoneProvince
- type ShippingZoneRate
- type ShippingZoneService
- type Shop
- type ShopService
- type ShopifyErrorer
- type Storefront
- type StorefrontService
- type StorefrontWrapper
- type TaxLine
- type Topic
- type Transaction
- type TransactionError
- type TransactionStatus
- type UsageCharge
- type UsageChargeRequest
- type Variant
- type VariantOption
- type VariantParam
- type VariantService
- type Webhook
- type WebhookRequest
- type WebhookService
Constants ¶
const ( PriceRuleTargetSelectionAll PriceRuleTargetSelection = "all" PriceRuleTargetSelectionEntitled = "entitled" PriceRuleTargetTypeLineItem PriceRuleTargetType = "line_item" // The price rule applies to the cart's line items PriceRuleTargetTypeShippingLine = "shipping_line" // The price rule applies to the cart's shipping lines PriceRuleValueTypeFixedAmount PriceRuleValueType = "fixed_amount" PriceRuleValueTypePercentage = "percentage" )
const ( BillingTypeUnknown = iota BillingTypeOneTime BillingTypeRecurring BillingTypeUsage )
const ( BillingStatusUnknown = iota // pending: The recurring charge is pending. BillingStatusPending // accepted: The recurring charge has been accepted. BillingStatusAccepted // active: The recurring charge is activated. // This is the only status that actually causes a merchant to be charged. // An accepted charge is transitioned to active via the activate endpoint. BillingStatusActive // declined: The recurring charge has been declined. BillingStatusDeclined // expired: The recurring charge was not accepted within 2 days of being created. BillingStatusExpired // frozen: The recurring charge is on hold due to a shop subscription non-payment. // The charge will re-activate once subscription payments resume. BillingStatusFrozen // cancelled: The developer cancelled the charge. BillingStatusCancelled )
const ( WebhookHeaderHmac = "X-Shopify-Hmac-Sha256" WebhookHeaderShopDomain = "X-Shopify-Shop-Domain" WebhookHeaderTopic = "X-Shopify-Topic" )
const PolicyRefund = "Refund Policy"
const StripeVaultToken = `stripe_vault_token`
Variables ¶
var ( ErrIncorrectNumber = errors.New("incorrect_number") ErrInvalidNumber = errors.New("invalid_number") ErrInvalidExpiryDate = errors.New("invalid_expiry_date") ErrInvalidCvc = errors.New("invalid_expiry_date") ErrExpiredCard = errors.New("expired_card") ErrIncorrectCvc = errors.New("incorrect_cvc") ErrIncorrectZip = errors.New("incorrect_zip") ErrIncorrectAddress = errors.New("incorrect_address") ErrCardDeclined = errors.New("card_declined") ErrProcessingError = errors.New("processing_error") ErrCallIssuer = errors.New("call_issuer") ErrPickUpCard = errors.New("pick_up_card") )
var (
// TODO: make this an unmarshall type
ErrNotEnoughInStock = `not_enough_in_stock`
)
var (
ErrUnsupportedBillingType = errors.New("unsupported billing type")
)
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range or equal to 202 Accepted. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type AddressError ¶
type AddressError struct { ShopifyErrorer Key string `json:"key"` Field string `json:"field"` Code string `json:"code"` Message string `json:"message"` }
func (*AddressError) Error ¶
func (e *AddressError) Error() string
func (*AddressError) Type ¶
func (e *AddressError) Type() string
type AppliedDiscount ¶
type Billing ¶
type Billing struct { ID int64 `json:"id"` Name string `json:"name"` Price string `json:"price"` ReturnUrl string `json:"return_url"` ConfirmationUrl string `json:"confirmation_url"` CappedAmount string `json:"capped_amount,omitempty"` Terms string `json:"terms"` Type BillingType `json:"type"` Status BillingStatus `json:"status"` TrialDays int64 `json:"trial_days"` Test bool `json:"test"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` // formated as "YYYY-mm-dd" TrialEndsOn string `json:"trial_ends_on"` ActivatedOn string `json:"activated_on"` BillingOn string `json:"billing_on"` CancelledOn string `json:"cancelled_on"` }
type BillingAddress ¶
type BillingAddress struct{}
type BillingService ¶
type BillingService service
func (*BillingService) CreateUsageCharge ¶
func (c *BillingService) CreateUsageCharge(ctx context.Context, charge *UsageCharge) (*UsageCharge, *http.Response, error)
type BillingStatus ¶
type BillingStatus uint32
func (BillingStatus) MarshalText ¶
func (s BillingStatus) MarshalText() ([]byte, error)
MarshalText satisfies TextMarshaler
func (BillingStatus) String ¶
func (s BillingStatus) String() string
String returns the string value of the status.
func (*BillingStatus) UnmarshalText ¶
func (s *BillingStatus) UnmarshalText(text []byte) error
UnmarshalText satisfies TextUnmarshaler
type BillingType ¶
type BillingType uint32
func (BillingType) MarshalText ¶
func (t BillingType) MarshalText() ([]byte, error)
MarshalText satisfies TextMarshaler
func (BillingType) String ¶
func (t BillingType) String() string
String returns the string value of the status.
func (*BillingType) UnmarshalText ¶
func (t *BillingType) UnmarshalText(text []byte) error
UnmarshalText satisfies TextUnmarshaler
type Checkout ¶
type Checkout struct { LineItems []*LineItem `json:"line_items,omitempty"` Email string `json:"email,omitempty"` Token string `json:"token,omitempty"` Name string `json:"name,omitempty"` CustomerID int64 `json:"customer_id,omitempty"` // Totals SubtotalPrice string `json:"subtotal_price,omitempty"` TotalTax string `json:"total_tax,omitempty"` TotalPrice string `json:"total_price,omitempty"` PaymentDue string `json:"payment_due,omitempty"` Currency string `json:"currency,omitempty"` // Order OrderID int64 `json:"order_id,omitempty"` OrderStatusURL string `json:"order_status_url,omitempty"` // ShopifyPaymentAccountID is used to use stripe as a payment token provider ShopifyPaymentAccountID string `json:"shopify_payments_account_id,omitempty"` // Use payment url with the other direct payment providers to generate a token PaymentURL string `json:"payment_url,omitempty"` WebURL string `json:"web_url,omitempty"` WebProcessingURL string `json:"web_processing_url,omitempty"` // Don't omit empty, need empty to remove DiscountCode string `json:"discount_code,omitempty"` AppliedDiscount *AppliedDiscount `json:"applied_discount,omitempty"` ShippingAddress *CustomerAddress `json:"shipping_address,omitempty"` BillingAddress *CustomerAddress `json:"billing_address,omitempty"` TaxesIncluded bool `json:"taxes_included"` ShippingLine *ShippingLine `json:"shipping_line,omitempty"` TaxLines []*TaxLine `json:"tax_lines,omitempty"` Payments []*Payment `json:"payments,omitempty"` CompletedAt *time.Time `json:"completed_at,omitempty"` }
type CheckoutRequest ¶
type CheckoutRequest struct {
Checkout *Checkout `json:"checkout"`
}
func (*CheckoutRequest) MarshalJSON ¶
func (c *CheckoutRequest) MarshalJSON() ([]byte, error)
custom marshal json
type CheckoutService ¶
type CheckoutService service
func (*CheckoutService) CreateOrUpdate ¶
func (c *CheckoutService) CreateOrUpdate(ctx context.Context, checkout *Checkout) (*Checkout, *http.Response, error)
helper function get or create based on token
func (*CheckoutService) ListShippingRates ¶
func (c *CheckoutService) ListShippingRates(ctx context.Context, token string) ([]*CheckoutShipping, *http.Response, error)
type CheckoutShipping ¶
type Client ¶
type Client struct { // User agent used when communicating with the Shopify API. UserAgent string Billing *BillingService Product *ProductService Webhook *WebhookService Shop *ShopService Checkout *CheckoutService ProductList *ProductListService CollectionList *CollectionListService Variant *VariantService CustomCollection *CustomCollectionService PriceRule *PriceRuleService DiscountCode *DiscountCodeService Policy *PolicyService ShippingZone *ShippingZoneService // contains filtered or unexported fields }
func NewClient ¶
NewClient returns a new Shopify API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide a token that will be sent as part of authHeader.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned. TODO: Rate limiting
type CollectionList ¶
type CollectionList struct { ID int64 `json:"collection_id"` BodyHTML string `json:"body_html"` //DefaultProductImage []*CollectionListImage `json:"default_product_image,omitempty"` Handle string `json:"handle"` Image *CollectionListImage `json:"image"` Title string `json:"title"` SortOrder CollectionListSortOrder `json:"sort_order"` UpdatedAt time.Time `json:"updated_at"` PublishedAt time.Time `json:"published_at"` }
type CollectionListImage ¶
type CollectionListParam ¶
func (*CollectionListParam) EncodeQuery ¶
func (p *CollectionListParam) EncodeQuery() string
type CollectionListService ¶
type CollectionListService service
func (*CollectionListService) Get ¶
func (p *CollectionListService) Get(ctx context.Context, ID int64) (*CollectionList, *http.Response, error)
fetch one product by the given collection id
func (*CollectionListService) List ¶
func (p *CollectionListService) List(ctx context.Context, params *CollectionListParam) ([]*CollectionList, *http.Response, error)
list all collections
func (*CollectionListService) ListProductIDs ¶
func (p *CollectionListService) ListProductIDs(ctx context.Context, ID int64) ([]int64, *http.Response, error)
fetch collection product ids
type CollectionListSortOrder ¶
type CollectionListSortOrder uint32
const ( CollectionListSortOrderAlphaAsc CollectionListSortOrder CollectionListSortOrderAlphaDesc CollectionListSortOrderBestSelling CollectionListSortOrderCreated CollectionListSortOrderCreatedDesc CollectionListSortOrderManual CollectionListSortOrderPriceAsc CollectionListSortOrderPriceDesc )
func (CollectionListSortOrder) MarshalText ¶
func (s CollectionListSortOrder) MarshalText() ([]byte, error)
MarshalText satisfies TextMarshaler
func (CollectionListSortOrder) String ¶
func (s CollectionListSortOrder) String() string
String returns the string value of the status.
func (*CollectionListSortOrder) UnmarshalText ¶
func (s *CollectionListSortOrder) UnmarshalText(text []byte) error
UnmarshalText satisfies TextUnmarshaler
type CustomCollection ¶
type CustomCollection struct { ID int64 `json:"id"` Handle string `json:"handle"` Title string `json:"title"` BodyHTML string `json:"body_html"` SortOrder string `json:"sort_order"` PublishedScope string `json:"published_scope"` Image CustomCollectionImage `json:"image"` UpdatedAt time.Time `json:"updated_at"` PublishedAt time.Time `json:"published_at"` }
type CustomCollectionImage ¶
type CustomCollectionParam ¶
type CustomCollectionParam struct {
ProductID int64
}
func (*CustomCollectionParam) EncodeQuery ¶
func (p *CustomCollectionParam) EncodeQuery() string
type CustomCollectionService ¶
type CustomCollectionService service
func (*CustomCollectionService) Get ¶
func (c *CustomCollectionService) Get(ctx context.Context, params *CustomCollectionParam) ([]*CustomCollection, *http.Response, error)
type CustomerAddress ¶
type CustomerAddress struct { Address1 string `json:"address1"` Address2 string `json:"address2,omitempty"` City string `json:"city"` Company string `json:"company,omitempty"` Country string `json:"country"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Phone string `json:"phone,omitempty"` Province string `json:"province,omitempty"` ProvinceCode string `json:"province_code,omitempty"` Zip string `json:"zip"` CountryCode string `json:"country_code,omitempty"` }
type DiscountCode ¶
type DiscountCodeError ¶
type DiscountCodeError struct { Reason interface{} `json:"reason"` ShopifyErrorer }
func (*DiscountCodeError) Error ¶
func (e *DiscountCodeError) Error() string
func (*DiscountCodeError) Type ¶
func (e *DiscountCodeError) Type() string
type DiscountCodeRequest ¶
type DiscountCodeRequest struct {
*DiscountCode `json:"discount_code"`
}
type DiscountCodeService ¶
type DiscountCodeService service
func (*DiscountCodeService) Create ¶
func (s *DiscountCodeService) Create(ctx context.Context, discountCode *DiscountCode) (*DiscountCode, *http.Response, error)
func (*DiscountCodeService) Delete ¶
func (s *DiscountCodeService) Delete(ctx context.Context, discountCode *DiscountCode) (*DiscountCode, *http.Response, error)
func (*DiscountCodeService) Get ¶
func (s *DiscountCodeService) Get(ctx context.Context, discountCode *DiscountCode) (*DiscountCode, *http.Response, error)
type EmailError ¶
type EmailError struct { ShopifyErrorer Message string `json:"message"` }
func (*EmailError) Error ¶
func (e *EmailError) Error() string
func (*EmailError) Type ¶
func (e *EmailError) Type() string
type ErrorResponse ¶
type ErrorResponse struct {
Errors interface{} `json:"errors"`
}
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type LineItemError ¶
type LineItemError struct { ShopifyErrorer Field string Message string Code string Position string }
func (*LineItemError) Error ¶
func (e *LineItemError) Error() string
func (*LineItemError) Type ¶
func (e *LineItemError) Type() string
type Option ¶
type Options ¶
type Options struct { ShopURL string Token string Debug bool // turn on debugging // contains filtered or unexported fields }
Options can be used to create a customized client
type Payment ¶
type Payment struct { ID int64 `json:"id,omitempty"` Amount string `json:"amount"` SessionID string `json:"session_id,omitempty"` // clientside idempotency token UniqueToken string `json:"unique_token"` PaymentProcessingErrorMessage string `json:"payment_processing_error_message,omitempty"` PaymentToken *PaymentToken `json:"payment_token,omitempty"` RequestDetails *RequestDetail `json:"request_details,omitempty"` // transaction Transaction *Transaction `json:"transaction,omitempty"` }
type PaymentRequest ¶
type PaymentRequest struct {
Payment *Payment `json:"payment"`
}
type PaymentToken ¶
type PolicyService ¶
type PolicyService service
type PriceRule ¶
type PriceRule struct { ID int64 `json:"id,omitempty"` Title string `json:"title,omitempty"` ValueType PriceRuleValueType `json:"value_type,omitempty"` Value string `json:"value,omitempty"` CustomerSelection string `json:"customer_selection,omitempty"` TargetType PriceRuleTargetType `json:"target_type,omitempty"` TargetSelection PriceRuleTargetSelection `json:"target_selection,omitempty"` AllocationMethod string `json:"allocation_method,omitempty"` OncePerCustomer bool `json:"once_per_customer,omitempty"` UsageLimit int `json:"usage_limit,omitempty"` EntitledProductIds []int64 `json:"entitled_product_ids,omitempty"` EntitledVariantIds []int64 `json:"entitled_variant_ids,omitempty"` EntitledCollectionIds []int64 `json:"entitled_collection_ids,omitempty"` EntitledCountryIds []int64 `json:"entitled_country_ids,omitempty"` // Prefreq for BUY X GET Y type deals PrerequisiteSavedSearchIds []int64 `json:"prerequisite_saved_search_ids,omitempty"` PrerequisiteCustomerIds []int64 `json:"prerequisite_customer_ids,omitempty"` PrerequisiteSubtotalRange struct { Gte string `json:"greater_than_or_equal_to,omitempty"` } `json:"prerequisite_subtotal_range,omitempty"` PrerequisiteShippingPriceRange struct { Lte string `json:"less_than_or_equal_to,omitempty"` } `json:"prerequisite_shipping_price_range,omitempty"` PrerequisiteQuantityRange struct { Gte int `json:"greater_than_or_equal_to,omitempty"` } `json:"prerequisite_quantity_range,omitempty"` PrerequisiteQuantityRatio struct { Quantity int `json:"prerequisite_quantity,omitempty"` EntitledQuantity int `json:"entitled_quantity,omitempty"` } `json:"prerequisite_to_entitlement_quantity_ratio,omitempty"` PrerequisiteProductIDs []int64 `json:"prerequisite_product_ids,omitempty"` PrerequisiteVariantIDs []int64 `json:"prerequisite_variant_ids,omitempty"` PrerequisiteCollectionIDs []int64 `json:"prerequisite_collection_ids,omitempty"` AllocationLimit int `json:"allocation_limit,omitempty"` StartsAt time.Time `json:"starts_at,omitempty"` EndsAt *time.Time `json:"ends_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
type PriceRuleParam ¶
type PriceRuleParam struct { Limit int `json:"limit"` Page int `json:"page"` // Show rule starting AFTER date StartsAtMin *time.Time `json:"starts_at_min"` // Show rule starting BEFORE date StartsAtMax *time.Time `json:"starts_at_max"` // Show rule ending AFTER date EndsAtMin *time.Time `json:"ends_at_min"` // Show rule ending BEFORE date EndsAtMax *time.Time `json:"ends_at_max"` //Show rule created AFTER date CreatedAtMin *time.Time `json:"created_at_min"` SinceID int64 `json:"since_id"` TimesUsed int `json:"times_used"` }
func (*PriceRuleParam) EncodeQuery ¶
func (p *PriceRuleParam) EncodeQuery() string
type PriceRuleService ¶
type PriceRuleService service
func (*PriceRuleService) CreatePriceRule ¶
func (*PriceRuleService) List ¶
func (p *PriceRuleService) List(ctx context.Context, params *PriceRuleParam) ([]*PriceRule, *http.Response, error)
func (*PriceRuleService) ListDiscountCodes ¶
func (p *PriceRuleService) ListDiscountCodes(ctx context.Context, ID int64) ([]*DiscountCode, *http.Response, error)
type PriceRuleTargetSelection ¶
type PriceRuleTargetSelection string
type PriceRuleTargetType ¶
type PriceRuleTargetType string
type PriceRuleValueType ¶
type PriceRuleValueType string
type Product ¶
type Product struct { ProductID int64 `json:"product_id"` Title string `json:"title"` BodyHTML string `json:"body_html"` Vendor string `json:"vendor"` ProductType string `json:"product_type"` Handle string `json:"handle"` TemplateSuffix interface{} `json:"template_suffix"` PublishedScope string `json:"published_scope"` Tags string `json:"tags"` Available bool `json:"available"` Variants []*ProductVariant `json:"variants"` Options []*ProductOption `json:"options"` Images []*ProductImage `json:"images"` Image *ProductImage `json:"image"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` PublishedAt time.Time `json:"published_at"` }
type ProductImage ¶
type ProductImage struct { ID int64 `json:"id"` ProductID int64 `json:"product_id"` Position int `json:"position"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Width int64 `json:"width"` Height int64 `json:"height"` Src string `json:"src"` VariantIds []int64 `json:"variant_ids"` }
type ProductList ¶
type ProductList Product
type ProductListParam ¶
type ProductListParam struct { ProductIDs []int64 CollectionID int64 Handle string Limit int Page int UpdatedAtMin time.Time }
func (*ProductListParam) EncodeQuery ¶
func (p *ProductListParam) EncodeQuery() string
type ProductListService ¶
type ProductListService service
func (*ProductListService) Get ¶
func (p *ProductListService) Get(ctx context.Context, params *ProductListParam) ([]*ProductList, *http.Response, error)
func (*ProductListService) GetProduct ¶
func (p *ProductListService) GetProduct(ctx context.Context, ID int64) (*ProductList, *http.Response, error)
fetch one product by the given product id
type ProductOption ¶
type ProductService ¶
type ProductService service
func (*ProductService) GetImages ¶
func (p *ProductService) GetImages(ctx context.Context, productID int64) ([]*ProductImage, *http.Response, error)
func (*ProductService) GetVariant ¶
func (p *ProductService) GetVariant(ctx context.Context, variantID int64) (*ProductVariant, *http.Response, error)
type ProductVariant ¶
type ProductVariant struct { ID int64 `json:"id"` ProductID int64 `json:"product_id"` Title string `json:"title"` Price string `json:"price"` Sku string `json:"sku"` Position int `json:"position"` Grams int `json:"grams"` InventoryPolicy string `json:"inventory_policy"` FulfillmentService string `json:"fulfillment_service"` InventoryManagement string `json:"inventory_management"` Option1 string `json:"option1"` Option2 string `json:"option2"` Option3 string `json:"option3"` OptionValues []VariantOption `json:"option_values"` Taxable bool `json:"taxable"` Barcode string `json:"barcode"` ImageID interface{} `json:"image_id"` CompareAtPrice string `json:"compare_at_price"` Available bool `json:"available"` InventoryQuantity int `json:"inventory_quantity"` Weight float64 `json:"weight"` WeightUnit string `json:"weight_unit"` OldInventoryQuantity int `json:"old_inventory_quantity"` RequiresShipping bool `json:"requires_shipping"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type RecurringBillingRequest ¶
type RecurringBillingRequest struct {
Billing *Billing `json:"recurring_application_charge"`
}
type RequestDetail ¶
type ShippingLine ¶
type ShippingRate ¶
type ShippingRateRequest ¶
type ShippingRateRequest struct {
CheckoutShipping []*CheckoutShipping `json:"shipping_rates"`
}
type ShippingZone ¶
type ShippingZone struct { ID int64 `json:"id"` Name string `json:"name"` Countries []*ShippingZoneCountry `json:"countries"` WeightBasedShippingRates []*ShippingZoneRate `json:"weight_based_shipping_rates"` PriceBasedShippingRates []*ShippingZoneRate `json:"price_based_shipping_rates"` CarrierShippingRateProviders []*ShippingZoneRate `json:"carrier_shipping_rate_providers"` }
type ShippingZoneCountry ¶
type ShippingZoneProvince ¶
type ShippingZoneProvince struct { ID int64 `json:"id"` CountryID int64 `json:"country_id"` Name string `json:"name"` Code string `json:"code"` Tax float64 `json:"tax"` TaxName string `json:"tax_name"` TaxType string `json:"tax_type"` ShippingZoneID int64 `json:"shipping_zone_id"` TaxPercentage float64 `json:"tax_percentage"` }
type ShippingZoneRate ¶
type ShippingZoneRate struct { ID int64 `json:"id"` Name string `json:"name"` Price string `json:"price"` ShippingZoneID int64 `json:"shipping_zone_id"` // weight based rates WeightLow float64 `json:"weight_low"` WeightHigh float64 `json:"weight_high"` // price based rates MinOrderSubtotal string `json:"min_order_subtotal"` MaxOrderSubtotal string `json:"max_order_subtotal"` // carrier based rates FlatModifier string `json:"flat_modifier"` PercentModifier float64 `json:"percent_modifier"` CarrierServiceID int64 `json:"carrier_service_id"` }
type ShippingZoneService ¶
type ShippingZoneService service
func (*ShippingZoneService) List ¶
func (s *ShippingZoneService) List(ctx context.Context) ([]*ShippingZone, *http.Response, error)
type Shop ¶
type Shop struct { ID int `json:"id"` Name string `json:"name"` Email string `json:"email"` Domain string `json:"domain"` CreatedAt string `json:"created_at"` Province string `json:"province"` Country string `json:"country"` Address1 string `json:"address1"` Zip string `json:"zip"` City string `json:"city"` Source interface{} `json:"source"` Phone string `json:"phone"` UpdatedAt string `json:"updated_at"` CustomerEmail string `json:"customer_email"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` PrimaryLocale string `json:"primary_locale"` Address2 string `json:"address2"` CountryCode string `json:"country_code"` CountryName string `json:"country_name"` Currency string `json:"currency"` Timezone string `json:"timezone"` IanaTimezone string `json:"iana_timezone"` ShopOwner string `json:"shop_owner"` MoneyFormat string `json:"money_format"` MoneyWithCurrencyFormat string `json:"money_with_currency_format"` WeightUnit string `json:"weight_unit"` ProvinceCode string `json:"province_code"` TaxesIncluded interface{} `json:"taxes_included"` TaxShipping interface{} `json:"tax_shipping"` CountyTaxes bool `json:"county_taxes"` PlanDisplayName string `json:"plan_display_name"` PlanName string `json:"plan_name"` HasDiscounts bool `json:"has_discounts"` HasGiftCards bool `json:"has_gift_cards"` MyshopifyDomain string `json:"myshopify_domain"` GoogleAppsDomain interface{} `json:"google_apps_domain"` GoogleAppsLoginEnabled interface{} `json:"google_apps_login_enabled"` MoneyInEmailsFormat string `json:"money_in_emails_format"` MoneyWithCurrencyInEmailsFormat string `json:"money_with_currency_in_emails_format"` EligibleForPayments bool `json:"eligible_for_payments"` RequiresExtraPaymentsAgreement bool `json:"requires_extra_payments_agreement"` PasswordEnabled bool `json:"password_enabled"` HasStorefront bool `json:"has_storefront"` EligibleForCardReaderGiveaway bool `json:"eligible_for_card_reader_giveaway"` Finances bool `json:"finances"` SetupRequired bool `json:"setup_required"` ForceSsl bool `json:"force_ssl"` }
type ShopService ¶
type ShopService service
type ShopifyErrorer ¶
type ShopifyErrorer interface {
Type() string
}
type Storefront ¶
type StorefrontService ¶
type StorefrontService service
func (*StorefrontService) Create ¶
func (f *StorefrontService) Create(ctx context.Context, title string) (*Storefront, *http.Response, error)
type StorefrontWrapper ¶
type StorefrontWrapper struct {
Storefront *Storefront `json:"storefront_access_token"`
}
type Topic ¶
type Topic string
Webhook Topics for subscription
Shopify API docs: https://help.shopify.com/api/reference/webhook#create
const ( TopicUnknown Topic = "" TopicAppUninstalled Topic = "app/uninstalled" TopicCartsCreate Topic = "carts/create" TopicCartsUpdate Topic = "carts/update" TopicCheckoutsCreate Topic = "checkouts/create" TopicCheckoutsDelete Topic = "checkouts/delete" TopicCheckoutsUpdate Topic = "checkouts/update" TopicCollectionListingsAdd Topic = "collection_listings/add" TopicCollectionListingsRemove Topic = "collection_listings/remove" TopicCollectionListingsUpdate Topic = "collection_listings/update" TopicCollectionsCreate Topic = "collections/create" TopicCollectionsDelete Topic = "collections/delete" TopicCollectionsUpdate Topic = "collections/update" TopicCustomerGroupsCreate Topic = "customer_groups/create" TopicCustomerGroupsDelete Topic = "customer_groups/delete" TopicCustomerGroupsUpdate Topic = "customer_groups/update" TopicCustomersCreate Topic = "customers/create" TopicCustomersDelete Topic = "customers/delete" TopicCustomersDisable Topic = "customers/disable" TopicCustomersEnable Topic = "customers/enable" TopicCustomersUpdate Topic = "customers/update" TopicDraftOrdersCreate Topic = "draft_orders/create" TopicDraftOrdersDelete Topic = "draft_orders/delete" TopicDraftOrdersUpdate Topic = "draft_orders/update" TopicFulfillmentEventsCreate Topic = "fulfillment_events/create" TopicFulfillmentEventsDelete Topic = "fulfillment_events/delete" TopicFulfillmentsCreate Topic = "fulfillments/create" TopicFulfillmentsUpdate Topic = "fulfillments/update" TopicOrderTransactionsCreate Topic = "order_transactions/create" TopicOrdersCancelled Topic = "orders/cancelled" TopicOrdersCreate Topic = "orders/create" TopicOrdersDelete Topic = "orders/delete" TopicOrdersFulfilled Topic = "orders/fulfilled" TopicOrdersPaid Topic = "orders/paid" TopicOrdersPartiallyFulfilled Topic = "orders/partially_fulfilled" TopicOrdersUpdated Topic = "orders/updated" TopicProductListingsAdd Topic = "product_listings/add" TopicProductListingsRemove Topic = "product_listings/remove" TopicProductListingsUpdate Topic = "product_listings/update" TopicProductsCreate Topic = "products/create" TopicProductsDelete Topic = "products/delete" TopicProductsUpdate Topic = "products/update" TopicRefundsCreate Topic = "refunds/create" TopicShopUpdate Topic = "shop/update" TopicThemesCreate Topic = "themes/create" TopicThemesDelete Topic = "themes/delete" TopicThemesPublish Topic = "themes/publish" TopicThemesUpdate Topic = "themes/update" )
type Transaction ¶
type Transaction struct { ID int64 `json:"id"` Amount string `json:"amount"` OrderID int64 `json:"order_id"` // Status and error codes ErrorCode string `json:"error_code"` Status TransactionStatus `json:"status"` Message string `json:"message"` Test bool `json:"test"` Currency string `json:"currency"` CreatedAt *time.Time `json:"created_at"` }
type TransactionError ¶
type TransactionError error
type TransactionStatus ¶
type TransactionStatus uint32
const ( TransactionStatusPending TransactionStatus TransactionStatusSuccess TransactionStatusFailure TransactionStatusError )
func (TransactionStatus) MarshalText ¶
func (s TransactionStatus) MarshalText() ([]byte, error)
MarshalText satisfies TextMarshaler
func (TransactionStatus) String ¶
func (s TransactionStatus) String() string
String returns the string value of the status.
func (*TransactionStatus) UnmarshalText ¶
func (s *TransactionStatus) UnmarshalText(text []byte) error
UnmarshalText satisfies TextUnmarshaler
type UsageCharge ¶
type UsageCharge struct { ID int64 `json:"id,omitempty"` Description string `json:"description"` Price string `json:"price"` RecurringApplicationChargeID int64 `json:"recurring_application_charge_id,omitempty"` BalanceUsed float64 `json:"balance_used,omitempty"` BalanceRemaining float64 `json:"balance_remaining,omitempty"` RiskLevel float64 `json:"risk_level,omitempty"` BillingOn string `json:"billing_on,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` }
type UsageChargeRequest ¶
type UsageChargeRequest struct {
UsageCharge *UsageCharge `json:"usage_charge"`
}
type Variant ¶
type Variant struct { ID int64 `json:"id"` ProductID int64 `json:"product_id"` Title string `json:"title"` Price string `json:"price"` CompareAtPrice string `json:"compare_at_price"` Sku string `json:"sku"` Position int `json:"position"` InventoryPolicy string `json:"inventory_policy"` FulfillmentService string `json:"fulfillment_service"` InventoryManagement string `json:"inventory_management"` Option1 string `json:"option1"` Option2 string `json:"option2"` Option3 string `json:"option3"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Taxable bool `json:"taxable"` Barcode string `json:"barcode"` Grams int `json:"grams"` ImageID int64 `json:"image_id"` InventoryQuantity int `json:"inventory_quantity"` Weight float64 `json:"weight"` WeightUnit string `json:"weight_unit"` InventoryItemID int `json:"inventory_item_id"` OldInventoryQuantity int `json:"old_inventory_quantity"` RequiresShipping bool `json:"requires_shipping"` AdminGraphqlAPIID string `json:"admin_graphql_api_id"` }
type VariantOption ¶
type VariantParam ¶
func (*VariantParam) EncodeQuery ¶
func (param *VariantParam) EncodeQuery() string
type VariantService ¶
type VariantService service
func (*VariantService) Get ¶
func (p *VariantService) Get(ctx context.Context, params *VariantParam) ([]*Variant, *http.Response, error)
func (*VariantService) GetVariant ¶
func (p *VariantService) GetVariant(ctx context.Context, ID int64) (*Variant, *http.Response, error)
fetch one product by the given product id
type Webhook ¶
type Webhook struct { ID int `json:"id,omitempty"` Address string `json:"address"` Topic Topic `json:"topic"` Format string `json:"format"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` Fields []string `json:"fields,omitempty"` MetafieldNamespaces []string `json:"metafield_namespaces,omitempty"` }
type WebhookRequest ¶
type WebhookRequest struct {
Webhook *Webhook `json:"webhook"`
}
WebhookRequest represents a request to create/edit a webhook. It is just an alias of Webhook struct
type WebhookService ¶
type WebhookService service
func (*WebhookService) Create ¶
func (s *WebhookService) Create(ctx context.Context, webhook *WebhookRequest) (*Webhook, *http.Response, error)