goshopify

package module
v1.3.21 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: MIT Imports: 23 Imported by: 0

README

go-shopify

The new home of Conversio's Shopify Go library.

Note: The library does not have implementations of all Shopify resources, but it is being used in production and should be stable for usage. PRs for new resources and endpoints are welcome, or you can simply implement some yourself as-you-go. See the section "Using your own models" for more info.

Build Status codecov

Supported Go Versions

This library is tested automatically against the latest version of Go (currently 1.20) and the two previous versions (1.19, 1.18) but should also work with older versions.

Install v3

$ go get git.happyseven.cn/cliq/goshopify

Use v3

import "git.happyseven.cn/cliq/goshopify"

This gives you access to the goshopify package.

Install v2

$ go get git.happyseven.cn/cliq/goshopify

Use v2

import "git.happyseven.cn/cliq/goshopify"

This gives you access to the goshopify package.

Oauth

If you don't have an access token yet, you can obtain one with the oauth flow. Something like this will work:

// Create an app somewhere.
app := goshopify.App{
    ApiKey: "abcd",
    ApiSecret: "efgh",
    RedirectUrl: "https://example.com/shopify/callback",
    Scope: "read_products,read_orders",
}

// Create an oauth-authorize url for the app and redirect to it.
// In some request handler, you probably want something like this:
func MyHandler(w http.ResponseWriter, r *http.Request) {
    shopName := r.URL.Query().Get("shop")
    state := "nonce"
    authUrl := app.AuthorizeUrl(shopName, state)
    http.Redirect(w, r, authUrl, http.StatusFound)
}

// Fetch a permanent access token in the callback
func MyCallbackHandler(w http.ResponseWriter, r *http.Request) {
    // Check that the callback signature is valid
    if ok, _ := app.VerifyAuthorizationURL(r.URL); !ok {
        http.Error(w, "Invalid Signature", http.StatusUnauthorized)
        return
    }

    query := r.URL.Query()
    shopName := query.Get("shop")
    code := query.Get("code")
    token, err := app.GetAccessToken(shopName, code)

    // Do something with the token, like store it in a DB.
}
Api calls with a token

With a permanent access token, you can make API calls like this:

// Create an app somewhere.
app := goshopify.App{
    ApiKey: "abcd",
    ApiSecret: "efgh",
    RedirectUrl: "https://example.com/shopify/callback",
    Scope: "read_products",
}

// Create a new API client
client, err := goshopify.NewClient(app, "shopname", "token")

// Fetch the number of products.
numProducts, err := client.Product.Count(nil)
Private App Auth

Private Shopify apps use basic authentication and do not require going through the OAuth flow. Here is an example:

// Create an app somewhere.
app := goshopify.App{
	ApiKey: "apikey",
	Password: "apipassword",
}

// Create a new API client (notice the token parameter is the empty string)
client, err := goshopify.NewClient(app, "shopname", "")

// Fetch the number of products.
numProducts, err := client.Product.Count(nil)
Client Options

When creating a client there are configuration options you can pass to NewClient. Simply use the last variadic param and pass in the built in options or create your own and manipulate the client. See options.go for more details.

WithVersion

Read more details on the Shopify API Versioning to understand the format and release schedules. You can use WithVersion to specify a specific version of the API. If you do not use this option you will be defaulted to the oldest stable API.

client, err := goshopify.NewClient(app, "shopname", "", goshopify.WithVersion("2019-04"))
WithRetry

Shopify Rate Limits their API and if this happens to you they will send a back off (usually 2s) to tell you to retry your request. To support this functionality seamlessly within the client a WithRetry option exists where you can pass an int of how many times you wish to retry per-request before returning an error. WithRetry additionally supports retrying HTTP503 errors.

client, err := goshopify.NewClient(app, "shopname", "", goshopify.WithRetry(3))
Query options

Most API functions take an options interface{} as parameter. You can use one from the library or create your own. For example, to fetch the number of products created after January 1, 2016, you can do:

// Create standard CountOptions
date := time.Date(2016, time.January, 1, 0, 0, 0, 0, time.UTC)
options := goshopify.CountOptions{createdAtMin: date}

// Use the options when calling the API.
numProducts, err := client.Product.Count(options)

The options are parsed with Google's go-querystring library so you can use custom options like this:

// Create custom options for the orders.
// Notice the `url:"status"` tag
options := struct {
    Status string `url:"status"`
}{"any"}

// Fetch the order count for orders with status="any"
orderCount, err := client.Order.Count(options)
Using your own models

Not all endpoints are implemented right now. In those case, feel free to implement them and make a PR, or you can create your own struct for the data and use NewRequest with the API client. This is how the existing endpoints are implemented.

For example, let's say you want to fetch webhooks. There's a helper function Get specifically for fetching stuff so this will work:

// Declare a model for the webhook
type Webhook struct {
    Id int         `json:"id"`
    Address string `json:"address"`
}

// Declare a model for the resource root.
type WebhooksResource struct {
    Webhooks []Webhook `json:"webhooks"`
}

func FetchWebhooks() ([]Webhook, error) {
    path := "admin/webhooks.json"
    resource := new(WebhooksResource)
    client, _ := goshopify.NewClient(app, "shopname", "token")

    // resource gets modified when calling Get
    err := client.Get(path, resource, nil)

    return resource.Webhooks, err
}
Webhooks verification

In order to be sure that a webhook is sent from ShopifyApi you could easily verify it with the VerifyWebhookRequest method.

For example:

func ValidateWebhook(httpRequest *http.Request) (bool) {
    shopifyApp := goshopify.App{ApiSecret: "ratz"}
    return shopifyApp.VerifyWebhookRequest(httpRequest)
}

Develop and test

docker and docker-compose must be installed

Mac/Linux/Windows with make

Using the make file is the easiest way to get started with the tests and wraps the manual steps below with easy to use make commands.

make && make test
Makefile goals
  • make or make container: default goal is to make the go-shopify:latest build container
  • make test: run go test in the container
  • make clean: deletes the go-shopify:latest image and coverage output
  • make coverage: generates the coverage.html and opens it
Manually

To run the tests you will need the go-shopify:latest image built to run your tests, to do this run

docker-compose build test

To run tests you can use run

docker-compose run --rm tests

To create a coverage profile run the following to generate a coverage.html

docker-compose run --rm dev sh -c 'go test -coverprofile=coverage.out ./... && go tool cover -html coverage.out -o coverage.html'

When done testing and you want to cleanup simply run

docker image rm go-shopify:latest

Read the docker-compose.yml and Dockerfile for further details.

Documentation

Overview

Package goshopify provides methods for making requests to Shopify's admin API.

Index

Constants

View Source
const (
	LevelError = iota + 1
	LevelWarn
	LevelInfo
	LevelDebug
)
View Source
const (
	// True or false.
	MetafieldTypeBoolean metafieldType = "boolean"

	// A hexidecimal color code, #fff123.
	MetafieldTypeColor metafieldType = "color" //#fff123

	// ISO601, YYYY-MM-DD.
	MetafieldTypeDate metafieldType = "date"

	// ISO8601, YYYY-MM-DDTHH:MM:SS.
	MetafieldTypeDatetime metafieldType = "date_time"

	// JSON, {"value:" 25.0, "unit": "cm"}.
	MetafieldTypeDimension metafieldType = "dimension"

	//{"ingredient": "flour", "amount": 0.3}.
	MetafieldTypeJSON metafieldType = "json"

	// JSON, {"amount": 5.99, "currency_code": "CAD"}.
	MetafieldTypeMoney metafieldType = "money"

	// lines of text separated with newline characters.
	MetafieldTypeMultiLineTextField metafieldType = "multi_line_text_field"

	// 10.4.
	MetafieldTypeNumberDecimal metafieldType = "number_decimal"

	// 10.
	MetafieldTypeNumberInteger metafieldType = "number_integer"

	// JSON, {"value": "3.5", "scale_min": "1.0", "scale_max": "5.0"}.
	MetafieldTypeRating metafieldType = "rating"

	// JSON, {"type": "root","children": [{"type": "paragraph","children": [{"type": "text","value": "Bold text.","bold": true}]}]}.
	MetafieldTypeRichTextField metafieldType = "rich_text_field"

	// A single line of text. Do not use for numbers or dates, use correct type instead!
	MetafieldTypeSingleLineTextField metafieldType = "single_line_text_field"

	// https, http, mailto, sms, or tel.
	MetafieldTypeURL metafieldType = "url"

	// JSON, {"value:" 20.0, "unit": "ml"}.
	MetafieldTypeVolume metafieldType = "volume"

	// JSON, {"value:" 2.5, "unit": "kg"}.
	MetafieldTypeWeight metafieldType = "weight"
)

https://shopify.dev/docs/api/admin-rest/2023-07/resources/metafield#resource-object

View Source
const (
	// Show only open orders.
	OrderStatusOpen orderStatus = "open"

	// Show only closed orders.
	OrderStatusClosed orderStatus = "closed"

	// Show only cancelled orders.
	OrderStatusCancelled orderStatus = "cancelled"

	// Show orders of any status, open, closed, cancellerd, or archived.
	OrderStatusAny orderStatus = "any"
)

https://shopify.dev/docs/api/admin-rest/2023-07/resources/order#get-orders?status=any

View Source
const (
	// Show orders that have been shipped.
	OrderFulfillmentStatusShipped orderFulfillmentStatus = "shipped"

	// Show partially shipped orders.
	OrderFulfillmentStatusPartial orderFulfillmentStatus = "partial"

	// Show orders that have not yet been shipped.
	OrderFulfillmentStatusUnshipped orderFulfillmentStatus = "unshipped"

	// Show orders of any fulfillment status.
	OrderFulfillmentStatusAny orderFulfillmentStatus = "any"

	// Returns orders with fulfillment_status of null or partial.
	OrderFulfillmentStatusUnfulfilled orderFulfillmentStatus = "unfulfilled"

	//"fulfilled" used to be an acceptable value? Was it deprecated? It isn't noted
	//in the Shopify docs at the provided URL, but it was used in tests and still
	//seems to function.
	OrderFulfillmentStatusFulfilled orderFulfillmentStatus = "fulfilled"
)

https://shopify.dev/docs/api/admin-rest/2023-07/resources/order#get-orders?status=any

View Source
const (
	// Show only authorized orders.
	OrderFinancialStatusAuthorized orderFinancialStatus = "authorized"

	// Show only pending orders.
	OrderFinancialStatusPending orderFinancialStatus = "pending"

	// Show only paid orders.
	OrderFinancialStatusPaid orderFinancialStatus = "paid"

	// Show only partially paid orders.
	OrderFinancialStatusPartiallyPaid orderFinancialStatus = "partially_paid"

	// Show only refunded orders.
	OrderFinancialStatusRefunded orderFinancialStatus = "refunded"

	// Show only voided orders.
	OrderFinancialStatusVoided orderFinancialStatus = "voided"

	// Show only partially refunded orders.
	OrderFinancialStatusPartiallyRefunded orderFinancialStatus = "partially_refunded"

	// Show orders of any financial status.
	OrderFinancialStatusAny orderFinancialStatus = "any"

	// Show authorized and partially paid orders.
	OrderFinancialStatusUnpaid orderFinancialStatus = "unpaid"
)

https://shopify.dev/docs/api/admin-rest/2023-07/resources/order#get-orders?status=any

View Source
const (
	// The customer canceled the order.
	OrderCancelReasonCustomer orderCancelReason = "customer"

	// The order was fraudulent.
	OrderCancelReasonFraud orderCancelReason = "fraud"

	// Items in the order were not in inventory.
	OrderCancelReasonInventory orderCancelReason = "inventory"

	// The payment was declined.
	OrderCancelReasonDeclined orderCancelReason = "declined"

	// Cancelled for some other reason.
	OrderCancelReasonOther orderCancelReason = "other"
)
View Source
const (
	// Do not claim inventory.
	OrderInventoryBehaviourBypass orderInventoryBehaviour = "bypass"

	// Ignore the product's inventory policy and claim inventory.
	OrderInventoryBehaviourDecrementIgnoringPolicy orderInventoryBehaviour = "decrement_ignoring_policy"

	// Follow the product's inventory policy and claim inventory, if possible.
	OrderInventoryBehaviourDecrementObeyingPolicy orderInventoryBehaviour = "decrement_obeying_policy"
)
View Source
const (
	// order is fraudulent.
	OrderRecommendationCancel orderRiskRecommendation = "cancel"

	// medium level of risk that this order is fraudulent.
	OrderRecommendationInvestigate orderRiskRecommendation = "investigate"

	// level of risk that this order is fraudulent.
	OrderRecommendationAccept orderRiskRecommendation = "accept"
)
View Source
const (
	// Customers are not allowed to place orders for the product variant if it's out
	// of stock. This is the default value.
	VariantInventoryPolicyDeny variantInventoryPolicy = "deny"

	// Customers are allowed to place orders for the product variant if it's out of
	// stock.
	VariantInventoryPolicyContinue variantInventoryPolicy = "continue"
)

https://shopify.dev/docs/api/admin-rest/2023-07/resources/product-variant#resource-object

View Source
const (
	// UnstableApiVersion Shopify API version for accessing unstable API features
	UnstableApiVersion = "unstable"
)

Variables

This section is empty.

Functions

func CheckResponseError

func CheckResponseError(r *http.Response) error

func FulfillmentOrderPathPrefix added in v1.3.18

func FulfillmentOrderPathPrefix(resource string, resourceId uint64) string

FulfillmentOrderPathPrefix returns the prefix for a fulfillmentOrder path

func FulfillmentPathPrefix

func FulfillmentPathPrefix(resource string, resourceId uint64) string

Return the prefix for a fulfillment path

func MetafieldPathPrefix

func MetafieldPathPrefix(resource string, resourceId uint64) string

Return the prefix for a metafield path

func ShopBaseUrl

func ShopBaseUrl(name string) string

Return the Shop's base url.

func ShopFullName

func ShopFullName(name string) string

Return the full shop name, including .myshopify.com

func ShopShortName

func ShopShortName(name string) string

Return the short shop name, excluding .myshopify.com

Types

type AbandonedCheckout added in v1.3.18

type AbandonedCheckout struct {
	Id                       uint64               `json:"id,omitempty"`
	Token                    string               `json:"token,omitempty"`
	CartToken                string               `json:"cart_token,omitempty"`
	Email                    string               `json:"email,omitempty"`
	Gateway                  string               `json:"gateway,omitempty"`
	BuyerAcceptsMarketing    bool                 `json:"buyer_accepts_marketing,omitempty"`
	CreatedAt                *time.Time           `json:"created_at,omitempty"`
	UpdatedAt                *time.Time           `json:"updated_at,omitempty"`
	LandingSite              string               `json:"landing_site,omitempty"`
	Note                     string               `json:"note,omitempty"`
	NoteAttributes           []NoteAttribute      `json:"note_attributes,omitempty"`
	ReferringSite            string               `json:"referring_site,omitempty"`
	ShippingLines            []ShippingLines      `json:"shipping_lines,omitempty"`
	TaxesIncluded            bool                 `json:"taxes_included,omitempty"`
	TotalWeight              int                  `json:"total_weight,omitempty"`
	Currency                 string               `json:"currency,omitempty"`
	CompletedAt              *time.Time           `json:"completed_at,omitempty"`
	ClosedAt                 *time.Time           `json:"closed_at,omitempty"`
	UserId                   uint64               `json:"user_id,omitempty"`
	SourceIdentifier         string               `json:"source_identifier,omitempty"`
	SourceUrl                string               `json:"source_url,omitempty"`
	DeviceId                 uint64               `json:"device_id,omitempty"`
	Phone                    string               `json:"phone,omitempty"`
	CustomerLocale           string               `json:"customer_locale,omitempty"`
	Name                     string               `json:"name,omitempty"`
	Source                   string               `json:"source,omitempty"`
	AbandonedCheckoutUrl     string               `json:"abandoned_checkout_url,omitempty"`
	DiscountCodes            []DiscountCode       `json:"discount_codes,omitempty"`
	TaxLines                 []TaxLine            `json:"tax_lines,omitempty"`
	SourceName               string               `json:"source_name,omitempty"`
	PresentmentCurrency      string               `json:"presentment_currency,omitempty"`
	BuyerAcceptsSmsMarketing bool                 `json:"buyer_accepts_sms_marketing,omitempty"`
	SmsMarketingPhone        string               `json:"sms_marketing_phone,omitempty"`
	TotalDiscounts           *decimal.Decimal     `json:"total_discounts,omitempty"`
	TotalLineItemsPrice      *decimal.Decimal     `json:"total_line_items_price,omitempty"`
	TotalPrice               *decimal.Decimal     `json:"total_price,omitempty"`
	SubtotalPrice            *decimal.Decimal     `json:"subtotal_price,omitempty"`
	TotalDuties              string               `json:"total_duties,omitempty"`
	BillingAddress           *Address             `json:"billing_address,omitempty"`
	ShippingAddress          *Address             `json:"shipping_address,omitempty"`
	Customer                 *Customer            `json:"customer,omitempty"`
	SmsMarketingConsent      *SmsMarketingConsent `json:"sms_marketing_consent,omitempty"`
	AdminGraphqlApiId        string               `json:"admin_graphql_api_id,omitempty"`
	DefaultAddress           *CustomerAddress     `json:"default_address,omitempty"`
}

AbandonedCheckout represents a Shopify abandoned checkout

type AbandonedCheckoutService added in v1.3.18

type AbandonedCheckoutService interface {
	List(context.Context, interface{}) ([]AbandonedCheckout, error)
}

AbandonedCheckoutService is an interface for interfacing with the abandonedCheckouts endpoints of the Shopify API. See: https://shopify.dev/docs/api/admin-rest/latest/resources/abandoned-checkouts

type AbandonedCheckoutServiceOp added in v1.3.18

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

AbandonedCheckoutServiceOp handles communication with the checkout related methods of the Shopify API.

func (*AbandonedCheckoutServiceOp) List added in v1.3.18

func (s *AbandonedCheckoutServiceOp) List(ctx context.Context, options interface{}) ([]AbandonedCheckout, error)

Get abandoned checkout list

type AbandonedCheckoutsResource added in v1.3.18

type AbandonedCheckoutsResource struct {
	AbandonedCheckouts []AbandonedCheckout `json:"checkouts,omitempty"`
}

Represents the result from the checkouts.json endpoint

type AccessScope added in v1.3.18

type AccessScope struct {
	Handle string `json:"handle,omitempty"`
}

type AccessScopesResource added in v1.3.18

type AccessScopesResource struct {
	AccessScopes []AccessScope `json:"access_scopes,omitempty"`
}

AccessScopesResource represents the result from the oauth/access_scopes.json endpoint

type AccessScopesService added in v1.3.18

type AccessScopesService interface {
	List(context.Context, interface{}) ([]AccessScope, error)
}

type AccessScopesServiceOp added in v1.3.18

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

AccessScopesServiceOp handles communication with the Access Scopes related methods of the Shopify API

func (*AccessScopesServiceOp) List added in v1.3.18

func (s *AccessScopesServiceOp) List(ctx context.Context, options interface{}) ([]AccessScope, error)

List gets access scopes based on used oauth token

type Address

type Address struct {
	Id           uint64  `json:"id,omitempty"`
	Address1     string  `json:"address1,omitempty"`
	Address2     string  `json:"address2,omitempty"`
	City         string  `json:"city,omitempty"`
	Company      string  `json:"company,omitempty"`
	Country      string  `json:"country,omitempty"`
	CountryCode  string  `json:"country_code,omitempty"`
	FirstName    string  `json:"first_name,omitempty"`
	LastName     string  `json:"last_name,omitempty"`
	Latitude     float64 `json:"latitude,omitempty"`
	Longitude    float64 `json:"longitude,omitempty"`
	Name         string  `json:"name,omitempty"`
	Phone        string  `json:"phone,omitempty"`
	Province     string  `json:"province,omitempty"`
	ProvinceCode string  `json:"province_code,omitempty"`
	Zip          string  `json:"zip,omitempty"`
}

type AmountSet added in v1.3.18

type AmountSet struct {
	ShopMoney        AmountSetEntry `json:"shop_money,omitempty"`
	PresentmentMoney AmountSetEntry `json:"presentment_money,omitempty"`
}

type AmountSetEntry added in v1.3.18

type AmountSetEntry struct {
	Amount       *decimal.Decimal `json:"amount,omitempty"`
	CurrencyCode string           `json:"currency_code,omitempty"`
}

type App

type App struct {
	ApiKey      string
	ApiSecret   string
	RedirectUrl string
	Scope       string
	Password    string
	Client      *Client // see GetAccessToken
	UserAgent   string
}

App represents basic app settings such as Api key, secret, scope, and redirect url. See oauth.go for OAuth related helper functions.

func (App) AuthorizeUrl

func (app App) AuthorizeUrl(shopName string, state string) (string, error)

Returns a Shopify oauth authorization url for the given shopname and state.

State is a unique value that can be used to check the authenticity during a callback from Shopify.

func (App) GetAccessToken

func (app App) GetAccessToken(ctx context.Context, shopName string, code string) (string, error)

func (App) GetAccessTokenBySessionToken added in v1.3.18

func (app App) GetAccessTokenBySessionToken(ctx context.Context, shopName string, sessionToken string) (string, error)

func (App) NewClient added in v1.3.18

func (app App) NewClient(shopName, token string, opts ...Option) (*Client, error)

MustNewClient returns a new Shopify API client with an already authenticated shopname and token. The shopName parameter is the shop's myshopify domain, e.g. "theshop.myshopify.com", or simply "theshop" a.NewClient(shopName, token, opts) is equivalent to NewClient(a, shopName, token, opts)

func (App) VerifyAuthorizationURL

func (app App) VerifyAuthorizationURL(u *url.URL) (bool, error)

Verifying URL callback parameters.

func (App) VerifyMessage

func (app App) VerifyMessage(message, messageMAC string) bool

Verify a message against a message HMAC

func (App) VerifySignature added in v1.3.18

func (app App) VerifySignature(u *url.URL) bool

Verifies an app proxy request, sent by Shopify. When Shopify proxies HTTP requests to the proxy URL, Shopify adds a signature paramter that is used to verify that the request was sent by Shopify. https://shopify.dev/tutorials/display-dynamic-store-data-with-app-proxies

func (App) VerifyWebhookRequest

func (app App) VerifyWebhookRequest(httpRequest *http.Request) bool

Verifies a webhook http request, sent by Shopify. The body of the request is still readable after invoking the method.

func (App) VerifyWebhookRequestVerbose added in v1.3.18

func (app App) VerifyWebhookRequestVerbose(httpRequest *http.Request) (bool, error)

Verifies a webhook http request, sent by Shopify. The body of the request is still readable after invoking the method. This method has more verbose error output which is useful for debugging.

type ApplicationCharge

type ApplicationCharge struct {
	Id                 uint64           `json:"id"`
	Name               string           `json:"name"`
	APIClientId        uint64           `json:"api_client_id"`
	Price              *decimal.Decimal `json:"price"`
	Status             string           `json:"status"`
	ReturnURL          string           `json:"return_url"`
	Test               *bool            `json:"test"`
	CreatedAt          *time.Time       `json:"created_at"`
	UpdatedAt          *time.Time       `json:"updated_at"`
	ChargeType         *string          `json:"charge_type"`
	DecoratedReturnURL string           `json:"decorated_return_url"`
	ConfirmationURL    string           `json:"confirmation_url"`
}

type ApplicationChargeResource

type ApplicationChargeResource struct {
	Charge *ApplicationCharge `json:"application_charge"`
}

ApplicationChargeResource represents the result from the admin/application_charges{/X{/activate.json}.json}.json endpoints.

type ApplicationChargeService

type ApplicationChargeService interface {
	Create(context.Context, ApplicationCharge) (*ApplicationCharge, error)
	Get(context.Context, uint64, interface{}) (*ApplicationCharge, error)
	List(context.Context, interface{}) ([]ApplicationCharge, error)
	Activate(context.Context, ApplicationCharge) (*ApplicationCharge, error)
}

ApplicationChargeService is an interface for interacting with the ApplicationCharge endpoints of the Shopify API. See https://help.shopify.com/api/reference/billing/applicationcharge

type ApplicationChargeServiceOp

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

func (ApplicationChargeServiceOp) Activate

Activate activates application charge.

func (ApplicationChargeServiceOp) Create

Create creates new application charge.

func (ApplicationChargeServiceOp) Get

func (a ApplicationChargeServiceOp) Get(ctx context.Context, chargeId uint64, options interface{}) (*ApplicationCharge, error)

Get gets individual application charge.

func (ApplicationChargeServiceOp) List

func (a ApplicationChargeServiceOp) List(ctx context.Context, options interface{}) ([]ApplicationCharge, error)

List gets all application charges.

type ApplicationChargesResource

type ApplicationChargesResource struct {
	Charges []ApplicationCharge `json:"application_charges"`
}

ApplicationChargesResource represents the result from the admin/application_charges.json endpoint.

type AppliedDiscount added in v1.3.18

type AppliedDiscount struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Value       string `json:"value,omitempty"`
	ValueType   string `json:"value_type,omitempty"`
	Amount      string `json:"amount,omitempty"`
}

AppliedDiscount is the discount applied to the line item or the draft order object.

type Asset

