Example #1
0
        /// <summary>
        /// Updates the given <see cref="ShopifyCustomCollection"/>. Id must not be null.
        /// </summary>
        /// <param name="customCollection">The <see cref="ShopifyCustomCollection"/> to update.</param>
        /// <returns>The updated <see cref="ShopifyCustomCollection"/>.</returns>
        public virtual async Task <ShopifyCustomCollection> UpdateAsync(ShopifyCustomCollection customCollection)
        {
            IRestRequest req = RequestEngine.CreateRequest($"custom_collections/{customCollection.Id.Value}.json", Method.PUT, "custom_collection");

            //Build the request body
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "custom_collection", customCollection }
            };

            req.AddJsonBody(body);

            return(await RequestEngine.ExecuteRequestAsync <ShopifyCustomCollection>(_RestClient, req));
        }
        /// <summary>
        /// Creates a new <see cref="ShopifyCustomCollection"/> Custom Collection
        /// </summary>
        /// <param name="customCollection">A new <see cref="ShopifyCustomCollection"/>. Id should be set to null.</param>
        /// <returns>The new <see cref="ShopifyCustomCollection"/>.</returns>
        public async Task<ShopifyCustomCollection> CreateAsync(ShopifyCustomCollection customCollection)
        {
            string reqPath = "custom_collections.json";

            IRestRequest req = RequestEngine.CreateRequest(reqPath, Method.POST, "custom_collection");

            //Build the request body
            Dictionary<string, object> body = new Dictionary<string, object>()
            {
                { "custom_collection", customCollection }
            };

            req.AddJsonBody(body);

            return await RequestEngine.ExecuteRequestAsync<ShopifyCustomCollection>(_RestClient, req);
        }
Example #3
0
        /// <summary>
        /// Creates a new <see cref="ShopifyCustomCollection"/> Custom Collection
        /// </summary>
        /// <param name="customCollection">A new <see cref="ShopifyCustomCollection"/>. Id should be set to null.</param>
        /// <returns>The new <see cref="ShopifyCustomCollection"/>.</returns>
        public virtual async Task <ShopifyCustomCollection> CreateAsync(ShopifyCustomCollection customCollection)
        {
            string reqPath = "custom_collections.json";

            IRestRequest req = RequestEngine.CreateRequest(reqPath, Method.POST, "custom_collection");

            //Build the request body
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "custom_collection", customCollection }
            };

            req.AddJsonBody(body);

            return(await RequestEngine.ExecuteRequestAsync <ShopifyCustomCollection>(_RestClient, req));
        }
        /// <summary>
        /// Updates the given <see cref="ShopifyCustomCollection"/>. Id must not be null.
        /// </summary>
        /// <param name="customCollection">The <see cref="ShopifyCustomCollection"/> to update.</param>
        /// <returns>The updated <see cref="ShopifyCustomCollection"/>.</returns>
        public async Task<ShopifyCustomCollection> UpdateAsync(ShopifyCustomCollection customCollection)
        {
            IRestRequest req = RequestEngine.CreateRequest($"custom_collections/{customCollection.Id.Value}.json", Method.PUT, "custom_collection");

            //Build the request body
            Dictionary<string, object> body = new Dictionary<string, object>()
            {
                { "custom_collection", customCollection }
            };

            req.AddJsonBody(body);

            return await RequestEngine.ExecuteRequestAsync<ShopifyCustomCollection>(_RestClient, req);
        }