/// <summary>
 /// Returns a <see ref="ShopifyClient">ShopifyClient </see> for the <c>domain<c> passed in. This is useful
 /// when you have multiple Shops your application is querying. Note that
 /// <see ref="ShopifyBuy.Init">ShopifyBuy.Init </see> must be called before trying to call this function.
 /// </summary>
 /// <param name="domain">the domain associated to a client</param>
 /// \code
 /// // 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);
 /// });
 /// \endcode
 public static ShopifyClient Client(string domain)
 {
     if (ClientByDomain.ContainsKey(domain))
     {
         return(ClientByDomain[domain]);
     }
     else
     {
         return(null);
     }
 }
        /// <summary>
        /// Initializes a <see ref="ShopifyClient">ShopifyClient </see> that can be used to query the Storefront API.
        /// The default client which can be accessed by calling <see ref="ShopifyBuy.Client">ShopifyBuy.Client() </see> which is
        /// initialized after <see ref="ShopifyBuy.Init">ShopifyBuy.Init </see> is called. To access the client for the specific
        /// domain passed, use <see ref="ShopifyBuy.Client">ShopifyBuy.Client(domain) </see>.
        /// </summary>
        /// <param name="accessToken">access token that was generated for your store</param>
        /// <param name="domain">domain of your Shopify store</param>
        /// <param name="locale">optional locale for translated content of supported types and fields</param>
        /// \code
        /// // 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);
        /// \endcode
        public static ShopifyClient Init(string accessToken, string domain, string locale = null)
        {
            if (!ClientByDomain.ContainsKey(domain))
            {
                ClientByDomain[domain] = new ShopifyClient(accessToken, domain, locale);

                if (DefaultClient == null)
                {
                    DefaultClient = ClientByDomain[domain];
                }
            }

            return(ClientByDomain[domain]);
        }
        /// <summary>
        /// Typically not used, but it is possible to create a <see ref="ShopifyClient">ShopifyClient </see> by passing an instance
        /// that implements <see ref="BaseLoader">BaseLoader </see>. <see ref="BaseLoader">BaseLoaders </see> 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 <c>domain</c> string used to access specific initialized clients is inferred from
        /// <see ref="BaseLoader">BaseLoader.Domain</see> which can be used to request a specific client.
        /// </summary>
        /// <param name="loader">a loader which will handle network communicationication with the Storefront API</param>
        /// \code
        /// // 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);
        /// \endcode
        public static ShopifyClient Init(BaseLoader loader)
        {
            string domain = loader.Domain;

            if (!ClientByDomain.ContainsKey(domain))
            {
                ClientByDomain[domain] = new ShopifyClient(loader);

                if (DefaultClient == null)
                {
                    DefaultClient = ClientByDomain[domain];
                }
            }

            return(ClientByDomain[domain]);
        }