/// <summary> /// Updates the given <see cref="ShopifyPage"/>. Id must not be null. /// </summary> /// <param name="page">The <see cref="ShopifyPage"/> to update.</param> /// <returns>The updated <see cref="ShopifyPage"/>.</returns> public virtual async Task <ShopifyPage> UpdateAsync(ShopifyPage page) { IRestRequest req = RequestEngine.CreateRequest($"pages/{page.Id.Value}.json", Method.PUT, "page"); req.AddJsonBody(new { page }); 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 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)); }
/// <summary> /// Updates the given <see cref="ShopifyPage"/>. Id must not be null. /// </summary> /// <param name="page">The <see cref="ShopifyPage"/> to update.</param> /// <returns>The updated <see cref="ShopifyPage"/>.</returns> public async Task<ShopifyPage> UpdateAsync(ShopifyPage page) { IRestRequest req = RequestEngine.CreateRequest($"pages/{page.Id.Value}.json", Method.PUT, "page"); req.AddJsonBody(new { page }); return await RequestEngine.ExecuteRequestAsync<ShopifyPage>(_RestClient, req); }