type Asset struct {
	Attachment  string     `json:"attachment,omitempty"`
	ContentType string     `json:"content_type,omitempty"`
	Key         string     `json:"key,omitempty"`
	PublicURL   string     `json:"public_url,omitempty"`
	Size        int        `json:"size,omitempty"`
	SourceKey   string     `json:"source_key,omitempty"`
	Src         string     `json:"src,omitempty"`
	ThemeId     uint64     `json:"theme_id,omitempty"`
	Value       string     `json:"value,omitempty"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
}

Asset represents a Shopify asset

type AssetResource

type AssetResource struct {
	Asset *Asset `json:"asset"`
}

AssetResource is the result from the themes/x/assets.json?asset[key]= endpoint

type AssetService

type AssetService interface {
	List(context.Context, uint64, interface{}) ([]Asset, error)
	Get(context.Context, uint64, string) (*Asset, error)
	Update(context.Context, uint64, Asset) (*Asset, error)
	Delete(context.Context, uint64, string) error
}

AssetService is an interface for interfacing with the asset endpoints of the Shopify API. See: https://help.shopify.com/api/reference/asset

type AssetServiceOp

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

AssetServiceOp handles communication with the asset related methods of the Shopify API.

func (*AssetServiceOp) Delete

func (s *AssetServiceOp) Delete(ctx context.Context, themeId uint64, key string) error

Delete an asset

func (*AssetServiceOp) Get

func (s *AssetServiceOp) Get(ctx context.Context, themeId uint64, key string) (*Asset, error)

Get an asset by key from the given theme

func (*AssetServiceOp) List

func (s *AssetServiceOp) List(ctx context.Context, themeId uint64, options interface{}) ([]Asset, error)

List the metadata for all assets in the given theme

func (*AssetServiceOp) Update

func (s *AssetServiceOp) Update(ctx context.Context, themeId uint64, asset Asset) (*Asset, error)

Update an asset

type AssetsResource

type AssetsResource struct {
	Assets []Asset `json:"assets"`
}

AssetsResource is the result from the themes/x/assets.json endpoint

type AssignedFulfillmentOrder added in v1.3.18

type AssignedFulfillmentOrder struct {
	Id                 uint64                              `json:"id,omitempty"`
	AssignedLocationId uint64                              `json:"assigned_location_id,omitempty"`
	Destination        AssignedFulfillmentOrderDestination `json:"destination,omitempty"`
	LineItems          []AssignedFulfillmentOrderLineItem  `json:"line_items,omitempty"`
	OrderId            uint64                              `json:"order_id,omitempty"`
	RequestStatus      string                              `json:"request_status,omitempty"`
	ShopId             uint64                              `json:"shop_id,omitempty"`
	Status             string                              `json:"status,omitempty"`
}

type AssignedFulfillmentOrderDestination added in v1.3.18

type AssignedFulfillmentOrderDestination struct {
	Id        uint64 `json:"id,omitempty"`
	Address1  string `json:"address1,omitempty"`
	Address2  string `json:"address2,omitempty"`
	City      string `json:"city,omitempty"`
	Company   string `json:"company,omitempty"`
	Country   string `json:"country,omitempty"`
	Email     string `json:"email,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
	Phone     string `json:"phone,omitempty"`
	Province  string `json:"province,omitempty"`
	Zip       string `json:"zip,omitempty"`
}

AssignedFulfillmentOrderDestination represents a destination for a AssignedFulfillmentOrder

type AssignedFulfillmentOrderLineItem added in v1.3.18

type AssignedFulfillmentOrderLineItem struct {
	Id                  uint64 `json:"id,omitempty"`
	ShopId              uint64 `json:"shop_id,omitempty"`
	FulfillmentOrderId  uint64 `json:"fulfillment_order_id,omitempty"`
	LineItemId          uint64 `json:"line_item_id,omitempty"`
	InventoryItemId     uint64 `json:"inventory_item_id,omitempty"`
	Quantity            uint64 `json:"quantity,omitempty"`
	FulfillableQuantity uint64 `json:"fulfillable_quantity,omitempty"`
}

AssignedFulfillmentOrderLineItem represents a line item for a AssignedFulfillmentOrder

type AssignedFulfillmentOrderOptions added in v1.3.18

type AssignedFulfillmentOrderOptions struct {
	AssignmentStatus string `url:"assignment_status,omitempty"`
	LocationIds      string `url:"location_ids,omitempty"`
}

type AssignedFulfillmentOrderService added in v1.3.18

type AssignedFulfillmentOrderService interface {
	Get(context.Context, interface{}) ([]AssignedFulfillmentOrder, error)
}

AssignedFulfillmentService is an interface for interfacing with the assigned fulfillment orders of the Shopify API. https://shopify.dev/docs/api/admin-rest/2023-07/resources/assignedfulfillmentorder

type AssignedFulfillmentOrderServiceOp added in v1.3.18

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

AssignedFulfillmentOrderServiceOp handles communication with the AssignedFulfillmentOrderService related methods of the Shopify API

func (*AssignedFulfillmentOrderServiceOp) Get added in v1.3.18

func (s *AssignedFulfillmentOrderServiceOp) Get(ctx context.Context, options interface{}) ([]AssignedFulfillmentOrder, error)

Gets a list of all the fulfillment orders that are assigned to an app at the shop level

type AssignedFulfillmentOrdersResource added in v1.3.18

type AssignedFulfillmentOrdersResource struct {
	AssignedFulfillmentOrders []AssignedFulfillmentOrder `json:"fulfillment_orders,omitempty"`
}

AssignedFulfillmentOrderResource represents the result from the assigned_fulfillment_order.json endpoint

type Blog

type Blog struct {
	Id                 uint64     `json:"id"`
	Title              string     `json:"title"`
	Commentable        string     `json:"commentable"`
	Feedburner         string     `json:"feedburner"`
	FeedburnerLocation string     `json:"feedburner_location"`
	Handle             string     `json:"handle"`
	Metafield          Metafield  `json:"metafield"`
	Tags               string     `json:"tags"`
	TemplateSuffix     string     `json:"template_suffix"`
	CreatedAt          *time.Time `json:"created_at"`
	UpdatedAt          *time.Time `json:"updated_at"`
	AdminGraphqlApiId  string     `json:"admin_graphql_api_id,omitempty"`
}

Blog represents a Shopify blog

type BlogResource

type BlogResource struct {
	Blog *Blog `json:"blog"`
}

Represents the result from the blogs/X.json endpoint

type BlogService

type BlogService interface {
	List(context.Context, interface{}) ([]Blog, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Blog, error)
	Create(context.Context, Blog) (*Blog, error)
	Update(context.Context, Blog) (*Blog, error)
	Delete(context.Context, uint64) error
}

BlogService is an interface for interfacing with the blogs endpoints of the Shopify API. See: https://help.shopify.com/api/reference/online_store/blog

type BlogServiceOp

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

BlogServiceOp handles communication with the blog related methods of the Shopify API.

func (*BlogServiceOp) Count

func (s *BlogServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count blogs

func (*BlogServiceOp) Create

func (s *BlogServiceOp) Create(ctx context.Context, blog Blog) (*Blog, error)

Create a new blog

func (*BlogServiceOp) Delete

func (s *BlogServiceOp) Delete(ctx context.Context, blogId uint64) error

Delete an blog

func (*BlogServiceOp) Get

func (s *BlogServiceOp) Get(ctx context.Context, blogId uint64, options interface{}) (*Blog, error)

Get single blog

func (*BlogServiceOp) List

func (s *BlogServiceOp) List(ctx context.Context, options interface{}) ([]Blog, error)

List all blogs

func (*BlogServiceOp) Update

func (s *BlogServiceOp) Update(ctx context.Context, blog Blog) (*Blog, error)

Update an existing blog

type BlogsResource

type BlogsResource struct {
	Blogs []Blog `json:"blogs"`
}

BlogsResource is the result from the blogs.json endpoint

type CarrierService added in v1.3.18

type CarrierService struct {
	// Whether this carrier service is active.
	Active bool `json:"active,omitempty"`

	// The URL endpoint that Shopify needs to retrieve shipping rates. This must be a public URL.
	CallbackUrl string `json:"callback_url,omitempty"`

	// Distinguishes between API or legacy carrier services.
	CarrierServiceType string `json:"carrier_service_type,omitempty"`

	// The Id of the carrier service.
	Id uint64 `json:"id,omitempty"`

	// The format of the data returned by the URL endpoint. Valid values: json and xml. Default value: json.
	Format string `json:"format,omitempty"`

	// The name of the shipping service as seen by merchants and their customers.
	Name string `json:"name,omitempty"`

	// Whether merchants are able to send dummy data to your service through the Shopify admin to see shipping rate examples.
	ServiceDiscovery bool `json:"service_discovery,omitempty"`

	AdminGraphqlApiId string `json:"admin_graphql_api_id,omitempty"`
}

CarrierService represents a Shopify carrier service

type CarrierServiceOp added in v1.3.18

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

CarrierServiceOp handles communication with the product related methods of the Shopify API.

func (*CarrierServiceOp) Create added in v1.3.18

func (s *CarrierServiceOp) Create(ctx context.Context, carrier CarrierService) (*CarrierService, error)

Create a carrier service

func (*CarrierServiceOp) Delete added in v1.3.18

func (s *CarrierServiceOp) Delete(ctx context.Context, id uint64) error

Delete a carrier service

func (*CarrierServiceOp) Get added in v1.3.18

Get individual carrier resource by carrier resource Id

func (*CarrierServiceOp) List added in v1.3.18

List carrier services

func (*CarrierServiceOp) Update added in v1.3.18

func (s *CarrierServiceOp) Update(ctx context.Context, carrier CarrierService) (*CarrierService, error)

Update a carrier service

type CarrierServiceService added in v1.3.18

CarrierServiceService is an interface for interfacing with the carrier service endpoints of the Shopify API. See: https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/carrierservice

type CarrierShippingRateProvider added in v1.3.18

type CarrierShippingRateProvider struct {
	Id               uint64            `json:"id,omitempty"`
	CarrierServiceId uint64            `json:"carrier_service_id,omitempty"`
	ShippingZoneId   uint64            `json:"shipping_zone_id,omitempty"`
	FlatModifier     *decimal.Decimal  `json:"flat_modifier,omitempty"`
	PercentModifier  *decimal.Decimal  `json:"percent_modifier,omitempty"`
	ServiceFilter    map[string]string `json:"service_filter,omitempty"`
}

CarrierShippingRateProvider represents a Shopify carrier-constrained shipping rate

type Client

type Client struct {
	// HTTP client used to communicate with the Shopify API.
	Client *http.Client

	// App settings
	App App

	RateLimits RateLimitInfo

	// Services used for communicating with the API
	Product                    ProductService
	CustomCollection           CustomCollectionService
	SmartCollection            SmartCollectionService
	Customer                   CustomerService
	CustomerAddress            CustomerAddressService
	Order                      OrderService
	Fulfillment                FulfillmentService
	DraftOrder                 DraftOrderService
	AbandonedCheckout          AbandonedCheckoutService
	Shop                       ShopService
	Webhook                    WebhookService
	Variant                    VariantService
	Image                      ImageService
	Transaction                TransactionService
	Theme                      ThemeService
	Asset                      AssetService
	ScriptTag                  ScriptTagService
	RecurringApplicationCharge RecurringApplicationChargeService
	UsageCharge                UsageChargeService
	Metafield                  MetafieldService
	Blog                       BlogService
	ApplicationCharge          ApplicationChargeService
	Redirect                   RedirectService
	Page                       PageService
	StorefrontAccessToken      StorefrontAccessTokenService
	Collect                    CollectService
	Collection                 CollectionService
	Location                   LocationService
	DiscountCode               DiscountCodeService
	PriceRule                  PriceRuleService
	InventoryItem              InventoryItemService
	ShippingZone               ShippingZoneService
	ProductListing             ProductListingService
	InventoryLevel             InventoryLevelService
	AccessScopes               AccessScopesService
	FulfillmentService         FulfillmentServiceService
	CarrierService             CarrierServiceService
	Payouts                    PayoutsService
	GiftCard                   GiftCardService
	FulfillmentOrder           FulfillmentOrderService
	GraphQL                    GraphQLService
	AssignedFulfillmentOrder   AssignedFulfillmentOrderService
	FulfillmentEvent           FulfillmentEventService
	FulfillmentRequest         FulfillmentRequestService
	PaymentsTransactions       PaymentsTransactionsService
	OrderRisk                  OrderRiskService
	// contains filtered or unexported fields
}

Client manages communication with the Shopify API.

func MustNewClient added in v1.3.18

func MustNewClient(app App, shopName, token string, opts ...Option) *Client

Returns a new Shopify API client with an already authenticated shopname and token. The shopName parameter is the shop's myshopify domain, e.g. "theshop.myshopify.com", or simply "theshop" panics if an error occurs

func NewClient

func NewClient(app App, shopName, token string, opts ...Option) (*Client, error)

Returns a new Shopify API client with an already authenticated shopname and token. The shopName parameter is the shop's myshopify domain, e.g. "theshop.myshopify.com", or simply "theshop"

func (*Client) Count

func (c *Client) Count(ctx context.Context, path string, options interface{}) (int, error)

func (*Client) CreateAndDo

func (c *Client) CreateAndDo(ctx context.Context, method, relPath string, data, options, resource interface{}) error

CreateAndDo performs a web request to Shopify with the given method (GET, POST, PUT, DELETE) and relative path (e.g. "/admin/orders.json"). The data, options and resource arguments are optional and only relevant in certain situations. If the data argument is non-nil, it will be used as the body of the request for POST and PUT requests. The options argument is used for specifying request options such as search parameters like created_at_min Any data returned from Shopify will be marshalled into resource argument.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string) error

Delete performs a DELETE request for the given path

func (*Client) DeleteWithOptions added in v1.3.18

func (c *Client) DeleteWithOptions(ctx context.Context, path string, options interface{}) error

DeleteWithOptions performs a DELETE request for the given path WithOptions

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) error

Do sends an API request and populates the given interface with the parsed response. It does not make much sense to call Do without a prepared interface instance.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, resource, options interface{}) error

Get performs a GET request for the given path and saves the result in the given resource.

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(ctx context.Context, code string) (string, error)

func (*Client) GetAccessTokenBySessionToken added in v1.3.18

func (c *Client) GetAccessTokenBySessionToken(ctx context.Context, sessionToken string) (string, error)

func (*Client) HandleRequest added in v1.3.18

func (this *Client) HandleRequest(m ...RequestHandler) *Client

func (*Client) HandleResponse added in v1.3.18

func (this *Client) HandleResponse(m ...ResponseHandler) *Client

func (*Client) ListWithPagination added in v1.3.18

func (c *Client) ListWithPagination(ctx context.Context, path string, resource, options interface{}) (*Pagination, error)

ListWithPagination performs a GET request for the given path and saves the result in the given resource and returns the pagination.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, relPath string, body, options interface{}) (*http.Request, error)

Creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, data, resource interface{}) error

Post performs a POST request for the given path and saves the result in the given resource.

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, data, resource interface{}) error

Put performs a PUT request for the given path and saves the result in the given resource.

type ClientDetails

type ClientDetails struct {
	AcceptLanguage string `json:"accept_language,omitempty"`
	BrowserHeight  int    `json:"browser_height,omitempty"`
	BrowserIp      string `json:"browser_ip,omitempty"`
	BrowserWidth   int    `json:"browser_width,omitempty"`
	SessionHash    string `json:"session_hash,omitempty"`
	UserAgent      string `json:"user_agent,omitempty"`
}

type Collect added in v1.3.18

type Collect struct {
	Id           uint64     `json:"id,omitempty"`
	CollectionId uint64     `json:"collection_id,omitempty"`
	ProductId    uint64     `json:"product_id,omitempty"`
	Featured     bool       `json:"featured,omitempty"`
	CreatedAt    *time.Time `json:"created_at,omitempty"`
	UpdatedAt    *time.Time `json:"updated_at,omitempty"`
	Position     int        `json:"position,omitempty"`
	SortValue    string     `json:"sort_value,omitempty"`
}

Collect represents a Shopify collect

type CollectResource added in v1.3.18

type CollectResource struct {
	Collect *Collect `json:"collect"`
}

Represents the result from the collects/X.json endpoint

type CollectService added in v1.3.18

type CollectService interface {
	List(context.Context, interface{}) ([]Collect, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Collect, error)
	Create(context.Context, Collect) (*Collect, error)
	Delete(context.Context, uint64) error
}

CollectService is an interface for interfacing with the collect endpoints of the Shopify API. See: https://help.shopify.com/api/reference/products/collect

type CollectServiceOp added in v1.3.18

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

CollectServiceOp handles communication with the collect related methods of the Shopify API.

func (*CollectServiceOp) Count added in v1.3.18

