Connectster.Shopify.ShopifyCommunicator.CreateCollection C# (CSharp) Method

CreateCollection() public method

public CreateCollection ( ShopifyStoreAuth storeAuth, ShopifyCollection collection ) : ShopifyResponse
storeAuth ShopifyStoreAuth
collection ShopifyCollection
return ShopifyResponse
            public ShopifyResponse<ShopifyCollection> CreateCollection(ShopifyStoreAuth storeAuth,
                                                                   ShopifyCollection collection)
            {
            if (storeAuth == null || collection == null)
            {
                Logger.Error("ShopifyCommunicator::CreateCollection(): storeAuth and collection cannot be null.");
                return null;
            }

            var xS = new XmlSerializer(typeof (ShopifyCollection));
            var memStream = new MemoryStream();
            var xDoc = new XmlDocument();

            xS.Serialize(memStream, collection);
            memStream.Seek(0, SeekOrigin.Begin);
            xDoc.Load(memStream);
            memStream.Close();

            return
                new ShopifyResponse<ShopifyCollection>(
                    ShopifyPutPost((_protocol + storeAuth.StoreSubDomain + _domain + "/admin/custom_collections.xml"),
                                   HashString(_appAuth.Secret + storeAuth.StoreAuthToken), xDoc, "POST"));
            }