goshopify

package module
v0.0.0-...-5001f0d Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 24 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 github.com/bold-commerce/go-shopify/v3

Use v3

import "github.com/bold-commerce/go-shopify/v3"

This gives you access to the goshopify package.

Install v2

$ go get github.com/bold-commerce/go-shopify

Use v2

import "github.com/bold-commerce/go-shopify"

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 := 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 := 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 := 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 := 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 (
	UserAgent = "goshopify/1.0.0"
	// UnstableApiVersion Shopify API version for accessing unstable API features
	UnstableApiVersion = "unstable"
)
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 (
	// 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

Variables

This section is empty.

Functions

func CheckResponseError

func CheckResponseError(r *http.Response) error

func FulfillmentOrderPathPrefix

func FulfillmentOrderPathPrefix(resource string, resourceID int64) string

FulfillmentOrderPathPrefix returns the prefix for a fulfillmentOrder path

func FulfillmentPathPrefix

func FulfillmentPathPrefix(resource string, resourceID int64) string

Return the prefix for a fulfillment path

func MetafieldPathPrefix

func MetafieldPathPrefix(resource string, resourceID int64) 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

type AbandonedCheckout struct {
	ID                       int64                `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                   int64                `json:"user_id,omitempty"`
	SourceIdentifier         string               `json:"source_identifier,omitempty"`
	SourceUrl                string               `json:"source_url,omitempty"`
	DeviceID                 int64                `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

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

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

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

func (*AbandonedCheckoutServiceOp) List

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

Get abandoned checkout list

type AbandonedCheckoutsResource

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

Represents the result from the checkouts.json endpoint

type AccessScope

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

type AccessScopesResource

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

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

type AccessScopesService

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

type AccessScopesServiceOp

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

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

func (*AccessScopesServiceOp) List

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           int64   `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

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

type AmountSetEntry

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
}

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

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) NewClient

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

NewClient 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

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

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                 int64            `json:"id"`
	Name               string           `json:"name"`
	APIClientID        int64            `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, int64, 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 int64, 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

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     int64      `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, int64, interface{}) ([]Asset, error)
	Get(context.Context, int64, string) (*Asset, error)
	Update(context.Context, int64, Asset) (*Asset, error)
	Delete(context.Context, int64, 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 int64, key string) error

Delete an asset

func (*AssetServiceOp) Get

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

Get an asset by key from the given theme

func (*AssetServiceOp) List

func (s *AssetServiceOp) List(ctx context.Context, themeID int64, 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 int64, 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

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

type AssignedFulfillmentOrderDestination

type AssignedFulfillmentOrderDestination struct {
	Id        int64  `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

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

AssignedFulfillmentOrderLineItem represents a line item for a AssignedFulfillmentOrder

type AssignedFulfillmentOrderOptions

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

type AssignedFulfillmentOrderService

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

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

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

func (*AssignedFulfillmentOrderServiceOp) Get

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

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                 int64      `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, int64, interface{}) (*Blog, error)
	Create(context.Context, Blog) (*Blog, error)
	Update(context.Context, Blog) (*Blog, error)
	Delete(context.Context, int64) 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 int64) error

Delete an blog

func (*BlogServiceOp) Get

func (s *BlogServiceOp) Get(ctx context.Context, blogId int64, 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

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 int64 `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

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

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

func (*CarrierServiceOp) Create

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

Create a carrier service

func (*CarrierServiceOp) Delete

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

Delete a carrier service

func (*CarrierServiceOp) Get

Get individual carrier resource by carrier resource ID

func (*CarrierServiceOp) List

List carrier services

func (*CarrierServiceOp) Update

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

Update a carrier service

type CarrierServiceService

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

type CarrierShippingRateProvider struct {
	ID               int64             `json:"id,omitempty"`
	CarrierServiceID int64             `json:"carrier_service_id,omitempty"`
	ShippingZoneID   int64             `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

	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 NewClient

func NewClient(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"

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

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) ListWithPagination

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

type Collect struct {
	ID           int64      `json:"id,omitempty"`
	CollectionID int64      `json:"collection_id,omitempty"`
	ProductID    int64      `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

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

Represents the result from the collects/X.json endpoint

type CollectService

type CollectService interface {
	List(context.Context, interface{}) ([]Collect, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, int64, interface{}) (*Collect, error)
	Create(context.Context, Collect) (*Collect, error)
	Delete(context.Context, int64) 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

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

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

func (*CollectServiceOp) Count

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

Count collects

func (*CollectServiceOp) Create

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

Create collects

func (*CollectServiceOp) Delete

func (s *CollectServiceOp) Delete(ctx context.Context, collectID int64) error

Delete an existing collect

func (*CollectServiceOp) Get

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

Get individual collect

func (*CollectServiceOp) List

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

List collects

type Collection

type Collection struct {
	ID             int64      `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

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

Represents the result from the collections/X.json endpoint

type CollectionService

type CollectionService interface {
	Get(ctx context.Context, collectionID int64, options interface{}) (*Collection, error)
	ListProducts(ctx context.Context, collectionID int64, options interface{}) ([]Product, error)
	ListProductsWithPagination(ctx context.Context, collectionID int64, 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

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

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

func (*CollectionServiceOp) Get

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

Get individual collection

func (*CollectionServiceOp) ListProducts

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

List products for a collection

func (*CollectionServiceOp) ListProductsWithPagination

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

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

type CollectsResource

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             int64       `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, int64, interface{}) (*CustomCollection, error)
	Create(context.Context, CustomCollection) (*CustomCollection, error)
	Update(context.Context, CustomCollection) (*CustomCollection, error)
	Delete(context.Context, int64) 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 int64, 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 int64, metafield Metafield) (*Metafield, error)

Create a new metafield for a custom collection

func (*CustomCollectionServiceOp) Delete

func (s *CustomCollectionServiceOp) Delete(ctx context.Context, collectionID int64) error

Delete an existing custom collection.

func (*CustomCollectionServiceOp) DeleteMetafield

func (s *CustomCollectionServiceOp) DeleteMetafield(ctx context.Context, customCollectionID int64, metafieldID int64) error

// Delete an existing metafield for a custom collection

func (*CustomCollectionServiceOp) Get

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

Get individual custom collection

func (*CustomCollectionServiceOp) GetMetafield

func (s *CustomCollectionServiceOp) GetMetafield(ctx context.Context, customCollectionID int64, metafieldID int64, 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 int64, 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 int64, 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                  int64              `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         int64              `json:"last_order_id,omitempty"`
	LastOrderName       string             `json:"last_order_name,omitempty"`
	AcceptsMarketing    bool               `json:"accepts_marketing,omitempty"`
	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           int64  `json:"id,omitempty"`
	CustomerID   int64  `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

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

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

type CustomerAddressService

type CustomerAddressService interface {
	List(context.Context, int64, interface{}) ([]CustomerAddress, error)
	Get(context.Context, int64, int64, interface{}) (*CustomerAddress, error)
	Create(context.Context, int64, CustomerAddress) (*CustomerAddress, error)
	Update(context.Context, int64, CustomerAddress) (*CustomerAddress, error)
	Delete(context.Context, int64, int64) 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

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

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

func (*CustomerAddressServiceOp) Create

func (s *CustomerAddressServiceOp) Create(ctx context.Context, customerID int64, address CustomerAddress) (*CustomerAddress, error)

Create a new address for given customer

func (*CustomerAddressServiceOp) Delete

func (s *CustomerAddressServiceOp) Delete(ctx context.Context, customerID, addressID int64) error

Delete an existing address

func (*CustomerAddressServiceOp) Get

func (s *CustomerAddressServiceOp) Get(ctx context.Context, customerID, addressID int64, options interface{}) (*CustomerAddress, error)

Get address

func (*CustomerAddressServiceOp) List

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

List addresses

func (*CustomerAddressServiceOp) Update

func (s *CustomerAddressServiceOp) Update(ctx context.Context, customerID int64, address CustomerAddress) (*CustomerAddress, error)

Create a new address for given customer

type CustomerAddressesResource

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

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

type CustomerID

type CustomerID struct {
	CustomerID int64 `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, int64, interface{}) (*Customer, error)
	Search(context.Context, interface{}) ([]Customer, error)
	Create(context.Context, Customer) (*Customer, error)
	Update(context.Context, Customer) (*Customer, error)
	Delete(context.Context, int64) error
	ListOrders(context.Context, int64, 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 int64, 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 int64, metafield Metafield) (*Metafield, error)

Create a new metafield for a customer

func (*CustomerServiceOp) Delete

func (s *CustomerServiceOp) Delete(ctx context.Context, customerID int64) error

Delete an existing customer

func (*CustomerServiceOp) DeleteMetafield

func (s *CustomerServiceOp) DeleteMetafield(ctx context.Context, customerID int64, metafieldID int64) error

// Delete an existing metafield for a customer

func (*CustomerServiceOp) Get

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

Get customer

func (*CustomerServiceOp) GetMetafield

func (s *CustomerServiceOp) GetMetafield(ctx context.Context, customerID int64, metafieldID int64, 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 int64, options interface{}) ([]Metafield, error)

List metafields for a customer

func (*CustomerServiceOp) ListOrders

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

ListOrders retrieves all orders from a customer

func (*CustomerServiceOp) ListTags

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

ListTags retrieves all unique tags across all customers

func (*CustomerServiceOp) ListWithPagination

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, 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 int64, metafield Metafield) (*Metafield, error)

Update an existing metafield for a customer

type CustomerTagsResource

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

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

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

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

type DiscountCodeService

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

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

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

func (*DiscountCodeServiceOp) Create

Create a discount code

func (*DiscountCodeServiceOp) Delete

func (s *DiscountCodeServiceOp) Delete(ctx context.Context, priceRuleID int64, discountCodeID int64) error

Delete a discount code

func (*DiscountCodeServiceOp) Get

func (s *DiscountCodeServiceOp) Get(ctx context.Context, priceRuleID int64, discountCodeID int64) (*PriceRuleDiscountCode, error)

Get a single discount code

func (*DiscountCodeServiceOp) List

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

List of discount codes

func (*DiscountCodeServiceOp) Update

Update an existing discount code

type DiscountCodesResource

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

DiscountCodesResource is the result from the discount_codes.json endpoint

type DraftOrder

type DraftOrder struct {
	ID              int64            `json:"id,omitempty"`
	OrderID         int64            `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

type DraftOrderCountOptions struct {
	Fields  string      `url:"fields,omitempty"`
	Limit   int         `url:"limit,omitempty"`
	SinceID int64       `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

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

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

type DraftOrderListOptions

type DraftOrderListOptions struct {
	Fields       string      `url:"fields,omitempty"`
	Limit        int         `url:"limit,omitempty"`
	SinceID      int64       `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

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

type DraftOrderService

type DraftOrderService interface {
	List(context.Context, interface{}) ([]DraftOrder, error)
	Count(context.Context, interface{}) (int, error)
	Get(context.Context, int64, interface{}) (*DraftOrder, error)
	Create(context.Context, DraftOrder) (*DraftOrder, error)
	Update(context.Context, DraftOrder) (*DraftOrder, error)
	Delete(context.Context, int64) error
	Invoice(context.Context, int64, DraftOrderInvoice) (*DraftOrderInvoice, error)
	Complete(context.Context, int64, 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

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

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

func (*DraftOrderServiceOp) Complete

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

Complete draft order

func (*DraftOrderServiceOp) Count

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

Count draft orders

func (*DraftOrderServiceOp) CountMetafields

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

Count metafields for an order

func (*DraftOrderServiceOp) Create

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

Create draft order

func (*DraftOrderServiceOp) CreateMetafield

func (s *DraftOrderServiceOp) CreateMetafield(ctx context.Context, draftOrderID int64, metafield Metafield) (*Metafield, error)

Create a new metafield for an order

func (*DraftOrderServiceOp) Delete

func (s *DraftOrderServiceOp) Delete(ctx context.Context, draftOrderID int64) error

Delete draft orders

func (*DraftOrderServiceOp) DeleteMetafield

func (s *DraftOrderServiceOp) DeleteMetafield(ctx context.Context, draftOrderID int64, metafieldID int64) error

Delete an existing metafield for an order

func (*DraftOrderServiceOp) Get

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

Get individual draft order

func (*DraftOrderServiceOp) GetMetafield

func (s *DraftOrderServiceOp) GetMetafield(ctx context.Context, draftOrderID int64, metafieldID int64, options interface{}) (*Metafield, error)

Get individual metafield for an order

func (*DraftOrderServiceOp) Invoice

func (s *DraftOrderServiceOp) Invoice(ctx context.Context, draftOrderID int64, draftOrderInvoice DraftOrderInvoice) (*DraftOrderInvoice, error)

Invoice a draft order

func (*DraftOrderServiceOp) List

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

List draft orders

func (*DraftOrderServiceOp) ListMetafields

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

List metafields for an order

func (*DraftOrderServiceOp) Update

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

Update draft order

func (*DraftOrderServiceOp) UpdateMetafield

func (s *DraftOrderServiceOp) UpdateMetafield(ctx context.Context, draftOrderID int64, metafield Metafield) (*Metafield, error)

Update an existing metafield for an order

type DraftOrdersResource

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

type Fulfillment

type Fulfillment struct {
	ID                          int64                        `json:"id,omitempty"`
	OrderID                     int64                        `json:"order_id,omitempty"`
	LocationID                  int64                        `json:"location_id,omitempty"`
	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

type FulfillmentEvent struct {
	ID                  int64   `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       int64   `json:"fulfillment_id"`
	HappenedAt          string  `json:"happened_at"`
	Latitude            float64 `json:"latitude"`
	Longitude           float64 `json:"longitude"`
	Message             string  `json:"message"`
	OrderID             int64   `json:"order_id"`
	Province            string  `json:"province"`
	ShopID              int64   `json:"shop_id"`
	Status              string  `json:"status"`
	UpdatedAt           string  `json:"updated_at"`
	Zip                 string  `json:"zip"`
}

FulfillmentEvent represents a Shopify fulfillment event.

type FulfillmentEventCreateRequest

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

type FulfillmentEventResource

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

type FulfillmentEventService

type FulfillmentEventService interface {
	List(ctx context.Context, orderID int64, fulfillmentID int64) ([]FulfillmentEvent, error)
	Get(ctx context.Context, orderID int64, fulfillmentID int64, eventID int64) (*FulfillmentEvent, error)
	Create(ctx context.Context, orderID int64, fulfillmentID int64, event FulfillmentEvent) (*FulfillmentEvent, error)
	Delete(ctx context.Context, orderID int64, fulfillmentID int64, eventID int64) 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

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

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

func (*FulfillmentEventServiceOp) Create

func (s *FulfillmentEventServiceOp) Create(ctx context.Context, orderID int64, fulfillmentID int64, event FulfillmentEvent) (*FulfillmentEvent, error)

Create a new FulfillmentEvent

func (*FulfillmentEventServiceOp) Delete

func (s *FulfillmentEventServiceOp) Delete(ctx context.Context, orderID int64, fulfillmentID int64, eventID int64) error

Delete an existing FulfillmentEvent

func (*FulfillmentEventServiceOp) Get

func (s *FulfillmentEventServiceOp) Get(ctx context.Context, orderID int64, fulfillmentID int64, eventID int64) (*FulfillmentEvent, error)

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

func (*FulfillmentEventServiceOp) List

func (s *FulfillmentEventServiceOp) List(ctx context.Context, orderID int64, fulfillmentID int64) ([]FulfillmentEvent, error)

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

type FulfillmentEventsResource

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

type FulfillmentOrder

type FulfillmentOrder struct {
	Id                  int64                               `json:"id,omitempty"`
	AssignedLocation    FulfillmentOrderAssignedLocation    `json:"assigned_location,omitempty"`
	AssignedLocationId  int64                               `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             int64                               `json:"order_id,omitempty"`
	RequestStatus       string                              `json:"request_status,omitempty"`
	ShopId              int64                               `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

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  int64  `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

type FulfillmentOrderDeliveryMethod struct {
	Id                  int64     `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

type FulfillmentOrderDestination struct {
	Id        int64  `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

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

FulfillmentOrderHold represents a fulfillment hold for a FulfillmentOrder

type FulfillmentOrderHoldReason

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

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

FulfillmentOrderInternationalDuties represents an InternationalDuty for a FulfillmentOrder

type FulfillmentOrderLineItem

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

FulfillmentOrderLineItem represents a line item for a FulfillmentOrder

type FulfillmentOrderLineItemQuantity

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

type FulfillmentOrderMerchantRequest

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

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

type FulfillmentOrderMoveResource

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

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

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

type FulfillmentOrderServiceOp

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

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

func (*FulfillmentOrderServiceOp) Cancel

func (s *FulfillmentOrderServiceOp) Cancel(ctx context.Context, fulfillmentID int64) (*FulfillmentOrder, error)

Cancel cancels a fulfillment order

func (*FulfillmentOrderServiceOp) Close

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

Close marks a fulfillment order as incomplete with an optional message

func (*FulfillmentOrderServiceOp) Get

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

Get gets an individual fulfillment order

func (*FulfillmentOrderServiceOp) Hold

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

Hold applies a fulfillment hold on an open fulfillment order

func (*FulfillmentOrderServiceOp) List

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

List gets FulfillmentOrder items for an order

func (*FulfillmentOrderServiceOp) Move

Move moves a fulfillment order to a new location

func (*FulfillmentOrderServiceOp) Open

func (s *FulfillmentOrderServiceOp) Open(ctx context.Context, fulfillmentID int64) (*FulfillmentOrder, error)

Open marks the fulfillment order as open

func (*FulfillmentOrderServiceOp) ReleaseHold

func (s *FulfillmentOrderServiceOp) ReleaseHold(ctx context.Context, fulfillmentID int64) (*FulfillmentOrder, error)

ReleaseHold releases the fulfillment hold on a fulfillment order

func (*FulfillmentOrderServiceOp) Reschedule

func (s *FulfillmentOrderServiceOp) Reschedule(ctx context.Context, fulfillmentID int64) (*FulfillmentOrder, error)

Reschedule reschedules the fulfill_at time of a scheduled fulfillment order

func (*FulfillmentOrderServiceOp) SetDeadline

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

SetDeadline sets deadline for fulfillment orders

type FulfillmentOrdersResource

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

FulfillmentOrdersResource represents the result from the fulfillment_orders.json endpoint

type FulfillmentRequest

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

type FulfillmentRequestLineItem struct {
	FulfillmentOrderLineItemID int64  `json:"fulfillment_order_line_item_id,omitempty"`
	Message                    string `json:"message,omitempty"`
}

type FulfillmentRequestOrderLineItem

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

type FulfillmentRequestResource

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

type FulfillmentRequestService

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

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

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

func (*FulfillmentRequestServiceOp) Accept

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

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

func (*FulfillmentRequestServiceOp) Reject

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

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

func (*FulfillmentRequestServiceOp) Send

func (s *FulfillmentRequestServiceOp) Send(ctx context.Context, fulfillmentOrderID int64, 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, int64, interface{}) (*Fulfillment, error)
	Create(context.Context, Fulfillment) (*Fulfillment, error)
	Update(context.Context, Fulfillment) (*Fulfillment, error)
	Complete(context.Context, int64) (*Fulfillment, error)
	Transition(context.Context, int64) (*Fulfillment, error)
	Cancel(context.Context, int64) (*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

type FulfillmentServiceData struct {
	Id                     int64  `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             int64  `json:"provider_id,omitempty"`
	LocationId             int64  `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 int64) (*Fulfillment, error)

Cancel an existing fulfillment

func (*FulfillmentServiceOp) Complete

func (s *FulfillmentServiceOp) Complete(ctx context.Context, fulfillmentID int64) (*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 int64, 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 int64) (*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

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

type FulfillmentServiceResource

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

type FulfillmentServiceService

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

type FulfillmentServiceServiceOp

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

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

func (*FulfillmentServiceServiceOp) Create

Create Create a new FulfillmentServiceData

func (*FulfillmentServiceServiceOp) Delete

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

Delete Remove an existing FulfillmentServiceData

func (*FulfillmentServiceServiceOp) Get

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

Get Receive a single FulfillmentServiceData

func (*FulfillmentServiceServiceOp) List

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

List Receive a list of all FulfillmentServiceData

func (*FulfillmentServiceServiceOp) Update

Update Modify an existing FulfillmentServiceData

type FulfillmentServicesResource

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

type FulfillmentTrackingInfo

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, int64, interface{}) ([]Fulfillment, error)
	CountFulfillments(context.Context, int64, interface{}) (int, error)
	GetFulfillment(context.Context, int64, int64, interface{}) (*Fulfillment, error)
	CreateFulfillment(context.Context, int64, Fulfillment) (*Fulfillment, error)
	UpdateFulfillment(context.Context, int64, Fulfillment) (*Fulfillment, error)
	CompleteFulfillment(context.Context, int64, int64) (*Fulfillment, error)
	TransitionFulfillment(context.Context, int64, int64) (*Fulfillment, error)
	CancelFulfillment(context.Context, int64, int64) (*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

type GiftCard struct {
	ID             int64            `json:"id,omitempty"`
	ApiClientId    int64            `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     int64            `json:"line_item_id,omitempty"`
	Note           string           `json:"note,omitempty"`
	OrderID        int64            `json:"order_id,omitempty"`
	TemplateSuffix string           `json:"template_suffix,omitempty"`
	UserID         int64            `json:"user_id,omitempty"`
	UpdatedAt      *time.Time       `json:"updated_at,omitempty"`
}

giftCard represents a Shopify discount rule

type GiftCardResource

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

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

type GiftCardService

type GiftCardService interface {
	Get(context.Context, int64) (*GiftCard, error)
	Create(context.Context, GiftCard) (*GiftCard, error)
	Update(context.Context, GiftCard) (*GiftCard, error)
	List(context.Context) ([]GiftCard, error)
	Disable(context.Context, int64) (*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

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

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

func (*GiftCardServiceOp) Count

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

Count retrieves the number of gift cards

func (*GiftCardServiceOp) Create

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

Create creates a gift card

func (*GiftCardServiceOp) Disable

func (s *GiftCardServiceOp) Disable(ctx context.Context, giftCardID int64) (*GiftCard, error)

Disable disables an existing a gift card

func (*GiftCardServiceOp) Get

func (s *GiftCardServiceOp) Get(ctx context.Context, giftCardID int64) (*GiftCard, error)

Get retrieves a single gift cards

func (*GiftCardServiceOp) List

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

List retrieves a list of gift cards

func (*GiftCardServiceOp) Update

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

Update updates an existing a gift card

type GiftCardsResource

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

giftCardsResource represents the result from the gift_cards.json endpoint

type GraphQLCost

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

func (c GraphQLCost) RetryAfterSeconds() float64

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

type GraphQLService

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

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

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

func (*GraphQLServiceOp) Query

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

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                int64      `json:"id,omitempty"`
	ProductID         int64      `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        []int64    `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, int64, interface{}) ([]Image, error)
	Count(context.Context, int64, interface{}) (int, error)
	Get(context.Context, int64, int64, interface{}) (*Image, error)
	Create(context.Context, int64, Image) (*Image, error)
	Update(context.Context, int64, Image) (*Image, error)
	Delete(context.Context, int64, int64) 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 int64, options interface{}) (int, error)

Count images

func (*ImageServiceOp) Create

func (s *ImageServiceOp) Create(ctx context.Context, productID int64, 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 int64, imageID int64) error

Delete an existing image

func (*ImageServiceOp) Get

func (s *ImageServiceOp) Get(ctx context.Context, productID int64, imageID int64, options interface{}) (*Image, error)

Get individual image

func (*ImageServiceOp) List

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

List images

func (*ImageServiceOp) Update

func (s *ImageServiceOp) Update(ctx context.Context, productID int64, 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

type InventoryItem struct {
	ID                           int64            `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

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

InventoryItemResource is used for handling single item requests and responses

type InventoryItemService

type InventoryItemService interface {
	List(context.Context, interface{}) ([]InventoryItem, error)
	Get(context.Context, int64, 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

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

InventoryItemServiceOp is the default implementation of the InventoryItemService interface

func (*InventoryItemServiceOp) Get

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

Get a inventory item

func (*InventoryItemServiceOp) List

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

List inventory items

func (*InventoryItemServiceOp) Update

Update a inventory item

type InventoryItemsResource

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

InventoryItemsResource is used for handling multiple item responsees

type InventoryLevel

type InventoryLevel struct {
	InventoryItemId   int64      `json:"inventory_item_id,omitempty"`
	LocationId        int64      `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

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

InventoryLevelAdjustOptions is used for Adjust inventory levels

type InventoryLevelListOptions

type InventoryLevelListOptions struct {
	InventoryItemIds []int64   `url:"inventory_item_ids,omitempty,comma"`
	LocationIds      []int64   `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

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

InventoryLevelResource is used for handling single level requests and responses

type InventoryLevelService

type InventoryLevelService interface {
	List(context.Context, interface{}) ([]InventoryLevel, error)
	Adjust(context.Context, interface{}) (*InventoryLevel, error)
	Delete(context.Context, int64, int64) 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

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

InventoryLevelServiceOp is the default implementation of the InventoryLevelService interface

func (*InventoryLevelServiceOp) Adjust

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

Connect an inventory level

func (*InventoryLevelServiceOp) Delete

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

Delete an inventory level

func (*InventoryLevelServiceOp) List

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

List inventory levels

func (*InventoryLevelServiceOp) Set

Set an inventory level

type InventoryLevelsResource

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

InventoryLevelsResource is used for handling multiple item responsees

type LeveledLogger

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

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

Debugf logs a debug message using Printf conventions.

func (*LeveledLogger) Errorf

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

Errorf logs a warning message using Printf conventions.

func (*LeveledLogger) Infof

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

Infof logs an informational message using Printf conventions.

func (*LeveledLogger) Warnf

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

Warnf logs a warning message using Printf conventions.

type LeveledLoggerInterface

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                         int64                  `json:"id,omitempty"`
	ProductID                  int64                  `json:"product_id,omitempty"`
	VariantID                  int64                  `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

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

type LineItemByFulfillmentOrder struct {
	FulfillmentOrderID        int64                                    `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

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

LineItemByFulfillmentOrderItemQuantity represents the quantity to fulfill for one item.

type LineItemProperty

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

type ListCarrierResource

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      int64     `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          []int64   `url:"ids,omitempty,comma"`
}

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

type Location

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 int64 `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

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

Represents the result from the locations/X.json endpoint

type LocationService

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 int64, 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

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

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

func (*LocationServiceOp) Count

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

func (*LocationServiceOp) Get

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

func (*LocationServiceOp) List

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

type LocationsResource

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                int64         `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           int64         `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, int64, interface{}) (*Metafield, error)
	Create(context.Context, Metafield) (*Metafield, error)
	Update(context.Context, Metafield) (*Metafield, error)
	Delete(context.Context, int64) 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 int64) error

Delete an existing metafield

func (*MetafieldServiceOp) Get

func (s *MetafieldServiceOp) Get(ctx context.Context, metafieldID int64, 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, int64, interface{}) ([]Metafield, error)
	CountMetafields(context.Context, int64, interface{}) (int, error)
	GetMetafield(context.Context, int64, int64, interface{}) (*Metafield, error)
	CreateMetafield(context.Context, int64, Metafield) (*Metafield, error)
	UpdateMetafield(context.Context, int64, Metafield) (*Metafield, error)
	DeleteMetafield(context.Context, int64, int64) 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

type OnlyDate struct {
	time.Time
}

func (*OnlyDate) EncodeValues

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

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

func (*OnlyDate) String

func (c *OnlyDate) String() string

func (*OnlyDate) UnmarshalJSON

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

type Option

type Option func(c *Client)

Option is used to configure client with options

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient is used to set a custom http client

func WithLogger

func WithLogger(logger LeveledLoggerInterface) Option

func WithRetry

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

func WithVersion(apiVersion string) Option

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

type Order

type Order struct {
	ID                     int64                  `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             int64                  `json:"location_id,omitempty"`
	PaymentGatewayNames    []string               `json:"payment_gateway_names,omitempty"`
	ProcessingMethod       string                 `json:"processing_method,omitempty"`
	Refunds                []Refund               `json:"refunds,omitempty"`
	UserId                 int64                  `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               int64                  `json:"device_id,omitempty"`
	Phone                  string                 `json:"phone,omitempty"`
	LandingSiteRef         string                 `json:"landing_site_ref,omitempty"`
	CheckoutID             int64                  `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"`
}

Order represents a Shopify order

type OrderAdjustment

type OrderAdjustment struct {
	Id           int64               `json:"id,omitempty"`
	OrderId      int64               `json:"order_id,omitempty"`
	RefundId     int64               `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

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

type OrderCancelOptions

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           int64                  `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

type OrderRisk struct {
	Id              int64                   `json:"id,omitempty"`
	CheckoutId      int64                   `json:"checkout_id,omitempty"`
	OrderId         int64                   `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

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

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

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

type OrderRiskService

type OrderRiskService interface {
	List(context.Context, int64, interface{}) ([]OrderRisk, error)
	ListWithPagination(context.Context, int64, interface{}) ([]OrderRisk, *Pagination, error)
	Get(context.Context, int64, int64, interface{}) (*OrderRisk, error)
	Create(context.Context, int64, OrderRisk) (*OrderRisk, error)
	Update(context.Context, int64, int64, OrderRisk) (*OrderRisk, error)
	Delete(context.Context, int64, int64) 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

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

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

func (*OrderRiskServiceOp) Create

func (s *OrderRiskServiceOp) Create(ctx context.Context, orderID int64, orderRisk OrderRisk) (*OrderRisk, error)

Create order

func (*OrderRiskServiceOp) Delete

func (s *OrderRiskServiceOp) Delete(ctx context.Context, orderID int64, riskID int64) error

Delete order

func (*OrderRiskServiceOp) Get

func (s *OrderRiskServiceOp) Get(ctx context.Context, orderID int64, riskID int64, options interface{}) (*OrderRisk, error)

Get individual order

func (*OrderRiskServiceOp) List

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

List OrderRisk

func (*OrderRiskServiceOp) ListWithPagination

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

func (*OrderRiskServiceOp) Update

func (s *OrderRiskServiceOp) Update(ctx context.Context, orderID int64, riskID int64, 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, int64, interface{}) (*Order, error)
	Create(context.Context, Order) (*Order, error)
	Update(context.Context, Order) (*Order, error)
	Cancel(context.Context, int64, interface{}) (*Order, error)
	Close(context.Context, int64) (*Order, error)
	Open(context.Context, int64) (*Order, error)
	Delete(context.Context, int64) 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

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

Cancel order

func (*OrderServiceOp) CancelFulfillment

func (s *OrderServiceOp) CancelFulfillment(ctx context.Context, orderID int64, fulfillmentID int64) (*Fulfillment, error)

Cancel an existing fulfillment for an order

func (*OrderServiceOp) Close

func (s *OrderServiceOp) Close(ctx context.Context, orderID int64) (*Order, error)

Close order

func (*OrderServiceOp) CompleteFulfillment

func (s *OrderServiceOp) CompleteFulfillment(ctx context.Context, orderID int64, fulfillmentID int64) (*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 int64, options interface{}) (int, error)

Count fulfillments for an order

func (*OrderServiceOp) CountMetafields

func (s *OrderServiceOp) CountMetafields(ctx context.Context, orderID int64, 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 int64, fulfillment Fulfillment) (*Fulfillment, error)

Create a new fulfillment for an order

func (*OrderServiceOp) CreateMetafield

func (s *OrderServiceOp) CreateMetafield(ctx context.Context, orderID int64, metafield Metafield) (*Metafield, error)

Create a new metafield for an order

func (*OrderServiceOp) Delete

func (s *OrderServiceOp) Delete(ctx context.Context, orderID int64) error

Delete order

func (*OrderServiceOp) DeleteMetafield

func (s *OrderServiceOp) DeleteMetafield(ctx context.Context, orderID int64, metafieldID int64) error

Delete an existing metafield for an order

func (*OrderServiceOp) Get

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

Get individual order

func (*OrderServiceOp) GetFulfillment

func (s *OrderServiceOp) GetFulfillment(ctx context.Context, orderID int64, fulfillmentID int64, options interface{}) (*Fulfillment, error)

Get individual fulfillment for an order

func (*OrderServiceOp) GetMetafield

func (s *OrderServiceOp) GetMetafield(ctx context.Context, orderID int64, metafieldID int64, 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 int64, options interface{}) ([]Fulfillment, error)

List fulfillments for an order

func (*OrderServiceOp) ListMetafields

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

List metafields for an order

func (*OrderServiceOp) ListWithPagination

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

func (*OrderServiceOp) Open

func (s *OrderServiceOp) Open(ctx context.Context, orderID int64) (*Order, error)

Open order

func (*OrderServiceOp) TransitionFulfillment

func (s *OrderServiceOp) TransitionFulfillment(ctx context.Context, orderID int64, fulfillmentID int64) (*Fulfillment, error)

Transition an existing fulfillment for an order

func (*OrderServiceOp) Update

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

Update order

func (*OrderServiceOp) UpdateFulfillment

func (s *OrderServiceOp) UpdateFulfillment(ctx context.Context, orderID int64, fulfillment Fulfillment) (*Fulfillment, error)

Update an existing fulfillment for an order

func (*OrderServiceOp) UpdateMetafield

func (s *OrderServiceOp) UpdateMetafield(ctx context.Context, orderID int64, 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

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

Represents the result from the orders-risk.json endpoint

type Page

type Page struct {
	ID             int64       `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         int64       `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, int64, interface{}) (*Page, error)
	Create(context.Context, Page) (*Page, error)
	Update(context.Context, Page) (*Page, error)
	Delete(context.Context, int64) 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 int64, 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 int64, metafield Metafield) (*Metafield, error)

Create a new metafield for a page

func (*PageServiceOp) Delete

func (s *PageServiceOp) Delete(ctx context.Context, pageID int64) error

Delete an existing page.

func (*PageServiceOp) DeleteMetafield

func (s *PageServiceOp) DeleteMetafield(ctx context.Context, pageID int64, metafieldID int64) error

Delete an existing metafield for a page

func (*PageServiceOp) Get

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

Get individual page

func (*PageServiceOp) GetMetafield

func (s *PageServiceOp) GetMetafield(ctx context.Context, pageID int64, metafieldID int64, 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 int64, 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 int64, 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

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

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

Represents the result from the PaymentsTransactions/X.json endpoint

type PaymentsTransactions

type PaymentsTransactions struct {
	Id                       int64                     `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

type PaymentsTransactionsListOptions struct {
	PageInfo     string       `url:"page_info,omitempty"`
	Limit        int          `url:"limit,omitempty"`
	Fields       string       `url:"fields,omitempty"`
	LastId       int64        `url:"last_id,omitempty"`
	SinceId      int64        `url:"since_id,omitempty"`
	PayoutId     int64        `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

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

Represents the result from the PaymentsTransactions.json endpoint

type PaymentsTransactionsService

type PaymentsTransactionsService interface {
	List(context.Context, interface{}) ([]PaymentsTransactions, error)
	ListWithPagination(context.Context, interface{}) ([]PaymentsTransactions, *Pagination, error)
	Get(context.Context, int64, 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

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

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

Get individual PaymentsTransactions

func (*PaymentsTransactionsServiceOp) List

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

List PaymentsTransactions

func (*PaymentsTransactionsServiceOp) ListWithPagination

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

type PaymentsTransactionsTypes

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

type Payout struct {
	Id       int64           `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

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

Represents the result from the payouts/X.json endpoint

type PayoutStatus

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

type PayoutsListOptions

type PayoutsListOptions struct {
	PageInfo string       `url:"page_info,omitempty"`
	Limit    int          `url:"limit,omitempty"`
	Fields   string       `url:"fields,omitempty"`
	LastId   int64        `url:"last_id,omitempty"`
	SinceId  int64        `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

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

Represents the result from the payouts.json endpoint

type PayoutsService

type PayoutsService interface {
	List(context.Context, interface{}) ([]Payout, error)
	ListWithPagination(context.Context, interface{}) ([]Payout, *Pagination, error)
	Get(context.Context, int64, 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

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

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

func (*PayoutsServiceOp) Get

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

Get individual payout

func (*PayoutsServiceOp) List

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

List payouts

func (*PayoutsServiceOp) ListWithPagination

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

type PriceBasedShippingRate

type PriceBasedShippingRate struct {
	ID               int64            `json:"id,omitempty"`
	ShippingZoneID   int64            `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

type PriceRule struct {
	ID                                     int64                                   `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                     []int64                                 `json:"entitled_product_ids,omitempty"`
	EntitledVariantIds                     []int64                                 `json:"entitled_variant_ids,omitempty"`
	EntitledCollectionIds                  []int64                                 `json:"entitled_collection_ids,omitempty"`
	EntitledCountryIds                     []int64                                 `json:"entitled_country_ids,omitempty"`
	PrerequisiteProductIds                 []int64                                 `json:"prerequisite_product_ids,omitempty"`
	PrerequisiteVariantIds                 []int64                                 `json:"prerequisite_variant_ids,omitempty"`
	PrerequisiteCollectionIds              []int64                                 `json:"prerequisite_collection_ids,omitempty"`
	PrerequisiteSavedSearchIds             []int64                                 `json:"prerequisite_saved_search_ids,omitempty"`
	PrerequisiteCustomerIds                []int64                                 `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

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

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

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

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

type PriceRuleDiscountCode struct {
	ID          int64      `json:"id,omitempty"`
	PriceRuleID int64      `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

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

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

type PriceRuleService

type PriceRuleService interface {
	Get(context.Context, int64) (*PriceRule, error)
	Create(context.Context, PriceRule) (*PriceRule, error)
	Update(context.Context, PriceRule) (*PriceRule, error)
	List(context.Context) ([]PriceRule, error)
	Delete(context.Context, int64) 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

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

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

func (*PriceRuleServiceOp) Create

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

Create creates a price rule

func (*PriceRuleServiceOp) Delete

func (s *PriceRuleServiceOp) Delete(ctx context.Context, priceRuleID int64) error

Delete deletes a price rule

func (*PriceRuleServiceOp) Get

func (s *PriceRuleServiceOp) Get(ctx context.Context, priceRuleID int64) (*PriceRule, error)

Get retrieves a single price rules

func (*PriceRuleServiceOp) List

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

List retrieves a list of price rules

func (*PriceRuleServiceOp) Update

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

Update updates an existing a price rule

type PriceRulesResource

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

PriceRulesResource represents the result from the price_rules.json endpoint

type Product

type Product struct {
	ID                             int64           `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

type ProductListOptions struct {
	ListOptions
	CollectionID          int64           `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

type ProductListing struct {
	ID          int64           `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

type ProductListingIDsResource struct {
	ProductIDs []int64 `json:"product_ids"`
}

Represents the result from the product_listings/product_ids.json endpoint

type ProductListingPublishResource

type ProductListingPublishResource struct {
	ProductListing struct {
		ProductID int64 `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

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

Represents the result from the product_listings/X.json endpoint

type ProductListingService

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, int64, interface{}) (*ProductListing, error)
	GetProductIDs(context.Context, interface{}) ([]int64, error)
	Publish(context.Context, int64) (*ProductListing, error)
	Delete(context.Context, int64) 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

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

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

func (*ProductListingServiceOp) Count

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

Count products listings published to your sales channel app

func (*ProductListingServiceOp) Delete

func (s *ProductListingServiceOp) Delete(ctx context.Context, productID int64) error

Delete unpublishes an existing product from your sales channel app.

func (*ProductListingServiceOp) Get

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

Get individual product_listing by product ID

func (*ProductListingServiceOp) GetProductIDs

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

GetProductIDs lists all product IDs that are published to your sales channel

func (*ProductListingServiceOp) List

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

List products

func (*ProductListingServiceOp) ListWithPagination

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

func (s *ProductListingServiceOp) Publish(ctx context.Context, productID int64) (*ProductListing, error)

Publish an existing product listing to your sales channel app

type ProductOption

type ProductOption struct {
	ID        int64    `json:"id,omitempty"`
	ProductID int64    `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, int64, interface{}) (*Product, error)
	Create(context.Context, Product) (*Product, error)
	Update(context.Context, Product) (*Product, error)
	Delete(context.Context, int64) 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 int64, 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 int64, metafield Metafield) (*Metafield, error)

CreateMetafield for a product

func (*ProductServiceOp) Delete

func (s *ProductServiceOp) Delete(ctx context.Context, productID int64) error

Delete an existing product

func (*ProductServiceOp) DeleteMetafield

func (s *ProductServiceOp) DeleteMetafield(ctx context.Context, productID int64, metafieldID int64) error

DeleteMetafield for a product

func (*ProductServiceOp) Get

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

Get individual product

func (*ProductServiceOp) GetMetafield

func (s *ProductServiceOp) GetMetafield(ctx context.Context, productID int64, metafieldID int64, 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 int64, options interface{}) ([]Metafield, error)

ListMetafields for a product

func (*ProductServiceOp) ListWithPagination

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 int64, metafield Metafield) (*Metafield, error)

UpdateMetafield for a product

type ProductStatus

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

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

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           int64            `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                    int64            `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 int64, 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 int64) (
	*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     int64  `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, int64, interface{}) (*Redirect, error)
	Create(context.Context, Redirect) (*Redirect, error)
	Update(context.Context, Redirect) (*Redirect, error)
	Delete(context.Context, int64) 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 int64) error

Delete an existing redirect.

func (*RedirectServiceOp) Get

func (s *RedirectServiceOp) Get(ctx context.Context, redirectID int64, 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               int64             `json:"id,omitempty"`
	OrderId          int64             `json:"order_id,omitempty"`
	CreatedAt        *time.Time        `json:"created_at,omitempty"`
	Note             string            `json:"note,omitempty"`
	Restock          bool              `json:"restock,omitempty"`
	UserId           int64             `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         int64            `json:"id,omitempty"`
	Quantity   int              `json:"quantity,omitempty"`
	LineItemId int64            `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 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

func (e ResponseError) GetErrors() []string

GetErrors returns response errors list

func (ResponseError) GetMessage

func (e ResponseError) GetMessage() string

GetMessage returns response error message

func (ResponseError) GetStatus

func (e ResponseError) GetStatus() int

GetStatus returns http response status

type Rule

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

type ScriptTag

type ScriptTag struct {
	CreatedAt    *time.Time `json:"created_at"`
	Event        string     `json:"event"`
	ID           int64      `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      int64     `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, int64, interface{}) (*ScriptTag, error)
	Create(context.Context, ScriptTag) (*ScriptTag, error)
	Update(context.Context, ScriptTag) (*ScriptTag, error)
	Delete(context.Context, int64) 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 int64) error

Delete an existing script tag

func (*ScriptTagServiceOp) Get

func (s *ScriptTagServiceOp) Get(ctx context.Context, tagID int64, 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

type ShippingCountry struct {
	ID             int64              `json:"id,omitempty"`
	ShippingZoneID int64              `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                            int64            `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

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

type ShippingProvince struct {
	ID             int64            `json:"id,omitempty"`
	CountryID      int64            `json:"country_id,omitempty"`
	ShippingZoneID int64            `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

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

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

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

type ShippingRateRequest struct {
	Rate ShippingRateQuery `json:"rate"`
}

type ShippingRateResponse

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

type ShippingZone struct {
	ID                           int64                         `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

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

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

ShippingZoneServiceOp handles communication with the shipping zone related methods of the Shopify API.

func (*ShippingZoneServiceOp) List

List shipping zones

type ShippingZonesResource

type ShippingZonesResource struct {
	ShippingZones []ShippingZone `json:"shipping_zones"`
}

Represents the result from the shipping_zones.json endpoint

type Shop

type Shop struct {
	ID                              int64      `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               int64      `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"`
	SetupRequire                    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"`
}

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

func (s *ShopServiceOp) CountMetafields(ctx context.Context, _ int64, options interface{}) (int, error)

CountMetafields for a shop

func (*ShopServiceOp) CreateMetafield

func (s *ShopServiceOp) CreateMetafield(ctx context.Context, _ int64, metafield Metafield) (*Metafield, error)

CreateMetafield for a shop

func (*ShopServiceOp) DeleteMetafield

func (s *ShopServiceOp) DeleteMetafield(ctx context.Context, _ int64, metafieldID int64) error

DeleteMetafield for a shop

func (*ShopServiceOp) Get

func (s *ShopServiceOp) Get(ctx context.Context, options interface{}) (*Shop, error)

Get shop

func (*ShopServiceOp) GetMetafield

func (s *ShopServiceOp) GetMetafield(ctx context.Context, _ int64, metafieldID int64, options interface{}) (*Metafield, error)

GetMetafield for a shop

func (*ShopServiceOp) ListMetafields

func (s *ShopServiceOp) ListMetafields(ctx context.Context, _ int64, options interface{}) ([]Metafield, error)

ListMetafields for a shop

func (*ShopServiceOp) UpdateMetafield

func (s *ShopServiceOp) UpdateMetafield(ctx context.Context, _ int64, metafield Metafield) (*Metafield, error)

UpdateMetafield for a shop

type SingleCarrierResource

type SingleCarrierResource struct {
	CarrierService *CarrierService `json:"carrier_service"`
}

type SmartCollection

type SmartCollection struct {
	ID             int64       `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, int64, interface{}) (*SmartCollection, error)
	Create(context.Context, SmartCollection) (*SmartCollection, error)
	Update(context.Context, SmartCollection) (*SmartCollection, error)
	Delete(context.Context, int64) 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 int64, 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 int64, metafield Metafield) (*Metafield, error)

Create a new metafield for a smart collection

func (*SmartCollectionServiceOp) Delete

func (s *SmartCollectionServiceOp) Delete(ctx context.Context, collectionID int64) error

Delete an existing smart collection.

func (*SmartCollectionServiceOp) DeleteMetafield

func (s *SmartCollectionServiceOp) DeleteMetafield(ctx context.Context, smartCollectionID int64, metafieldID int64) error

// Delete an existing metafield for a smart collection

func (*SmartCollectionServiceOp) Get

func (s *SmartCollectionServiceOp) Get(ctx context.Context, collectionID int64, options interface{}) (*SmartCollection, error)

Get individual smart collection

func (*SmartCollectionServiceOp) GetMetafield

func (s *SmartCollectionServiceOp) GetMetafield(ctx context.Context, smartCollectionID int64, metafieldID int64, 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 int64, 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 int64, 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

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

type StorefrontAccessToken struct {
	ID                int64      `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

type StorefrontAccessTokenResource struct {
	StorefrontAccessToken *StorefrontAccessToken `json:"storefront_access_token"`
}

StorefrontAccessTokenResource represents the result from the admin/storefront_access_tokens.json endpoint

type StorefrontAccessTokenService

type StorefrontAccessTokenService interface {
	List(context.Context, interface{}) ([]StorefrontAccessToken, error)
	Create(context.Context, StorefrontAccessToken) (*StorefrontAccessToken, error)
	Delete(context.Context, int64) 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

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

Create a new storefront access token

func (*StorefrontAccessTokenServiceOp) Delete

Delete an existing storefront access token

func (*StorefrontAccessTokenServiceOp) List

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

List storefront access tokens

type StorefrontAccessTokensResource

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                int64      `json:"id"`
	Name              string     `json:"name"`
	Previewable       bool       `json:"previewable"`
	Processing        bool       `json:"processing"`
	Role              string     `json:"role"`
	ThemeStoreID      int64      `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

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, int64, interface{}) (*Theme, error)
	Update(context.Context, Theme) (*Theme, error)
	Delete(context.Context, int64) 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

func (s *ThemeServiceOp) Create(ctx context.Context, theme Theme) (*Theme, error)

Update a theme

func (*ThemeServiceOp) Delete

func (s *ThemeServiceOp) Delete(ctx context.Context, themeID int64) error

Delete a theme

func (*ThemeServiceOp) Get

func (s *ThemeServiceOp) Get(ctx context.Context, themeID int64, 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

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             int64            `json:"id,omitempty"`
	OrderID        int64            `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, int64, interface{}) ([]Transaction, error)
	Count(context.Context, int64, interface{}) (int, error)
	Get(context.Context, int64, int64, interface{}) (*Transaction, error)
	Create(context.Context, int64, 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 int64, options interface{}) (int, error)

Count transactions

func (*TransactionServiceOp) Create

func (s *TransactionServiceOp) Create(ctx context.Context, orderID int64, transaction Transaction) (*Transaction, error)

Create a new transaction

func (*TransactionServiceOp) Get

func (s *TransactionServiceOp) Get(ctx context.Context, orderID int64, transactionID int64, options interface{}) (*Transaction, error)

Get individual transaction

func (*TransactionServiceOp) List

func (s *TransactionServiceOp) List(ctx context.Context, orderID int64, 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

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               int64            `json:"id,omitempty"`
	Price            *decimal.Decimal `json:"price,omitempty"`
	RiskLevel        *decimal.Decimal `json:"risk_level,omitempty"`
}

UsageCharge represents a Shopify UsageCharge.

func (*UsageCharge) UnmarshalJSON

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

type UsageChargeResource

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

type UsageChargeService interface {
	Create(context.Context, int64, UsageCharge) (*UsageCharge, error)
	Get(context.Context, int64, int64, interface{}) (*UsageCharge, error)
	List(context.Context, int64, 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

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

UsageChargeServiceOp handles communication with the UsageCharge related methods of the Shopify API.

func (*UsageChargeServiceOp) Create

func (r *UsageChargeServiceOp) Create(ctx context.Context, chargeID int64, usageCharge UsageCharge) (
	*UsageCharge, error,
)

Create creates new usage charge given a recurring charge. *required fields: price and description

func (*UsageChargeServiceOp) Get

func (r *UsageChargeServiceOp) Get(ctx context.Context, chargeID int64, usageChargeID int64, options interface{}) (
	*UsageCharge, error,
)

Get gets individual usage charge.

func (*UsageChargeServiceOp) List

func (r *UsageChargeServiceOp) List(ctx context.Context, chargeID int64, options interface{}) (
	[]UsageCharge, error,
)

List gets all usage charges associated with the recurring charge.

type UsageChargesResource

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                   int64                  `json:"id,omitempty"`
	ProductID            int64                  `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      int64                  `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              int64                  `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"`
}

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, int64, interface{}) ([]Variant, error)
	Count(context.Context, int64, interface{}) (int, error)
	Get(context.Context, int64, interface{}) (*Variant, error)
	Create(context.Context, int64, Variant) (*Variant, error)
	Update(context.Context, Variant) (*Variant, error)
	Delete(context.Context, int64, int64) 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 int64, options interface{}) (int, error)

Count variants

func (*VariantServiceOp) CountMetafields

func (s *VariantServiceOp) CountMetafields(ctx context.Context, variantID int64, options interface{}) (int, error)

CountMetafields for a variant

func (*VariantServiceOp) Create

func (s *VariantServiceOp) Create(ctx context.Context, productID int64, variant Variant) (*Variant, error)

Create a new variant

func (*VariantServiceOp) CreateMetafield

func (s *VariantServiceOp) CreateMetafield(ctx context.Context, variantID int64, metafield Metafield) (*Metafield, error)

CreateMetafield for a variant

func (*VariantServiceOp) Delete

func (s *VariantServiceOp) Delete(ctx context.Context, productID int64, variantID int64) error

Delete an existing variant

func (*VariantServiceOp) DeleteMetafield

func (s *VariantServiceOp) DeleteMetafield(ctx context.Context, variantID int64, metafieldID int64) error

DeleteMetafield for a variant

func (*VariantServiceOp) Get

func (s *VariantServiceOp) Get(ctx context.Context, variantID int64, options interface{}) (*Variant, error)

Get individual variant

func (*VariantServiceOp) GetMetafield

func (s *VariantServiceOp) GetMetafield(ctx context.Context, variantID int64, metafieldID int64, options interface{}) (*Metafield, error)

GetMetafield for a variant

func (*VariantServiceOp) List

func (s *VariantServiceOp) List(ctx context.Context, productID int64, options interface{}) ([]Variant, error)

List variants

func (*VariantServiceOp) ListMetafields

func (s *VariantServiceOp) ListMetafields(ctx context.Context, variantID int64, 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

func (s *VariantServiceOp) UpdateMetafield(ctx context.Context, variantID int64, 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                         int64      `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, int64, interface{}) (*Webhook, error)
	Create(context.Context, Webhook) (*Webhook, error)
	Update(context.Context, Webhook) (*Webhook, error)
	Delete(context.Context, int64) 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 int64) error

Delete an existing webhooks

func (*WebhookServiceOp) Get

func (s *WebhookServiceOp) Get(ctx context.Context, webhookdID int64, 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

type WeightBasedShippingRate struct {
	ID             int64            `json:"id,omitempty"`
	ShippingZoneID int64            `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