goshopify

package module
v0.0.0-...-42d554c Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 22 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 has been tested against the following versions of Go

  • 1.10
  • 1.11
  • 1.12
  • 1.13
  • 1.14
  • 1.15

Install

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

Use

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
)

Variables

This section is empty.

Functions

func CheckResponseError

func CheckResponseError(r *http.Response) error

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 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(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(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(shopName string, code string) (string, error)

func (App) NewClient

func (a 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) 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(ApplicationCharge) (*ApplicationCharge, error)
	Get(int64, interface{}) (*ApplicationCharge, error)
	List(interface{}) ([]ApplicationCharge, error)
	Activate(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(chargeID int64, options interface{}) (*ApplicationCharge, error)

Get gets individual application charge.

func (ApplicationChargeServiceOp) List

func (a ApplicationChargeServiceOp) List(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:"applied_discount,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"`
	ContentType string     `json:"content_type"`
	Key         string     `json:"key"`
	PublicURL   string     `json:"public_url"`
	Size        int        `json:"size"`
	SourceKey   string     `json:"source_key"`
	Src         string     `json:"src"`
	ThemeID     int64      `json:"theme_id"`
	Value       string     `json:"value"`
	CreatedAt   *time.Time `json:"created_at"`
	UpdatedAt   *time.Time `json:"updated_at"`
}

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

Delete an asset

func (*AssetServiceOp) Get

func (s *AssetServiceOp) Get(themeID int64, key string) (*Asset, error)

Get an asset by key from the given theme

func (*AssetServiceOp) List

func (s *AssetServiceOp) List(themeID int64, options interface{}) ([]Asset, error)

List the metadata for all assets in the given theme

func (*AssetServiceOp) Update

func (s *AssetServiceOp) Update(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 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"`
}

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

Count blogs

func (*BlogServiceOp) Create

func (s *BlogServiceOp) Create(blog Blog) (*Blog, error)

Create a new blog

func (*BlogServiceOp) Delete

func (s *BlogServiceOp) Delete(blogId int64) error

Delete an blog

func (*BlogServiceOp) Get

func (s *BlogServiceOp) Get(blogId int64, options interface{}) (*Blog, error)

Get single blog

func (*BlogServiceOp) List

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

List all blogs

func (*BlogServiceOp) Update

func (s *BlogServiceOp) Update(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 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
	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
	AccessScopes               AccessScopesService
	// 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(path string, options interface{}) (int, error)

func (*Client) CreateAndDo

func (c *Client) CreateAndDo(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(path string) error

Delete performs a DELETE request for the given path

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(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) NewRequest

func (c *Client) NewRequest(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(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(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(interface{}) ([]Collect, error)
	Count(interface{}) (int, 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(options interface{}) (int, error)

Count collects

func (*CollectServiceOp) List

func (s *CollectServiceOp) List(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(collectionID int64, options interface{}) (*Collection, error)
	ListProducts(collectionID int64, options interface{}) ([]Product, error)
	ListProductsWithPagination(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(collectionID int64, options interface{}) (*Collection, error)

Get individual collection

func (*CollectionServiceOp) ListProducts

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

List products for a collection

func (*CollectionServiceOp) ListProductsWithPagination

func (s *CollectionServiceOp) ListProductsWithPagination(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(interface{}) ([]CustomCollection, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*CustomCollection, error)
	Create(CustomCollection) (*CustomCollection, error)
	Update(CustomCollection) (*CustomCollection, error)
	Delete(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(options interface{}) (int, error)

Count custom collections

func (*CustomCollectionServiceOp) CountMetafields

func (s *CustomCollectionServiceOp) CountMetafields(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(customCollectionID int64, metafield Metafield) (*Metafield, error)

Create a new metafield for a custom collection

func (*CustomCollectionServiceOp) Delete

func (s *CustomCollectionServiceOp) Delete(collectionID int64) error

Delete an existing custom collection.

func (*CustomCollectionServiceOp) DeleteMetafield

func (s *CustomCollectionServiceOp) DeleteMetafield(customCollectionID int64, metafieldID int64) error

// Delete an existing metafield for a custom collection

func (*CustomCollectionServiceOp) Get

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

Get individual custom collection

func (*CustomCollectionServiceOp) GetMetafield

func (s *CustomCollectionServiceOp) GetMetafield(customCollectionID int64, metafieldID int64, options interface{}) (*Metafield, error)

Get individual metafield for a custom collection

func (*CustomCollectionServiceOp) List

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

List custom collections

func (*CustomCollectionServiceOp) ListMetafields

func (s *CustomCollectionServiceOp) ListMetafields(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(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(int64, interface{}) ([]CustomerAddress, error)
	Get(int64, int64, interface{}) (*CustomerAddress, error)
	Create(int64, CustomerAddress) (*CustomerAddress, error)
	Update(int64, CustomerAddress) (*CustomerAddress, error)
	Delete(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(customerID int64, address CustomerAddress) (*CustomerAddress, error)

Create a new address for given customer

func (*CustomerAddressServiceOp) Delete

func (s *CustomerAddressServiceOp) Delete(customerID, addressID int64) error

Delete an existing address

func (*CustomerAddressServiceOp) Get

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

Get address

func (*CustomerAddressServiceOp) List

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

List addresses

func (*CustomerAddressServiceOp) Update

func (s *CustomerAddressServiceOp) Update(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 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(interface{}) ([]Customer, error)
	ListWithPagination(options interface{}) ([]Customer, *Pagination, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*Customer, error)
	Search(interface{}) ([]Customer, error)
	Create(Customer) (*Customer, error)
	Update(Customer) (*Customer, error)
	Delete(int64) error
	ListOrders(int64, interface{}) ([]Order, error)
	ListTags(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(options interface{}) (int, error)

Count customers

func (*CustomerServiceOp) CountMetafields

func (s *CustomerServiceOp) CountMetafields(customerID int64, options interface{}) (int, error)

Count metafields for a customer

func (*CustomerServiceOp) Create

func (s *CustomerServiceOp) Create(customer Customer) (*Customer, error)

Create a new customer

func (*CustomerServiceOp) CreateMetafield

func (s *CustomerServiceOp) CreateMetafield(customerID int64, metafield Metafield) (*Metafield, error)

Create a new metafield for a customer

func (*CustomerServiceOp) Delete

func (s *CustomerServiceOp) Delete(customerID int64) error

Delete an existing customer

func (*CustomerServiceOp) DeleteMetafield

func (s *CustomerServiceOp) DeleteMetafield(customerID int64, metafieldID int64) error

// Delete an existing metafield for a customer

func (*CustomerServiceOp) Get

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

Get customer

func (*CustomerServiceOp) GetMetafield

func (s *CustomerServiceOp) GetMetafield(customerID int64, metafieldID int64, options interface{}) (*Metafield, error)

Get individual metafield for a customer

func (*CustomerServiceOp) List

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

List customers

func (*CustomerServiceOp) ListMetafields

func (s *CustomerServiceOp) ListMetafields(customerID int64, options interface{}) ([]Metafield, error)

List metafields for a customer

func (*CustomerServiceOp) ListOrders

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

ListOrders retrieves all orders from a customer

func (*CustomerServiceOp) ListTags

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

ListTags retrieves all unique tags across all customers

func (*CustomerServiceOp) ListWithPagination

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

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

func (*CustomerServiceOp) Search

func (s *CustomerServiceOp) Search(options interface{}) ([]Customer, error)

Search customers

func (*CustomerServiceOp) Update

func (s *CustomerServiceOp) Update(customer Customer) (*Customer, error)

Update an existing customer

func (*CustomerServiceOp) UpdateMetafield

func (s *CustomerServiceOp) UpdateMetafield(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(priceRuleID int64, discountCodeID int64) error

Delete a discount code

func (*DiscountCodeServiceOp) Get

func (s *DiscountCodeServiceOp) Get(priceRuleID int64, discountCodeID int64) (*PriceRuleDiscountCode, error)

Get a single discount code

func (*DiscountCodeServiceOp) List

func (s *DiscountCodeServiceOp) List(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_attribute,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"`
	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  string `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       string     `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(interface{}) ([]DraftOrder, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*DraftOrder, error)
	Create(DraftOrder) (*DraftOrder, error)
	Update(DraftOrder) (*DraftOrder, error)
	Delete(int64) error
	Invoice(int64, DraftOrderInvoice) (*DraftOrderInvoice, error)
	Complete(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(draftOrderID int64, paymentPending bool) (*DraftOrder, error)

Complete draft order

func (*DraftOrderServiceOp) Count

func (s *DraftOrderServiceOp) Count(options interface{}) (int, error)

Count draft orders

func (*DraftOrderServiceOp) CountMetafields

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

Count metafields for an order

func (*DraftOrderServiceOp) Create

func (s *DraftOrderServiceOp) Create(draftOrder DraftOrder) (*DraftOrder, error)

Create draft order

func (*DraftOrderServiceOp) CreateMetafield

func (s *DraftOrderServiceOp) CreateMetafield(draftOrderID int64, metafield Metafield) (*Metafield, error)

Create a new metafield for an order

func (*DraftOrderServiceOp) Delete

func (s *DraftOrderServiceOp) Delete(draftOrderID int64) error

Delete draft orders

func (*DraftOrderServiceOp) DeleteMetafield

func (s *DraftOrderServiceOp) DeleteMetafield(draftOrderID int64, metafieldID int64) error

Delete an existing metafield for an order

func (*DraftOrderServiceOp) Get

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

Get individual draft order

func (*DraftOrderServiceOp) GetMetafield

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

Get individual metafield for an order

func (*DraftOrderServiceOp) Invoice

func (s *DraftOrderServiceOp) Invoice(draftOrderID int64, draftOrderInvoice DraftOrderInvoice) (*DraftOrderInvoice, error)

Invoice a draft order

func (*DraftOrderServiceOp) List

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

List draft orders

func (*DraftOrderServiceOp) ListMetafields

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

List metafields for an order

func (*DraftOrderServiceOp) Update

func (s *DraftOrderServiceOp) Update(draftOrder DraftOrder) (*DraftOrder, error)

Update draft order

func (*DraftOrderServiceOp) UpdateMetafield

func (s *DraftOrderServiceOp) UpdateMetafield(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"`
	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"`
	NotifyCustomer  bool       `json:"notify_customer"`
}

Fulfillment represents a Shopify fulfillment.

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(interface{}) ([]Fulfillment, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*Fulfillment, error)
	Create(Fulfillment) (*Fulfillment, error)
	Update(Fulfillment) (*Fulfillment, error)
	Complete(int64) (*Fulfillment, error)
	Transition(int64) (*Fulfillment, error)
	Cancel(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 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(fulfillmentID int64) (*Fulfillment, error)

Cancel an existing fulfillment

func (*FulfillmentServiceOp) Complete

func (s *FulfillmentServiceOp) Complete(fulfillmentID int64) (*Fulfillment, error)

Complete an existing fulfillment

func (*FulfillmentServiceOp) Count

func (s *FulfillmentServiceOp) Count(options interface{}) (int, error)

Count fulfillments

func (*FulfillmentServiceOp) Create

func (s *FulfillmentServiceOp) Create(fulfillment Fulfillment) (*Fulfillment, error)

Create a new fulfillment

func (*FulfillmentServiceOp) Get

func (s *FulfillmentServiceOp) Get(fulfillmentID int64, options interface{}) (*Fulfillment, error)

Get individual fulfillment

func (*FulfillmentServiceOp) List

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

List fulfillments

func (*FulfillmentServiceOp) Transition

func (s *FulfillmentServiceOp) Transition(fulfillmentID int64) (*Fulfillment, error)

Transition an existing fulfillment

func (*FulfillmentServiceOp) Update

func (s *FulfillmentServiceOp) Update(fulfillment Fulfillment) (*Fulfillment, error)

Update an existing fulfillment

type FulfillmentsResource

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

FulfillmentsResource represents the result from the fullfilments.json endpoint

type FulfillmentsService

type FulfillmentsService interface {
	ListFulfillments(int64, interface{}) ([]Fulfillment, error)
	CountFulfillments(int64, interface{}) (int, error)
	GetFulfillment(int64, int64, interface{}) (*Fulfillment, error)
	CreateFulfillment(int64, Fulfillment) (*Fulfillment, error)
	UpdateFulfillment(int64, Fulfillment) (*Fulfillment, error)
	CompleteFulfillment(int64, int64) (*Fulfillment, error)
	TransitionFulfillment(int64, int64) (*Fulfillment, error)
	CancelFulfillment(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 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"`
}

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

Count images

func (*ImageServiceOp) Create

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

Delete an existing image

func (*ImageServiceOp) Get

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

Get individual image

func (*ImageServiceOp) List

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

List images

func (*ImageServiceOp) Update

func (s *ImageServiceOp) Update(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"`
}

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(interface{}) ([]InventoryItem, error)
	Get(int64, interface{}) (*InventoryItem, error)
	Update(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(id int64, options interface{}) (*InventoryItem, error)

Get a inventory item

func (*InventoryItemServiceOp) List

func (s *InventoryItemServiceOp) List(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 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          string                `json:"fulfillment_status,omitempty"`
	TaxLines                   []TaxLine             `json:"tax_lines,omitempty"`
	OriginLocation             *Address              `json:"origin_location,omitempty"`
	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 LineItemProperty

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

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(options interface{}) ([]Location, error)
	// Retrieves a single location by its ID
	Get(ID int64, options interface{}) (*Location, error)
	// Retrieves a count of locations
	Count(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(options interface{}) (int, error)

func (*LocationServiceOp) Get

func (s *LocationServiceOp) Get(ID int64, options interface{}) (*Location, error)

func (*LocationServiceOp) List

func (s *LocationServiceOp) List(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 {
	ID                int64       `json:"id,omitempty"`
	Key               string      `json:"key,omitempty"`
	Value             interface{} `json:"value,omitempty"`
	ValueType         string      `json:"value_type,omitempty"`
	Type              string      `json:"type,omitempty"`
	Namespace         string      `json:"namespace,omitempty"`
	Description       string      `json:"description,omitempty"`
	OwnerId           int64       `json:"owner_id,omitempty"`
	CreatedAt         *time.Time  `json:"created_at,omitempty"`
	UpdatedAt         *time.Time  `json:"updated_at,omitempty"`
	OwnerResource     string      `json:"owner_resource,omitempty"`
	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(interface{}) ([]Metafield, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*Metafield, error)
	Create(Metafield) (*Metafield, error)
	Update(Metafield) (*Metafield, error)
	Delete(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(options interface{}) (int, error)

Count metafields

func (*MetafieldServiceOp) Create

func (s *MetafieldServiceOp) Create(metafield Metafield) (*Metafield, error)

Create a new metafield

func (*MetafieldServiceOp) Delete

func (s *MetafieldServiceOp) Delete(metafieldID int64) error

Delete an existing metafield

func (*MetafieldServiceOp) Get

func (s *MetafieldServiceOp) Get(metafieldID int64, options interface{}) (*Metafield, error)

Get individual metafield

func (*MetafieldServiceOp) List

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

List metafields

func (*MetafieldServiceOp) Update

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

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"`
	SubtotalPrice         *decimal.Decimal `json:"subtotal_price,omitempty"`
	TotalDiscounts        *decimal.Decimal `json:"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"`
	TaxLines              []TaxLine        `json:"tax_lines,omitempty"`
	TotalWeight           int              `json:"total_weight,omitempty"`
	FinancialStatus       string           `json:"financial_status,omitempty"`
	Fulfillments          []Fulfillment    `json:"fulfillments,omitempty"`
	FulfillmentStatus     string           `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          string           `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"`
	TotalPriceUSD         *decimal.Decimal `json:"total_price_usd,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"`
}

Order represents a Shopify order

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            string    `url:"status,omitempty"`
	FinancialStatus   string    `url:"financial_status,omitempty"`
	FulfillmentStatus string    `url:"fulfillment_status,omitempty"`
}

A struct for all available order count options

type OrderListOptions

type OrderListOptions struct {
	ListOptions
	Status            string    `url:"status,omitempty"`
	FinancialStatus   string    `url:"financial_status,omitempty"`
	FulfillmentStatus string    `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 OrderService

type OrderService interface {
	List(interface{}) ([]Order, error)
	ListWithPagination(interface{}) ([]Order, *Pagination, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*Order, error)
	Create(Order) (*Order, error)
	Update(Order) (*Order, error)
	Cancel(int64, interface{}) (*Order, error)
	Close(int64) (*Order, error)
	Open(int64) (*Order, 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(orderID int64, options interface{}) (*Order, error)

Cancel order

func (*OrderServiceOp) CancelFulfillment

func (s *OrderServiceOp) CancelFulfillment(orderID int64, fulfillmentID int64) (*Fulfillment, error)

Cancel an existing fulfillment for an order

func (*OrderServiceOp) Close

func (s *OrderServiceOp) Close(orderID int64) (*Order, error)

Close order

func (*OrderServiceOp) CompleteFulfillment

func (s *OrderServiceOp) CompleteFulfillment(orderID int64, fulfillmentID int64) (*Fulfillment, error)

Complete an existing fulfillment for an order

func (*OrderServiceOp) Count

func (s *OrderServiceOp) Count(options interface{}) (int, error)

Count orders

func (*OrderServiceOp) CountFulfillments

func (s *OrderServiceOp) CountFulfillments(orderID int64, options interface{}) (int, error)

Count fulfillments for an order

func (*OrderServiceOp) CountMetafields

func (s *OrderServiceOp) CountMetafields(orderID int64, options interface{}) (int, error)

Count metafields for an order

func (*OrderServiceOp) Create

func (s *OrderServiceOp) Create(order Order) (*Order, error)

Create order

func (*OrderServiceOp) CreateFulfillment

func (s *OrderServiceOp) CreateFulfillment(orderID int64, fulfillment Fulfillment) (*Fulfillment, error)

Create a new fulfillment for an order

func (*OrderServiceOp) CreateMetafield

func (s *OrderServiceOp) CreateMetafield(orderID int64, metafield Metafield) (*Metafield, error)

Create a new metafield for an order

func (*OrderServiceOp) DeleteMetafield

func (s *OrderServiceOp) DeleteMetafield(orderID int64, metafieldID int64) error

Delete an existing metafield for an order

func (*OrderServiceOp) Get

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

Get individual order

func (*OrderServiceOp) GetFulfillment

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

Get individual fulfillment for an order

func (*OrderServiceOp) GetMetafield

func (s *OrderServiceOp) GetMetafield(orderID int64, metafieldID int64, options interface{}) (*Metafield, error)

Get individual metafield for an order

func (*OrderServiceOp) List

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

List orders

func (*OrderServiceOp) ListFulfillments

func (s *OrderServiceOp) ListFulfillments(orderID int64, options interface{}) ([]Fulfillment, error)

List fulfillments for an order

func (*OrderServiceOp) ListMetafields

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

List metafields for an order

func (*OrderServiceOp) ListWithPagination

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

func (*OrderServiceOp) Open

func (s *OrderServiceOp) Open(orderID int64) (*Order, error)

Open order

func (*OrderServiceOp) TransitionFulfillment

func (s *OrderServiceOp) TransitionFulfillment(orderID int64, fulfillmentID int64) (*Fulfillment, error)

Transition an existing fulfillment for an order

func (*OrderServiceOp) Update

func (s *OrderServiceOp) Update(order Order) (*Order, error)

Update order

func (*OrderServiceOp) UpdateFulfillment

func (s *OrderServiceOp) UpdateFulfillment(orderID int64, fulfillment Fulfillment) (*Fulfillment, error)

Update an existing fulfillment for an order

func (*OrderServiceOp) UpdateMetafield

func (s *OrderServiceOp) UpdateMetafield(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 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(interface{}) ([]Page, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*Page, error)
	Create(Page) (*Page, error)
	Update(Page) (*Page, error)
	Delete(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(options interface{}) (int, error)

Count pages

func (*PageServiceOp) CountMetafields

func (s *PageServiceOp) CountMetafields(pageID int64, options interface{}) (int, error)

Count metafields for a page

func (*PageServiceOp) Create

func (s *PageServiceOp) Create(page Page) (*Page, error)

Create a new page

func (*PageServiceOp) CreateMetafield

func (s *PageServiceOp) CreateMetafield(pageID int64, metafield Metafield) (*Metafield, error)

Create a new metafield for a page

func (*PageServiceOp) Delete

func (s *PageServiceOp) Delete(pageID int64) error

Delete an existing page.

func (*PageServiceOp) DeleteMetafield

func (s *PageServiceOp) DeleteMetafield(pageID int64, metafieldID int64) error

Delete an existing metafield for a page

func (*PageServiceOp) Get

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

Get individual page

func (*PageServiceOp) GetMetafield

func (s *PageServiceOp) GetMetafield(pageID int64, metafieldID int64, options interface{}) (*Metafield, error)

Get individual metafield for a page

func (*PageServiceOp) List

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

List pages

func (*PageServiceOp) ListMetafields

func (s *PageServiceOp) ListMetafields(pageID int64, options interface{}) ([]Metafield, error)

List metafields for a page

func (*PageServiceOp) Update

func (s *PageServiceOp) Update(page Page) (*Page, error)

Update an existing page

func (*PageServiceOp) UpdateMetafield

func (s *PageServiceOp) UpdateMetafield(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 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                        string                                  `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(int64) (*PriceRule, error)
	Create(PriceRule) (*PriceRule, error)
	Update(PriceRule) (*PriceRule, error)
	List() ([]PriceRule, error)
	Delete(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(pr PriceRule) (*PriceRule, error)

Create creates a price rule

func (*PriceRuleServiceOp) Delete

func (s *PriceRuleServiceOp) Delete(priceRuleID int64) error

Delete deletes a price rule

func (*PriceRuleServiceOp) Get

func (s *PriceRuleServiceOp) Get(priceRuleID int64) (*PriceRule, error)

Get retrieves a single price rules

func (*PriceRuleServiceOp) List

func (s *PriceRuleServiceOp) List() ([]PriceRule, error)

List retrieves a list of price rules

func (*PriceRuleServiceOp) Update

func (s *PriceRuleServiceOp) Update(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"`
	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"`
}

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(interface{}) ([]ProductListing, error)
	ListWithPagination(interface{}) ([]ProductListing, *Pagination, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*ProductListing, error)
	GetProductIDs(interface{}) ([]int64, error)
	Publish(int64) (*ProductListing, error)
	Delete(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(options interface{}) (int, error)

Count products listings published to your sales channel app

func (*ProductListingServiceOp) Delete

func (s *ProductListingServiceOp) Delete(productID int64) error

Delete unpublishes an existing product from your sales channel app.

func (*ProductListingServiceOp) Get

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

Get individual product_listing by product ID

func (*ProductListingServiceOp) GetProductIDs

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

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

func (*ProductListingServiceOp) List

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

List products

func (*ProductListingServiceOp) ListWithPagination

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

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

func (*ProductListingServiceOp) Publish

func (s *ProductListingServiceOp) Publish(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(interface{}) ([]Product, error)
	ListWithPagination(interface{}) ([]Product, *Pagination, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*Product, error)
	Create(Product) (*Product, error)
	Update(Product) (*Product, error)
	Delete(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(options interface{}) (int, error)

Count products

func (*ProductServiceOp) CountMetafields

func (s *ProductServiceOp) CountMetafields(productID int64, options interface{}) (int, error)

Count metafields for a product

func (*ProductServiceOp) Create

func (s *ProductServiceOp) Create(product Product) (*Product, error)

Create a new product

func (*ProductServiceOp) CreateMetafield

func (s *ProductServiceOp) CreateMetafield(productID int64, metafield Metafield) (*Metafield, error)

CreateMetafield for a product

func (*ProductServiceOp) Delete

func (s *ProductServiceOp) Delete(productID int64) error

Delete an existing product

func (*ProductServiceOp) DeleteMetafield

func (s *ProductServiceOp) DeleteMetafield(productID int64, metafieldID int64) error

DeleteMetafield for a product

func (*ProductServiceOp) Get

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

Get individual product

func (*ProductServiceOp) GetMetafield

func (s *ProductServiceOp) GetMetafield(productID int64, metafieldID int64, options interface{}) (*Metafield, error)

GetMetafield for a product

func (*ProductServiceOp) List

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

List products

func (*ProductServiceOp) ListMetafields

func (s *ProductServiceOp) ListMetafields(productID int64, options interface{}) ([]Metafield, error)

ListMetafields for a product

func (*ProductServiceOp) ListWithPagination

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

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

func (*ProductServiceOp) Update

func (s *ProductServiceOp) Update(product Product) (*Product, error)

Update an existing product

func (*ProductServiceOp) UpdateMetafield

func (s *ProductServiceOp) UpdateMetafield(productID int64, metafield Metafield) (*Metafield, error)

UpdateMetafield for a product

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

type RecurringApplicationChargeService interface {
	Create(RecurringApplicationCharge) (*RecurringApplicationCharge, error)
	Get(int64, interface{}) (*RecurringApplicationCharge, error)
	List(interface{}) ([]RecurringApplicationCharge, error)
	Activate(RecurringApplicationCharge) (*RecurringApplicationCharge, error)
	Delete(int64) error
	Update(int64, int64) (*RecurringApplicationCharge, error)
}

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

func (r *RecurringApplicationChargeServiceOp) Delete(chargeID int64) error

Delete deletes recurring application charge.

func (*RecurringApplicationChargeServiceOp) Get

func (r *RecurringApplicationChargeServiceOp) Get(chargeID int64, options interface{}) (
	*RecurringApplicationCharge, error)

Get gets individual recurring application charge.

func (*RecurringApplicationChargeServiceOp) List

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

List gets all recurring application charges.

func (*RecurringApplicationChargeServiceOp) Update

func (r *RecurringApplicationChargeServiceOp) Update(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(interface{}) ([]Redirect, error)
	Count(interface{}) (int, error)
	Get(int64, interface{}) (*Redirect, error)
	Create(Redirect) (*Redirect, error)
	Update(Redirect) (*Redirect, error)
	Delete(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(options interface{}) (int, error)

Count redirects

func (*RedirectServiceOp) Create

func (s *RedirectServiceOp) Create(redirect Redirect) (*Redirect, error)

Create a new redirect

func (*RedirectServiceOp) Delete

func (s *RedirectServiceOp) Delete(redirectID int64) error

Delete an existing redirect.

func (*RedirectServiceOp) Get

func (s *RedirectServiceOp) Get(redirectID int64, options interface{}) (*Redirect, error)

Get individual redirect

func (*RedirectServiceOp) List

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

List redirects

func (*RedirectServiceOp) Update

func (s *RedirectServiceOp) Update(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"`
}

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

Count script tags

func (*ScriptTagServiceOp) Create

func (s *ScriptTagServiceOp) Create(tag ScriptTag) (*ScriptTag, error)

Create a new script tag

func (*ScriptTagServiceOp) Delete

func (s *ScriptTagServiceOp) Delete(tagID int64) error

Delete an existing script tag

func (*ScriptTagServiceOp) Get

func (s *ScriptTagServiceOp) Get(tagID int64, options interface{}) (*ScriptTag, error)

Get individual script tag

func (*ScriptTagServiceOp) List

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

List script tags

func (*ScriptTagServiceOp) Update

func (s *ScriptTagServiceOp) Update(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"`
	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"`
}

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 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() ([]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

func (s *ShippingZoneServiceOp) List() ([]ShippingZone, error)

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(options interface{}) (*Shop, error)
}

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

func (s *ShopServiceOp) Get(options interface{}) (*Shop, error)

Get shop

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

Count smart collections

func (*SmartCollectionServiceOp) CountMetafields

func (s *SmartCollectionServiceOp) CountMetafields(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(smartCollectionID int64, metafield Metafield) (*Metafield, error)

Create a new metafield for a smart collection

func (*SmartCollectionServiceOp) Delete

func (s *SmartCollectionServiceOp) Delete(collectionID int64) error

Delete an existing smart collection.

func (*SmartCollectionServiceOp) DeleteMetafield

func (s *SmartCollectionServiceOp) DeleteMetafield(smartCollectionID int64, metafieldID int64) error

// Delete an existing metafield for a smart collection

func (*SmartCollectionServiceOp) Get

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

Get individual smart collection

func (*SmartCollectionServiceOp) GetMetafield

func (s *SmartCollectionServiceOp) GetMetafield(smartCollectionID int64, metafieldID int64, options interface{}) (*Metafield, error)

Get individual metafield for a smart collection

func (*SmartCollectionServiceOp) List

func (s *SmartCollectionServiceOp) List(options interface{}) ([]SmartCollection, error)

List smart collections

func (*SmartCollectionServiceOp) ListMetafields

func (s *SmartCollectionServiceOp) ListMetafields(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(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 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(interface{}) ([]StorefrontAccessToken, error)
	Create(StorefrontAccessToken) (*StorefrontAccessToken, error)
	Delete(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(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(interface{}) ([]Theme, error)
	Create(Theme) (*Theme, error)
	Get(int64, interface{}) (*Theme, error)
	Update(Theme) (*Theme, error)
	Delete(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(theme Theme) (*Theme, error)

Update a theme

func (*ThemeServiceOp) Delete

func (s *ThemeServiceOp) Delete(themeID int64) error

Delete a theme

func (*ThemeServiceOp) Get

func (s *ThemeServiceOp) Get(themeID int64, options interface{}) (*Theme, error)

Get a theme

func (*ThemeServiceOp) List

func (s *ThemeServiceOp) List(options interface{}) ([]Theme, error)

List all themes

func (*ThemeServiceOp) Update

func (s *ThemeServiceOp) Update(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(int64, interface{}) ([]Transaction, error)
	Count(int64, interface{}) (int, error)
	Get(int64, int64, interface{}) (*Transaction, error)
	Create(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(orderID int64, options interface{}) (int, error)

Count transactions

func (*TransactionServiceOp) Create

func (s *TransactionServiceOp) Create(orderID int64, transaction Transaction) (*Transaction, error)

Create a new transaction

func (*TransactionServiceOp) Get

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

Get individual transaction

func (*TransactionServiceOp) List

func (s *TransactionServiceOp) List(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(int64, UsageCharge) (*UsageCharge, error)
	Get(int64, int64, interface{}) (*UsageCharge, error)
	List(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(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(chargeID int64, usageChargeID int64, options interface{}) (
	*UsageCharge, error)

Get gets individual usage charge.

func (*UsageChargeServiceOp) List

func (r *UsageChargeServiceOp) List(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      string           `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,omitempty"`
	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(int64, interface{}) ([]Variant, error)
	Count(int64, interface{}) (int, error)
	Get(int64, interface{}) (*Variant, error)
	Create(int64, Variant) (*Variant, error)
	Update(Variant) (*Variant, error)
	Delete(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(productID int64, options interface{}) (int, error)

Count variants

func (*VariantServiceOp) CountMetafields

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

CountMetafields for a variant

func (*VariantServiceOp) Create

func (s *VariantServiceOp) Create(productID int64, variant Variant) (*Variant, error)

Create a new variant

func (*VariantServiceOp) CreateMetafield

func (s *VariantServiceOp) CreateMetafield(variantID int64, metafield Metafield) (*Metafield, error)

CreateMetafield for a variant

func (*VariantServiceOp) Delete

func (s *VariantServiceOp) Delete(productID int64, variantID int64) error

Delete an existing variant

func (*VariantServiceOp) DeleteMetafield

func (s *VariantServiceOp) DeleteMetafield(variantID int64, metafieldID int64) error

DeleteMetafield for a variant

func (*VariantServiceOp) Get

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

Get individual variant

func (*VariantServiceOp) GetMetafield

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

GetMetafield for a variant

func (*VariantServiceOp) List

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

List variants

func (*VariantServiceOp) ListMetafields

func (s *VariantServiceOp) ListMetafields(variantID int64, options interface{}) ([]Metafield, error)

ListMetafields for a variant

func (*VariantServiceOp) Update

func (s *VariantServiceOp) Update(variant Variant) (*Variant, error)

Update existing variant

func (*VariantServiceOp) UpdateMetafield

func (s *VariantServiceOp) UpdateMetafield(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"`
}

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

Count webhooks

func (*WebhookServiceOp) Create

func (s *WebhookServiceOp) Create(webhook Webhook) (*Webhook, error)

Create a new webhook

func (*WebhookServiceOp) Delete

func (s *WebhookServiceOp) Delete(ID int64) error

Delete an existing webhooks

func (*WebhookServiceOp) Get

func (s *WebhookServiceOp) Get(webhookdID int64, options interface{}) (*Webhook, error)

Get individual webhook

func (*WebhookServiceOp) List

func (s *WebhookServiceOp) List(options interface{}) ([]Webhook, error)

List webhooks

func (*WebhookServiceOp) Update

func (s *WebhookServiceOp) Update(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