/// <summary> /// Updates a blog. /// </summary> /// <param name="blog">The updated blog. Id should not be null.</param> /// <param name="metafields">Optional metafield data that can be returned by the <see cref="ShopifyMetaFieldService"/>.</param> public async Task <ShopifyBlog> UpdateAsync(ShopifyBlog blog, IEnumerable <ShopifyMetaField> metafields = null) { var request = RequestEngine.CreateRequest($"blogs/{blog.Id.Value}.json", RestSharp.Method.PUT, "blog"); var body = blog.ToDictionary(); if (metafields != null && metafields.Count() >= 1) { body.Add("metafields", metafields); } request.AddJsonBody(new { blog = body }); return(await RequestEngine.ExecuteRequestAsync <ShopifyBlog>(_RestClient, request)); }
/// <summary> /// Updates a blog. /// </summary> /// <param name="blog">The updated blog. Id should not be null.</param> /// <param name="metafields">Optional metafield data that can be returned by the <see cref="ShopifyMetaFieldService"/>.</param> public async Task<ShopifyBlog> UpdateAsync(ShopifyBlog blog, IEnumerable<ShopifyMetaField> metafields = null) { var request = RequestEngine.CreateRequest($"blogs/{blog.Id.Value}.json", RestSharp.Method.PUT, "blog"); var body = blog.ToDictionary(); if (metafields != null && metafields.Count() >= 1) { body.Add("metafields", metafields); } request.AddJsonBody(new { blog = body }); return await RequestEngine.ExecuteRequestAsync<ShopifyBlog>(_RestClient, request); }