Documentation
¶
Index ¶
- Constants
- Variables
- type CustomerService
- type CustomerServiceOp
- type GetCustomersCountResponse
- type GetCustomersResponse
- type GetLocationsCountResponse
- type GetLocationsResponse
- type GetOrdersCountResponse
- type GetOrdersResponse
- type GetProductsCountResponse
- type GetProductsResponse
- type GetShopLocalesResponse
- type GetShopResponse
- type GraphQLAPI
- type GraphQLAdmin
- type GraphQLAdminClient
- type GraphQLStorefront
- type GraphQLStorefrontClient
- type LocationService
- type LocationServiceOp
- type OrderService
- type OrderServiceOp
- type ProductService
- type ProductServiceOp
- type ShopService
- type ShopServiceOp
- type ShopifyClient
- func (c *ShopifyClient) AccessMode() string
- func (c *ShopifyClient) AccessToken() string
- func (c *ShopifyClient) ClientId() string
- func (c *ShopifyClient) ClientSecret() string
- func (c *ShopifyClient) GetConfig() *config.Config
- func (c *ShopifyClient) InitDefaultGraphQLClient() error
- func (c *ShopifyClient) IsReady() (bool, error)
- func (c *ShopifyClient) RedirectURL() string
- func (c *ShopifyClient) Scopes() []string
- func (c *ShopifyClient) SetAccessToken(token string)
- func (c *ShopifyClient) SetShopDomain(domain string)
- func (c *ShopifyClient) SetShopURL(s string)
- func (c *ShopifyClient) ShopDomain() string
- func (c *ShopifyClient) ShopURL() string
Constants ¶
const (
CUSTOMERS_PER_PAGE int = 250
)
const DEFAULT_CUSTOMERS_COUNT_QUERY = `query {
customersCount(query: "id:>=1") {
count
}
}`
const DEFAULT_LOCATIONS_COUNT_QUERY = `query {
locationsCount(query: "id:>=1") {
count
}
}`
const DEFAULT_ORDERS_COUNT_QUERY = `query {
ordersCount(query: "id:>=1") {
count
}
}`
const DEFAULT_PRODUCTS_COUNT_QUERY = `query {
productsCount(query: "id:>=1") {
count
}
}`
const (
LOCATIONS_PER_PAGE = 250
)
const (
ORDERS_PER_PAGE = 250
)
const (
PRODUCTS_PER_PAGE int = 100
)
const (
SHOPIFY_CURRENT_API_VERSION = `2025-01`
)
Variables ¶
var DEFAULT_CUSTOMERS_QUERY = `query ListCustomers($numCustomers: Int!, $cursor: String) {
customers(first: $numCustomers, after: $cursor) {
nodes {
id
legacyResourceId
firstName
lastName
displayName
image {
...ImageFields
}
email
emailMarketingConsent {
marketingState
marketingOptInLevel
consentUpdatedAt
}
smsMarketingConsent {
marketingState
marketingOptInLevel
consentUpdatedAt
consentCollectedFrom
}
verifiedEmail
dataSaleOptOut
phone
state
addressesV2(first: 10) {
nodes {
...MailingAddressFields
}
}
defaultAddress {
...MailingAddressFields
}
locale
lastOrder {
id
name
}
productSubscriberStatus
metafields(first: 20) {
nodes {
id
key
namespace
jsonValue
}
}
multipassIdentifier
numberOfOrders
unsubscribeUrl
taxExempt
taxExemptions
statistics {
predictedSpendTier
}
amountSpent {
amount
currencyCode
}
note
tags
createdAt
updatedAt
}
pageInfo {
hasNextPage
endCursor
}
}
}` + mailingAddressFragment + imageFragment
ListCustomers
var DEFAULT_LOCATIONS_QUERY string = `` /* 475-byte string literal not displayed */
List Locations
var DEFAULT_ORDERS_QUERY = `query ListOrders($numOrders: Int!, $cursor: String) {
orders(first: $numOrders, after: $cursor) {
nodes {
id
legacyResourceId
name
poNumber
email
phone
app {
id
name
}
clientIp
customerAcceptsMarketing
cancelReason
cancelledAt
confirmed
confirmationNumber
closed
closedAt
customer {
id
legacyResourceId
firstName
lastName
state
phone
email
verifiedEmail
emailMarketingConsent {
marketingState
}
smsMarketingConsent {
marketingState
}
multipassIdentifier
taxExempt
taxExemptions
note
tags
createdAt
updatedAt
}
customerLocale
customerJourneySummary {
customerOrderIndex
daysToConversion
lastVisit {
landingPage
source
sourceType
referrerUrl
referralCode
marketingEvent {
id
legacyResourceId
app {
id
}
remoteId
channelHandle
type
marketingChannelType
sourceAndMedium
previewUrl
manageUrl
scheduledToEndAt
endedAt
}
occurredAt
}
}
billingAddress {
...MailingAddressFields
}
shippingAddress {
...MailingAddressFields
}
currencyCode
presentmentCurrencyCode
displayFinancialStatus
displayFulfillmentStatus
statusPageUrl
currentTotalAdditionalFeesSet {
...MoneyBagFields
}
currentTotalDiscountsSet {
...MoneyBagFields
}
currentTotalDutiesSet {
...MoneyBagFields
}
currentTotalPriceSet {
...MoneyBagFields
}
currentSubtotalPriceSet {
...MoneyBagFields
}
currentTotalTaxSet {
...MoneyBagFields
}
discountApplications {
nodes {
index
targetType
value {
... on MoneyV2 {
amount
currencyCode
}
... on PricingPercentageValue {
percentage
}
}
}
}
discountCodes
estimatedTaxes
fulfillable
fulfillments {
id
legacyResourceId
name
status
order {
id
}
fulfillmentLineItems {
nodes {
id
lineItem {
...LineItemFields
}
quantity
}
}
trackingInfo {
company
number
url
}
createdAt
estimatedDeliveryAt
inTransitAt
deliveredAt
updatedAt
}
lineItems {
nodes {
...LineItemFields
}
}
originalTotalDutiesSet {
...MoneyBagFields
}
paymentTerms {
id
overdue
dueInDays
order {
totalOutstandingSet {
...MoneyBagFields
}
}
paymentTermsName
paymentTermsType
paymentSchedules {
nodes {
id
issuedAt
dueAt
completedAt
}
}
}
paymentGatewayNames
fullyPaid
refunds {
id
legacyResourceId
order {
id
}
orderAdjustments {
nodes {
id
reason
amountSet {
...MoneyBagFields
}
taxAmountSet {
...MoneyBagFields
}
}
}
refundLineItems {
nodes {
id
lineItem {
...LineItemFields
}
priceSet {
...MoneyBagFields
}
subtotalSet {
...MoneyBagFields
}
totalTaxSet {
...MoneyBagFields
}
quantity
restocked
restockType
location {
id
legacyResourceId
}
}
}
totalRefundedSet {
...MoneyBagFields
}
note
staffMember {
id
name
isShopOwner
active
}
createdAt
updatedAt
}
subtotalPriceSet {
...MoneyBagFields
}
staffMember {
id
name
isShopOwner
active
}
test
taxesIncluded
taxExempt
taxLines {
title
priceSet {
...MoneyBagFields
}
rate
ratePercentage
source
channelLiable
}
totalCashRoundingAdjustment {
paymentSet {
...MoneyBagFields
}
refundSet {
...MoneyBagFields
}
}
totalDiscountsSet {
...MoneyBagFields
}
totalOutstandingSet {
...MoneyBagFields
}
totalPriceSet {
...MoneyBagFields
}
totalShippingPriceSet {
...MoneyBagFields
}
totalTaxSet {
...MoneyBagFields
}
totalTipReceivedSet {
...MoneyBagFields
}
totalWeight
note
tags
createdAt
processedAt
updatedAt
}
pageInfo {
hasNextPage
endCursor
}
}
}` + moneyBagFragment + lineItemFragment + mailingAddressFragment
****************************************************************************************************************** QUERIES ******************************************************************************************************************
var DEFAULT_PRODUCTS_QUERY string = `` /* 1706-byte string literal not displayed */
var DEFAULT_SHOP_LOCALES_QUERY = `query GetShopLocales() {
shopLocales {
name
locale
primary
published
}
}`
var DEFAULT_SHOP_QUERY string = `` /* 983-byte string literal not displayed */
Functions ¶
This section is empty.
Types ¶
type CustomerService ¶
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(c context.Context) (int, error)
Return orders count
func (*CustomerServiceOp) List ¶
func (s *CustomerServiceOp) List(c context.Context, cursor string) (*types.CustomerConnection, error)
func (*CustomerServiceOp) ListAll ¶
func (s *CustomerServiceOp) ListAll(c context.Context, cursor string) (*types.CustomerConnection, error)
type GetCustomersResponse ¶
type GetCustomersResponse struct {
Customers *types.CustomerConnection `json:"customers"`
}
type GetLocationsResponse ¶
type GetLocationsResponse struct {
Locations *types.LocationConnection `json:"locations"`
}
type GetOrdersCountResponse ¶
type GetOrdersResponse ¶
type GetOrdersResponse struct {
Orders *types.OrderConnection `json:"orders"`
}
type GetProductsResponse ¶
type GetProductsResponse struct {
Products *types.ProductConnection `json:"products,omitempty"`
}
type GetShopLocalesResponse ¶
type GetShopLocalesResponse struct {
ShopLocales []types.ShopLocale `json:"shopLocales"`
}
type GetShopResponse ¶
type GraphQLAPI ¶
type GraphQLAPI struct {
Admin *GraphQLAdmin
Storefront *GraphQLStorefront
// contains filtered or unexported fields
}
GraphQL API struct that exposes the Admin and the Storefront API
func NewShopifyGraphQLClientWithDefaultHeaders ¶
func NewShopifyGraphQLClientWithDefaultHeaders(shopURL, apiVersion, accessToken string, defaultHeaders map[string]string) *GraphQLAPI
New Shopify GraphQL Client constructor
type GraphQLAdmin ¶
type GraphQLAdmin struct {
// Services used for communicating with the API
Customer CustomerService
Location LocationService
Order OrderService
Product ProductService
Shop ShopService
// contains filtered or unexported fields
}
GraphQL Admin Client
type GraphQLAdminClient ¶
type GraphQLAdminClient interface {
Query(c context.Context, query string, vars map[string]interface{}, resp interface{}) error
}
A GraphQL Client with methods to interact with the Shopify GraphQL Admin API
type GraphQLStorefront ¶
type GraphQLStorefront struct {
// contains filtered or unexported fields
}
GraphQL Storefront Client
type GraphQLStorefrontClient ¶
type GraphQLStorefrontClient interface {
Query(c context.Context, query string, vars map[string]interface{}, resp interface{}) error
}
A GraphQL Client with methods to interact with the Shopify GraphQL Storefront API
type LocationService ¶
type LocationService interface {
List(c context.Context, cursor string) (*types.LocationConnection, error)
ListAll(c context.Context, cursor string) (*types.LocationConnection, error)
Count(c context.Context) (int, error)
}
LocationService is an interface for interfacing with the location endpoints of the Shopify API.
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(c context.Context) (int, error)
Return lcoations count
func (*LocationServiceOp) List ¶
func (s *LocationServiceOp) List(c context.Context, cursor string) (*types.LocationConnection, error)
Lists locations
func (*LocationServiceOp) ListAll ¶
func (s *LocationServiceOp) ListAll(c context.Context, cursor string) (*types.LocationConnection, error)
Lists all locations, iterating over pages
type OrderService ¶
type OrderServiceOp ¶
type OrderServiceOp struct {
// contains filtered or unexported fields
}
OrderServiceOp handles communication with the order / orders related methods of the Shopify GraphQL API.
func (*OrderServiceOp) Count ¶
func (s *OrderServiceOp) Count(c context.Context) (int, error)
Return orders count
func (*OrderServiceOp) List ¶
func (s *OrderServiceOp) List(c context.Context, cursor string) (*types.OrderConnection, error)
Lists orders
func (*OrderServiceOp) ListAll ¶
func (s *OrderServiceOp) ListAll(c context.Context, cursor string) (*types.OrderConnection, error)
Lists all orders, iterating over pages
type ProductService ¶
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(c context.Context) (int, error)
Return products count
func (*ProductServiceOp) List ¶
func (s *ProductServiceOp) List(c context.Context, cursor string) (*types.ProductConnection, error)
Lists products
func (*ProductServiceOp) ListAll ¶
func (s *ProductServiceOp) ListAll(c context.Context, cursor string) (*types.ProductConnection, error)
Lists all products, iterating over pages
type ShopService ¶
type ShopServiceOp ¶
type ShopServiceOp struct {
// contains filtered or unexported fields
}
ShopServiceOp handles communication with the shop related methods of the Shopify GraphQL API.
func (*ShopServiceOp) ListLocales ¶
func (s *ShopServiceOp) ListLocales(c context.Context) ([]types.ShopLocale, error)
Get a list of locales available on a shop.
type ShopifyClient ¶
type ShopifyClient struct {
GraphQL *GraphQLAPI // The GraphQL API
// contains filtered or unexported fields
}
func NewShopifyClient ¶
func NewShopifyClient(cfg *config.Config) (*ShopifyClient, error)
Create new Shopify Client
func (*ShopifyClient) AccessMode ¶
func (c *ShopifyClient) AccessMode() string
Get Read-only Access Mode
func (*ShopifyClient) AccessToken ¶
func (c *ShopifyClient) AccessToken() string
Get Read-only Access Token
func (*ShopifyClient) ClientId ¶
func (c *ShopifyClient) ClientId() string
Get Read-only Shopify Client ID
func (*ShopifyClient) ClientSecret ¶
func (c *ShopifyClient) ClientSecret() string
Get Read-only Shopify Client Secret
func (*ShopifyClient) GetConfig ¶
func (c *ShopifyClient) GetConfig() *config.Config
Get Read-only config. Use Setter functions to update Config after initialization.
func (*ShopifyClient) InitDefaultGraphQLClient ¶
func (c *ShopifyClient) InitDefaultGraphQLClient() error
Initialize GraphQL Client
func (*ShopifyClient) IsReady ¶
func (c *ShopifyClient) IsReady() (bool, error)
Whether client is ready to serve API requests
func (*ShopifyClient) RedirectURL ¶
func (c *ShopifyClient) RedirectURL() string
Get Read-only Redirect URL
func (*ShopifyClient) SetAccessToken ¶
func (c *ShopifyClient) SetAccessToken(token string)
Set the Access Token manually.
Example use case: When using an Shopify Embedded App flow, where you get an access token via Token Exchange
func (*ShopifyClient) SetShopDomain ¶
func (c *ShopifyClient) SetShopDomain(domain string)
Set shop domain in the format `{shop}.myshopify.com`
func (*ShopifyClient) SetShopURL ¶
func (c *ShopifyClient) SetShopURL(s string)
Set shop url in the format `https://{shop}.myshopify.com`
func (*ShopifyClient) ShopDomain ¶
func (c *ShopifyClient) ShopDomain() string
Get Read-only Shop Domain in the format: `{shop}.myshopify.com`
func (*ShopifyClient) ShopURL ¶
func (c *ShopifyClient) ShopURL() string
Get Read-only Shop URL in the format: `https://{shop}.myshopify.com`