Esempio n. 1
0
        /// <summary>
        /// Creates a new <see cref="ShopifyPage"/> on the store.
        /// </summary>
        /// <param name="page">A new <see cref="ShopifyPage"/>. Id should be set to null.</param>
        /// <param name="options">Options for creating the page.</param>
        /// <returns>The new <see cref="ShopifyPage"/>.</returns>
        public async Task<ShopifyPage> CreateAsync(ShopifyPage page, ShopifyPageCreateOptions options = null)
        {
            IRestRequest req = RequestEngine.CreateRequest("pages.json", Method.POST, "page");

            //Build the request body
            Dictionary<string, object> body = new Dictionary<string, object>(options?.ToDictionary() ?? new Dictionary<string, object>())
            {
                { "page", page }
            };

            req.AddJsonBody(body);

            return await RequestEngine.ExecuteRequestAsync<ShopifyPage>(_RestClient, req);
        }
        /// <summary>
        /// Creates a new <see cref="ShopifyPage"/> on the store.
        /// </summary>
        /// <param name="page">A new <see cref="ShopifyPage"/>. Id should be set to null.</param>
        /// <param name="options">Options for creating the page.</param>
        /// <returns>The new <see cref="ShopifyPage"/>.</returns>
        public virtual async Task <ShopifyPage> CreateAsync(ShopifyPage page, ShopifyPageCreateOptions options = null)
        {
            IRestRequest req = RequestEngine.CreateRequest("pages.json", Method.POST, "page");

            //Build the request body
            Dictionary <string, object> body = new Dictionary <string, object>(options?.ToDictionary() ?? new Dictionary <string, object>())
            {
                { "page", page }
            };

            req.AddJsonBody(body);

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