func (s *CollectServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count collects

func (*CollectServiceOp) Create added in v1.3.18

func (s *CollectServiceOp) Create(ctx context.Context, collect Collect) (*Collect, error)

Create collects

func (*CollectServiceOp) Delete added in v1.3.18

func (s *CollectServiceOp) Delete(ctx context.Context, collectId uint64) error

Delete an existing collect

func (*CollectServiceOp) Get added in v1.3.18

func (s *CollectServiceOp) Get(ctx context.Context, collectId uint64, options interface{}) (*Collect, error)

Get individual collect

func (*CollectServiceOp) List added in v1.3.18

func (s *CollectServiceOp) List(ctx context.Context, options interface{}) ([]Collect, error)

List collects

type Collection added in v1.3.18

type Collection struct {
	Id             uint64     `json:"id"`
	Handle         string     `json:"handle"`
	Title          string     `json:"title"`
	UpdatedAt      *time.Time `json:"updated_at"`
	BodyHTML       string     `json:"body_html"`
	SortOrder      string     `json:"sort_order"`
	TemplateSuffix string     `json:"template_suffix"`
	Image          Image      `json:"image"`
	PublishedAt    *time.Time `json:"published_at"`
	PublishedScope string     `json:"published_scope"`
}

Collection represents a Shopify collection

type CollectionResource added in v1.3.18

type CollectionResource struct {
	Collection *Collection `json:"collection"`
}

Represents the result from the collections/X.json endpoint

type CollectionService added in v1.3.18

type CollectionService interface {
	Get(ctx context.Context, collectionId uint64, options interface{}) (*Collection, error)
	ListProducts(ctx context.Context, collectionId uint64, options interface{}) ([]Product, error)
	ListProductsWithPagination(ctx context.Context, collectionId uint64, options interface{}) ([]Product, *Pagination, error)
}

CollectionService is an interface for interfacing with the collection endpoints of the Shopify API. See: https://help.shopify.com/api/reference/products/collection

type CollectionServiceOp added in v1.3.18

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

CollectionServiceOp handles communication with the collection related methods of the Shopify API.

func (*CollectionServiceOp) Get added in v1.3.18

func (s *CollectionServiceOp) Get(ctx context.Context, collectionId uint64, options interface{}) (*Collection, error)

Get individual collection

func (*CollectionServiceOp) ListProducts added in v1.3.18

func (s *CollectionServiceOp) ListProducts(ctx context.Context, collectionId uint64, options interface{}) ([]Product, error)

List products for a collection

func (*CollectionServiceOp) ListProductsWithPagination added in v1.3.18

func (s *CollectionServiceOp) ListProductsWithPagination(ctx context.Context, collectionId uint64, options interface{}) ([]Product, *Pagination, error)

List products for a collection and return pagination to retrieve next/previous results.

type CollectsResource added in v1.3.18

type CollectsResource struct {
	Collects []Collect `json:"collects"`
}

Represents the result from the collects.json endpoint

type CountOptions

type CountOptions struct {
	CreatedAtMin time.Time `url:"created_at_min,omitempty"`
	CreatedAtMax time.Time `url:"created_at_max,omitempty"`
	UpdatedAtMin time.Time `url:"updated_at_min,omitempty"`
	UpdatedAtMax time.Time `url:"updated_at_max,omitempty"`
}

General count options that can be used for most collection counts.

type CustomCollection

type CustomCollection struct {
	Id             uint64      `json:"id"`
	Handle         string      `json:"handle"`
	Title          string      `json:"title"`
	UpdatedAt      *time.Time  `json:"updated_at"`
	BodyHTML       string      `json:"body_html"`
	SortOrder      string      `json:"sort_order"`
	TemplateSuffix string      `json:"template_suffix"`
	Image          Image       `json:"image"`
	Published      bool        `json:"published"`
	PublishedAt    *time.Time  `json:"published_at"`
	PublishedScope string      `json:"published_scope"`
	Metafields     []Metafield `json:"metafields,omitempty"`
}

CustomCollection represents a Shopify custom collection.

type CustomCollectionResource

type CustomCollectionResource struct {
	Collection *CustomCollection `json:"custom_collection"`
}

CustomCollectionResource represents the result form the custom_collections/X.json endpoint

type CustomCollectionService

type CustomCollectionService interface {
	List(context.Context, interface{}) ([]CustomCollection, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*CustomCollection, error)
	Create(context.Context, CustomCollection) (*CustomCollection, error)
	Update(context.Context, CustomCollection) (*CustomCollection, error)
	Delete(context.Context, uint64) error

	// MetafieldsService used for CustomCollection resource to communicate with Metafields resource
	MetafieldsService
}

CustomCollectionService is an interface for interacting with the custom collection endpoints of the Shopify API. See https://help.shopify.com/api/reference/customcollection

type CustomCollectionServiceOp

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

CustomCollectionServiceOp handles communication with the custom collection related methods of the Shopify API.

func (*CustomCollectionServiceOp) Count

func (s *CustomCollectionServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count custom collections

func (*CustomCollectionServiceOp) CountMetafields

func (s *CustomCollectionServiceOp) CountMetafields(ctx context.Context, customCollectionId uint64, options interface{}) (int, error)

Count metafields for a custom collection

func (*CustomCollectionServiceOp) Create

Create a new custom collection See Image for the details of the Image creation for a collection.

func (*CustomCollectionServiceOp) CreateMetafield

func (s *CustomCollectionServiceOp) CreateMetafield(ctx context.Context, customCollectionId uint64, metafield Metafield) (*Metafield, error)

Create a new metafield for a custom collection

func (*CustomCollectionServiceOp) Delete

func (s *CustomCollectionServiceOp) Delete(ctx context.Context, collectionId uint64) error

Delete an existing custom collection.

func (*CustomCollectionServiceOp) DeleteMetafield

func (s *CustomCollectionServiceOp) DeleteMetafield(ctx context.Context, customCollectionId uint64, metafieldId uint64) error

// Delete an existing metafield for a custom collection

func (*CustomCollectionServiceOp) Get

func (s *CustomCollectionServiceOp) Get(ctx context.Context, collectionId uint64, options interface{}) (*CustomCollection, error)

Get individual custom collection

func (*CustomCollectionServiceOp) GetMetafield

func (s *CustomCollectionServiceOp) GetMetafield(ctx context.Context, customCollectionId uint64, metafieldId uint64, options interface{}) (*Metafield, error)

Get individual metafield for a custom collection

func (*CustomCollectionServiceOp) List

func (s *CustomCollectionServiceOp) List(ctx context.Context, options interface{}) ([]CustomCollection, error)

List custom collections

func (*CustomCollectionServiceOp) ListMetafields

func (s *CustomCollectionServiceOp) ListMetafields(ctx context.Context, customCollectionId uint64, options interface{}) ([]Metafield, error)

List metafields for a custom collection

func (*CustomCollectionServiceOp) Update

Update an existing custom collection

func (*CustomCollectionServiceOp) UpdateMetafield

func (s *CustomCollectionServiceOp) UpdateMetafield(ctx context.Context, customCollectionId uint64, metafield Metafield) (*Metafield, error)

Update an existing metafield for a custom collection

type CustomCollectionsResource

type CustomCollectionsResource struct {
	Collections []CustomCollection `json:"custom_collections"`
}

CustomCollectionsResource represents the result from the custom_collections.json endpoint

type Customer

type Customer struct {
	Id                        uint64                 `json:"id,omitempty"`
	Email                     string                 `json:"email,omitempty"`
	FirstName                 string                 `json:"first_name,omitempty"`
	LastName                  string                 `json:"last_name,omitempty"`
	State                     string                 `json:"state,omitempty"`
	Note                      string                 `json:"note,omitempty"`
	VerifiedEmail             bool                   `json:"verified_email,omitempty"`
	MultipassIdentifier       string                 `json:"multipass_identifier,omitempty"`
	OrdersCount               int                    `json:"orders_count,omitempty"`
	TaxExempt                 bool                   `json:"tax_exempt,omitempty"`
	TotalSpent                *decimal.Decimal       `json:"total_spent,omitempty"`
	Phone                     string                 `json:"phone,omitempty"`
	Tags                      string                 `json:"tags,omitempty"`
	LastOrderId               uint64                 `json:"last_order_id,omitempty"`
	LastOrderName             string                 `json:"last_order_name,omitempty"`
	AcceptsMarketing          bool                   `json:"accepts_marketing,omitempty"`
	AcceptsMarketingUpdatedAt *time.Time             `json:"accepts_marketing_updated_at,omitempty"`
	EmailMarketingConsent     *EmailMarketingConsent `json:"email_marketing_consent"`
	SMSMarketingConsent       *SMSMarketingConsent   `json:"sms_marketing_consent"`
	DefaultAddress            *CustomerAddress       `json:"default_address,omitempty"`
	Addresses                 []*CustomerAddress     `json:"addresses,omitempty"`
	CreatedAt                 *time.Time             `json:"created_at,omitempty"`
	UpdatedAt                 *time.Time             `json:"updated_at,omitempty"`
	Metafields                []Metafield            `json:"metafields,omitempty"`
}

Customer represents a Shopify customer

type CustomerAddress

type CustomerAddress struct {
	Id           uint64 `json:"id,omitempty"`
	CustomerId   uint64 `json:"customer_id,omitempty"`
	FirstName    string `json:"first_name,omitempty"`
	LastName     string `json:"last_name,omitempty"`
	Company      string `json:"company,omitempty"`
	Address1     string `json:"address1,omitempty"`
	Address2     string `json:"address2,omitempty"`
	City         string `json:"city,omitempty"`
	Province     string `json:"province,omitempty"`
	Country      string `json:"country,omitempty"`
	Zip          string `json:"zip,omitempty"`
	Phone        string `json:"phone,omitempty"`
	Name         string `json:"name,omitempty"`
	ProvinceCode string `json:"province_code,omitempty"`
	CountryCode  string `json:"country_code,omitempty"`
	CountryName  string `json:"country_name,omitempty"`
	Default      bool   `json:"default,omitempty"`
}

CustomerAddress represents a Shopify customer address

type CustomerAddressResource added in v1.3.18

type CustomerAddressResource struct {
	Address *CustomerAddress `json:"customer_address"`
}

CustomerAddressResoruce represents the result from the addresses/X.json endpoint

type CustomerAddressService added in v1.3.18

type CustomerAddressService interface {
	List(context.Context, uint64, interface{}) ([]CustomerAddress, error)
	Get(context.Context, uint64, uint64, interface{}) (*CustomerAddress, error)
	Create(context.Context, uint64, CustomerAddress) (*CustomerAddress, error)
	Update(context.Context, uint64, CustomerAddress) (*CustomerAddress, error)
	Delete(context.Context, uint64, uint64) error
}

CustomerAddressService is an interface for interfacing with the customer address endpoints of the Shopify API. See: https://help.shopify.com/en/api/reference/customers/customer_address

type CustomerAddressServiceOp added in v1.3.18

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

CustomerAddressServiceOp handles communication with the customer address related methods of the Shopify API.

func (*CustomerAddressServiceOp) Create added in v1.3.18

func (s *CustomerAddressServiceOp) Create(ctx context.Context, customerId uint64, address CustomerAddress) (*CustomerAddress, error)

Create a new address for given customer

func (*CustomerAddressServiceOp) Delete added in v1.3.18

func (s *CustomerAddressServiceOp) Delete(ctx context.Context, customerId, addressId uint64) error

Delete an existing address

func (*CustomerAddressServiceOp) Get added in v1.3.18

func (s *CustomerAddressServiceOp) Get(ctx context.Context, customerId, addressId uint64, options interface{}) (*CustomerAddress, error)

Get address

func (*CustomerAddressServiceOp) List added in v1.3.18

func (s *CustomerAddressServiceOp) List(ctx context.Context, customerId uint64, options interface{}) ([]CustomerAddress, error)

List addresses

func (*CustomerAddressServiceOp) Update added in v1.3.18

func (s *CustomerAddressServiceOp) Update(ctx context.Context, customerId uint64, address CustomerAddress) (*CustomerAddress, error)

Create a new address for given customer

type CustomerAddressesResource added in v1.3.18

type CustomerAddressesResource struct {
	Addresses []CustomerAddress `json:"addresses"`
}

CustomerAddressResoruce represents the result from the customers/X/addresses.json endpoint

type CustomerId added in v1.3.18

type CustomerId struct {
	CustomerId uint64 `json:"customer_id,omitempty"`
}

type CustomerResource

type CustomerResource struct {
	Customer *Customer `json:"customer"`
}

Represents the result from the customers/X.json endpoint

type CustomerSearchOptions

type CustomerSearchOptions struct {
	Page   int    `url:"page,omitempty"`
	Limit  int    `url:"limit,omitempty"`
	Fields string `url:"fields,omitempty"`
	Order  string `url:"order,omitempty"`
	Query  string `url:"query,omitempty"`
}

Represents the options available when searching for a customer

type CustomerService

type CustomerService interface {
	List(context.Context, interface{}) ([]Customer, error)
	ListWithPagination(ctx context.Context, options interface{}) ([]Customer, *Pagination, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Customer, error)
	Search(context.Context, interface{}) ([]Customer, *Pagination, error)
	Create(context.Context, Customer) (*Customer, error)
	Update(context.Context, Customer) (*Customer, error)
	Delete(context.Context, uint64) error
	ListOrders(context.Context, uint64, interface{}) ([]Order, error)
	ListTags(context.Context, interface{}) ([]string, error)

	// MetafieldsService used for Customer resource to communicate with Metafields resource
	MetafieldsService
}

CustomerService is an interface for interfacing with the customers endpoints of the Shopify API. See: https://help.shopify.com/api/reference/customer

type CustomerServiceOp

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

CustomerServiceOp handles communication with the product related methods of the Shopify API.

func (*CustomerServiceOp) Count

func (s *CustomerServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count customers

func (*CustomerServiceOp) CountMetafields

func (s *CustomerServiceOp) CountMetafields(ctx context.Context, customerId uint64, options interface{}) (int, error)

Count metafields for a customer

func (*CustomerServiceOp) Create

func (s *CustomerServiceOp) Create(ctx context.Context, customer Customer) (*Customer, error)

Create a new customer

func (*CustomerServiceOp) CreateMetafield

func (s *CustomerServiceOp) CreateMetafield(ctx context.Context, customerId uint64, metafield Metafield) (*Metafield, error)

Create a new metafield for a customer

func (*CustomerServiceOp) Delete

func (s *CustomerServiceOp) Delete(ctx context.Context, customerId uint64) error

Delete an existing customer

func (*CustomerServiceOp) DeleteMetafield

func (s *CustomerServiceOp) DeleteMetafield(ctx context.Context, customerId uint64, metafieldId uint64) error

// Delete an existing metafield for a customer

func (*CustomerServiceOp) Get

func (s *CustomerServiceOp) Get(ctx context.Context, customerId uint64, options interface{}) (*Customer, error)

Get customer

func (*CustomerServiceOp) GetMetafield

func (s *CustomerServiceOp) GetMetafield(ctx context.Context, customerId uint64, metafieldId uint64, options interface{}) (*Metafield, error)

Get individual metafield for a customer

func (*CustomerServiceOp) List

func (s *CustomerServiceOp) List(ctx context.Context, options interface{}) ([]Customer, error)

List customers

func (*CustomerServiceOp) ListMetafields

func (s *CustomerServiceOp) ListMetafields(ctx context.Context, customerId uint64, options interface{}) ([]Metafield, error)

List metafields for a customer

func (*CustomerServiceOp) ListOrders added in v1.3.18

func (s *CustomerServiceOp) ListOrders(ctx context.Context, customerId uint64, options interface{}) ([]Order, error)

ListOrders retrieves all orders from a customer

func (*CustomerServiceOp) ListTags added in v1.3.18

func (s *CustomerServiceOp) ListTags(ctx context.Context, options interface{}) ([]string, error)

ListTags retrieves all unique tags across all customers

func (*CustomerServiceOp) ListWithPagination added in v1.3.18

func (s *CustomerServiceOp) ListWithPagination(ctx context.Context, options interface{}) ([]Customer, *Pagination, error)

ListWithPagination lists customers and return pagination to retrieve next/previous results.

func (*CustomerServiceOp) Search

func (s *CustomerServiceOp) Search(ctx context.Context, options interface{}) ([]Customer, *Pagination, error)

Search customers

func (*CustomerServiceOp) Update

func (s *CustomerServiceOp) Update(ctx context.Context, customer Customer) (*Customer, error)

Update an existing customer

func (*CustomerServiceOp) UpdateMetafield

func (s *CustomerServiceOp) UpdateMetafield(ctx context.Context, customerId uint64, metafield Metafield) (*Metafield, error)

Update an existing metafield for a customer

type CustomerTagsResource added in v1.3.18

type CustomerTagsResource struct {
	Tags []string `json:"tags"`
}

Represents the result from the customers/tags.json endpoint

type CustomersResource

type CustomersResource struct {
	Customers []Customer `json:"customers"`
}

Represents the result from the customers.json endpoint

type DiscountAllocations added in v1.3.18

type DiscountAllocations struct {
	Amount                   *decimal.Decimal `json:"amount,omitempty"`
	DiscountApplicationIndex int              `json:"discount_application_index,omitempty"`
	AmountSet                *AmountSet       `json:"amount_set,omitempty"`
}

type DiscountCode

type DiscountCode struct {
	Amount *decimal.Decimal `json:"amount,omitempty"`
	Code   string           `json:"code,omitempty"`
	Type   string           `json:"type,omitempty"`
}

type DiscountCodeResource added in v1.3.18

type DiscountCodeResource struct {
	PriceRuleDiscountCode *PriceRuleDiscountCode `json:"discount_code"`
}

DiscountCodeResource represents the result from the discount_codes/X.json endpoint

type DiscountCodeService added in v1.3.18

DiscountCodeService is an interface for interfacing with the discount endpoints of the Shopify API. See: https://help.shopify.com/en/api/reference/discounts/PriceRuleDiscountCode

type DiscountCodeServiceOp added in v1.3.18

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

DiscountCodeServiceOp handles communication with the discount code related methods of the Shopify API.

func (*DiscountCodeServiceOp) Create added in v1.3.18

Create a discount code

func (*DiscountCodeServiceOp) Delete added in v1.3.18

func (s *DiscountCodeServiceOp) Delete(ctx context.Context, priceRuleId uint64, discountCodeId uint64) error

Delete a discount code

func (*DiscountCodeServiceOp) Get added in v1.3.18

func (s *DiscountCodeServiceOp) Get(ctx context.Context, priceRuleId uint64, discountCodeId uint64) (*PriceRuleDiscountCode, error)

Get a single discount code

func (*DiscountCodeServiceOp) List added in v1.3.18

func (s *DiscountCodeServiceOp) List(ctx context.Context, priceRuleId uint64) ([]PriceRuleDiscountCode, error)

List of discount codes

func (*DiscountCodeServiceOp) ListWithPagination added in v1.3.20

func (s *DiscountCodeServiceOp) ListWithPagination(ctx context.Context, priceRuleId uint64, options interface{}) ([]PriceRuleDiscountCode, *Pagination, error)

List discount codes and return pagination to retrieve next/previous results.

func (*DiscountCodeServiceOp) Update added in v1.3.18

Update an existing discount code

type DiscountCodesResource added in v1.3.18

type DiscountCodesResource struct {
	DiscountCodes []PriceRuleDiscountCode `json:"discount_codes"`
}

DiscountCodesResource is the result from the discount_codes.json endpoint

type DraftOrder added in v1.3.18

type DraftOrder struct {
	Id              uint64           `json:"id,omitempty"`
	OrderId         uint64           `json:"order_id,omitempty"`
	Name            string           `json:"name,omitempty"`
	Customer        *Customer        `json:"customer,omitempty"`
	ShippingAddress *Address         `json:"shipping_address,omitempty"`
	BillingAddress  *Address         `json:"billing_address,omitempty"`
	Note            string           `json:"note,omitempty"`
	NoteAttributes  []NoteAttribute  `json:"note_attributes,omitempty"`
	Email           string           `json:"email,omitempty"`
	Currency        string           `json:"currency,omitempty"`
	InvoiceSentAt   *time.Time       `json:"invoice_sent_at,omitempty"`
	InvoiceURL      string           `json:"invoice_url,omitempty"`
	LineItems       []LineItem       `json:"line_items,omitempty"`
	ShippingLine    *ShippingLines   `json:"shipping_line,omitempty"`
	Tags            string           `json:"tags,omitempty"`
	TaxLines        []TaxLine        `json:"tax_lines,omitempty"`
	AppliedDiscount *AppliedDiscount `json:"applied_discount,omitempty"`
	TaxesIncluded   bool             `json:"taxes_included,omitempty"`
	TotalTax        string           `json:"total_tax,omitempty"`
	TaxExempt       *bool            `json:"tax_exempt,omitempty"`
	TotalPrice      string           `json:"total_price,omitempty"`
	SubtotalPrice   *decimal.Decimal `json:"subtotal_price,omitempty"`
	CompletedAt     *time.Time       `json:"completed_at,omitempty"`
	CreatedAt       *time.Time       `json:"created_at,omitempty"`
	UpdatedAt       *time.Time       `json:"updated_at,omitempty"`
	Status          string           `json:"status,omitempty"`
	// only in request to flag using the customer's default address
	UseCustomerDefaultAddress bool `json:"use_customer_default_address,omitempty"`
}

DraftOrder represents a shopify draft order

type DraftOrderCountOptions added in v1.3.18

type DraftOrderCountOptions struct {
	Fields  string      `url:"fields,omitempty"`
	Limit   int         `url:"limit,omitempty"`
	SinceId uint64      `url:"since_id,omitempty"`
	Ids     string      `url:"ids,omitempty"`
	Status  orderStatus `url:"status,omitempty"`
}

DraftOrderCountOptions represents the possible options to the count draft orders endpoint

type DraftOrderInvoice added in v1.3.18

type DraftOrderInvoice struct {
	To            string   `json:"to,omitempty"`
	From          string   `json:"from,omitempty"`
	Subject       string   `json:"subject,omitempty"`
	CustomMessage string   `json:"custom_message,omitempty"`
	Bcc           []string `json:"bcc,omitempty"`
}

DraftOrderInvoice is the struct used to create an invoice for a draft order

type DraftOrderInvoiceResource added in v1.3.18

type DraftOrderInvoiceResource struct {
	DraftOrderInvoice *DraftOrderInvoice `json:"draft_order_invoice,omitempty"`
}

type DraftOrderListOptions added in v1.3.18

type DraftOrderListOptions struct {
	Fields       string      `url:"fields,omitempty"`
	Limit        int         `url:"limit,omitempty"`
	SinceId      uint64      `url:"since_id,omitempty"`
	UpdatedAtMin *time.Time  `url:"updated_at_min,omitempty"`
	UpdatedAtMax *time.Time  `url:"updated_at_max,omitempty"`
	Ids          string      `url:"ids,omitempty"`
	Status       orderStatus `url:"status,omitempty"`
}

DraftOrderListOptions represents the possible options that can be used to further query the list draft orders endpoint

type DraftOrderResource added in v1.3.18

type DraftOrderResource struct {
	DraftOrder *DraftOrder `json:"draft_order"`
}

type DraftOrderService added in v1.3.18

type DraftOrderService interface {
	List(context.Context, interface{}) ([]DraftOrder, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*DraftOrder, error)
	Create(context.Context, DraftOrder) (*DraftOrder, error)
	Update(context.Context, DraftOrder) (*DraftOrder, error)
	Delete(context.Context, uint64) error
	Invoice(context.Context, uint64, DraftOrderInvoice) (*DraftOrderInvoice, error)
	Complete(context.Context, uint64, bool) (*DraftOrder, error)

	// MetafieldsService used for DrafT Order resource to communicate with Metafields resource
	MetafieldsService
}

DraftOrderService is an interface for interfacing with the draft orders endpoints of the Shopify API. See: https://help.shopify.com/api/reference/orders/draftorder

type DraftOrderServiceOp added in v1.3.18

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

DraftOrderServiceOp handles communication with the draft order related methods of the Shopify API.

func (*DraftOrderServiceOp) Complete added in v1.3.18

func (s *DraftOrderServiceOp) Complete(ctx context.Context, draftOrderId uint64, paymentPending bool) (*DraftOrder, error)

Complete draft order

func (*DraftOrderServiceOp) Count added in v1.3.18

func (s *DraftOrderServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count draft orders

func (*DraftOrderServiceOp) CountMetafields added in v1.3.18

func (s *DraftOrderServiceOp) CountMetafields(ctx context.Context, draftOrderId uint64, options interface{}) (int, error)

Count metafields for an order

func (*DraftOrderServiceOp) Create added in v1.3.18

func (s *DraftOrderServiceOp) Create(ctx context.Context, draftOrder DraftOrder) (*DraftOrder, error)

Create draft order

func (*DraftOrderServiceOp) CreateMetafield added in v1.3.18

func (s *DraftOrderServiceOp) CreateMetafield(ctx context.Context, draftOrderId uint64, metafield Metafield) (*Metafield, error)

Create a new metafield for an order

func (*DraftOrderServiceOp) Delete added in v1.3.18

func (s *DraftOrderServiceOp) Delete(ctx context.Context, draftOrderId uint64) error

Delete draft orders

func (*DraftOrderServiceOp) DeleteMetafield added in v1.3.18

func (s *DraftOrderServiceOp) DeleteMetafield(ctx context.Context, draftOrderId uint64, metafieldId uint64) error

Delete an existing metafield for an order

func (*DraftOrderServiceOp) Get added in v1.3.18

func (s *DraftOrderServiceOp) Get(ctx context.Context, draftOrderId uint64, options interface{}) (*DraftOrder, error)

Get individual draft order

func (*DraftOrderServiceOp) GetMetafield added in v1.3.18

func (s *DraftOrderServiceOp) GetMetafield(ctx context.Context, draftOrderId uint64, metafieldId uint64, options interface{}) (*Metafield, error)

Get individual metafield for an order

func (*DraftOrderServiceOp) Invoice added in v1.3.18

func (s *DraftOrderServiceOp) Invoice(ctx context.Context, draftOrderId uint64, draftOrderInvoice DraftOrderInvoice) (*DraftOrderInvoice, error)

Invoice a draft order

func (*DraftOrderServiceOp) List added in v1.3.18

func (s *DraftOrderServiceOp) List(ctx context.Context, options interface{}) ([]DraftOrder, error)

List draft orders

func (*DraftOrderServiceOp) ListMetafields added in v1.3.18

func (s *DraftOrderServiceOp) ListMetafields(ctx context.Context, draftOrderId uint64, options interface{}) ([]Metafield, error)

List metafields for an order

func (*DraftOrderServiceOp) Update added in v1.3.18

func (s *DraftOrderServiceOp) Update(ctx context.Context, draftOrder DraftOrder) (*DraftOrder, error)

Update draft order

func (*DraftOrderServiceOp) UpdateMetafield added in v1.3.18

func (s *DraftOrderServiceOp) UpdateMetafield(ctx context.Context, draftOrderId uint64, metafield Metafield) (*Metafield, error)

Update an existing metafield for an order

type DraftOrdersResource added in v1.3.18

type DraftOrdersResource struct {
	DraftOrders []DraftOrder `json:"draft_orders"`
}

type EmailMarketingConsent added in v1.3.18

type EmailMarketingConsent struct {
	State            string     `json:"state"`
	OptInLevel       string     `json:"opt_in_level"`
	ConsentUpdatedAt *time.Time `json:"consent_updated_at"`
}

type Fulfillment

type Fulfillment struct {
	Id                          uint64                       `json:"id,omitempty"`
	OrderId                     uint64                       `json:"order_id,omitempty"`
	LocationId                  uint64                       `json:"location_id,omitempty"`
	Name                        string                       `json:"name"`
	Status                      string                       `json:"status,omitempty"`
	CreatedAt                   *time.Time                   `json:"created_at,omitempty"`
	Service                     string                       `json:"service,omitempty"`
	UpdatedAt                   *time.Time                   `json:"updated_at,omitempty"`
	TrackingCompany             string                       `json:"tracking_company,omitempty"`
	ShipmentStatus              string                       `json:"shipment_status,omitempty"`
	TrackingInfo                FulfillmentTrackingInfo      `json:"tracking_info,omitempty"`
	TrackingNumber              string                       `json:"tracking_number,omitempty"`
	TrackingNumbers             []string                     `json:"tracking_numbers,omitempty"`
	TrackingUrl                 string                       `json:"tracking_url,omitempty"`
	TrackingUrls                []string                     `json:"tracking_urls,omitempty"`
	Receipt                     Receipt                      `json:"receipt,omitempty"`
	LineItems                   []LineItem                   `json:"line_items,omitempty"`
	LineItemsByFulfillmentOrder []LineItemByFulfillmentOrder `json:"line_items_by_fulfillment_order,omitempty"`
	NotifyCustomer              bool                         `json:"notify_customer"`
}

Fulfillment represents a Shopify fulfillment.

type FulfillmentEvent added in v1.3.18

type FulfillmentEvent struct {
	Id                  uint64  `json:"id"`
	Address1            string  `json:"address1"`
	City                string  `json:"city"`
	Country             string  `json:"country"`
	CreatedAt           string  `json:"created_at"`
	EstimatedDeliveryAt string  `json:"estimated_delivery_at"`
	FulfillmentId       uint64  `json:"fulfillment_id"`
	HappenedAt          string  `json:"happened_at"`
	Latitude            float64 `json:"latitude"`
	Longitude           float64 `json:"longitude"`
	Message             string  `json:"message"`
	OrderId             uint64  `json:"order_id"`
	Province            string  `json:"province"`
	ShopId              uint64  `json:"shop_id"`
	Status              string  `json:"status"`
	UpdatedAt           string  `json:"updated_at"`
	Zip                 string  `json:"zip"`
}

FulfillmentEvent represents a Shopify fulfillment event.

type FulfillmentEventCreateRequest added in v1.3.18

type FulfillmentEventCreateRequest struct {
	Event *FulfillmentEvent `json:"event"`
}

type FulfillmentEventResource added in v1.3.18

type FulfillmentEventResource struct {
	FulfillmentEvent *FulfillmentEvent `json:"fulfillment_event,omitempty"`
	Event            *FulfillmentEvent `json:"event,omitempty"`
}

type FulfillmentEventService added in v1.3.18

type FulfillmentEventService interface {
	List(ctx context.Context, orderId uint64, fulfillmentId uint64) ([]FulfillmentEvent, error)
	Get(ctx context.Context, orderId uint64, fulfillmentId uint64, eventId uint64) (*FulfillmentEvent, error)
	Create(ctx context.Context, orderId uint64, fulfillmentId uint64, event FulfillmentEvent) (*FulfillmentEvent, error)
	Delete(ctx context.Context, orderId uint64, fulfillmentId uint64, eventId uint64) error
}

FulfillmentEventService is an interface for interfacing with the fulfillment event service of the Shopify API. https://help.shopify.com/api/reference/fulfillmentevent

type FulfillmentEventServiceOp added in v1.3.18

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

FulfillmentEventServiceOp handles communication with the fulfillment event related methods of the Shopify API.

func (*FulfillmentEventServiceOp) Create added in v1.3.18

func (s *FulfillmentEventServiceOp) Create(ctx context.Context, orderId uint64, fulfillmentId uint64, event FulfillmentEvent) (*FulfillmentEvent, error)

Create a new FulfillmentEvent

func (*FulfillmentEventServiceOp) Delete added in v1.3.18

func (s *FulfillmentEventServiceOp) Delete(ctx context.Context, orderId uint64, fulfillmentId uint64, eventId uint64) error

Delete an existing FulfillmentEvent

func (*FulfillmentEventServiceOp) Get added in v1.3.18

func (s *FulfillmentEventServiceOp) Get(ctx context.Context, orderId uint64, fulfillmentId uint64, eventId uint64) (*FulfillmentEvent, error)

Get a single FulfillmentEvent. The API returns the event under the 'fulfillment_event' key.

func (*FulfillmentEventServiceOp) List added in v1.3.18

func (s *FulfillmentEventServiceOp) List(ctx context.Context, orderId uint64, fulfillmentId uint64) ([]FulfillmentEvent, error)

List of all FulfillmentEvents for an order's fulfillment. The API returns the list under the 'fulfillment_events' key.

type FulfillmentEventsResource added in v1.3.18

type FulfillmentEventsResource struct {
	FulfillmentEvents []FulfillmentEvent `json:"fulfillment_events"`
}

type FulfillmentOrder added in v1.3.18

type FulfillmentOrder struct {
	Id                  uint64                              `json:"id,omitempty"`
	AssignedLocation    FulfillmentOrderAssignedLocation    `json:"assigned_location,omitempty"`
	AssignedLocationId  uint64                              `json:"assigned_location_id,omitempty"`
	DeliveryMethod      FulfillmentOrderDeliveryMethod      `json:"delivery_method,omitempty"`
	Destination         FulfillmentOrderDestination         `json:"destination,omitempty"`
	FulfillAt           *time.Time                          `json:"fulfill_at,omitempty"`
	FulfillBy           *time.Time                          `json:"fulfill_by,omitempty"`
	FulfillmentHolds    []FulfillmentOrderHold              `json:"fulfillment_holds,omitempty"`
	InternationalDuties FulfillmentOrderInternationalDuties `json:"international_duties,omitempty"`
	LineItems           []FulfillmentOrderLineItem          `json:"line_items,omitempty"`
	MerchantRequests    []FulfillmentOrderMerchantRequest   `json:"merchant_requests,omitempty"`
	OrderId             uint64                              `json:"order_id,omitempty"`
	RequestStatus       string                              `json:"request_status,omitempty"`
	ShopId              uint64                              `json:"shop_id,omitempty"`
	Status              string                              `json:"status,omitempty"`
	SupportedActions    []string                            `json:"supported_actions,omitempty"`
	CreatedAt           *time.Time                          `json:"created_at,omitempty"`
	UpdatedAt           *time.Time                          `json:"updated_at,omitempty"`
}

FulfillmentOrder represents a Shopify Fulfillment Order

type FulfillmentOrderAssignedLocation added in v1.3.18

type FulfillmentOrderAssignedLocation struct {
	Address1    string `json:"address1,omitempty"`
	Address2    string `json:"address2,omitempty"`
	City        string `json:"city,omitempty"`
	CountryCode string `json:"country_code,omitempty"`
	LocationId  uint64 `json:"location_id,omitempty"`
	Name        string `json:"name,omitempty"`
	Phone       string `json:"phone,omitempty"`
	Province    string `json:"province,omitempty"`
	Zip         string `json:"zip,omitempty"`
}

FulfillmentOrderAssignedLocation represents an AssignedLocation for a FulfillmentOrder

type FulfillmentOrderDeliveryMethod added in v1.3.18

type FulfillmentOrderDeliveryMethod struct {
	Id                  uint64    `json:"id,omitempty"`
	MethodType          string    `json:"method_type,omitempty"`
	MinDeliveryDateTime time.Time `json:"min_delivery_date_time,omitempty"`
	MaxDeliveryDateTime time.Time `json:"max_delivery_date_time,omitempty"`
}

FulfillmentOrderDeliveryMethod represents a delivery method for a FulfillmentOrder

type FulfillmentOrderDestination added in v1.3.18

type FulfillmentOrderDestination struct {
	Id        uint64 `json:"id,omitempty"`
	Address1  string `json:"address1,omitempty"`
	Address2  string `json:"address2,omitempty"`
	City      string `json:"city,omitempty"`
	Company   string `json:"company,omitempty"`
	Country   string `json:"country,omitempty"`
	Email     string `json:"email,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
	Phone     string `json:"phone,omitempty"`
	Province  string `json:"province,omitempty"`
	Zip       string `json:"zip,omitempty"`
}

FulfillmentOrderDestination represents a destination for a FulfillmentOrder

type FulfillmentOrderHold added in v1.3.18

type FulfillmentOrderHold struct {
	Reason      FulfillmentOrderHoldReason `json:"reason,omitempty"`
	ReasonNotes string                     `json:"reason_notes,omitempty"`
}

FulfillmentOrderHold represents a fulfillment hold for a FulfillmentOrder

type FulfillmentOrderHoldReason added in v1.3.18

type FulfillmentOrderHoldReason string

FulfillmentOrderHoldReason represents the reason for a fulfillment hold

const (
	HoldReasonAwaitingPayment  FulfillmentOrderHoldReason = "awaiting_payment"
	HoldReasonHighRiskOfFraud  FulfillmentOrderHoldReason = "high_risk_of_fraud"
	HoldReasonIncorrectAddress FulfillmentOrderHoldReason = "incorrect_address"
	HoldReasonOutOfStock       FulfillmentOrderHoldReason = "inventory_out_of_stock"
	HoldReasonOther            FulfillmentOrderHoldReason = "other"
)

type FulfillmentOrderInternationalDuties added in v1.3.18

type FulfillmentOrderInternationalDuties struct {
	IncoTerm string `json:"incoterm,omitempty"`
}

FulfillmentOrderInternationalDuties represents an InternationalDuty for a FulfillmentOrder

type FulfillmentOrderLineItem added in v1.3.18

type FulfillmentOrderLineItem struct {
	Id                  uint64 `json:"id,omitempty"`
	ShopId              uint64 `json:"shop_id,omitempty"`
	FulfillmentOrderId  uint64 `json:"fulfillment_order_id,omitempty"`
	LineItemId          uint64 `json:"line_item_id,omitempty"`
	InventoryItemId     uint64 `json:"inventory_item_id,omitempty"`
	Quantity            uint64 `json:"quantity,omitempty"`
	FulfillableQuantity uint64 `json:"fulfillable_quantity,omitempty"`
	VariantId           uint64 `json:"variant_id,omitempty"`
}

FulfillmentOrderLineItem represents a line item for a FulfillmentOrder

type FulfillmentOrderLineItemQuantity added in v1.3.18

type FulfillmentOrderLineItemQuantity struct {
	Id       uint64 `json:"id"`
	Quantity uint64 `json:"quantity"`
}

type FulfillmentOrderMerchantRequest added in v1.3.18

type FulfillmentOrderMerchantRequest struct {
	Message        string `json:"message,omitempty"`
	RequestOptions struct {
		ShippingMethod string    `json:"shipping_method,omitempty"`
		Note           string    `json:"note,omitempty"`
		Date           time.Time `json:"date,omitempty"`
	} `json:"request_options"`
	Kind string `json:"kind,omitempty"`
}

FulfillmentOrderMerchantRequest represents a MerchantRequest for a FulfillmentOrder

type FulfillmentOrderMoveRequest added in v1.3.18

type FulfillmentOrderMoveRequest struct {
	NewLocationId uint64                             `json:"new_location_id"`
	LineItems     []FulfillmentOrderLineItemQuantity `json:"fulfillment_order_line_items,omitempty"`
}

type FulfillmentOrderMoveResource added in v1.3.18

type FulfillmentOrderMoveResource struct {
	OriginalFulfillmentOrder FulfillmentOrder `json:"original_fulfillment_order"`
	MovedFulfillmentOrder    FulfillmentOrder `json:"moved_fulfillment_order"`
}

FulfillmentOrderMoveResource represents the result from the move.json endpoint

type FulfillmentOrderResource added in v1.3.18

type FulfillmentOrderResource struct {
	FulfillmentOrder *FulfillmentOrder `json:"fulfillment_order"`
}

FulfillmentOrderResource represents the result from the fulfillment_orders/<id>.json endpoint

type FulfillmentOrderService added in v1.3.18

FulfillmentOrderService is an interface for interfacing with the fulfillment order endpoints of the Shopify API. https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillmentorder#resource-object

type FulfillmentOrderServiceOp added in v1.3.18

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

FulfillmentOrderServiceOp handles communication with the fulfillment order related methods of the Shopify API.

func (*FulfillmentOrderServiceOp) Cancel added in v1.3.18

func (s *FulfillmentOrderServiceOp) Cancel(ctx context.Context, fulfillmentId uint64) (*FulfillmentOrder, error)

Cancel cancels a fulfillment order

func (*FulfillmentOrderServiceOp) Close added in v1.3.18

func (s *FulfillmentOrderServiceOp) Close(ctx context.Context, fulfillmentId uint64, message string) (*FulfillmentOrder, error)

Close marks a fulfillment order as incomplete with an optional message

func (*FulfillmentOrderServiceOp) Get added in v1.3.18

func (s *FulfillmentOrderServiceOp) Get(ctx context.Context, fulfillmentId uint64, options interface{}) (*FulfillmentOrder, error)

Get gets an individual fulfillment order

func (*FulfillmentOrderServiceOp) Hold added in v1.3.18

func (s *FulfillmentOrderServiceOp) Hold(ctx context.Context, fulfillmentId uint64, notify bool, reason FulfillmentOrderHoldReason, notes string) (*FulfillmentOrder, error)

Hold applies a fulfillment hold on an open fulfillment order

func (*FulfillmentOrderServiceOp) List added in v1.3.18

func (s *FulfillmentOrderServiceOp) List(ctx context.Context, orderId uint64, options interface{}) ([]FulfillmentOrder, error)

List gets FulfillmentOrder items for an order

func (*FulfillmentOrderServiceOp) Move added in v1.3.18

Move moves a fulfillment order to a new location

func (*FulfillmentOrderServiceOp) Open added in v1.3.18

func (s *FulfillmentOrderServiceOp) Open(ctx context.Context, fulfillmentId uint64) (*FulfillmentOrder, error)

Open marks the fulfillment order as open

func (*FulfillmentOrderServiceOp) ReleaseHold added in v1.3.18

func (s *FulfillmentOrderServiceOp) ReleaseHold(ctx context.Context, fulfillmentId uint64) (*FulfillmentOrder, error)

ReleaseHold releases the fulfillment hold on a fulfillment order

func (*FulfillmentOrderServiceOp) Reschedule added in v1.3.18

func (s *FulfillmentOrderServiceOp) Reschedule(ctx context.Context, fulfillmentId uint64) (*FulfillmentOrder, error)

Reschedule reschedules the fulfill_at time of a scheduled fulfillment order

func (*FulfillmentOrderServiceOp) SetDeadline added in v1.3.18

func (s *FulfillmentOrderServiceOp) SetDeadline(ctx context.Context, fulfillmentIds []uint64, deadline time.Time) error

SetDeadline sets deadline for fulfillment orders

type FulfillmentOrdersResource added in v1.3.18

type FulfillmentOrdersResource struct {
	FulfillmentOrders []FulfillmentOrder `json:"fulfillment_orders"`
}

FulfillmentOrdersResource represents the result from the fulfillment_orders.json endpoint

type FulfillmentRequest added in v1.3.18

type FulfillmentRequest struct {
	Message                   string                       `json:"message,omitempty"`
	FulfillmentOrderLineItems []FulfillmentOrderLineItem   `json:"fulfillment_order_line_items,omitempty"`
	Reason                    string                       `json:"reason,omitempty"`
	LineItems                 []FulfillmentRequestLineItem `json:"line_items,omitempty"`
}

type FulfillmentRequestLineItem added in v1.3.18

type FulfillmentRequestLineItem struct {
	FulfillmentOrderLineItemId uint64 `json:"fulfillment_order_line_item_id,omitempty"`
	Message                    string `json:"message,omitempty"`
}

type FulfillmentRequestOrderLineItem added in v1.3.18

type FulfillmentRequestOrderLineItem struct {
	Id       uint64 `json:"id"`
	Quantity uint64 `json:"quantity"`
}

type FulfillmentRequestResource added in v1.3.18

type FulfillmentRequestResource struct {
	FulfillmentOrder         *FulfillmentOrder  `json:"fulfillment_order,omitempty"`
	FulfillmentRequest       FulfillmentRequest `json:"fulfillment_request,omitempty"`
	OriginalFulfillmentOrder *FulfillmentOrder  `json:"original_fulfillment_order,omitempty"`
}

type FulfillmentRequestService added in v1.3.18

FulfillmentRequestService is an interface for interfacing with the fulfillment request endpoints of the Shopify API. https://shopify.dev/docs/api/admin-rest/2023-10/resources/fulfillmentrequest

type FulfillmentRequestServiceOp added in v1.3.18

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

FulfillmentRequestServiceOp handles communication with the fulfillment request related methods of the Shopify API.

func (*FulfillmentRequestServiceOp) Accept added in v1.3.18

func (s *FulfillmentRequestServiceOp) Accept(ctx context.Context, fulfillmentOrderId uint64, request FulfillmentRequest) (*FulfillmentOrder, error)

Accept accepts a fulfillment request sent to a fulfillment service for a fulfillment order.

func (*FulfillmentRequestServiceOp) Reject added in v1.3.18

func (s *FulfillmentRequestServiceOp) Reject(ctx context.Context, fulfillmentOrderId uint64, request FulfillmentRequest) (*FulfillmentOrder, error)

Reject rejects a fulfillment request sent to a fulfillment service for a fulfillment order.

func (*FulfillmentRequestServiceOp) Send added in v1.3.18

func (s *FulfillmentRequestServiceOp) Send(ctx context.Context, fulfillmentOrderId uint64, request FulfillmentRequest) (*FulfillmentOrder, error)

Send sends a fulfillment request to the fulfillment service of a fulfillment order.

type FulfillmentResource

type FulfillmentResource struct {
	Fulfillment *Fulfillment `json:"fulfillment"`
}

FulfillmentResource represents the result from the fulfillments/X.json endpoint

type FulfillmentService

type FulfillmentService interface {
	List(context.Context, interface{}) ([]Fulfillment, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Fulfillment, error)
	Create(context.Context, Fulfillment) (*Fulfillment, error)
	Update(context.Context, Fulfillment) (*Fulfillment, error)
	Complete(context.Context, uint64) (*Fulfillment, error)
	Transition(context.Context, uint64) (*Fulfillment, error)
	Cancel(context.Context, uint64) (*Fulfillment, error)
}

FulfillmentService is an interface for interfacing with the fulfillment endpoints of the Shopify API. https://help.shopify.com/api/reference/fulfillment

type FulfillmentServiceData added in v1.3.18

type FulfillmentServiceData struct {
	Id                     uint64 `json:"id,omitempty"`
	Name                   string `json:"name,omitempty"`
	Email                  string `json:"email,omitempty"`
	ServiceName            string `json:"service_name,omitempty"`
	Handle                 string `json:"handle,omitempty"`
	FulfillmentOrdersOptIn bool   `json:"fulfillment_orders_opt_in,omitempty"`
	IncludePendingStock    bool   `json:"include_pending_stock,omitempty"`
	ProviderId             uint64 `json:"provider_id,omitempty"`
	LocationId             uint64 `json:"location_id,omitempty"`
	CallbackURL            string `json:"callback_url,omitempty"`
	TrackingSupport        bool   `json:"tracking_support,omitempty"`
	InventoryManagement    bool   `json:"inventory_management,omitempty"`
	AdminGraphqlApiId      string `json:"admin_graphql_api_id,omitempty"`
	PermitsSkuSharing      bool   `json:"permits_sku_sharing,omitempty"`
	RequiresShippingMethod bool   `json:"requires_shipping_method,omitempty"`
	Format                 string `json:"format,omitempty"`
}

type FulfillmentServiceOp

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

FulfillmentServiceOp handles communication with the fulfillment related methods of the Shopify API.

func (*FulfillmentServiceOp) Cancel

func (s *FulfillmentServiceOp) Cancel(ctx context.Context, fulfillmentId uint64) (*Fulfillment, error)

Cancel an existing fulfillment

func (*FulfillmentServiceOp) Complete

func (s *FulfillmentServiceOp) Complete(ctx context.Context, fulfillmentId uint64) (*Fulfillment, error)

Complete an existing fulfillment

func (*FulfillmentServiceOp) Count

func (s *FulfillmentServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count fulfillments

func (*FulfillmentServiceOp) Create

func (s *FulfillmentServiceOp) Create(ctx context.Context, fulfillment Fulfillment) (*Fulfillment, error)

Create a new fulfillment

func (*FulfillmentServiceOp) Get

func (s *FulfillmentServiceOp) Get(ctx context.Context, fulfillmentId uint64, options interface{}) (*Fulfillment, error)

Get individual fulfillment

func (*FulfillmentServiceOp) List

func (s *FulfillmentServiceOp) List(ctx context.Context, options interface{}) ([]Fulfillment, error)

List fulfillments

func (*FulfillmentServiceOp) Transition

func (s *FulfillmentServiceOp) Transition(ctx context.Context, fulfillmentId uint64) (*Fulfillment, error)

Transition an existing fulfillment

func (*FulfillmentServiceOp) Update

func (s *FulfillmentServiceOp) Update(ctx context.Context, fulfillment Fulfillment) (*Fulfillment, error)

Update an existing fulfillment

type FulfillmentServiceOptions added in v1.3.18

type FulfillmentServiceOptions struct {
	Scope string `url:"scope,omitempty"`
}

type FulfillmentServiceResource added in v1.3.18

type FulfillmentServiceResource struct {
	FulfillmentService *FulfillmentServiceData `json:"fulfillment_service,omitempty"`
}

type FulfillmentServiceService added in v1.3.18

FulfillmentServiceService is an interface for interfacing with the fulfillment service of the Shopify API. https://help.shopify.com/api/reference/fulfillmentservice

type FulfillmentServiceServiceOp added in v1.3.18

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

FulfillmentServiceServiceOp handles communication with the FulfillmentServices related methods of the Shopify API

func (*FulfillmentServiceServiceOp) Create added in v1.3.18

Create Create a new FulfillmentServiceData

func (*FulfillmentServiceServiceOp) Delete added in v1.3.18

func (s *FulfillmentServiceServiceOp) Delete(ctx context.Context, fulfillmentServiceId uint64) error

Delete Remove an existing FulfillmentServiceData

func (*FulfillmentServiceServiceOp) Get added in v1.3.18

func (s *FulfillmentServiceServiceOp) Get(ctx context.Context, fulfillmentServiceId uint64, options interface{}) (*FulfillmentServiceData, error)

Get Receive a single FulfillmentServiceData

func (*FulfillmentServiceServiceOp) List added in v1.3.18

func (s *FulfillmentServiceServiceOp) List(ctx context.Context, options interface{}) ([]FulfillmentServiceData, error)

List Receive a list of all FulfillmentServiceData

func (*FulfillmentServiceServiceOp) Update added in v1.3.18

Update Modify an existing FulfillmentServiceData

type FulfillmentServicesResource added in v1.3.18

type FulfillmentServicesResource struct {
	FulfillmentServices []FulfillmentServiceData `json:"fulfillment_services,omitempty"`
}

type FulfillmentTrackingInfo added in v1.3.18

type FulfillmentTrackingInfo struct {
	Company string `json:"company,omitempty"`
	Number  string `json:"number,omitempty"`
	Url     string `json:"url,omitempty"`
}

FulfillmentTrackingInfo represents the tracking information used to create a Fulfillment. https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments

type FulfillmentsResource

type FulfillmentsResource struct {
	Fulfillments []Fulfillment `json:"fulfillments"`
}

FulfillmentsResource represents the result from the fullfilments.json endpoint

type FulfillmentsService

type FulfillmentsService interface {
	ListFulfillments(context.Context, uint64, interface{}) ([]Fulfillment, error)
	CountFulfillments(context.Context, uint64, interface{}) (int, error)
	GetFulfillment(context.Context, uint64, uint64, interface{}) (*Fulfillment, error)
	CreateFulfillment(context.Context, uint64, Fulfillment) (*Fulfillment, error)
	UpdateFulfillment(context.Context, uint64, Fulfillment) (*Fulfillment, error)
	CompleteFulfillment(context.Context, uint64, uint64) (*Fulfillment, error)
	TransitionFulfillment(context.Context, uint64, uint64) (*Fulfillment, error)
	CancelFulfillment(context.Context, uint64, uint64) (*Fulfillment, error)
}

FulfillmentsService is an interface for other Shopify resources to interface with the fulfillment endpoints of the Shopify API. https://help.shopify.com/api/reference/fulfillment

type GiftCard added in v1.3.18

type GiftCard struct {
	Id             uint64           `json:"id,omitempty"`
	ApiClientId    uint64           `json:"api_client_id,omitempty"`
	Balance        *decimal.Decimal `json:"balance,omitempty"`
	InitalValue    *decimal.Decimal `json:"initial_value,omitempty"`
	Code           string           `json:"code,omitempty"`
	Currency       string           `json:"currency,omitempty"`
	CustomerId     *CustomerId      `json:"customer_id,omitempty"`
	CreatedAt      *time.Time       `json:"created_at,omitempty"`
	DisabledAt     *time.Time       `json:"disabled_at,omitempty"`
	ExpiresOn      string           `json:"expires_on,omitempty"`
	LastCharacters string           `json:"last_characters,omitempty"`
	LineItemId     uint64           `json:"line_item_id,omitempty"`
	Note           string           `json:"note,omitempty"`
	OrderId        uint64           `json:"order_id,omitempty"`
	TemplateSuffix string           `json:"template_suffix,omitempty"`
	UserId         uint64           `json:"user_id,omitempty"`
	UpdatedAt      *time.Time       `json:"updated_at,omitempty"`
}

giftCard represents a Shopify discount rule

type GiftCardResource added in v1.3.18

type GiftCardResource struct {
	GiftCard *GiftCard `json:"gift_card"`
}

giftCardResource represents the result from the gift_cards/X.json endpoint

type GiftCardService added in v1.3.18

type GiftCardService interface {
	Get(context.Context, uint64) (*GiftCard, error)
	Create(context.Context, GiftCard) (*GiftCard, error)
	Update(context.Context, GiftCard) (*GiftCard, error)
	List(context.Context) ([]GiftCard, error)
	Disable(context.Context, uint64) (*GiftCard, error)
	Count(context.Context, interface{}) (int, error)
}

giftCardService is an interface for interfacing with the gift card endpoints of the Shopify API. See: https://shopify.dev/docs/api/admin-rest/2023-04/resources/gift-card

type GiftCardServiceOp added in v1.3.18

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

giftCardServiceOp handles communication with the gift card related methods of the Shopify API.

func (*GiftCardServiceOp) Count added in v1.3.18

func (s *GiftCardServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count retrieves the number of gift cards

func (*GiftCardServiceOp) Create added in v1.3.18

func (s *GiftCardServiceOp) Create(ctx context.Context, pr GiftCard) (*GiftCard, error)

Create creates a gift card

func (*GiftCardServiceOp) Disable added in v1.3.18

func (s *GiftCardServiceOp) Disable(ctx context.Context, giftCardId uint64) (*GiftCard, error)

Disable disables an existing a gift card

func (*GiftCardServiceOp) Get added in v1.3.18

func (s *GiftCardServiceOp) Get(ctx context.Context, giftCardId uint64) (*GiftCard, error)

Get retrieves a single gift cards

func (*GiftCardServiceOp) List added in v1.3.18

func (s *GiftCardServiceOp) List(ctx context.Context) ([]GiftCard, error)

List retrieves a list of gift cards

func (*GiftCardServiceOp) Update added in v1.3.18

func (s *GiftCardServiceOp) Update(ctx context.Context, pr GiftCard) (*GiftCard, error)

Update updates an existing a gift card

type GiftCardsResource added in v1.3.18

type GiftCardsResource struct {
	GiftCards []GiftCard `json:"gift_cards"`
}

giftCardsResource represents the result from the gift_cards.json endpoint

type GraphQLCost added in v1.3.18

type GraphQLCost struct {
	RequestedQueryCost int                   `json:"requestedQueryCost"`
	ActualQueryCost    *int                  `json:"actualQueryCost"`
	ThrottleStatus     GraphQLThrottleStatus `json:"throttleStatus"`
}

GraphQLCost represents the cost of the graphql query

func (GraphQLCost) RetryAfterSeconds added in v1.3.18

func (c GraphQLCost) RetryAfterSeconds() float64

RetryAfterSeconds returns the estimated retry after seconds based on the requested query cost and throttle status

type GraphQLService added in v1.3.18

type GraphQLService interface {
	Query(context.Context, string, interface{}, interface{}) error
}

GraphQLService is an interface to interact with the graphql endpoint of the Shopify API See https://shopify.dev/docs/admin-api/graphql/reference

type GraphQLServiceOp added in v1.3.18

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

GraphQLServiceOp handles communication with the graphql endpoint of the Shopify API.

func (*GraphQLServiceOp) Query added in v1.3.18

func (s *GraphQLServiceOp) Query(ctx context.Context, q string, vars, resp interface{}) error

Query creates a graphql query against the Shopify API the "data" portion of the response is unmarshalled into resp

type GraphQLThrottleStatus added in v1.3.18

type GraphQLThrottleStatus struct {
	MaximumAvailable   float64 `json:"maximumAvailable"`
	CurrentlyAvailable float64 `json:"currentlyAvailable"`
	RestoreRate        float64 `json:"restoreRate"`
}

GraphQLThrottleStatus represents the status of the shop's rate limit points

type Image

type Image struct {
	Id                uint64     `json:"id,omitempty"`
	ProductId         uint64     `json:"product_id,omitempty"`
	Position          int        `json:"position,omitempty"`
	CreatedAt         *time.Time `json:"created_at,omitempty"`
	UpdatedAt         *time.Time `json:"updated_at,omitempty"`
	Width             int        `json:"width,omitempty"`
	Height            int        `json:"height,omitempty"`
	Src               string     `json:"src,omitempty"`
	Attachment        string     `json:"attachment,omitempty"`
	Filename          string     `json:"filename,omitempty"`
	VariantIds        []uint64   `json:"variant_ids,omitempty"`
	AdminGraphqlApiId string     `json:"admin_graphql_api_id,omitempty"`
}

Image represents a Shopify product's image.

type ImageResource

type ImageResource struct {
	Image *Image `json:"image"`
}

ImageResource represents the result form the products/X/images/Y.json endpoint

type ImageService

type ImageService interface {
	List(context.Context, uint64, interface{}) ([]Image, error)
	Count(context.Context, uint64, interface{}) (int, error)
	Get(context.Context, uint64, uint64, interface{}) (*Image, error)
	Create(context.Context, uint64, Image) (*Image, error)
	Update(context.Context, uint64, Image) (*Image, error)
	Delete(context.Context, uint64, uint64) error
}

ImageService is an interface for interacting with the image endpoints of the Shopify API. See https://help.shopify.com/api/reference/product_image

type ImageServiceOp

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

ImageServiceOp handles communication with the image related methods of the Shopify API.

func (*ImageServiceOp) Count

func (s *ImageServiceOp) Count(ctx context.Context, productId uint64, options interface{}) (int, error)

Count images

func (*ImageServiceOp) Create

func (s *ImageServiceOp) Create(ctx context.Context, productId uint64, image Image) (*Image, error)

Create a new image

There are 2 methods of creating an image in Shopify: 1. Src 2. Filename and Attachment

If both Image.Filename and Image.Attachment are supplied, then Image.Src is not needed. And vice versa.

If both Image.Attachment and Image.Src are provided, Shopify will take the attachment.

Shopify will accept Image.Attachment without Image.Filename.

func (*ImageServiceOp) Delete

func (s *ImageServiceOp) Delete(ctx context.Context, productId uint64, imageId uint64) error

Delete an existing image

func (*ImageServiceOp) Get

func (s *ImageServiceOp) Get(ctx context.Context, productId uint64, imageId uint64, options interface{}) (*Image, error)

Get individual image

func (*ImageServiceOp) List

func (s *ImageServiceOp) List(ctx context.Context, productId uint64, options interface{}) ([]Image, error)

List images

func (*ImageServiceOp) Update

func (s *ImageServiceOp) Update(ctx context.Context, productId uint64, image Image) (*Image, error)

Update an existing image

type ImagesResource

type ImagesResource struct {
	Images []Image `json:"images"`
}

ImagesResource represents the result from the products/X/images.json endpoint

type InventoryItem added in v1.3.18

type InventoryItem struct {
	Id                           uint64           `json:"id,omitempty"`
	SKU                          string           `json:"sku,omitempty"`
	CreatedAt                    *time.Time       `json:"created_at,omitempty"`
	UpdatedAt                    *time.Time       `json:"updated_at,omitempty"`
	Cost                         *decimal.Decimal `json:"cost,omitempty"`
	Tracked                      *bool            `json:"tracked,omitempty"`
	AdminGraphqlApiId            string           `json:"admin_graphql_api_id,omitempty"`
	CountryCodeOfOrigin          *string          `json:"country_code_of_origin"`
	CountryHarmonizedSystemCodes []string         `json:"country_harmonized_system_codes"`
	HarmonizedSystemCode         *string          `json:"harmonized_system_code"`
	ProvinceCodeOfOrigin         *string          `json:"province_code_of_origin"`
}

InventoryItem represents a Shopify inventory item

type InventoryItemResource added in v1.3.18

type InventoryItemResource struct {
	InventoryItem *InventoryItem `json:"inventory_item"`
}

InventoryItemResource is used for handling single item requests and responses

type InventoryItemService added in v1.3.18

type InventoryItemService interface {
	List(context.Context, interface{}) ([]InventoryItem, error)
	Get(context.Context, uint64, interface{}) (*InventoryItem, error)
	Update(context.Context, InventoryItem) (*InventoryItem, error)
}

InventoryItemService is an interface for interacting with the inventory items endpoints of the Shopify API See https://help.shopify.com/en/api/reference/inventory/inventoryitem

type InventoryItemServiceOp added in v1.3.18

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

InventoryItemServiceOp is the default implementation of the InventoryItemService interface

func (*InventoryItemServiceOp) Get added in v1.3.18

func (s *InventoryItemServiceOp) Get(ctx context.Context, id uint64, options interface{}) (*InventoryItem, error)

Get a inventory item

func (*InventoryItemServiceOp) List added in v1.3.18

func (s *InventoryItemServiceOp) List(ctx context.Context, options interface{}) ([]InventoryItem, error)

List inventory items

func (*InventoryItemServiceOp) Update added in v1.3.18

Update a inventory item

type InventoryItemsResource added in v1.3.18

type InventoryItemsResource struct {
	InventoryItems []InventoryItem `json:"inventory_items"`
}

InventoryItemsResource is used for handling multiple item responsees

type InventoryLevel added in v1.3.18

type InventoryLevel struct {
	InventoryItemId   uint64     `json:"inventory_item_id,omitempty"`
	LocationId        uint64     `json:"location_id,omitempty"`
	Available         int        `json:"available"`
	CreatedAt         *time.Time `json:"created_at,omitempty"`
	UpdatedAt         *time.Time `json:"updated_at,omitempty"`
	AdminGraphqlApiId string     `json:"admin_graphql_api_id,omitempty"`
}

InventoryLevel represents a Shopify inventory level

type InventoryLevelAdjustOptions added in v1.3.18

type InventoryLevelAdjustOptions struct {
	InventoryItemId uint64 `json:"inventory_item_id"`
	LocationId      uint64 `json:"location_id"`
	Adjust          int    `json:"available_adjustment"`
}

InventoryLevelAdjustOptions is used for Adjust inventory levels

type InventoryLevelListOptions added in v1.3.18

type InventoryLevelListOptions struct {
	InventoryItemIds []uint64  `url:"inventory_item_ids,omitempty,comma"`
	LocationIds      []uint64  `url:"location_ids,omitempty,comma"`
	Limit            int       `url:"limit,omitempty"`
	UpdatedAtMin     time.Time `url:"updated_at_min,omitempty"`
}

InventoryLevelListOptions is used for get list

type InventoryLevelResource added in v1.3.18

type InventoryLevelResource struct {
	InventoryLevel *InventoryLevel `json:"inventory_level"`
}

InventoryLevelResource is used for handling single level requests and responses

type InventoryLevelService added in v1.3.18

type InventoryLevelService interface {
	List(context.Context, interface{}) ([]InventoryLevel, error)
	Adjust(context.Context, interface{}) (*InventoryLevel, error)
	Delete(context.Context, uint64, uint64) error
	Connect(context.Context, InventoryLevel) (*InventoryLevel, error)
	Set(context.Context, InventoryLevel) (*InventoryLevel, error)
}

InventoryLevelService is an interface for interacting with the inventory items endpoints of the Shopify API See https://help.shopify.com/en/api/reference/inventory/inventorylevel

type InventoryLevelServiceOp added in v1.3.18

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

InventoryLevelServiceOp is the default implementation of the InventoryLevelService interface

func (*InventoryLevelServiceOp) Adjust added in v1.3.18

func (s *InventoryLevelServiceOp) Adjust(ctx context.Context, options interface{}) (*InventoryLevel, error)

Adjust the inventory level of an inventory item at a single location

func (*InventoryLevelServiceOp) Connect added in v1.3.18

Connect an inventory level

func (*InventoryLevelServiceOp) Delete added in v1.3.18

func (s *InventoryLevelServiceOp) Delete(ctx context.Context, itemId, locationId uint64) error

Delete an inventory level

func (*InventoryLevelServiceOp) List added in v1.3.18

func (s *InventoryLevelServiceOp) List(ctx context.Context, options interface{}) ([]InventoryLevel, error)

List inventory levels

func (*InventoryLevelServiceOp) Set added in v1.3.18

Set an inventory level

type InventoryLevelsResource added in v1.3.18

type InventoryLevelsResource struct {
	InventoryLevels []InventoryLevel `json:"inventory_levels"`
}

InventoryLevelsResource is used for handling multiple item responsees

type LeveledLogger added in v1.3.18

type LeveledLogger struct {
	// Level is the minimum logging level that will be emitted by this logger.
	//
	// For example, a Level set to LevelWarn will emit warnings and errors, but
	// not informational or debug messages.
	//
	// Always set this with a constant like LevelWarn because the individual
	// values are not guaranteed to be stable.
	Level int
	// contains filtered or unexported fields
}

It prints warnings and errors to `os.Stderr` and other messages to `os.Stdout`.

func (*LeveledLogger) Debugf added in v1.3.18

func (l *LeveledLogger) Debugf(format string, v ...interface{})

Debugf logs a debug message using Printf conventions.

func (*LeveledLogger) Errorf added in v1.3.18

func (l *LeveledLogger) Errorf(format string, v ...interface{})

Errorf logs a warning message using Printf conventions.

func (*LeveledLogger) Infof added in v1.3.18

func (l *LeveledLogger) Infof(format string, v ...interface{})

Infof logs an informational message using Printf conventions.

func (*LeveledLogger) Warnf added in v1.3.18

func (l *LeveledLogger) Warnf(format string, v ...interface{})

Warnf logs a warning message using Printf conventions.

type LeveledLoggerInterface added in v1.3.18

type LeveledLoggerInterface interface {
	Debugf(format string, v ...interface{})
	Errorf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Warnf(format string, v ...interface{})
}

type LineItem

type LineItem struct {
	Id                         uint64                 `json:"id,omitempty"`
	ProductId                  uint64                 `json:"product_id,omitempty"`
	VariantId                  uint64                 `json:"variant_id,omitempty"`
	Quantity                   int                    `json:"quantity,omitempty"`
	Price                      *decimal.Decimal       `json:"price,omitempty"`
	TotalDiscount              *decimal.Decimal       `json:"total_discount,omitempty"`
	Title                      string                 `json:"title,omitempty"`
	VariantTitle               string                 `json:"variant_title,omitempty"`
	Name                       string                 `json:"name,omitempty"`
	SKU                        string                 `json:"sku,omitempty"`
	Vendor                     string                 `json:"vendor,omitempty"`
	GiftCard                   bool                   `json:"gift_card,omitempty"`
	Taxable                    bool                   `json:"taxable,omitempty"`
	FulfillmentService         string                 `json:"fulfillment_service,omitempty"`
	RequiresShipping           bool                   `json:"requires_shipping,omitempty"`
	VariantInventoryManagement string                 `json:"variant_inventory_management,omitempty"`
	PreTaxPrice                *decimal.Decimal       `json:"pre_tax_price,omitempty"`
	Properties                 []NoteAttribute        `json:"properties,omitempty"`
	ProductExists              bool                   `json:"product_exists,omitempty"`
	FulfillableQuantity        int                    `json:"fulfillable_quantity,omitempty"`
	Grams                      int                    `json:"grams,omitempty"`
	FulfillmentStatus          orderFulfillmentStatus `json:"fulfillment_status,omitempty"`
	TaxLines                   []TaxLine              `json:"tax_lines,omitempty"`

	// Deprecated: See 2022-10 release notes: https://shopify.dev/docs/api/release-notes/2022-10
	OriginLocation *Address `json:"origin_location,omitempty"`

	// Deprecated: See 2022-10 release notes: https://shopify.dev/docs/api/release-notes/2022-10
	DestinationLocation *Address `json:"destination_location,omitempty"`

	AppliedDiscount     *AppliedDiscount      `json:"applied_discount,omitempty"`
	DiscountAllocations []DiscountAllocations `json:"discount_allocations,omitempty"`
}

func (*LineItem) UnmarshalJSON added in v1.3.18

func (li *LineItem) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarsaller for LineItem required to mitigate some older orders having LineItem.Properies which are empty JSON objects rather than the expected array.

type LineItemByFulfillmentOrder added in v1.3.18

type LineItemByFulfillmentOrder struct {
	FulfillmentOrderId        uint64                                   `json:"fulfillment_order_id,omitempty"`
	FulfillmentOrderLineItems []LineItemByFulfillmentOrderItemQuantity `json:"fulfillment_order_line_items,omitempty"`
}

LineItemByFulfillmentOrder represents the FulfillmentOrders (and optionally the items) used to create a Fulfillment. https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments

type LineItemByFulfillmentOrderItemQuantity added in v1.3.18

type LineItemByFulfillmentOrderItemQuantity struct {
	Id       uint64 `json:"id"`
	Quantity uint64 `json:"quantity"`
}

LineItemByFulfillmentOrderItemQuantity represents the quantity to fulfill for one item.

type LineItemProperty

type LineItemProperty struct {
	Message string `json:"message"`
}

type ListCarrierResource added in v1.3.18

type ListCarrierResource struct {
	CarrierServices []CarrierService `json:"carrier_services"`
}

type ListOptions

type ListOptions struct {
	// PageInfo is used with new pagination search.
	PageInfo string `url:"page_info,omitempty"`

	// Page is used to specify a specific page to load.
	// It is the deprecated way to do pagination.
	Page         int       `url:"page,omitempty"`
	Limit        int       `url:"limit,omitempty"`
	SinceId      *uint64   `url:"since_id,omitempty"`
	CreatedAtMin time.Time `url:"created_at_min,omitempty"`
	CreatedAtMax time.Time `url:"created_at_max,omitempty"`
	UpdatedAtMin time.Time `url:"updated_at_min,omitempty"`
	UpdatedAtMax time.Time `url:"updated_at_max,omitempty"`
	Order        string    `url:"order,omitempty"`
	Fields       string    `url:"fields,omitempty"`
	Vendor       string    `url:"vendor,omitempty"`
	Ids          []uint64  `url:"ids,omitempty,comma"`
}

General list options that can be used for most collections of entities.

type Location added in v1.3.18

type Location struct {
	// Whether the location is active.If true, then the location can be used to sell products,
	// stock inventory, and fulfill orders.Merchants can deactivate locations from the Shopify admin.
	// Deactivated locations don't contribute to the shop's location limit.
	Active bool `json:"active"`

	// The first line of the address.
	Address1 string `json:"address1"`

	// The second line of the address.
	Address2 string `json:"address2"`

	// The city the location is in.
	City string `json:"city"`

	// The country the location is in.
	Country string `json:"country"`

	// The two-letter code (ISO 3166-1 alpha-2 format) corresponding to country the location is in.
	CountryCode string `json:"country_code"`

	CountryName string `json:"country_name"`

	// The date and time (ISO 8601 format) when the location was created.
	CreatedAt time.Time `json:"created_at"`

	// The Id for the location.
	Id uint64 `json:"id"`

	// Whether this is a fulfillment service location.
	// If true, then the location is a fulfillment service location.
	// If false, then the location was created by the merchant and isn't tied to a fulfillment service.
	Legacy bool `json:"legacy"`

	// The name of the location.
	Name string `json:"name"`

	// The phone number of the location.This value can contain special characters like - and +.
	Phone string `json:"phone"`

	// The province the location is in.
	Province string `json:"province"`

	// The two-letter code corresponding to province or state the location is in.
	ProvinceCode string `json:"province_code"`

	// The date and time (ISO 8601 format) when the location was last updated.
	UpdatedAt time.Time `json:"updated_at"`

	// The zip or postal code.
	Zip string `json:"zip"`

	AdminGraphqlApiId string `json:"admin_graphql_api_id"`
}

type LocationResource added in v1.3.18

type LocationResource struct {
	Location *Location `json:"location"`
}

Represents the result from the locations/X.json endpoint

type LocationService added in v1.3.18

type LocationService interface {
	// Retrieves a list of locations
	List(ctx context.Context, options interface{}) ([]Location, error)
	// Retrieves a single location by its Id
	Get(ctx context.Context, id uint64, options interface{}) (*Location, error)
	// Retrieves a count of locations
	Count(ctx context.Context, options interface{}) (int, error)
}

LocationService is an interface for interfacing with the location endpoints of the Shopify API. See: https://help.shopify.com/en/api/reference/inventory/location

type LocationServiceOp added in v1.3.18

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

LocationServiceOp handles communication with the location related methods of the Shopify API.

func (*LocationServiceOp) Count added in v1.3.18

func (s *LocationServiceOp) Count(ctx context.Context, options interface{}) (int, error)

func (*LocationServiceOp) Get added in v1.3.18

func (s *LocationServiceOp) Get(ctx context.Context, id uint64, options interface{}) (*Location, error)

func (*LocationServiceOp) List added in v1.3.18

func (s *LocationServiceOp) List(ctx context.Context, options interface{}) ([]Location, error)

type LocationsResource added in v1.3.18

type LocationsResource struct {
	Locations []Location `json:"locations"`
}

Represents the result from the locations.json endpoint

type Metafield

type Metafield struct {
	CreatedAt         *time.Time    `json:"created_at,omitempty"`
	Description       string        `json:"description,omitempty"`    // Description of the metafield.
	Id                uint64        `json:"id,omitempty"`             // Assigned by Shopify, used for updating a metafield.
	Key               string        `json:"key,omitempty"`            // The unique identifier for a metafield within its namespace, 3-64 characters long.
	Namespace         string        `json:"namespace,omitempty"`      // The container for a group of metafields, 3-255 characters long.
	OwnerId           uint64        `json:"owner_id,omitempty"`       // The unique Id of the resource the metafield is for, i.e.: an Order Id.
	OwnerResource     string        `json:"owner_resource,omitempty"` // The type of reserouce the metafield is for, i.e.: and Order.
	UpdatedAt         *time.Time    `json:"updated_at,omitempty"`     //
	Value             interface{}   `json:"value,omitempty"`          // The data stored in the metafield. Always stored as a string, use Type field for actual data type.
	Type              metafieldType `json:"type,omitempty"`           // One of Shopify's defined types, see metafieldType.
	AdminGraphqlApiId string        `json:"admin_graphql_api_id,omitempty"`
}

Metafield represents a Shopify metafield.

type MetafieldResource

type MetafieldResource struct {
	Metafield *Metafield `json:"metafield"`
}

MetafieldResource represents the result from the metafields/X.json endpoint

type MetafieldService

type MetafieldService interface {
	List(context.Context, interface{}) ([]Metafield, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Metafield, error)
	Create(context.Context, Metafield) (*Metafield, error)
	Update(context.Context, Metafield) (*Metafield, error)
	Delete(context.Context, uint64) error
}

MetafieldService is an interface for interfacing with the metafield endpoints of the Shopify API. https://help.shopify.com/api/reference/metafield

type MetafieldServiceOp

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

MetafieldServiceOp handles communication with the metafield related methods of the Shopify API.

func (*MetafieldServiceOp) Count

func (s *MetafieldServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count metafields

func (*MetafieldServiceOp) Create

func (s *MetafieldServiceOp) Create(ctx context.Context, metafield Metafield) (*Metafield, error)

Create a new metafield

func (*MetafieldServiceOp) Delete

func (s *MetafieldServiceOp) Delete(ctx context.Context, metafieldId uint64) error

Delete an existing metafield

func (*MetafieldServiceOp) Get

func (s *MetafieldServiceOp) Get(ctx context.Context, metafieldId uint64, options interface{}) (*Metafield, error)

Get individual metafield

func (*MetafieldServiceOp) List

func (s *MetafieldServiceOp) List(ctx context.Context, options interface{}) ([]Metafield, error)

List metafields

func (*MetafieldServiceOp) Update

func (s *MetafieldServiceOp) Update(ctx context.Context, metafield Metafield) (*Metafield, error)

Update an existing metafield

type MetafieldsResource

type MetafieldsResource struct {
	Metafields []Metafield `json:"metafields"`
}

MetafieldsResource represents the result from the metafields.json endpoint

type MetafieldsService

type MetafieldsService interface {
	ListMetafields(context.Context, uint64, interface{}) ([]Metafield, error)
	CountMetafields(context.Context, uint64, interface{}) (int, error)
	GetMetafield(context.Context, uint64, uint64, interface{}) (*Metafield, error)
	CreateMetafield(context.Context, uint64, Metafield) (*Metafield, error)
	UpdateMetafield(context.Context, uint64, Metafield) (*Metafield, error)
	DeleteMetafield(context.Context, uint64, uint64) error
}

MetafieldsService is an interface for other Shopify resources to interface with the metafield endpoints of the Shopify API. https://help.shopify.com/api/reference/metafield

type NoteAttribute

type NoteAttribute struct {
	Name  string      `json:"name,omitempty"`
	Value interface{} `json:"value,omitempty"`
}

type OnlyDate added in v1.3.18

type OnlyDate struct {
	time.Time
}

func (*OnlyDate) EncodeValues added in v1.3.18

func (c *OnlyDate) EncodeValues(key string, v *url.Values) error

It seems shopify accepts both the date with double-quotes and without them, so we just stick to the double-quotes for now.

func (*OnlyDate) MarshalJSON added in v1.3.18

func (c *OnlyDate) MarshalJSON() ([]byte, error)

func (*OnlyDate) String added in v1.3.18

func (c *OnlyDate) String() string

func (*OnlyDate) UnmarshalJSON added in v1.3.18

func (c *OnlyDate) UnmarshalJSON(b []byte) error

type Option added in v1.3.18

type Option func(c *Client)

Option is used to configure client with options

func WithHTTPClient added in v1.3.18

func WithHTTPClient(client *http.Client) Option

WithHTTPClient is used to set a custom http client

func WithLogger added in v1.3.18

func WithLogger(logger LeveledLoggerInterface) Option

func WithRetry added in v1.3.18

func WithRetry(retries int) Option

WithRetry sets the number of times a request will be retried if a rate limit or service unavailable error is returned. Rate limiting can be either REST API limits or GraphQL Cost limits

func WithVersion added in v1.3.18

func WithVersion(apiVersion string) Option

WithVersion optionally sets the api-version if the passed string is valid

type Order

type Order struct {
	Id                     uint64                  `json:"id,omitempty"`
	Name                   string                  `json:"name,omitempty"`
	Email                  string                  `json:"email,omitempty"`
	CreatedAt              *time.Time              `json:"created_at,omitempty"`
	UpdatedAt              *time.Time              `json:"updated_at,omitempty"`
	CancelledAt            *time.Time              `json:"cancelled_at,omitempty"`
	ClosedAt               *time.Time              `json:"closed_at,omitempty"`
	ProcessedAt            *time.Time              `json:"processed_at,omitempty"`
	Customer               *Customer               `json:"customer,omitempty"`
	BillingAddress         *Address                `json:"billing_address,omitempty"`
	ShippingAddress        *Address                `json:"shipping_address,omitempty"`
	Currency               string                  `json:"currency,omitempty"`
	TotalPrice             *decimal.Decimal        `json:"total_price,omitempty"`
	TotalPriceSet          *AmountSet              `json:"total_price_set,omitempty"`
	TotalShippingPriceSet  *AmountSet              `json:"total_shipping_price_set,omitempty"`
	CurrentTotalPrice      *decimal.Decimal        `json:"current_total_price,omitempty"`
	SubtotalPrice          *decimal.Decimal        `json:"subtotal_price,omitempty"`
	CurrentSubtotalPrice   *decimal.Decimal        `json:"current_subtotal_price,omitempty"`
	TotalDiscounts         *decimal.Decimal        `json:"total_discounts,omitempty"`
	CurrentTotalDiscounts  *decimal.Decimal        `json:"current_total_discounts,omitempty"`
	TotalLineItemsPrice    *decimal.Decimal        `json:"total_line_items_price,omitempty"`
	TaxesIncluded          bool                    `json:"taxes_included,omitempty"`
	TotalTax               *decimal.Decimal        `json:"total_tax,omitempty"`
	TotalTaxSet            *AmountSet              `json:"total_tax_set,omitempty"`
	CurrentTotalTax        *decimal.Decimal        `json:"current_total_tax,omitempty"`
	TaxLines               []TaxLine               `json:"tax_lines,omitempty"`
	TotalWeight            int                     `json:"total_weight,omitempty"`
	FinancialStatus        orderFinancialStatus    `json:"financial_status,omitempty"`
	Fulfillments           []Fulfillment           `json:"fulfillments,omitempty"`
	FulfillmentStatus      orderFulfillmentStatus  `json:"fulfillment_status,omitempty"`
	Token                  string                  `json:"token,omitempty"`
	CartToken              string                  `json:"cart_token,omitempty"`
	Number                 int                     `json:"number,omitempty"`
	OrderNumber            int                     `json:"order_number,omitempty"`
	Note                   string                  `json:"note,omitempty"`
	Test                   bool                    `json:"test,omitempty"`
	BrowserIp              string                  `json:"browser_ip,omitempty"`
	BuyerAcceptsMarketing  bool                    `json:"buyer_accepts_marketing,omitempty"`
	CancelReason           orderCancelReason       `json:"cancel_reason,omitempty"`
	NoteAttributes         []NoteAttribute         `json:"note_attributes,omitempty"`
	DiscountCodes          []DiscountCode          `json:"discount_codes,omitempty"`
	LineItems              []LineItem              `json:"line_items,omitempty"`
	ShippingLines          []ShippingLines         `json:"shipping_lines,omitempty"`
	Transactions           []Transaction           `json:"transactions,omitempty"`
	AppId                  int                     `json:"app_id,omitempty"`
	CustomerLocale         string                  `json:"customer_locale,omitempty"`
	LandingSite            string                  `json:"landing_site,omitempty"`
	ReferringSite          string                  `json:"referring_site,omitempty"`
	SourceName             string                  `json:"source_name,omitempty"`
	ClientDetails          *ClientDetails          `json:"client_details,omitempty"`
	Tags                   string                  `json:"tags,omitempty"`
	LocationId             uint64                  `json:"location_id,omitempty"`
	PaymentGatewayNames    []string                `json:"payment_gateway_names,omitempty"`
	ProcessingMethod       string                  `json:"processing_method,omitempty"`
	Refunds                []Refund                `json:"refunds,omitempty"`
	UserId                 uint64                  `json:"user_id,omitempty"`
	OrderStatusUrl         string                  `json:"order_status_url,omitempty"`
	Gateway                string                  `json:"gateway,omitempty"`
	Confirmed              bool                    `json:"confirmed,omitempty"`
	CheckoutToken          string                  `json:"checkout_token,omitempty"`
	Reference              string                  `json:"reference,omitempty"`
	SourceIdentifier       string                  `json:"source_identifier,omitempty"`
	SourceURL              string                  `json:"source_url,omitempty"`
	DeviceId               uint64                  `json:"device_id,omitempty"`
	Phone                  string                  `json:"phone,omitempty"`
	LandingSiteRef         string                  `json:"landing_site_ref,omitempty"`
	CheckoutId             uint64                  `json:"checkout_id,omitempty"`
	ContactEmail           string                  `json:"contact_email,omitempty"`
	Metafields             []Metafield             `json:"metafields,omitempty"`
	SendReceipt            bool                    `json:"send_receipt,omitempty"`
	SendFulfillmentReceipt bool                    `json:"send_fulfillment_receipt,omitempty"`
	PresentmentCurrency    string                  `json:"presentment_currency,omitempty"`
	InventoryBehaviour     orderInventoryBehaviour `json:"inventory_behaviour,omitempty"`
}

Order represents a Shopify order

type OrderAdjustment added in v1.3.18

type OrderAdjustment struct {
	Id           uint64              `json:"id,omitempty"`
	OrderId      uint64              `json:"order_id,omitempty"`
	RefundId     uint64              `json:"refund_id,omitempty"`
	Amount       *decimal.Decimal    `json:"amount,omitempty"`
	TaxAmount    *decimal.Decimal    `json:"tax_amount,omitempty"`
	Kind         OrderAdjustmentType `json:"kind,omitempty"`
	Reason       string              `json:"reason,omitempty"`
	AmountSet    *AmountSet          `json:"amount_set,omitempty"`
	TaxAmountSet *AmountSet          `json:"tax_amount_set,omitempty"`
}

type OrderAdjustmentType added in v1.3.18

type OrderAdjustmentType string
const (
	OrderAdjustmentTypeShippingRefund    OrderAdjustmentType = "shipping_refund"
	OrderAdjustmentTypeRefundDiscrepancy OrderAdjustmentType = "refund_discrepancy"
)

type OrderCancelOptions added in v1.3.18

type OrderCancelOptions struct {
	Amount   *decimal.Decimal `json:"amount,omitempty"`
	Currency string           `json:"currency,omitempty"`
	Restock  bool             `json:"restock,omitempty"`
	Reason   string           `json:"reason,omitempty"`
	Email    bool             `json:"email,omitempty"`
	Refund   *Refund          `json:"refund,omitempty"`
}

A struct of all available order cancel options. See: https://help.shopify.com/api/reference/order#index

type OrderCountOptions

type OrderCountOptions struct {
	Page              int                    `url:"page,omitempty"`
	Limit             int                    `url:"limit,omitempty"`
	SinceId           uint64                 `url:"since_id,omitempty"`
	CreatedAtMin      time.Time              `url:"created_at_min,omitempty"`
	CreatedAtMax      time.Time              `url:"created_at_max,omitempty"`
	UpdatedAtMin      time.Time              `url:"updated_at_min,omitempty"`
	UpdatedAtMax      time.Time              `url:"updated_at_max,omitempty"`
	Order             string                 `url:"order,omitempty"`
	Fields            string                 `url:"fields,omitempty"`
	Status            orderStatus            `url:"status,omitempty"`
	FinancialStatus   orderFinancialStatus   `url:"financial_status,omitempty"`
	FulfillmentStatus orderFulfillmentStatus `url:"fulfillment_status,omitempty"`
}

A struct for all available order count options

type OrderListOptions

type OrderListOptions struct {
	ListOptions
	Status            orderStatus            `url:"status,omitempty"`
	FinancialStatus   orderFinancialStatus   `url:"financial_status,omitempty"`
	FulfillmentStatus orderFulfillmentStatus `url:"fulfillment_status,omitempty"`
	ProcessedAtMin    time.Time              `url:"processed_at_min,omitempty"`
	ProcessedAtMax    time.Time              `url:"processed_at_max,omitempty"`
	Order             string                 `url:"order,omitempty"`
}

A struct for all available order list options. See: https://help.shopify.com/api/reference/order#index

type OrderResource

type OrderResource struct {
	Order *Order `json:"order"`
}

Represents the result from the orders/X.json endpoint

type OrderRisk added in v1.3.18

type OrderRisk struct {
	Id              uint64                  `json:"id,omitempty"`
	CheckoutId      uint64                  `json:"checkout_id,omitempty"`
	OrderId         uint64                  `json:"order_id,omitempty"`
	CauseCancel     bool                    `json:"cause_cancel,omitempty"`
	Display         bool                    `json:"display,omitempty"`
	MerchantMessage string                  `json:"merchant_message,omitempty"`
	Message         string                  `json:"message,omitempty"`
	Score           string                  `json:"score,omitempty"`
	Source          string                  `json:"source,omitempty"`
	Recommendation  orderRiskRecommendation `json:"recommendation,omitempty"`
}

OrderRisk represents a Shopify order risk

type OrderRiskListOptions added in v1.3.18

type OrderRiskListOptions struct {
	ListOptions
}

A struct for all available order Risk list options. See: https://shopify.dev/docs/api/admin-rest/2023-10/resources/order-risk#index

type OrderRiskResource added in v1.3.18

type OrderRiskResource struct {
	OrderRisk *OrderRisk `json:"risk"`
}

Represents the result from the orders-risk/X.json endpoint

type OrderRiskService added in v1.3.18

type OrderRiskService interface {
	List(context.Context, uint64, interface{}) ([]OrderRisk, error)
	ListWithPagination(context.Context, uint64, interface{}) ([]OrderRisk, *Pagination, error)
	Get(context.Context, uint64, uint64, interface{}) (*OrderRisk, error)
	Create(context.Context, uint64, OrderRisk) (*OrderRisk, error)
	Update(context.Context, uint64, uint64, OrderRisk) (*OrderRisk, error)
	Delete(context.Context, uint64, uint64) error
}

OrderRiskService is an interface for interfacing with the orders Risk endpoints of the Shopify API. See: https://shopify.dev/docs/api/admin-rest/2023-10/resources/order-risk

type OrderRiskServiceOp added in v1.3.18

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

OrderRiskServiceOp handles communication with the order related methods of the Shopify API.

func (*OrderRiskServiceOp) Create added in v1.3.18

func (s *OrderRiskServiceOp) Create(ctx context.Context, orderId uint64, orderRisk OrderRisk) (*OrderRisk, error)

Create order

func (*OrderRiskServiceOp) Delete added in v1.3.18

func (s *OrderRiskServiceOp) Delete(ctx context.Context, orderId uint64, riskId uint64) error

Delete order

func (*OrderRiskServiceOp) Get added in v1.3.18

func (s *OrderRiskServiceOp) Get(ctx context.Context, orderId uint64, riskId uint64, options interface{}) (*OrderRisk, error)

Get individual order

func (*OrderRiskServiceOp) List added in v1.3.18

func (s *OrderRiskServiceOp) List(ctx context.Context, orderId uint64, options interface{}) ([]OrderRisk, error)

List OrderRisk

func (*OrderRiskServiceOp) ListWithPagination added in v1.3.18

func (s *OrderRiskServiceOp) ListWithPagination(ctx context.Context, orderId uint64, options interface{}) ([]OrderRisk, *Pagination, error)

func (*OrderRiskServiceOp) Update added in v1.3.18

func (s *OrderRiskServiceOp) Update(ctx context.Context, orderId uint64, riskId uint64, orderRisk OrderRisk) (*OrderRisk, error)

Update order

type OrderService

type OrderService interface {
	List(context.Context, interface{}) ([]Order, error)
	ListWithPagination(context.Context, interface{}) ([]Order, *Pagination, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Order, error)
	Create(context.Context, Order) (*Order, error)
	Update(context.Context, Order) (*Order, error)
	Cancel(context.Context, uint64, interface{}) (*Order, error)
	Close(context.Context, uint64) (*Order, error)
	Open(context.Context, uint64) (*Order, error)
	Delete(context.Context, uint64) error

	// MetafieldsService used for Order resource to communicate with Metafields resource
	MetafieldsService

	// FulfillmentsService used for Order resource to communicate with Fulfillments resource
	FulfillmentsService
}

OrderService is an interface for interfacing with the orders endpoints of the Shopify API. See: https://help.shopify.com/api/reference/order

type OrderServiceOp

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

OrderServiceOp handles communication with the order related methods of the Shopify API.

func (*OrderServiceOp) Cancel added in v1.3.18

func (s *OrderServiceOp) Cancel(ctx context.Context, orderId uint64, options interface{}) (*Order, error)

Cancel order

func (*OrderServiceOp) CancelFulfillment

func (s *OrderServiceOp) CancelFulfillment(ctx context.Context, orderId uint64, fulfillmentId uint64) (*Fulfillment, error)

Cancel an existing fulfillment for an order

func (*OrderServiceOp) Close added in v1.3.18

func (s *OrderServiceOp) Close(ctx context.Context, orderId uint64) (*Order, error)

Close order

func (*OrderServiceOp) CompleteFulfillment

func (s *OrderServiceOp) CompleteFulfillment(ctx context.Context, orderId uint64, fulfillmentId uint64) (*Fulfillment, error)

Complete an existing fulfillment for an order

func (*OrderServiceOp) Count

func (s *OrderServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count orders

func (*OrderServiceOp) CountFulfillments

func (s *OrderServiceOp) CountFulfillments(ctx context.Context, orderId uint64, options interface{}) (int, error)

Count fulfillments for an order

func (*OrderServiceOp) CountMetafields

func (s *OrderServiceOp) CountMetafields(ctx context.Context, orderId uint64, options interface{}) (int, error)

Count metafields for an order

func (*OrderServiceOp) Create

func (s *OrderServiceOp) Create(ctx context.Context, order Order) (*Order, error)

Create order

func (*OrderServiceOp) CreateFulfillment

func (s *OrderServiceOp) CreateFulfillment(ctx context.Context, orderId uint64, fulfillment Fulfillment) (*Fulfillment, error)

Create a new fulfillment for an order

func (*OrderServiceOp) CreateMetafield

func (s *OrderServiceOp) CreateMetafield(ctx context.Context, orderId uint64, metafield Metafield) (*Metafield, error)

Create a new metafield for an order

func (*OrderServiceOp) Delete added in v1.3.18

func (s *OrderServiceOp) Delete(ctx context.Context, orderId uint64) error

Delete order

func (*OrderServiceOp) DeleteMetafield

func (s *OrderServiceOp) DeleteMetafield(ctx context.Context, orderId uint64, metafieldId uint64) error

Delete an existing metafield for an order

func (*OrderServiceOp) Get

func (s *OrderServiceOp) Get(ctx context.Context, orderId uint64, options interface{}) (*Order, error)

Get individual order

func (*OrderServiceOp) GetFulfillment

func (s *OrderServiceOp) GetFulfillment(ctx context.Context, orderId uint64, fulfillmentId uint64, options interface{}) (*Fulfillment, error)

Get individual fulfillment for an order

func (*OrderServiceOp) GetMetafield

func (s *OrderServiceOp) GetMetafield(ctx context.Context, orderId uint64, metafieldId uint64, options interface{}) (*Metafield, error)

Get individual metafield for an order

func (*OrderServiceOp) List

func (s *OrderServiceOp) List(ctx context.Context, options interface{}) ([]Order, error)

List orders

func (*OrderServiceOp) ListFulfillments

func (s *OrderServiceOp) ListFulfillments(ctx context.Context, orderId uint64, options interface{}) ([]Fulfillment, error)

List fulfillments for an order

func (*OrderServiceOp) ListMetafields

func (s *OrderServiceOp) ListMetafields(ctx context.Context, orderId uint64, options interface{}) ([]Metafield, error)

List metafields for an order

func (*OrderServiceOp) ListWithPagination added in v1.3.18

func (s *OrderServiceOp) ListWithPagination(ctx context.Context, options interface{}) ([]Order, *Pagination, error)

func (*OrderServiceOp) Open added in v1.3.18

func (s *OrderServiceOp) Open(ctx context.Context, orderId uint64) (*Order, error)

Open order

func (*OrderServiceOp) TransitionFulfillment

func (s *OrderServiceOp) TransitionFulfillment(ctx context.Context, orderId uint64, fulfillmentId uint64) (*Fulfillment, error)

Transition an existing fulfillment for an order

func (*OrderServiceOp) Update added in v1.3.18

func (s *OrderServiceOp) Update(ctx context.Context, order Order) (*Order, error)

Update order

func (*OrderServiceOp) UpdateFulfillment

func (s *OrderServiceOp) UpdateFulfillment(ctx context.Context, orderId uint64, fulfillment Fulfillment) (*Fulfillment, error)

Update an existing fulfillment for an order

func (*OrderServiceOp) UpdateMetafield

func (s *OrderServiceOp) UpdateMetafield(ctx context.Context, orderId uint64, metafield Metafield) (*Metafield, error)

Update an existing metafield for an order

type OrdersResource

type OrdersResource struct {
	Orders []Order `json:"orders"`
}

Represents the result from the orders.json endpoint

type OrdersRisksResource added in v1.3.18

type OrdersRisksResource struct {
	OrderRisk []OrderRisk `json:"risks"`
}

Represents the result from the orders-risk.json endpoint

type Page

type Page struct {
	Id             uint64      `json:"id,omitempty"`
	Author         string      `json:"author,omitempty"`
	Handle         string      `json:"handle,omitempty"`
	Title          string      `json:"title,omitempty"`
	CreatedAt      *time.Time  `json:"created_at,omitempty"`
	UpdatedAt      *time.Time  `json:"updated_at,omitempty"`
	BodyHTML       string      `json:"body_html,omitempty"`
	TemplateSuffix string      `json:"template_suffix,omitempty"`
	PublishedAt    *time.Time  `json:"published_at,omitempty"`
	ShopId         uint64      `json:"shop_id,omitempty"`
	Metafields     []Metafield `json:"metafields,omitempty"`
}

Page represents a Shopify page.

type PageResource

type PageResource struct {
	Page *Page `json:"page"`
}

PageResource represents the result from the pages/X.json endpoint

type PageService

type PageService interface {
	List(context.Context, interface{}) ([]Page, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Page, error)
	Create(context.Context, Page) (*Page, error)
	Update(context.Context, Page) (*Page, error)
	Delete(context.Context, uint64) error

	// MetafieldsService used for Pages resource to communicate with Metafields
	// resource
	MetafieldsService
}

PagesPageService is an interface for interacting with the pages endpoints of the Shopify API. See https://help.shopify.com/api/reference/online_store/page

type PageServiceOp

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

PageServiceOp handles communication with the page related methods of the Shopify API.

func (*PageServiceOp) Count

func (s *PageServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count pages

func (*PageServiceOp) CountMetafields

func (s *PageServiceOp) CountMetafields(ctx context.Context, pageId uint64, options interface{}) (int, error)

Count metafields for a page

func (*PageServiceOp) Create

func (s *PageServiceOp) Create(ctx context.Context, page Page) (*Page, error)

Create a new page

func (*PageServiceOp) CreateMetafield

func (s *PageServiceOp) CreateMetafield(ctx context.Context, pageId uint64, metafield Metafield) (*Metafield, error)

Create a new metafield for a page

func (*PageServiceOp) Delete

func (s *PageServiceOp) Delete(ctx context.Context, pageId uint64) error

Delete an existing page.

func (*PageServiceOp) DeleteMetafield

func (s *PageServiceOp) DeleteMetafield(ctx context.Context, pageId uint64, metafieldId uint64) error

Delete an existing metafield for a page

func (*PageServiceOp) Get

func (s *PageServiceOp) Get(ctx context.Context, pageId uint64, options interface{}) (*Page, error)

Get individual page

func (*PageServiceOp) GetMetafield

func (s *PageServiceOp) GetMetafield(ctx context.Context, pageId uint64, metafieldId uint64, options interface{}) (*Metafield, error)

Get individual metafield for a page

func (*PageServiceOp) List

func (s *PageServiceOp) List(ctx context.Context, options interface{}) ([]Page, error)

List pages

func (*PageServiceOp) ListMetafields

func (s *PageServiceOp) ListMetafields(ctx context.Context, pageId uint64, options interface{}) ([]Metafield, error)

List metafields for a page

func (*PageServiceOp) Update

func (s *PageServiceOp) Update(ctx context.Context, page Page) (*Page, error)

Update an existing page

func (*PageServiceOp) UpdateMetafield

func (s *PageServiceOp) UpdateMetafield(ctx context.Context, pageId uint64, metafield Metafield) (*Metafield, error)

Update an existing metafield for a page

type PagesResource

type PagesResource struct {
	Pages []Page `json:"pages"`
}

PagesResource represents the result from the pages.json endpoint

type Pagination added in v1.3.18

type Pagination struct {
	NextPageOptions     *ListOptions
	PreviousPageOptions *ListOptions
}

Pagination of results

type PaymentDetails

type PaymentDetails struct {
	AVSResultCode     string `json:"avs_result_code,omitempty"`
	CreditCardBin     string `json:"credit_card_bin,omitempty"`
	CVVResultCode     string `json:"cvv_result_code,omitempty"`
	CreditCardNumber  string `json:"credit_card_number,omitempty"`
	CreditCardCompany string `json:"credit_card_company,omitempty"`
}

type PaymentsTransactionResource added in v1.3.18

type PaymentsTransactionResource struct {
	PaymentsTransaction *PaymentsTransactions `json:"transaction"`
}

Represents the result from the PaymentsTransactions/X.json endpoint

type PaymentsTransactions added in v1.3.18

type PaymentsTransactions struct {
	Id                       uint64                    `json:"id,omitempty"`
	Type                     PaymentsTransactionsTypes `json:"type,omitempty"`
	Test                     bool                      `json:"test,omitempty"`
	PayoutId                 int                       `json:"payout_id,omitempty"`
	PayoutStatus             PayoutStatus              `json:"payout_status,omitempty"`
	Currency                 string                    `json:"currency,omitempty"`
	Amount                   string                    `json:"amount,omitempty"`
	Fee                      string                    `json:"fee,omitempty"`
	Net                      string                    `json:"net,omitempty"`
	SourceId                 int                       `json:"source_id,omitempty"`
	SourceType               string                    `json:"source_type,omitempty"`
	SourceOrderTransactionId int                       `json:"source_order_transaction_id,omitempty"`
	SourceOrderId            int                       `json:"source_order_id,omitempty"`
	ProcessedAt              OnlyDate                  `json:"processed_at,omitempty"`
}

PaymentsTransactions represents a Shopify Transactions

type PaymentsTransactionsListOptions added in v1.3.18

type PaymentsTransactionsListOptions struct {
	PageInfo     string       `url:"page_info,omitempty"`
	Limit        int          `url:"limit,omitempty"`
	Fields       string       `url:"fields,omitempty"`
	LastId       uint64       `url:"last_id,omitempty"`
	SinceId      uint64       `url:"since_id,omitempty"`
	PayoutId     uint64       `url:"payout_id,omitempty"`
	PayoutStatus PayoutStatus `url:"payout_status,omitempty"`
	DateMin      *OnlyDate    `url:"date_min,omitempty"`
	DateMax      *OnlyDate    `url:"date_max,omitempty"`
	ProcessedAt  *OnlyDate    `json:"processed_at,omitempty"`
}

A struct for all available PaymentsTransactions list options

type PaymentsTransactionsResource added in v1.3.18

type PaymentsTransactionsResource struct {
	PaymentsTransactions []PaymentsTransactions `json:"transactions"`
}

Represents the result from the PaymentsTransactions.json endpoint

type PaymentsTransactionsService added in v1.3.18

type PaymentsTransactionsService interface {
	List(context.Context, interface{}) ([]PaymentsTransactions, error)
	ListWithPagination(context.Context, interface{}) ([]PaymentsTransactions, *Pagination, error)
	Get(context.Context, uint64, interface{}) (*PaymentsTransactions, error)
}

PaymentsTransactionsService is an interface for interfacing with the Transactions endpoints of the Shopify API. See: https://shopify.dev/docs/api/admin-rest/2023-01/resources/transactions

type PaymentsTransactionsServiceOp added in v1.3.18

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

PaymentsTransactionsServiceOp handles communication with the transactions related methods of the Payment methods of Shopify API.

func (*PaymentsTransactionsServiceOp) Get added in v1.3.18

func (s *PaymentsTransactionsServiceOp) Get(ctx context.Context, payoutId uint64, options interface{}) (*PaymentsTransactions, error)

Get individual PaymentsTransactions

func (*PaymentsTransactionsServiceOp) List added in v1.3.18

func (s *PaymentsTransactionsServiceOp) List(ctx context.Context, options interface{}) ([]PaymentsTransactions, error)

List PaymentsTransactions

func (*PaymentsTransactionsServiceOp) ListWithPagination added in v1.3.18

func (s *PaymentsTransactionsServiceOp) ListWithPagination(ctx context.Context, options interface{}) ([]PaymentsTransactions, *Pagination, error)

type PaymentsTransactionsTypes added in v1.3.18

type PaymentsTransactionsTypes string
const (
	PaymentsTransactionsCharge             PaymentsTransactionsTypes = "charge"
	PaymentsTransactionsRefund             PaymentsTransactionsTypes = "refund"
	PaymentsTransactionsDispute            PaymentsTransactionsTypes = "dispute"
	PaymentsTransactionsReserve            PaymentsTransactionsTypes = "reserve"
	PaymentsTransactionsAdjustment         PaymentsTransactionsTypes = "adjustment"
	PaymentsTransactionsCredit             PaymentsTransactionsTypes = "credit"
	PaymentsTransactionsDebit              PaymentsTransactionsTypes = "debit"
	PaymentsTransactionsPayout             PaymentsTransactionsTypes = "payout"
	PaymentsTransactionsPayoutFailure      PaymentsTransactionsTypes = "payout_failure"
	PaymentsTransactionsPayoutCancellation PaymentsTransactionsTypes = "payout_cancellation"
)

type Payout added in v1.3.18

type Payout struct {
	Id       uint64          `json:"id,omitempty"`
	Date     OnlyDate        `json:"date,omitempty"`
	Currency string          `json:"currency,omitempty"`
	Amount   decimal.Decimal `json:"amount,omitempty"`
	Status   PayoutStatus    `json:"status,omitempty"`
}

Payout represents a Shopify payout

type PayoutResource added in v1.3.18

type PayoutResource struct {
	Payout *Payout `json:"payout"`
}

Represents the result from the payouts/X.json endpoint

type PayoutStatus added in v1.3.18

type PayoutStatus string
const (
	PayoutStatusScheduled PayoutStatus = "scheduled"
	PayoutStatusInTransit PayoutStatus = "in_transit"
	PayoutStatusPaid      PayoutStatus = "paid"
	PayoutStatusFailed    PayoutStatus = "failed"
	PayoutStatusCancelled PayoutStatus = "canceled"
)

type PayoutsListOptions added in v1.3.18

type PayoutsListOptions struct {
	PageInfo string       `url:"page_info,omitempty"`
	Limit    int          `url:"limit,omitempty"`
	Fields   string       `url:"fields,omitempty"`
	LastId   uint64       `url:"last_id,omitempty"`
	SinceId  uint64       `url:"since_id,omitempty"`
	Status   PayoutStatus `url:"status,omitempty"`
	DateMin  *OnlyDate    `url:"date_min,omitempty"`
	DateMax  *OnlyDate    `url:"date_max,omitempty"`
	Date     *OnlyDate    `url:"date,omitempty"`
}

A struct for all available payout list options

type PayoutsResource added in v1.3.18

type PayoutsResource struct {
	Payouts []Payout `json:"payouts"`
}

Represents the result from the payouts.json endpoint

type PayoutsService added in v1.3.18

type PayoutsService interface {
	List(context.Context, interface{}) ([]Payout, error)
	ListWithPagination(context.Context, interface{}) ([]Payout, *Pagination, error)
	Get(context.Context, uint64, interface{}) (*Payout, error)
}

PayoutsService is an interface for interfacing with the payouts endpoints of the Shopify API. See: https://shopify.dev/docs/api/admin-rest/2023-01/resources/payouts

type PayoutsServiceOp added in v1.3.18

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

PayoutsServiceOp handles communication with the payout related methods of the Shopify API.

func (*PayoutsServiceOp) Get added in v1.3.18

func (s *PayoutsServiceOp) Get(ctx context.Context, id uint64, options interface{}) (*Payout, error)

Get individual payout

func (*PayoutsServiceOp) List added in v1.3.18

func (s *PayoutsServiceOp) List(ctx context.Context, options interface{}) ([]Payout, error)

List payouts

func (*PayoutsServiceOp) ListWithPagination added in v1.3.18

func (s *PayoutsServiceOp) ListWithPagination(ctx context.Context, options interface{}) ([]Payout, *Pagination, error)

type PriceBasedShippingRate added in v1.3.18

type PriceBasedShippingRate struct {
	Id               uint64           `json:"id,omitempty"`
	ShippingZoneId   uint64           `json:"shipping_zone_id,omitempty"`
	Name             string           `json:"name,omitempty"`
	Price            *decimal.Decimal `json:"price,omitempty"`
	MinOrderSubtotal *decimal.Decimal `json:"min_order_subtotal,omitempty"`
	MaxOrderSubtotal *decimal.Decimal `json:"max_order_subtotal,omitempty"`
}

PriceBasedShippingRate represents a Shopify subtotal-constrained shipping rate

type PriceRule added in v1.3.18

type PriceRule struct {
	Id                                     uint64                                  `json:"id,omitempty"`
	Title                                  string                                  `json:"title,omitempty"`
	ValueType                              string                                  `json:"value_type,omitempty"`
	Value                                  *decimal.Decimal                        `json:"value,omitempty"`
	CustomerSelection                      string                                  `json:"customer_selection,omitempty"`
	TargetType                             string                                  `json:"target_type,omitempty"`
	TargetSelection                        string                                  `json:"target_selection,omitempty"`
	AllocationMethod                       string                                  `json:"allocation_method,omitempty"`
	AllocationLimit                        int                                     `json:"allocation_limit,omitempty"`
	OncePerCustomer                        bool                                    `json:"once_per_customer,omitempty"`
	UsageLimit                             int                                     `json:"usage_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"`
	EntitledProductIds                     []uint64                                `json:"entitled_product_ids,omitempty"`
	EntitledVariantIds                     []uint64                                `json:"entitled_variant_ids,omitempty"`
	EntitledCollectionIds                  []uint64                                `json:"entitled_collection_ids,omitempty"`
	EntitledCountryIds                     []uint64                                `json:"entitled_country_ids,omitempty"`
	PrerequisiteProductIds                 []uint64                                `json:"prerequisite_product_ids,omitempty"`
	PrerequisiteVariantIds                 []uint64                                `json:"prerequisite_variant_ids,omitempty"`
	PrerequisiteCollectionIds              []uint64                                `json:"prerequisite_collection_ids,omitempty"`
	PrerequisiteSavedSearchIds             []uint64                                `json:"prerequisite_saved_search_ids,omitempty"`
	PrerequisiteCustomerIds                []uint64                                `json:"prerequisite_customer_ids,omitempty"`
	PrerequisiteSubtotalRange              *prerequisiteSubtotalRange              `json:"prerequisite_subtotal_range,omitempty"`
	PrerequisiteQuantityRange              *prerequisiteQuantityRange              `json:"prerequisite_quantity_range,omitempty"`
	PrerequisiteShippingPriceRange         *prerequisiteShippingPriceRange         `json:"prerequisite_shipping_price_range,omitempty"`
	PrerequisiteToEntitlementQuantityRatio *prerequisiteToEntitlementQuantityRatio `json:"prerequisite_to_entitlement_quantity_ratio,omitempty"`
}

PriceRule represents a Shopify discount rule

func (*PriceRule) SetPrerequisiteQuantityRange added in v1.3.18

func (pr *PriceRule) SetPrerequisiteQuantityRange(greaterThanOrEqualTo *int)

SetPrerequisiteQuantityRange sets or clears the quantity range for which a cart must lie within to qualify for the price-rule

func (*PriceRule) SetPrerequisiteShippingPriceRange added in v1.3.18

func (pr *PriceRule) SetPrerequisiteShippingPriceRange(lessThanOrEqualTo *string) error

SetPrerequisiteShippingPriceRange sets or clears the shipping price range for which a cart must lie within to qualify for the price-rule

func (*PriceRule) SetPrerequisiteSubtotalRange added in v1.3.18

func (pr *PriceRule) SetPrerequisiteSubtotalRange(greaterThanOrEqualTo *string) error

SetPrerequisiteSubtotalRange sets or clears the subtotal range for which a cart must lie within to qualify for the price-rule

func (*PriceRule) SetPrerequisiteToEntitlementQuantityRatio added in v1.3.18

func (pr *PriceRule) SetPrerequisiteToEntitlementQuantityRatio(prerequisiteQuantity *int, entitledQuantity *int)

SetPrerequisiteToEntitlementQuantityRatio sets or clears the ratio between ordered items and entitled items (eg. buy X, get y free) for which a cart is eligible in the price-rule

type PriceRuleDiscountCode added in v1.3.18

type PriceRuleDiscountCode struct {
	Id          uint64     `json:"id,omitempty"`
	PriceRuleId uint64     `json:"price_rule_id,omitempty"`
	Code        string     `json:"code,omitempty"`
	UsageCount  int        `json:"usage_count,omitempty"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
}

PriceRuleDiscountCode represents a Shopify Discount Code

type PriceRuleResource added in v1.3.18

type PriceRuleResource struct {
	PriceRule *PriceRule `json:"price_rule"`
}

PriceRuleResource represents the result from the price_rules/X.json endpoint

type PriceRuleService added in v1.3.18

type PriceRuleService interface {
	Get(context.Context, uint64) (*PriceRule, error)
	Create(context.Context, PriceRule) (*PriceRule, error)
	Update(context.Context, PriceRule) (*PriceRule, error)
	List(context.Context) ([]PriceRule, error)
	ListWithPagination(context.Context, interface{}) ([]PriceRule, *Pagination, error)
	Delete(context.Context, uint64) error
}

PriceRuleService is an interface for interfacing with the price rule endpoints of the Shopify API. See: https://shopify.dev/docs/admin-api/rest/reference/discounts/pricerule

type PriceRuleServiceOp added in v1.3.18

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

PriceRuleServiceOp handles communication with the price rule related methods of the Shopify API.

func (*PriceRuleServiceOp) Create added in v1.3.18

func (s *PriceRuleServiceOp) Create(ctx context.Context, pr PriceRule) (*PriceRule, error)

Create creates a price rule

func (*PriceRuleServiceOp) Delete added in v1.3.18

func (s *PriceRuleServiceOp) Delete(ctx context.Context, priceRuleId uint64) error

Delete deletes a price rule

func (*PriceRuleServiceOp) Get added in v1.3.18

func (s *PriceRuleServiceOp) Get(ctx context.Context, priceRuleId uint64) (*PriceRule, error)

Get retrieves a single price rules

func (*PriceRuleServiceOp) List added in v1.3.18

func (s *PriceRuleServiceOp) List(ctx context.Context) ([]PriceRule, error)

List retrieves a list of price rules

func (*PriceRuleServiceOp) ListWithPagination added in v1.3.20

func (s *PriceRuleServiceOp) ListWithPagination(ctx context.Context, options interface{}) ([]PriceRule, *Pagination, error)

List price rules and return pagination to retrieve next/previous results.

func (*PriceRuleServiceOp) Update added in v1.3.18

func (s *PriceRuleServiceOp) Update(ctx context.Context, pr PriceRule) (*PriceRule, error)

Update updates an existing a price rule

type PriceRulesResource added in v1.3.18

type PriceRulesResource struct {
	PriceRules []PriceRule `json:"price_rules"`
}

PriceRulesResource represents the result from the price_rules.json endpoint

type Product

type Product struct {
	Id                             uint64          `json:"id,omitempty"`
	Title                          string          `json:"title,omitempty"`
	BodyHTML                       string          `json:"body_html,omitempty"`
	Vendor                         string          `json:"vendor,omitempty"`
	ProductType                    string          `json:"product_type,omitempty"`
	Handle                         string          `json:"handle,omitempty"`
	CreatedAt                      *time.Time      `json:"created_at,omitempty"`
	UpdatedAt                      *time.Time      `json:"updated_at,omitempty"`
	PublishedAt                    *time.Time      `json:"published_at,omitempty"`
	PublishedScope                 string          `json:"published_scope,omitempty"`
	Tags                           string          `json:"tags,omitempty"`
	Status                         ProductStatus   `json:"status,omitempty"`
	Options                        []ProductOption `json:"options,omitempty"`
	Variants                       []Variant       `json:"variants,omitempty"`
	Image                          Image           `json:"image,omitempty"`
	Images                         []Image         `json:"images,omitempty"`
	TemplateSuffix                 string          `json:"template_suffix,omitempty"`
	MetafieldsGlobalTitleTag       string          `json:"metafields_global_title_tag,omitempty"`
	MetafieldsGlobalDescriptionTag string          `json:"metafields_global_description_tag,omitempty"`
	Metafields                     []Metafield     `json:"metafields,omitempty"`
	AdminGraphqlApiId              string          `json:"admin_graphql_api_id,omitempty"`
}

Product represents a Shopify product

type ProductListOptions added in v1.3.18

type ProductListOptions struct {
	ListOptions
	CollectionId          uint64          `url:"collection_id,omitempty"`
	ProductType           string          `url:"product_type,omitempty"`
	Vendor                string          `url:"vendor,omitempty"`
	Handle                string          `url:"handle,omitempty"`
	PublishedAtMin        time.Time       `url:"published_at_min,omitempty"`
	PublishedAtMax        time.Time       `url:"published_at_max,omitempty"`
	PublishedStatus       string          `url:"published_status,omitempty"`
	PresentmentCurrencies string          `url:"presentment_currencies,omitempty"`
	Status                []ProductStatus `url:"status,omitempty,comma"`
}

type ProductListing added in v1.3.18

type ProductListing struct {
	Id          uint64          `json:"product_id,omitempty"`
	Title       string          `json:"title,omitempty"`
	BodyHTML    string          `json:"body_html,omitempty"`
	Vendor      string          `json:"vendor,omitempty"`
	ProductType string          `json:"product_type,omitempty"`
	Handle      string          `json:"handle,omitempty"`
	CreatedAt   *time.Time      `json:"created_at,omitempty"`
	UpdatedAt   *time.Time      `json:"updated_at,omitempty"`
	PublishedAt *time.Time      `json:"published_at,omitempty"`
	Tags        string          `json:"tags,omitempty"`
	Options     []ProductOption `json:"options,omitempty"`
	Variants    []Variant       `json:"variants,omitempty"`
	Images      []Image         `json:"images,omitempty"`
}

ProductListing represents a Shopify product published to your sales channel app

type ProductListingIdsResource added in v1.3.18

type ProductListingIdsResource struct {
	ProductIds []uint64 `json:"product_ids"`
}

Represents the result from the product_listings/product_ids.json endpoint

type ProductListingPublishResource added in v1.3.18

type ProductListingPublishResource struct {
	ProductListing struct {
		ProductId uint64 `json:"product_id"`
	} `json:"product_listing"`
}

Resource which create product_listing endpoint expects in request body e.g. PUT /admin/api/2020-07/product_listings/921728736.json

{
  "product_listing": {
    "product_id": 921728736
  }
}

type ProductListingResource added in v1.3.18

type ProductListingResource struct {
	ProductListing *ProductListing `json:"product_listing"`
}

Represents the result from the product_listings/X.json endpoint

type ProductListingService added in v1.3.18

type ProductListingService interface {
	List(context.Context, interface{}) ([]ProductListing, error)
	ListWithPagination(context.Context, interface{}) ([]ProductListing, *Pagination, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*ProductListing, error)
	GetProductIds(context.Context, interface{}) ([]uint64, error)
	Publish(context.Context, uint64) (*ProductListing, error)
	Delete(context.Context, uint64) error
}

ProductListingService is an interface for interfacing with the product listing endpoints of the Shopify API. See: https://shopify.dev/docs/admin-api/rest/reference/sales-channels/productlisting

type ProductListingServiceOp added in v1.3.18

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

ProductListingServiceOp handles communication with the product related methods of the Shopify API.

func (*ProductListingServiceOp) Count added in v1.3.18

func (s *ProductListingServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count products listings published to your sales channel app

func (*ProductListingServiceOp) Delete added in v1.3.18

func (s *ProductListingServiceOp) Delete(ctx context.Context, productId uint64) error

Delete unpublishes an existing product from your sales channel app.

func (*ProductListingServiceOp) Get added in v1.3.18

func (s *ProductListingServiceOp) Get(ctx context.Context, productId uint64, options interface{}) (*ProductListing, error)

Get individual product_listing by product Id

func (*ProductListingServiceOp) GetProductIds added in v1.3.18

func (s *ProductListingServiceOp) GetProductIds(ctx context.Context, options interface{}) ([]uint64, error)

GetProductIds lists all product Ids that are published to your sales channel

func (*ProductListingServiceOp) List added in v1.3.18

func (s *ProductListingServiceOp) List(ctx context.Context, options interface{}) ([]ProductListing, error)

List products

func (*ProductListingServiceOp) ListWithPagination added in v1.3.18

func (s *ProductListingServiceOp) ListWithPagination(ctx context.Context, options interface{}) ([]ProductListing, *Pagination, error)

ListWithPagination lists products and return pagination to retrieve next/previous results.

func (*ProductListingServiceOp) Publish added in v1.3.18

func (s *ProductListingServiceOp) Publish(ctx context.Context, productId uint64) (*ProductListing, error)

Publish an existing product listing to your sales channel app

type ProductOption

type ProductOption struct {
	Id        uint64   `json:"id,omitempty"`
	ProductId uint64   `json:"product_id,omitempty"`
	Name      string   `json:"name,omitempty"`
	Position  int      `json:"position,omitempty"`
	Values    []string `json:"values,omitempty"`
}

The options provided by Shopify

type ProductResource

type ProductResource struct {
	Product *Product `json:"product"`
}

Represents the result from the products/X.json endpoint

type ProductService

type ProductService interface {
	List(context.Context, interface{}) ([]Product, error)
	ListWithPagination(context.Context, interface{}) ([]Product, *Pagination, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Product, error)
	Create(context.Context, Product) (*Product, error)
	Update(context.Context, Product) (*Product, error)
	Delete(context.Context, uint64) error

	// MetafieldsService used for Product resource to communicate with Metafields resource
	MetafieldsService
}

ProductService is an interface for interfacing with the product endpoints of the Shopify API. See: https://help.shopify.com/api/reference/product

type ProductServiceOp

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

ProductServiceOp handles communication with the product related methods of the Shopify API.

func (*ProductServiceOp) Count

func (s *ProductServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count products

func (*ProductServiceOp) CountMetafields

func (s *ProductServiceOp) CountMetafields(ctx context.Context, productId uint64, options interface{}) (int, error)

Count metafields for a product

func (*ProductServiceOp) Create

func (s *ProductServiceOp) Create(ctx context.Context, product Product) (*Product, error)

Create a new product

func (*ProductServiceOp) CreateMetafield

func (s *ProductServiceOp) CreateMetafield(ctx context.Context, productId uint64, metafield Metafield) (*Metafield, error)

CreateMetafield for a product

func (*ProductServiceOp) Delete

func (s *ProductServiceOp) Delete(ctx context.Context, productId uint64) error

Delete an existing product

func (*ProductServiceOp) DeleteMetafield

func (s *ProductServiceOp) DeleteMetafield(ctx context.Context, productId uint64, metafieldId uint64) error

DeleteMetafield for a product

func (*ProductServiceOp) Get

func (s *ProductServiceOp) Get(ctx context.Context, productId uint64, options interface{}) (*Product, error)

Get individual product

func (*ProductServiceOp) GetMetafield

func (s *ProductServiceOp) GetMetafield(ctx context.Context, productId uint64, metafieldId uint64, options interface{}) (*Metafield, error)

GetMetafield for a product

func (*ProductServiceOp) List

func (s *ProductServiceOp) List(ctx context.Context, options interface{}) ([]Product, error)

List products

func (*ProductServiceOp) ListMetafields

func (s *ProductServiceOp) ListMetafields(ctx context.Context, productId uint64, options interface{}) ([]Metafield, error)

ListMetafields for a product

func (*ProductServiceOp) ListWithPagination added in v1.3.18

func (s *ProductServiceOp) ListWithPagination(ctx context.Context, options interface{}) ([]Product, *Pagination, error)

ListWithPagination lists products and return pagination to retrieve next/previous results.

func (*ProductServiceOp) Update

func (s *ProductServiceOp) Update(ctx context.Context, product Product) (*Product, error)

Update an existing product

func (*ProductServiceOp) UpdateMetafield

func (s *ProductServiceOp) UpdateMetafield(ctx context.Context, productId uint64, metafield Metafield) (*Metafield, error)

UpdateMetafield for a product

type ProductStatus added in v1.3.18

type ProductStatus string

ProductStatus represents a Shopify product status.

const (
	// The product is ready to sell and is available to customers on the online store,
	// sales channels, and apps. By default, existing products are set to active.
	ProductStatusActive ProductStatus = "active"

	// The product is no longer being sold and isn't available to customers on sales
	// channels and apps.
	ProductStatusArchived ProductStatus = "archived"

	// The product isn't ready to sell and is unavailable to customers on sales
	// channels and apps. By default, duplicated and unarchived products are set to
	// draft.
	ProductStatucDraft ProductStatus = "draft"
)

https://shopify.dev/docs/api/admin-rest/2023-07/resources/product#resource-object

type ProductsListingsResource added in v1.3.18

type ProductsListingsResource struct {
	ProductListings []ProductListing `json:"product_listings"`
}

Represents the result from the product_listings.json endpoint

type ProductsResource

type ProductsResource struct {
	Products []Product `json:"products"`
}

Represents the result from the products.json endpoint

type RateLimitError

type RateLimitError struct {
	ResponseError
	RetryAfter int
}

An error specific to a rate-limiting response. Embeds the ResponseError to allow consumers to handle it the same was a normal ResponseError.

type RateLimitInfo added in v1.3.18

type RateLimitInfo struct {
	RequestCount      int
	BucketSize        int
	GraphQLCost       *GraphQLCost
	RetryAfterSeconds float64
}

type Receipt

type Receipt struct {
	TestCase      bool   `json:"testcase,omitempty"`
	Authorization string `json:"authorization,omitempty"`
}

Receipt represents a Shopify receipt.

type RecurringApplicationCharge

type RecurringApplicationCharge struct {
	APIClientId           uint64           `json:"api_client_id"`
	ActivatedOn           *time.Time       `json:"activated_on"`
	BalanceRemaining      *decimal.Decimal `json:"balance_remaining"`
	BalanceUsed           *decimal.Decimal `json:"balance_used"`
	BillingOn             *time.Time       `json:"billing_on"`
	CancelledOn           *time.Time       `json:"cancelled_on"`
	CappedAmount          *decimal.Decimal `json:"capped_amount"`
	ConfirmationURL       string           `json:"confirmation_url"`
	CreatedAt             *time.Time       `json:"created_at"`
	DecoratedReturnURL    string           `json:"decorated_return_url"`
	Id                    uint64           `json:"id"`
	Name                  string           `json:"name"`
	Price                 *decimal.Decimal `json:"price"`
	ReturnURL             string           `json:"return_url"`
	RiskLevel             *decimal.Decimal `json:"risk_level"`
	Status                string           `json:"status"`
	Terms                 string           `json:"terms"`
	Test                  *bool            `json:"test"`
	TrialDays             int              `json:"trial_days"`
	TrialEndsOn           *time.Time       `json:"trial_ends_on"`
	UpdateCappedAmountURL string           `json:"update_capped_amount_url"`
	UpdatedAt             *time.Time       `json:"updated_at"`
}

RecurringApplicationCharge represents a Shopify RecurringApplicationCharge.

func (*RecurringApplicationCharge) UnmarshalJSON

func (r *RecurringApplicationCharge) UnmarshalJSON(data []byte) error

type RecurringApplicationChargeResource

type RecurringApplicationChargeResource struct {
	Charge *RecurringApplicationCharge `json:"recurring_application_charge"`
}

RecurringApplicationChargeResource represents the result from the admin/recurring_application_charges{/X{/activate.json}.json}.json endpoints.

type RecurringApplicationChargeService

RecurringApplicationChargeService is an interface for interacting with the RecurringApplicationCharge endpoints of the Shopify API. See https://help.shopify.com/api/reference/billing/recurringapplicationcharge

type RecurringApplicationChargeServiceOp

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

RecurringApplicationChargeServiceOp handles communication with the RecurringApplicationCharge related methods of the Shopify API.

func (*RecurringApplicationChargeServiceOp) Activate

Activate activates recurring application charge.

func (*RecurringApplicationChargeServiceOp) Create

Create creates new recurring application charge.

func (*RecurringApplicationChargeServiceOp) Delete

Delete deletes recurring application charge.

func (*RecurringApplicationChargeServiceOp) Get

func (r *RecurringApplicationChargeServiceOp) Get(ctx context.Context, chargeId uint64, options interface{}) (
	*RecurringApplicationCharge, error,
)

Get gets individual recurring application charge.

func (*RecurringApplicationChargeServiceOp) List

func (r *RecurringApplicationChargeServiceOp) List(ctx context.Context, options interface{}) (
	[]RecurringApplicationCharge, error,
)

List gets all recurring application charges.

func (*RecurringApplicationChargeServiceOp) Update

func (r *RecurringApplicationChargeServiceOp) Update(ctx context.Context, chargeId, newCappedAmount uint64) (
	*RecurringApplicationCharge, error,
)

Update updates recurring application charge.

type RecurringApplicationChargesResource

type RecurringApplicationChargesResource struct {
	Charges []RecurringApplicationCharge `json:"recurring_application_charges"`
}

RecurringApplicationChargesResource represents the result from the admin/recurring_application_charges.json endpoint.

type Redirect

type Redirect struct {
	Id     uint64 `json:"id"`
	Path   string `json:"path"`
	Target string `json:"target"`
}

Redirect represents a Shopify redirect.

type RedirectResource

type RedirectResource struct {
	Redirect *Redirect `json:"redirect"`
}

RedirectResource represents the result from the redirects/X.json endpoint

type RedirectService

type RedirectService interface {
	List(context.Context, interface{}) ([]Redirect, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Redirect, error)
	Create(context.Context, Redirect) (*Redirect, error)
	Update(context.Context, Redirect) (*Redirect, error)
	Delete(context.Context, uint64) error
}

RedirectService is an interface for interacting with the redirects endpoints of the Shopify API. See https://help.shopify.com/api/reference/online_store/redirect

type RedirectServiceOp

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

RedirectServiceOp handles communication with the redirect related methods of the Shopify API.

func (*RedirectServiceOp) Count

func (s *RedirectServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count redirects

func (*RedirectServiceOp) Create

func (s *RedirectServiceOp) Create(ctx context.Context, redirect Redirect) (*Redirect, error)

Create a new redirect

func (*RedirectServiceOp) Delete

func (s *RedirectServiceOp) Delete(ctx context.Context, redirectId uint64) error

Delete an existing redirect.

func (*RedirectServiceOp) Get

func (s *RedirectServiceOp) Get(ctx context.Context, redirectId uint64, options interface{}) (*Redirect, error)

Get individual redirect

func (*RedirectServiceOp) List

func (s *RedirectServiceOp) List(ctx context.Context, options interface{}) ([]Redirect, error)

List redirects

func (*RedirectServiceOp) Update

func (s *RedirectServiceOp) Update(ctx context.Context, redirect Redirect) (*Redirect, error)

Update an existing redirect

type RedirectsResource

type RedirectsResource struct {
	Redirects []Redirect `json:"redirects"`
}

RedirectsResource represents the result from the redirects.json endpoint

type Refund

type Refund struct {
	Id               uint64            `json:"id,omitempty"`
	OrderId          uint64            `json:"order_id,omitempty"`
	CreatedAt        *time.Time        `json:"created_at,omitempty"`
	Note             string            `json:"note,omitempty"`
	Restock          bool              `json:"restock,omitempty"`
	UserId           uint64            `json:"user_id,omitempty"`
	RefundLineItems  []RefundLineItem  `json:"refund_line_items,omitempty"`
	Transactions     []Transaction     `json:"transactions,omitempty"`
	OrderAdjustments []OrderAdjustment `json:"order_adjustments,omitempty"`
}

type RefundLineItem

type RefundLineItem struct {
	Id         uint64           `json:"id,omitempty"`
	Quantity   int              `json:"quantity,omitempty"`
	LineItemId uint64           `json:"line_item_id,omitempty"`
	LineItem   *LineItem        `json:"line_item,omitempty"`
	Subtotal   *decimal.Decimal `json:"subtotal,omitempty"`
	TotalTax   *decimal.Decimal `json:"total_tax,omitempty"`
}

type RequestHandler added in v1.3.18

type RequestHandler func(client *http.Client, req *http.Request)

type ResponseDecodingError

type ResponseDecodingError struct {
	Body    []byte
	Message string
	Status  int
}

ResponseDecodingError occurs when the response body from Shopify could not be parsed.

func (ResponseDecodingError) Error

func (e ResponseDecodingError) Error() string

type ResponseError

type ResponseError struct {
	Status  int
	Message string
	Errors  []string
}

A general response error that follows a similar layout to Shopify's response errors, i.e. either a single message or a list of messages.

func (ResponseError) Error

func (e ResponseError) Error() string

func (ResponseError) GetErrors added in v1.3.18

func (e ResponseError) GetErrors() []string

GetErrors returns response errors list

func (ResponseError) GetMessage added in v1.3.18

func (e ResponseError) GetMessage() string

GetMessage returns response error message

func (ResponseError) GetStatus added in v1.3.18

func (e ResponseError) GetStatus() int

GetStatus returns http response status

type ResponseHandler added in v1.3.18

type ResponseHandler func(resp *http.Response)

type Rule

type Rule struct {
	Column    string `json:"column"`
	Relation  string `json:"relation"`
	Condition string `json:"condition"`
}

type SMSMarketingConsent added in v1.3.18

type SMSMarketingConsent struct {
	State                string     `json:"state"`
	OptInLevel           string     `json:"opt_in_level"`
	ConsentUpdatedAt     *time.Time `json:"consent_updated_at"`
	ConsentCollectedFrom string     `json:"consent_collected_from"`
}

type ScriptTag

type ScriptTag struct {
	CreatedAt    *time.Time `json:"created_at"`
	Event        string     `json:"event"`
	Id           uint64     `json:"id"`
	Src          string     `json:"src"`
	DisplayScope string     `json:"display_scope"`
	UpdatedAt    *time.Time `json:"updated_at"`
}

ScriptTag represents a Shopify ScriptTag.

type ScriptTagOption

type ScriptTagOption struct {
	Limit        int       `url:"limit,omitempty"`
	Page         int       `url:"page,omitempty"`
	SinceId      uint64    `url:"since_id,omitempty"`
	CreatedAtMin time.Time `url:"created_at_min,omitempty"`
	CreatedAtMax time.Time `url:"created_at_max,omitempty"`
	UpdatedAtMin time.Time `url:"updated_at_min,omitempty"`
	UpdatedAtMax time.Time `url:"updated_at_max,omitempty"`
	Src          string    `url:"src,omitempty"`
	Fields       string    `url:"fields,omitempty"`
}

The options provided by Shopify.

type ScriptTagResource

type ScriptTagResource struct {
	ScriptTag *ScriptTag `json:"script_tag"`
}

ScriptTagResource represents the result from the admin/script_tags/{#script_tag_id}.json endpoint.

type ScriptTagService

type ScriptTagService interface {
	List(context.Context, interface{}) ([]ScriptTag, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*ScriptTag, error)
	Create(context.Context, ScriptTag) (*ScriptTag, error)
	Update(context.Context, ScriptTag) (*ScriptTag, error)
	Delete(context.Context, uint64) error
}

ScriptTagService is an interface for interfacing with the ScriptTag endpoints of the Shopify API. See: https://help.shopify.com/api/reference/scripttag

type ScriptTagServiceOp

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

ScriptTagServiceOp handles communication with the shop related methods of the Shopify API.

func (*ScriptTagServiceOp) Count

func (s *ScriptTagServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count script tags

func (*ScriptTagServiceOp) Create

func (s *ScriptTagServiceOp) Create(ctx context.Context, tag ScriptTag) (*ScriptTag, error)

Create a new script tag

func (*ScriptTagServiceOp) Delete

func (s *ScriptTagServiceOp) Delete(ctx context.Context, tagId uint64) error

Delete an existing script tag

func (*ScriptTagServiceOp) Get

func (s *ScriptTagServiceOp) Get(ctx context.Context, tagId uint64, options interface{}) (*ScriptTag, error)

Get individual script tag

func (*ScriptTagServiceOp) List

func (s *ScriptTagServiceOp) List(ctx context.Context, options interface{}) ([]ScriptTag, error)

List script tags

func (*ScriptTagServiceOp) Update

func (s *ScriptTagServiceOp) Update(ctx context.Context, tag ScriptTag) (*ScriptTag, error)

Update an existing script tag

type ScriptTagsResource

type ScriptTagsResource struct {
	ScriptTags []ScriptTag `json:"script_tags"`
}

ScriptTagsResource represents the result from the admin/script_tags.json endpoint.

type ShippingCountry added in v1.3.18

type ShippingCountry struct {
	Id             uint64             `json:"id,omitempty"`
	ShippingZoneId uint64             `json:"shipping_zone_id,omitempty"`
	Name           string             `json:"name,omitempty"`
	Tax            *decimal.Decimal   `json:"tax,omitempty"`
	Code           string             `json:"code,omitempty"`
	TaxName        string             `json:"tax_name,omitempty"`
	Provinces      []ShippingProvince `json:"provinces,omitempty"`
}

ShippingCountry represents a Shopify shipping country

type ShippingLines

type ShippingLines struct {
	Id                            uint64           `json:"id,omitempty"`
	Title                         string           `json:"title,omitempty"`
	Price                         *decimal.Decimal `json:"price,omitempty"`
	PriceSet                      *AmountSet       `json:"price_set,omitempty"`
	DiscountedPrice               *decimal.Decimal `json:"discounted_price,omitempty"`
	DiscountedPriceSet            *AmountSet       `json:"discounted_price_set,omitempty"`
	Code                          string           `json:"code,omitempty"`
	Source                        string           `json:"source,omitempty"`
	Phone                         string           `json:"phone,omitempty"`
	RequestedFulfillmentServiceId string           `json:"requested_fulfillment_service_id,omitempty"`
	DeliveryCategory              string           `json:"delivery_category,omitempty"`
	CarrierIdentifier             string           `json:"carrier_identifier,omitempty"`
	TaxLines                      []TaxLine        `json:"tax_lines,omitempty"`
	Handle                        string           `json:"handle,omitempty"`
}

func (*ShippingLines) UnmarshalJSON added in v1.3.18

func (sl *ShippingLines) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarshaller for ShippingLines implemented to handle requested_fulfillment_service_id being returned as json numbers or json nulls instead of json strings

type ShippingProvince added in v1.3.18

type ShippingProvince struct {
	Id             uint64           `json:"id,omitempty"`
	CountryId      uint64           `json:"country_id,omitempty"`
	ShippingZoneId uint64           `json:"shipping_zone_id,omitempty"`
	Name           string           `json:"name,omitempty"`
	Code           string           `json:"code,omitempty"`
	Tax            *decimal.Decimal `json:"tax,omitempty"`
	TaxName        string           `json:"tax_name,omitempty"`
	TaxType        string           `json:"tax_type,omitempty"`
	TaxPercentage  *decimal.Decimal `json:"tax_percentage,omitempty"`
}

ShippingProvince represents a Shopify shipping province

type ShippingRate added in v1.3.18

type ShippingRate struct {
	// The name of the rate, which customers see at checkout. For example: Expedited Mail.
	ServiceName string `json:"service_name"`

	// A description of the rate, which customers see at checkout. For example: Includes tracking and insurance.
	Description string `json:"description"`

	// A unique code associated with the rate. For example: expedited_mail.
	ServiceCode string `json:"service_code"`

	// The currency of the shipping rate.
	Currency string `json:"currency"`

	// The total price based on the shipping rate currency.
	// In cents unit. See https://github.com/Shopify/shipping-fulfillment-app/issues/15#issuecomment-725996936
	TotalPrice decimal.Decimal `json:"total_price"`

	// Whether the customer must provide a phone number at checkout.
	PhoneRequired bool `json:"phone_required,omitempty"`

	// The earliest delivery date for the displayed rate.
	MinDeliveryDate *time.Time `json:"min_delivery_date"` // "2013-04-12 14:48:45 -0400"

	// The latest delivery date for the displayed rate to still be valid.
	MaxDeliveryDate *time.Time `json:"max_delivery_date"` // "2013-04-12 14:48:45 -0400"
}

type ShippingRateAddress added in v1.3.18

type ShippingRateAddress struct {
	Country     string `json:"country"`
	PostalCode  string `json:"postal_code"`
	Province    string `json:"province"`
	City        string `json:"city"`
	Name        string `json:"name"`
	Address1    string `json:"address1"`
	Address2    string `json:"address2"`
	Address3    string `json:"address3"`
	Phone       string `json:"phone"`
	Fax         string `json:"fax"`
	Email       string `json:"email"`
	AddressType string `json:"address_type"`
	CompanyName string `json:"company_name"`
}

The address3, fax, address_type, and company_name fields are returned by specific ActiveShipping providers. For API-created carrier services, you should use only the following shipping address fields: * address1 * address2 * city * zip * province * country Other values remain as null and are not sent to the callback URL.

type ShippingRateQuery added in v1.3.18

type ShippingRateQuery struct {
	Origin      ShippingRateAddress `json:"origin"`
	Destination ShippingRateAddress `json:"destination"`
	Items       []LineItem          `json:"items"`
	Currency    string              `json:"currency"`
	Locale      string              `json:"locale"`
}

type ShippingRateRequest added in v1.3.18

type ShippingRateRequest struct {
	Rate ShippingRateQuery `json:"rate"`
}

type ShippingRateResponse added in v1.3.18

type ShippingRateResponse struct {
	Rates []ShippingRate `json:"rates"`
}

When Shopify requests shipping rates using your callback URL, the response object rates must be a JSON array of objects with the following fields. Required fields must be included in the response for the carrier service integration to work properly.

type ShippingZone added in v1.3.18

type ShippingZone struct {
	Id                           uint64                        `json:"id,omitempty"`
	Name                         string                        `json:"name,omitempty"`
	ProfileId                    string                        `json:"profile_id,omitempty"`
	LocationGroupId              string                        `json:"location_group_id,omitempty"`
	AdminGraphqlApiId            string                        `json:"admin_graphql_api_id,omitempty"`
	Countries                    []ShippingCountry             `json:"countries,omitempty"`
	WeightBasedShippingRates     []WeightBasedShippingRate     `json:"weight_based_shipping_rates,omitempty"`
	PriceBasedShippingRates      []PriceBasedShippingRate      `json:"price_based_shipping_rates,omitempty"`
	CarrierShippingRateProviders []CarrierShippingRateProvider `json:"carrier_shipping_rate_providers,omitempty"`
}

ShippingZone represents a Shopify shipping zone

type ShippingZoneService added in v1.3.18

type ShippingZoneService interface {
	List(context.Context) ([]ShippingZone, error)
}

ShippingZoneService is an interface for interfacing with the shipping zones endpoint of the Shopify API. See: https://help.shopify.com/api/reference/store-properties/shippingzone

type ShippingZoneServiceOp added in v1.3.18

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

ShippingZoneServiceOp handles communication with the shipping zone related methods of the Shopify API.

func (*ShippingZoneServiceOp) List added in v1.3.18

List shipping zones

type ShippingZonesResource added in v1.3.18

type ShippingZonesResource struct {
	ShippingZones []ShippingZone `json:"shipping_zones"`
}

Represents the result from the shipping_zones.json endpoint

type Shop

type Shop struct {
	Id                                   uint64     `json:"id"`
	Name                                 string     `json:"name"`
	ShopOwner                            string     `json:"shop_owner"`
	Email                                string     `json:"email"`
	CustomerEmail                        string     `json:"customer_email"`
	CreatedAt                            *time.Time `json:"created_at"`
	UpdatedAt                            *time.Time `json:"updated_at"`
	Address1                             string     `json:"address1"`
	Address2                             string     `json:"address2"`
	City                                 string     `json:"city"`
	Country                              string     `json:"country"`
	CountryCode                          string     `json:"country_code"`
	CountryName                          string     `json:"country_name"`
	Currency                             string     `json:"currency"`
	Domain                               string     `json:"domain"`
	Latitude                             float64    `json:"latitude"`
	Longitude                            float64    `json:"longitude"`
	Phone                                string     `json:"phone"`
	Province                             string     `json:"province"`
	ProvinceCode                         string     `json:"province_code"`
	Zip                                  string     `json:"zip"`
	MoneyFormat                          string     `json:"money_format"`
	MoneyWithCurrencyFormat              string     `json:"money_with_currency_format"`
	WeightUnit                           string     `json:"weight_unit"`
	MyshopifyDomain                      string     `json:"myshopify_domain"`
	PlanName                             string     `json:"plan_name"`
	PlanDisplayName                      string     `json:"plan_display_name"`
	PasswordEnabled                      bool       `json:"password_enabled"`
	PrimaryLocale                        string     `json:"primary_locale"`
	PrimaryLocationId                    uint64     `json:"primary_location_id"`
	Timezone                             string     `json:"timezone"`
	IanaTimezone                         string     `json:"iana_timezone"`
	ForceSSL                             bool       `json:"force_ssl"`
	TaxShipping                          bool       `json:"tax_shipping"`
	TaxesIncluded                        bool       `json:"taxes_included"`
	HasStorefront                        bool       `json:"has_storefront"`
	HasDiscounts                         bool       `json:"has_discounts"`
	HasGiftcards                         bool       `json:"has_gift_cards"`
	SetupRequired                        bool       `json:"setup_required"`
	CountyTaxes                          bool       `json:"county_taxes"`
	CheckoutAPISupported                 bool       `json:"checkout_api_supported"`
	Source                               string     `json:"source"`
	GoogleAppsDomain                     string     `json:"google_apps_domain"`
	GoogleAppsLoginEnabled               bool       `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"`
	PreLaunchEnabled                     bool       `json:"pre_launch_enabled"`
	AutoConfigureTaxInclusivity          bool       `json:"auto_configure_tax_inclusivity"`
	Finances                             bool       `json:"finances"`
	MultiLocationEnabled                 bool       `json:"multi_location_enabled"`
	EnabledPresentmentCurrencies         []string   `json:"enabled_presentment_currencies"`
	TransactionalSmsDisabled             bool       `json:"transactional_sms_disabled"`
	MarketingSmsConsentEnabledAtCheckout bool       `json:"marketing_sms_consent_enabled_at_checkout"`
}

Shop represents a Shopify shop

type ShopResource

type ShopResource struct {
	Shop *Shop `json:"shop"`
}

Represents the result from the admin/shop.json endpoint

type ShopService

type ShopService interface {
	Get(ctx context.Context, options interface{}) (*Shop, error)

	// MetafieldsService used for Shop resource to communicate with Metafields resource
	MetafieldsService
}

ShopService is an interface for interfacing with the shop endpoint of the Shopify API. See: https://help.shopify.com/api/reference/shop

type ShopServiceOp

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

ShopServiceOp handles communication with the shop related methods of the Shopify API.

func (*ShopServiceOp) CountMetafields added in v1.3.18

func (s *ShopServiceOp) CountMetafields(ctx context.Context, _ uint64, options interface{}) (int, error)

CountMetafields for a shop

func (*ShopServiceOp) CreateMetafield added in v1.3.18

func (s *ShopServiceOp) CreateMetafield(ctx context.Context, _ uint64, metafield Metafield) (*Metafield, error)

CreateMetafield for a shop

func (*ShopServiceOp) DeleteMetafield added in v1.3.18

func (s *ShopServiceOp) DeleteMetafield(ctx context.Context, _ uint64, metafieldId uint64) error

DeleteMetafield for a shop

func (*ShopServiceOp) Get

func (s *ShopServiceOp) Get(ctx context.Context, options interface{}) (*Shop, error)

Get shop

func (*ShopServiceOp) GetMetafield added in v1.3.18

func (s *ShopServiceOp) GetMetafield(ctx context.Context, _ uint64, metafieldId uint64, options interface{}) (*Metafield, error)

GetMetafield for a shop

func (*ShopServiceOp) ListMetafields added in v1.3.18

func (s *ShopServiceOp) ListMetafields(ctx context.Context, _ uint64, options interface{}) ([]Metafield, error)

ListMetafields for a shop

func (*ShopServiceOp) UpdateMetafield added in v1.3.18

func (s *ShopServiceOp) UpdateMetafield(ctx context.Context, _ uint64, metafield Metafield) (*Metafield, error)

UpdateMetafield for a shop

type SingleCarrierResource added in v1.3.18

type SingleCarrierResource struct {
	CarrierService *CarrierService `json:"carrier_service"`
}

type SmartCollection

type SmartCollection struct {
	Id             uint64      `json:"id"`
	Handle         string      `json:"handle"`
	Title          string      `json:"title"`
	UpdatedAt      *time.Time  `json:"updated_at"`
	BodyHTML       string      `json:"body_html"`
	SortOrder      string      `json:"sort_order"`
	TemplateSuffix string      `json:"template_suffix"`
	Image          Image       `json:"image"`
	Published      bool        `json:"published"`
	PublishedAt    *time.Time  `json:"published_at"`
	PublishedScope string      `json:"published_scope"`
	Rules          []Rule      `json:"rules"`
	Disjunctive    bool        `json:"disjunctive"`
	Metafields     []Metafield `json:"metafields,omitempty"`
}

SmartCollection represents a Shopify smart collection.

type SmartCollectionResource

type SmartCollectionResource struct {
	Collection *SmartCollection `json:"smart_collection"`
}

SmartCollectionResource represents the result from the smart_collections/X.json endpoint

type SmartCollectionService

type SmartCollectionService interface {
	List(context.Context, interface{}) ([]SmartCollection, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*SmartCollection, error)
	Create(context.Context, SmartCollection) (*SmartCollection, error)
	Update(context.Context, SmartCollection) (*SmartCollection, error)
	Delete(context.Context, uint64) error

	// MetafieldsService used for SmartCollection resource to communicate with Metafields resource
	MetafieldsService
}

SmartCollectionService is an interface for interacting with the smart collection endpoints of the Shopify API. See https://help.shopify.com/api/reference/smartcollection

type SmartCollectionServiceOp

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

SmartCollectionServiceOp handles communication with the smart collection related methods of the Shopify API.

func (*SmartCollectionServiceOp) Count

func (s *SmartCollectionServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count smart collections

func (*SmartCollectionServiceOp) CountMetafields

func (s *SmartCollectionServiceOp) CountMetafields(ctx context.Context, smartCollectionId uint64, options interface{}) (int, error)

Count metafields for a smart collection

func (*SmartCollectionServiceOp) Create

Create a new smart collection See Image for the details of the Image creation for a collection.

func (*SmartCollectionServiceOp) CreateMetafield

func (s *SmartCollectionServiceOp) CreateMetafield(ctx context.Context, smartCollectionId uint64, metafield Metafield) (*Metafield, error)

Create a new metafield for a smart collection

func (*SmartCollectionServiceOp) Delete

func (s *SmartCollectionServiceOp) Delete(ctx context.Context, collectionId uint64) error

Delete an existing smart collection.

func (*SmartCollectionServiceOp) DeleteMetafield

func (s *SmartCollectionServiceOp) DeleteMetafield(ctx context.Context, smartCollectionId uint64, metafieldId uint64) error

// Delete an existing metafield for a smart collection

func (*SmartCollectionServiceOp) Get

func (s *SmartCollectionServiceOp) Get(ctx context.Context, collectionId uint64, options interface{}) (*SmartCollection, error)

Get individual smart collection

func (*SmartCollectionServiceOp) GetMetafield

func (s *SmartCollectionServiceOp) GetMetafield(ctx context.Context, smartCollectionId uint64, metafieldId uint64, options interface{}) (*Metafield, error)

Get individual metafield for a smart collection

func (*SmartCollectionServiceOp) List

func (s *SmartCollectionServiceOp) List(ctx context.Context, options interface{}) ([]SmartCollection, error)

List smart collections

func (*SmartCollectionServiceOp) ListMetafields

func (s *SmartCollectionServiceOp) ListMetafields(ctx context.Context, smartCollectionId uint64, options interface{}) ([]Metafield, error)

List metafields for a smart collection

func (*SmartCollectionServiceOp) Update

Update an existing smart collection

func (*SmartCollectionServiceOp) UpdateMetafield

func (s *SmartCollectionServiceOp) UpdateMetafield(ctx context.Context, smartCollectionId uint64, metafield Metafield) (*Metafield, error)

Update an existing metafield for a smart collection

type SmartCollectionsResource

type SmartCollectionsResource struct {
	Collections []SmartCollection `json:"smart_collections"`
}

SmartCollectionsResource represents the result from the smart_collections.json endpoint

type SmsMarketingConsent added in v1.3.18

type SmsMarketingConsent struct {
	State                string     `json:"state,omitempty"`
	OptInLevel           string     `json:"opt_in_level,omitempty"`
	ConsentUpdatedAt     *time.Time `json:"consent_updated_at,omitempty"`
	ConsentCollectedFrom string     `json:"consent_collected_from,omitempty"`
}

type StorefrontAccessToken added in v1.3.18

type StorefrontAccessToken struct {
	Id                uint64     `json:"id,omitempty"`
	Title             string     `json:"title,omitempty"`
	AccessToken       string     `json:"access_token,omitempty"`
	AccessScope       string     `json:"access_scope,omitempty"`
	AdminGraphqlApiId string     `json:"admin_graphql_api_id,omitempty"`
	CreatedAt         *time.Time `json:"created_at,omitempty"`
}

StorefrontAccessToken represents a Shopify storefront access token

type StorefrontAccessTokenResource added in v1.3.18

type StorefrontAccessTokenResource struct {
	StorefrontAccessToken *StorefrontAccessToken `json:"storefront_access_token"`
}

StorefrontAccessTokenResource represents the result from the admin/storefront_access_tokens.json endpoint

type StorefrontAccessTokenService added in v1.3.18

type StorefrontAccessTokenService interface {
	List(context.Context, interface{}) ([]StorefrontAccessToken, error)
	Create(context.Context, StorefrontAccessToken) (*StorefrontAccessToken, error)
	Delete(context.Context, uint64) error
}

StorefrontAccessTokenService is an interface for interfacing with the storefront access token endpoints of the Shopify API. See: https://help.shopify.com/api/reference/access/storefrontaccesstoken

type StorefrontAccessTokenServiceOp added in v1.3.18

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

StorefrontAccessTokenServiceOp handles communication with the storefront access token related methods of the Shopify API.

func (*StorefrontAccessTokenServiceOp) Create added in v1.3.18

Create a new storefront access token

func (*StorefrontAccessTokenServiceOp) Delete added in v1.3.18

Delete an existing storefront access token

func (*StorefrontAccessTokenServiceOp) List added in v1.3.18

func (s *StorefrontAccessTokenServiceOp) List(ctx context.Context, options interface{}) ([]StorefrontAccessToken, error)

List storefront access tokens

type StorefrontAccessTokensResource added in v1.3.18

type StorefrontAccessTokensResource struct {
	StorefrontAccessTokens []StorefrontAccessToken `json:"storefront_access_tokens"`
}

StorefrontAccessTokensResource is the root object for a storefront access tokens get request.

type TaxLine

type TaxLine struct {
	Title string           `json:"title,omitempty"`
	Price *decimal.Decimal `json:"price,omitempty"`
	Rate  *decimal.Decimal `json:"rate,omitempty"`
}

type Theme

type Theme struct {
	Id                uint64     `json:"id"`
	Name              string     `json:"name"`
	Previewable       bool       `json:"previewable"`
	Processing        bool       `json:"processing"`
	Role              string     `json:"role"`
	ThemeStoreId      uint64     `json:"theme_store_id"`
	AdminGraphqlApiId string     `json:"admin_graphql_api_id"`
	CreatedAt         *time.Time `json:"created_at"`
	UpdatedAt         *time.Time `json:"updated_at"`
}

Theme represents a Shopify theme

type ThemeListOptions

type ThemeListOptions struct {
	Role   string `url:"role,omitempty"`
	Fields string `url:"fields,omitempty"`
}

Options for theme list

type ThemeResource added in v1.3.18

type ThemeResource struct {
	Theme *Theme `json:"theme"`
}

ThemesResource is the result from the themes/X.json endpoint

type ThemeService

type ThemeService interface {
	List(context.Context, interface{}) ([]Theme, error)
	Create(context.Context, Theme) (*Theme, error)
	Get(context.Context, uint64, interface{}) (*Theme, error)
	Update(context.Context, Theme) (*Theme, error)
	Delete(context.Context, uint64) error
}

ThemeService is an interface for interfacing with the themes endpoints of the Shopify API. See: https://help.shopify.com/api/reference/theme

type ThemeServiceOp

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

ThemeServiceOp handles communication with the theme related methods of the Shopify API.

func (*ThemeServiceOp) Create added in v1.3.18

func (s *ThemeServiceOp) Create(ctx context.Context, theme Theme) (*Theme, error)

Update a theme

func (*ThemeServiceOp) Delete added in v1.3.18

func (s *ThemeServiceOp) Delete(ctx context.Context, themeId uint64) error

Delete a theme

func (*ThemeServiceOp) Get added in v1.3.18

func (s *ThemeServiceOp) Get(ctx context.Context, themeId uint64, options interface{}) (*Theme, error)

Get a theme

func (*ThemeServiceOp) List

func (s *ThemeServiceOp) List(ctx context.Context, options interface{}) ([]Theme, error)

List all themes

func (*ThemeServiceOp) Update added in v1.3.18

func (s *ThemeServiceOp) Update(ctx context.Context, theme Theme) (*Theme, error)

Update a theme

type ThemesResource

type ThemesResource struct {
	Themes []Theme `json:"themes"`
}

ThemesResource is the result from the themes.json endpoint

type Transaction

type Transaction struct {
	Id             uint64           `json:"id,omitempty"`
	OrderId        uint64           `json:"order_id,omitempty"`
	Amount         *decimal.Decimal `json:"amount,omitempty"`
	Kind           string           `json:"kind,omitempty"`
	Gateway        string           `json:"gateway,omitempty"`
	Status         string           `json:"status,omitempty"`
	Message        string           `json:"message,omitempty"`
	CreatedAt      *time.Time       `json:"created_at,omitempty"`
	Test           bool             `json:"test,omitempty"`
	Authorization  string           `json:"authorization,omitempty"`
	Currency       string           `json:"currency,omitempty"`
	LocationId     *int64           `json:"location_id,omitempty"`
	UserId         *int64           `json:"user_id,omitempty"`
	ParentId       *int64           `json:"parent_id,omitempty"`
	DeviceId       *int64           `json:"device_id,omitempty"`
	ErrorCode      string           `json:"error_code,omitempty"`
	SourceName     string           `json:"source_name,omitempty"`
	Source         string           `json:"source,omitempty"`
	PaymentDetails *PaymentDetails  `json:"payment_details,omitempty"`
}

type TransactionResource

type TransactionResource struct {
	Transaction *Transaction `json:"transaction"`
}

TransactionResource represents the result from the orders/X/transactions/Y.json endpoint

type TransactionService

type TransactionService interface {
	List(context.Context, uint64, interface{}) ([]Transaction, error)
	Count(context.Context, uint64, interface{}) (int, error)
	Get(context.Context, uint64, uint64, interface{}) (*Transaction, error)
	Create(context.Context, uint64, Transaction) (*Transaction, error)
}

TransactionService is an interface for interfacing with the transactions endpoints of the Shopify API. See: https://help.shopify.com/api/reference/transaction

type TransactionServiceOp

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

TransactionServiceOp handles communication with the transaction related methods of the Shopify API.

func (*TransactionServiceOp) Count

func (s *TransactionServiceOp) Count(ctx context.Context, orderId uint64, options interface{}) (int, error)

Count transactions

func (*TransactionServiceOp) Create

func (s *TransactionServiceOp) Create(ctx context.Context, orderId uint64, transaction Transaction) (*Transaction, error)

Create a new transaction

func (*TransactionServiceOp) Get

func (s *TransactionServiceOp) Get(ctx context.Context, orderId uint64, transactionId uint64, options interface{}) (*Transaction, error)

Get individual transaction

func (*TransactionServiceOp) List

func (s *TransactionServiceOp) List(ctx context.Context, orderId uint64, options interface{}) ([]Transaction, error)

List transactions

type TransactionsResource

type TransactionsResource struct {
	Transactions []Transaction `json:"transactions"`
}

TransactionsResource represents the result from the orders/X/transactions.json endpoint

type UsageCharge added in v1.3.18

type UsageCharge struct {
	BalanceRemaining *decimal.Decimal `json:"balance_remaining,omitempty"`
	BalanceUsed      *decimal.Decimal `json:"balance_used,omitempty"`
	BillingOn        *time.Time       `json:"billing_on,omitempty"`
	CreatedAt        *time.Time       `json:"created_at,omitempty"`
	Description      string           `json:"description,omitempty"`
	Id               uint64           `json:"id,omitempty"`
	Price            *decimal.Decimal `json:"price,omitempty"`
	RiskLevel        *decimal.Decimal `json:"risk_level,omitempty"`
}

UsageCharge represents a Shopify UsageCharge.

func (*UsageCharge) UnmarshalJSON added in v1.3.18

func (r *UsageCharge) UnmarshalJSON(data []byte) error

type UsageChargeResource added in v1.3.18

type UsageChargeResource struct {
	Charge *UsageCharge `json:"usage_charge"`
}

UsageChargeResource represents the result from the /admin/recurring_application_charges/X/usage_charges/X.json endpoints

type UsageChargeService added in v1.3.18

type UsageChargeService interface {
	Create(context.Context, uint64, UsageCharge) (*UsageCharge, error)
	Get(context.Context, uint64, uint64, interface{}) (*UsageCharge, error)
	List(context.Context, uint64, interface{}) ([]UsageCharge, error)
}

UsageChargeService is an interface for interacting with the UsageCharge endpoints of the Shopify API. See https://help.shopify.com/en/api/reference/billing/usagecharge#endpoints

type UsageChargeServiceOp added in v1.3.18

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

UsageChargeServiceOp handles communication with the UsageCharge related methods of the Shopify API.

func (*UsageChargeServiceOp) Create added in v1.3.18

func (r *UsageChargeServiceOp) Create(ctx context.Context, chargeId uint64, usageCharge UsageCharge) (
	*UsageCharge, error,
)

Create creates new usage charge given a recurring charge. *required fields: price and description

func (*UsageChargeServiceOp) Get added in v1.3.18

func (r *UsageChargeServiceOp) Get(ctx context.Context, chargeId uint64, usageChargeId uint64, options interface{}) (
	*UsageCharge, error,
)

Get gets individual usage charge.

func (*UsageChargeServiceOp) List added in v1.3.18

func (r *UsageChargeServiceOp) List(ctx context.Context, chargeId uint64, options interface{}) (
	[]UsageCharge, error,
)

List gets all usage charges associated with the recurring charge.

type UsageChargesResource added in v1.3.18

type UsageChargesResource struct {
	Charges []UsageCharge `json:"usage_charges"`
}

UsageChargesResource represents the result from the admin/recurring_application_charges/X/usage_charges.json endpoint.

type Variant

type Variant struct {
	Id                   uint64                 `json:"id,omitempty"`
	ProductId            uint64                 `json:"product_id,omitempty"`
	Title                string                 `json:"title,omitempty"`
	Sku                  string                 `json:"sku,omitempty"`
	Position             int                    `json:"position,omitempty"`
	Grams                int                    `json:"grams,omitempty"`
	InventoryPolicy      variantInventoryPolicy `json:"inventory_policy,omitempty"`
	Price                *decimal.Decimal       `json:"price,omitempty"`
	CompareAtPrice       *decimal.Decimal       `json:"compare_at_price,omitempty"`
	FulfillmentService   string                 `json:"fulfillment_service,omitempty"`
	InventoryManagement  string                 `json:"inventory_management,omitempty"`
	InventoryItemId      uint64                 `json:"inventory_item_id,omitempty"`
	Option1              string                 `json:"option1,omitempty"`
	Option2              string                 `json:"option2,omitempty"`
	Option3              string                 `json:"option3,omitempty"`
	CreatedAt            *time.Time             `json:"created_at,omitempty"`
	UpdatedAt            *time.Time             `json:"updated_at,omitempty"`
	Taxable              bool                   `json:"taxable,omitempty"`
	TaxCode              string                 `json:"tax_code,omitempty"`
	Barcode              string                 `json:"barcode,omitempty"`
	ImageId              uint64                 `json:"image_id,omitempty"`
	InventoryQuantity    int                    `json:"inventory_quantity,omitempty"`
	Weight               *decimal.Decimal       `json:"weight,omitempty"`
	WeightUnit           string                 `json:"weight_unit,omitempty"`
	OldInventoryQuantity int                    `json:"old_inventory_quantity,omitempty"`
	RequireShipping      bool                   `json:"requires_shipping"`
	AdminGraphqlApiId    string                 `json:"admin_graphql_api_id,omitempty"`
	Metafields           []Metafield            `json:"metafields,omitempty"`
	PresentmentPrices    []presentmentPrices    `json:"presentment_prices,omitempty"`
}

Variant represents a Shopify variant

type VariantResource

type VariantResource struct {
	Variant *Variant `json:"variant"`
}

VariantResource represents the result from the variants/X.json endpoint

type VariantService

type VariantService interface {
	List(context.Context, uint64, interface{}) ([]Variant, error)
	Count(context.Context, uint64, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Variant, error)
	Create(context.Context, uint64, Variant) (*Variant, error)
	Update(context.Context, Variant) (*Variant, error)
	Delete(context.Context, uint64, uint64) error

	// MetafieldsService used for Variant resource to communicate with Metafields resource
	MetafieldsService
}

VariantService is an interface for interacting with the variant endpoints of the Shopify API. See https://help.shopify.com/api/reference/product_variant

type VariantServiceOp

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

VariantServiceOp handles communication with the variant related methods of the Shopify API.

func (*VariantServiceOp) Count

func (s *VariantServiceOp) Count(ctx context.Context, productId uint64, options interface{}) (int, error)

Count variants

func (*VariantServiceOp) CountMetafields added in v1.3.18

func (s *VariantServiceOp) CountMetafields(ctx context.Context, variantId uint64, options interface{}) (int, error)

CountMetafields for a variant

func (*VariantServiceOp) Create

func (s *VariantServiceOp) Create(ctx context.Context, productId uint64, variant Variant) (*Variant, error)

Create a new variant

func (*VariantServiceOp) CreateMetafield added in v1.3.18

func (s *VariantServiceOp) CreateMetafield(ctx context.Context, variantId uint64, metafield Metafield) (*Metafield, error)

CreateMetafield for a variant

func (*VariantServiceOp) Delete

func (s *VariantServiceOp) Delete(ctx context.Context, productId uint64, variantId uint64) error

Delete an existing variant

func (*VariantServiceOp) DeleteMetafield added in v1.3.18

func (s *VariantServiceOp) DeleteMetafield(ctx context.Context, variantId uint64, metafieldId uint64) error

DeleteMetafield for a variant

func (*VariantServiceOp) Get

func (s *VariantServiceOp) Get(ctx context.Context, variantId uint64, options interface{}) (*Variant, error)

Get individual variant

func (*VariantServiceOp) GetMetafield added in v1.3.18

func (s *VariantServiceOp) GetMetafield(ctx context.Context, variantId uint64, metafieldId uint64, options interface{}) (*Metafield, error)

GetMetafield for a variant

func (*VariantServiceOp) List

func (s *VariantServiceOp) List(ctx context.Context, productId uint64, options interface{}) ([]Variant, error)

List variants

func (*VariantServiceOp) ListMetafields added in v1.3.18

func (s *VariantServiceOp) ListMetafields(ctx context.Context, variantId uint64, options interface{}) ([]Metafield, error)

ListMetafields for a variant

func (*VariantServiceOp) Update

func (s *VariantServiceOp) Update(ctx context.Context, variant Variant) (*Variant, error)

Update existing variant

func (*VariantServiceOp) UpdateMetafield added in v1.3.18

func (s *VariantServiceOp) UpdateMetafield(ctx context.Context, variantId uint64, metafield Metafield) (*Metafield, error)

UpdateMetafield for a variant

type VariantsResource

type VariantsResource struct {
	Variants []Variant `json:"variants"`
}

VariantsResource represents the result from the products/X/variants.json endpoint

type Webhook

type Webhook struct {
	Id                         uint64     `json:"id"`
	Address                    string     `json:"address"`
	Topic                      string     `json:"topic"`
	Format                     string     `json:"format"`
	CreatedAt                  *time.Time `json:"created_at,omitempty"`
	UpdatedAt                  *time.Time `json:"updated_at,omitempty"`
	Fields                     []string   `json:"fields"`
	MetafieldNamespaces        []string   `json:"metafield_namespaces"`
	PrivateMetafieldNamespaces []string   `json:"private_metafield_namespaces"`
	ApiVersion                 string     `json:"api_version,omitempty"`
}

Webhook represents a Shopify webhook

type WebhookOptions

type WebhookOptions struct {
	Address string `url:"address,omitempty"`
	Topic   string `url:"topic,omitempty"`
}

WebhookOptions can be used for filtering webhooks on a List request.

type WebhookResource

type WebhookResource struct {
	Webhook *Webhook `json:"webhook"`
}

WebhookResource represents the result from the admin/webhooks.json endpoint

type WebhookService

type WebhookService interface {
	List(context.Context, interface{}) ([]Webhook, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, uint64, interface{}) (*Webhook, error)
	Create(context.Context, Webhook) (*Webhook, error)
	Update(context.Context, Webhook) (*Webhook, error)
	Delete(context.Context, uint64) error
}

WebhookService is an interface for interfacing with the webhook endpoints of the Shopify API. See: https://help.shopify.com/api/reference/webhook

type WebhookServiceOp

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

WebhookServiceOp handles communication with the webhook-related methods of the Shopify API.

func (*WebhookServiceOp) Count

func (s *WebhookServiceOp) Count(ctx context.Context, options interface{}) (int, error)

Count webhooks

func (*WebhookServiceOp) Create

func (s *WebhookServiceOp) Create(ctx context.Context, webhook Webhook) (*Webhook, error)

Create a new webhook

func (*WebhookServiceOp) Delete

func (s *WebhookServiceOp) Delete(ctx context.Context, Id uint64) error

Delete an existing webhooks

func (*WebhookServiceOp) Get

func (s *WebhookServiceOp) Get(ctx context.Context, webhookdId uint64, options interface{}) (*Webhook, error)

Get individual webhook

func (*WebhookServiceOp) List

func (s *WebhookServiceOp) List(ctx context.Context, options interface{}) ([]Webhook, error)

List webhooks

func (*WebhookServiceOp) Update

func (s *WebhookServiceOp) Update(ctx context.Context, webhook Webhook) (*Webhook, error)

Update an existing webhook.

type WebhooksResource

type WebhooksResource struct {
	Webhooks []Webhook `json:"webhooks"`
}

WebhooksResource is the root object for a webhook get request.

type WeightBasedShippingRate added in v1.3.18

type WeightBasedShippingRate struct {
	Id             uint64           `json:"id,omitempty"`
	ShippingZoneId uint64           `json:"shipping_zone_id,omitempty"`
	Name           string           `json:"name,omitempty"`
	Price          *decimal.Decimal `json:"price,omitempty"`
	WeightLow      *decimal.Decimal `json:"weight_low,omitempty"`
	WeightHigh     *decimal.Decimal `json:"weight_high,omitempty"`
}

WeightBasedShippingRate represents a Shopify weight-constrained shipping rate

Jump to

Keyboard shortcuts

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