Shopify SDK for Unity
Static Public Member Functions | List of all members
Shopify.Unity.ShopifyBuy Class Reference

Is the main entry point for the Shopify SDK for Unity. Using you'll create a client which can create queries on the Storefront API. ShopifyClient can also be used to create a Cart . More...

Static Public Member Functions

static ShopifyClient Client ()
 Returns the default ShopifyClient . The default client is the first client created after calling ShopifyBuy.Init . Note that ShopifyBuy.Init must be called before trying to call this function. More...
 
static ShopifyClient Client (string domain)
 Returns a ShopifyClient for the domain<c> passed in. This is useful when you have multiple Shops your application is querying. Note that ShopifyBuy.Init must be called before trying to call this function. More...
 
static ShopifyClient Init (string accessToken, string domain, string locale=null)
 Initializes a ShopifyClient that can be used to query the Storefront API. The default client which can be accessed by calling ShopifyBuy.Client() which is initialized after ShopifyBuy.Init is called. To access the client for the specific domain passed, use ShopifyBuy.Client(domain) . More...
 
static ShopifyClient Init (BaseLoader loader)
 Typically not used, but it is possible to create a ShopifyClient by passing an instance that implements BaseLoader . BaseLoaders handle network communicationication with the Storefront API. This functionality is useful if you'd like to use the Shopify SDK for Unity in a C# environment outside of Unity. The domain string used to access specific initialized clients is inferred from BaseLoader.Domainwhich can be used to request a specific client. More...
 

Detailed Description

Is the main entry point for the Shopify SDK for Unity. Using you'll create a client which can create queries on the Storefront API. ShopifyClient

can also be used to create a Cart

.

Member Function Documentation

◆ Client() [1/2]

static ShopifyClient Shopify.Unity.ShopifyBuy.Client ( )
inlinestatic

Returns the default ShopifyClient . The default client is the first client created after calling ShopifyBuy.Init . Note that ShopifyBuy.Init must be called before trying to call this function.

// Example usage querying all products using `Client`
ShopifyBuy.Client().products((products, error) => {
Debug.Log(products[0].title());
Debug.Log(products[1].title());
Debug.Log(products.Count);
});

◆ Client() [2/2]

static ShopifyClient Shopify.Unity.ShopifyBuy.Client ( string  domain)
inlinestatic

Returns a ShopifyClient for the domain<c> passed in. This is useful when you have multiple Shops your application is querying. Note that ShopifyBuy.Init must be called before trying to call this function.

Parameters
domainthe domain associated to a client
// Example usage querying all products using `Client` and a domain
ShopifyBuy.Client("unity-buy-sdk.myshopify.com").products((products, error) => {
Debug.Log(products[0].title());
Debug.Log(products[1].title());
Debug.Log(products.Count);
});

◆ Init() [1/2]

static ShopifyClient Shopify.Unity.ShopifyBuy.Init ( BaseLoader  loader)
inlinestatic

Typically not used, but it is possible to create a ShopifyClient by passing an instance that implements BaseLoader . BaseLoaders handle network communicationication with the Storefront API. This functionality is useful if you'd like to use the Shopify SDK for Unity in a C# environment outside of Unity. The domain string used to access specific initialized clients is inferred from BaseLoader.Domainwhich can be used to request a specific client.

Parameters
loadera loader which will handle network communicationication with the Storefront API
// Mock example using a custom loader for another C# platform
string accessToken = "b8d417759a62f7b342f3735dbe86b322";
string shopDomain = "unity-buy-sdk.myshopify.com";
CustomLoaderForNonUnityPlatform loader = new CustomLoaderForNonUnityPlatform(accessToken, shopDomain);
// Init only needs to be called once
ShopifyBuy.Init(loader);

◆ Init() [2/2]

static ShopifyClient Shopify.Unity.ShopifyBuy.Init ( string  accessToken,
string  domain,
string  locale = null 
)
inlinestatic

Initializes a ShopifyClient that can be used to query the Storefront API. The default client which can be accessed by calling ShopifyBuy.Client() which is initialized after ShopifyBuy.Init is called. To access the client for the specific domain passed, use ShopifyBuy.Client(domain) .

Parameters
accessTokenaccess token that was generated for your store
domaindomain of your Shopify store
localeoptional locale for translated content of supported types and fields
// Example that initializes the Shopify SDK for Unity
string accessToken = "b8d417759a62f7b342f3735dbe86b322";
string shopDomain = "unity-buy-sdk.myshopify.com";
string locale = "es";
// Init only needs to be called once
ShopifyBuy.Init(accessToken, shopDomain);
// To return translated content, include the `locale` parameter:
ShopifyBuy.Init(accessToken, shopDomain, locale);

The documentation for this class was generated from the following file: