Documentation ¶
Index ¶
- func CalculateWaitTime(respExt map[string]any) time.Duration
- func IsConnectionError(err error) bool
- type BulkOperationService
- type BulkOperationServiceOp
- func (s *BulkOperationServiceOp) BulkQuery(ctx context.Context, query string, out interface{}) error
- func (s *BulkOperationServiceOp) CancelRunningBulkQuery(ctx context.Context) error
- func (s *BulkOperationServiceOp) GetCurrentBulkQuery(ctx context.Context) (*model.BulkOperation, error)
- func (s *BulkOperationServiceOp) GetCurrentBulkQueryResultURL(ctx context.Context) (*string, error)
- func (s *BulkOperationServiceOp) PostBulkQuery(ctx context.Context, query string) (*string, error)
- func (s *BulkOperationServiceOp) ShouldGetBulkQueryResultURL(ctx context.Context, id *string) (*string, error)
- func (s *BulkOperationServiceOp) WaitForCurrentBulkQuery(ctx context.Context, interval time.Duration) (*model.BulkOperation, error)
- type Client
- func (c *Client) GraphQLClient() graphql.GraphQL
- func (c *Client) Mutate(ctx context.Context, m interface{}, variables map[string]interface{}) error
- func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error
- func (c *Client) QueryString(ctx context.Context, q string, variables map[string]interface{}, ...) error
- type CollectionService
- type CollectionServiceOp
- func (s *CollectionServiceOp) Create(ctx context.Context, collection model.CollectionInput) (*string, error)
- func (s *CollectionServiceOp) CreateBulk(ctx context.Context, collections []model.CollectionInput) error
- func (s *CollectionServiceOp) Get(ctx context.Context, id string) (*model.Collection, error)
- func (s *CollectionServiceOp) ListAll(ctx context.Context) ([]*model.Collection, error)
- func (s *CollectionServiceOp) Update(ctx context.Context, collection model.CollectionInput) error
- type FulfillmentService
- type FulfillmentServiceOp
- type InventoryService
- type InventoryServiceOp
- func (s *InventoryServiceOp) ActivateInventory(ctx context.Context, locationID string, id string) error
- func (s *InventoryServiceOp) Adjust(ctx context.Context, locationID string, input []model.InventoryAdjustItemInput) error
- func (s *InventoryServiceOp) Update(ctx context.Context, id string, input model.InventoryItemUpdateInput) error
- type ListOptions
- type LocationService
- type LocationServiceOp
- type MetafieldService
- type MetafieldServiceOp
- func (s *MetafieldServiceOp) Delete(ctx context.Context, metafield model.MetafieldDeleteInput) error
- func (s *MetafieldServiceOp) DeleteBulk(ctx context.Context, metafields []model.MetafieldDeleteInput) error
- func (s *MetafieldServiceOp) GetShopMetafieldByKey(ctx context.Context, namespace, key string) (*model.Metafield, error)
- func (s *MetafieldServiceOp) ListAllShopMetafields(ctx context.Context) ([]*model.Metafield, error)
- func (s *MetafieldServiceOp) ListShopMetafieldsByNamespace(ctx context.Context, namespace string) ([]*model.Metafield, error)
- type Option
- func WithGraphQLClient(gql graphql.GraphQL) Option
- func WithPrivateAppAuth(apiKey string, accessToken string) Option
- func WithRetries(retries int) Option
- func WithTimeout(timeout time.Duration) Option
- func WithToken(token string) Option
- func WithTransport(transport http.RoundTripper) Option
- func WithVersion(apiVersion string) Option
- type OrderService
- type OrderServiceOp
- func (s *OrderServiceOp) Get(ctx context.Context, id graphql.ID) (*model.Order, error)
- func (s *OrderServiceOp) List(ctx context.Context, opts ListOptions) ([]*model.Order, error)
- func (s *OrderServiceOp) ListAfterCursor(ctx context.Context, opts ListOptions) ([]*model.Order, *string, *string, error)
- func (s *OrderServiceOp) ListAll(ctx context.Context) ([]*model.Order, error)
- func (s *OrderServiceOp) Update(ctx context.Context, input model.OrderInput) error
- type ProductService
- type ProductServiceOp
- func (s *ProductServiceOp) Create(ctx context.Context, product model.ProductInput, ...) (*model.Product, error)
- func (s *ProductServiceOp) Delete(ctx context.Context, product model.ProductDeleteInput) error
- func (s *ProductServiceOp) Get(ctx context.Context, id string) (*model.Product, error)
- func (s *ProductServiceOp) List(ctx context.Context, query string) ([]*model.Product, error)
- func (s *ProductServiceOp) ListAll(ctx context.Context) ([]*model.Product, error)
- func (s *ProductServiceOp) Update(ctx context.Context, product model.ProductInput) (*model.Product, error)
- func (s *ProductServiceOp) VariantsBulkCreate(ctx context.Context, id string, input []model.ProductVariantsBulkInput) error
- func (s *ProductServiceOp) VariantsBulkReorder(ctx context.Context, id string, input []model.ProductVariantPositionInput) error
- func (s *ProductServiceOp) VariantsBulkUpdate(ctx context.Context, id string, input []model.ProductVariantsBulkInput) error
- type VariantService
- type VariantServiceOp
- type WebhookService
- type WebhookServiceOp
- func (s WebhookServiceOp) CreateEventBridgeWebhookSubscription(ctx context.Context, topic model.WebhookSubscriptionTopic, ...) (*model.WebhookSubscription, error)
- func (s WebhookServiceOp) CreateWebhookSubscription(ctx context.Context, topic model.WebhookSubscriptionTopic, ...) (*model.WebhookSubscription, error)
- func (s WebhookServiceOp) DeleteWebhook(ctx context.Context, webhookID string) (*string, error)
- func (s WebhookServiceOp) ListWebhookSubscriptions(ctx context.Context, topics []model.WebhookSubscriptionTopic) ([]*model.WebhookSubscription, error)
- func (s WebhookServiceOp) UpdateWebhookSubscription(ctx context.Context, webhookID string, input model.WebhookSubscriptionInput) (*model.WebhookSubscription, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateWaitTime ¶
CalculateWaitTime returns a duration needed to wait in order to avoid reaching rate limit. respExt is the data of the “extensions“ field in Shopify GraphQL response:
"cost": { "requestedQueryCost": 101, "actualQueryCost": 46, "throttleStatus": { "maximumAvailable": 1000, "currentlyAvailable": 954, "restoreRate": 50 } }
func IsConnectionError ¶
Types ¶
type BulkOperationService ¶
type BulkOperationService interface { BulkQuery(ctx context.Context, query string, v interface{}) error PostBulkQuery(ctx context.Context, query string) (*string, error) GetCurrentBulkQuery(ctx context.Context) (*model.BulkOperation, error) GetCurrentBulkQueryResultURL(ctx context.Context) (*string, error) WaitForCurrentBulkQuery(ctx context.Context, interval time.Duration) (*model.BulkOperation, error) ShouldGetBulkQueryResultURL(ctx context.Context, id *string) (*string, error) CancelRunningBulkQuery(ctx context.Context) error }
type BulkOperationServiceOp ¶
type BulkOperationServiceOp struct {
// contains filtered or unexported fields
}
func (*BulkOperationServiceOp) BulkQuery ¶
func (s *BulkOperationServiceOp) BulkQuery(ctx context.Context, query string, out interface{}) error
func (*BulkOperationServiceOp) CancelRunningBulkQuery ¶
func (s *BulkOperationServiceOp) CancelRunningBulkQuery(ctx context.Context) error
func (*BulkOperationServiceOp) GetCurrentBulkQuery ¶
func (s *BulkOperationServiceOp) GetCurrentBulkQuery(ctx context.Context) (*model.BulkOperation, error)
func (*BulkOperationServiceOp) GetCurrentBulkQueryResultURL ¶
func (s *BulkOperationServiceOp) GetCurrentBulkQueryResultURL(ctx context.Context) (*string, error)
func (*BulkOperationServiceOp) PostBulkQuery ¶
func (*BulkOperationServiceOp) ShouldGetBulkQueryResultURL ¶
func (*BulkOperationServiceOp) WaitForCurrentBulkQuery ¶
func (s *BulkOperationServiceOp) WaitForCurrentBulkQuery(ctx context.Context, interval time.Duration) (*model.BulkOperation, error)
type Client ¶
type Client struct { Product ProductService Variant VariantService Inventory InventoryService Collection CollectionService Order OrderService Fulfillment FulfillmentService Location LocationService Metafield MetafieldService BulkOperation BulkOperationService Webhook WebhookService // contains filtered or unexported fields }
func NewClientWithToken ¶
func NewDefaultClient ¶
func NewDefaultClient() *Client
func (*Client) GraphQLClient ¶
func (c *Client) GraphQLClient() graphql.GraphQL
type CollectionService ¶
type CollectionService interface { ListAll(ctx context.Context) ([]*model.Collection, error) Get(ctx context.Context, id string) (*model.Collection, error) Create(ctx context.Context, collection model.CollectionInput) (*string, error) CreateBulk(ctx context.Context, collections []model.CollectionInput) error Update(ctx context.Context, collection model.CollectionInput) error }
type CollectionServiceOp ¶
type CollectionServiceOp struct {
// contains filtered or unexported fields
}
func (*CollectionServiceOp) Create ¶
func (s *CollectionServiceOp) Create(ctx context.Context, collection model.CollectionInput) (*string, error)
func (*CollectionServiceOp) CreateBulk ¶
func (s *CollectionServiceOp) CreateBulk(ctx context.Context, collections []model.CollectionInput) error
func (*CollectionServiceOp) Get ¶
func (s *CollectionServiceOp) Get(ctx context.Context, id string) (*model.Collection, error)
func (*CollectionServiceOp) ListAll ¶
func (s *CollectionServiceOp) ListAll(ctx context.Context) ([]*model.Collection, error)
func (*CollectionServiceOp) Update ¶
func (s *CollectionServiceOp) Update(ctx context.Context, collection model.CollectionInput) error
type FulfillmentService ¶
type FulfillmentService interface {
Create(ctx context.Context, input model.FulfillmentV2Input) error
}
type FulfillmentServiceOp ¶
type FulfillmentServiceOp struct {
// contains filtered or unexported fields
}
func (*FulfillmentServiceOp) Create ¶
func (s *FulfillmentServiceOp) Create(ctx context.Context, fulfillment model.FulfillmentV2Input) error
type InventoryService ¶
type InventoryServiceOp ¶
type InventoryServiceOp struct {
// contains filtered or unexported fields
}
func (*InventoryServiceOp) ActivateInventory ¶
func (*InventoryServiceOp) Adjust ¶
func (s *InventoryServiceOp) Adjust(ctx context.Context, locationID string, input []model.InventoryAdjustItemInput) error
func (*InventoryServiceOp) Update ¶
func (s *InventoryServiceOp) Update(ctx context.Context, id string, input model.InventoryItemUpdateInput) error
type ListOptions ¶
type LocationService ¶
type LocationServiceOp ¶
type LocationServiceOp struct {
// contains filtered or unexported fields
}
type MetafieldService ¶
type MetafieldService interface { ListAllShopMetafields(ctx context.Context) ([]*model.Metafield, error) ListShopMetafieldsByNamespace(ctx context.Context, namespace string) ([]*model.Metafield, error) GetShopMetafieldByKey(ctx context.Context, namespace, key string) (*model.Metafield, error) Delete(ctx context.Context, metafield model.MetafieldDeleteInput) error DeleteBulk(ctx context.Context, metafield []model.MetafieldDeleteInput) error }
type MetafieldServiceOp ¶
type MetafieldServiceOp struct {
// contains filtered or unexported fields
}
func (*MetafieldServiceOp) Delete ¶
func (s *MetafieldServiceOp) Delete(ctx context.Context, metafield model.MetafieldDeleteInput) error
func (*MetafieldServiceOp) DeleteBulk ¶
func (s *MetafieldServiceOp) DeleteBulk(ctx context.Context, metafields []model.MetafieldDeleteInput) error
func (*MetafieldServiceOp) GetShopMetafieldByKey ¶
func (*MetafieldServiceOp) ListAllShopMetafields ¶
func (*MetafieldServiceOp) ListShopMetafieldsByNamespace ¶
type Option ¶
type Option func(shopClient *Client)
func WithGraphQLClient ¶
func WithGraphQLClient(gql graphql.GraphQL) Option
func WithPrivateAppAuth ¶
WithPrivateAppAuth optionally sets private app credentials (API key and access token).
func WithRetries ¶
WithRetries optionally sets maximum retry count for an API call.
func WithTimeout ¶
WithTimeout optionally sets timeout for each HTTP requests made.
func WithTransport ¶
func WithTransport(transport http.RoundTripper) Option
WithTransport optionally sets transport for HTTP client.
func WithVersion ¶
WithVersion optionally sets the API version if the passed string is valid.
type OrderService ¶
type OrderService interface { Get(ctx context.Context, id graphql.ID) (*model.Order, error) List(ctx context.Context, opts ListOptions) ([]*model.Order, error) ListAll(ctx context.Context) ([]*model.Order, error) ListAfterCursor(ctx context.Context, opts ListOptions) ([]*model.Order, *string, *string, error) Update(ctx context.Context, input model.OrderInput) error }
type OrderServiceOp ¶
type OrderServiceOp struct {
// contains filtered or unexported fields
}
func (*OrderServiceOp) List ¶
func (s *OrderServiceOp) List(ctx context.Context, opts ListOptions) ([]*model.Order, error)
func (*OrderServiceOp) ListAfterCursor ¶
func (s *OrderServiceOp) ListAfterCursor(ctx context.Context, opts ListOptions) ([]*model.Order, *string, *string, error)
func (*OrderServiceOp) Update ¶
func (s *OrderServiceOp) Update(ctx context.Context, input model.OrderInput) error
type ProductService ¶
type ProductService interface { List(ctx context.Context, query string) ([]*model.Product, error) ListAll(ctx context.Context) ([]*model.Product, error) Get(ctx context.Context, id string) (*model.Product, error) Create(ctx context.Context, product model.ProductInput, media []model.CreateMediaInput) (*model.Product, error) Update(ctx context.Context, product model.ProductInput) (*model.Product, error) Delete(ctx context.Context, product model.ProductDeleteInput) error VariantsBulkCreate(ctx context.Context, id string, input []model.ProductVariantsBulkInput) error VariantsBulkUpdate(ctx context.Context, id string, input []model.ProductVariantsBulkInput) error VariantsBulkReorder(ctx context.Context, id string, input []model.ProductVariantPositionInput) error }
type ProductServiceOp ¶
type ProductServiceOp struct {
// contains filtered or unexported fields
}
func (*ProductServiceOp) Create ¶
func (s *ProductServiceOp) Create(ctx context.Context, product model.ProductInput, media []model.CreateMediaInput) (*model.Product, error)
func (*ProductServiceOp) Delete ¶
func (s *ProductServiceOp) Delete(ctx context.Context, product model.ProductDeleteInput) error
func (*ProductServiceOp) Update ¶
func (s *ProductServiceOp) Update(ctx context.Context, product model.ProductInput) (*model.Product, error)
func (*ProductServiceOp) VariantsBulkCreate ¶
func (s *ProductServiceOp) VariantsBulkCreate(ctx context.Context, id string, input []model.ProductVariantsBulkInput) error
func (*ProductServiceOp) VariantsBulkReorder ¶
func (s *ProductServiceOp) VariantsBulkReorder(ctx context.Context, id string, input []model.ProductVariantPositionInput) error
func (*ProductServiceOp) VariantsBulkUpdate ¶
func (s *ProductServiceOp) VariantsBulkUpdate(ctx context.Context, id string, input []model.ProductVariantsBulkInput) error
type VariantService ¶
type VariantService interface {
Update(ctx context.Context, variant model.ProductVariantInput) error
}
type VariantServiceOp ¶
type VariantServiceOp struct {
// contains filtered or unexported fields
}
func (*VariantServiceOp) Update ¶
func (s *VariantServiceOp) Update(ctx context.Context, variant model.ProductVariantInput) error
type WebhookService ¶ added in v1.0.2
type WebhookService interface { CreateWebhookSubscription(ctx context.Context, topic model.WebhookSubscriptionTopic, input model.WebhookSubscriptionInput) (*model.WebhookSubscription, error) CreateEventBridgeWebhookSubscription(ctx context.Context, topic model.WebhookSubscriptionTopic, input model.EventBridgeWebhookSubscriptionInput) (*model.WebhookSubscription, error) ListWebhookSubscriptions(ctx context.Context, topics []model.WebhookSubscriptionTopic) ([]*model.WebhookSubscription, error) DeleteWebhook(ctx context.Context, webhookID string) (deletedID *string, err error) UpdateWebhookSubscription(ctx context.Context, webhookID string, input model.WebhookSubscriptionInput) (*model.WebhookSubscription, error) }
type WebhookServiceOp ¶ added in v1.0.2
type WebhookServiceOp struct {
// contains filtered or unexported fields
}
func (WebhookServiceOp) CreateEventBridgeWebhookSubscription ¶ added in v1.0.2
func (s WebhookServiceOp) CreateEventBridgeWebhookSubscription(ctx context.Context, topic model.WebhookSubscriptionTopic, input model.EventBridgeWebhookSubscriptionInput) (*model.WebhookSubscription, error)
func (WebhookServiceOp) CreateWebhookSubscription ¶ added in v1.0.2
func (s WebhookServiceOp) CreateWebhookSubscription(ctx context.Context, topic model.WebhookSubscriptionTopic, input model.WebhookSubscriptionInput) (*model.WebhookSubscription, error)
func (WebhookServiceOp) DeleteWebhook ¶ added in v1.0.2
func (WebhookServiceOp) ListWebhookSubscriptions ¶ added in v1.0.2
func (s WebhookServiceOp) ListWebhookSubscriptions(ctx context.Context, topics []model.WebhookSubscriptionTopic) ([]*model.WebhookSubscription, error)
func (WebhookServiceOp) UpdateWebhookSubscription ¶ added in v1.0.2
func (s WebhookServiceOp) UpdateWebhookSubscription(ctx context.Context, webhookID string, input model.WebhookSubscriptionInput) (*model.WebhookSubscription, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.