/// <summary> /// Creates a new <see cref="ShopifyRedirect"/> on the store. The redirect always starts out with a role of /// "unpublished." If the redirect has a different role, it will be assigned that only after all of its /// files have been extracted and stored by Shopify (which might take a couple of minutes). /// </summary> /// <param name="redirect">The new <see cref="ShopifyRedirect"/>.</param> /// <returns>The new <see cref="ShopifyRedirect"/>.</returns> public async Task <ShopifyRedirect> CreateAsync(ShopifyRedirect redirect) { IRestRequest req = RequestEngine.CreateRequest("redirects.json", Method.POST, "redirect"); req.AddJsonBody(new { redirect }); return(await RequestEngine.ExecuteRequestAsync <ShopifyRedirect>(_RestClient, req)); }
/// <summary> /// Updates the given <see cref="ShopifyRedirect"/>. Id must not be null. /// </summary> /// <param name="redirect">The <see cref="ShopifyRedirect"/> to update.</param> /// <returns>The updated <see cref="ShopifyRedirect"/>.</returns> public async Task <ShopifyRedirect> UpdateAsync(ShopifyRedirect redirect) { IRestRequest req = RequestEngine.CreateRequest("redirects/{0}.json".FormatWith(redirect.Id.Value), Method.PUT, "redirect"); req.AddJsonBody(new { redirect }); return(await RequestEngine.ExecuteRequestAsync <ShopifyRedirect>(_RestClient, req)); }
/// <summary> /// Creates a new <see cref="ShopifyRedirect"/> on the store. The redirect always starts out with a role of /// "unpublished." If the redirect has a different role, it will be assigned that only after all of its /// files have been extracted and stored by Shopify (which might take a couple of minutes). /// </summary> /// <param name="redirect">The new <see cref="ShopifyRedirect"/>.</param> /// <returns>The new <see cref="ShopifyRedirect"/>.</returns> public async Task<ShopifyRedirect> CreateAsync(ShopifyRedirect redirect) { IRestRequest req = RequestEngine.CreateRequest("redirects.json", Method.POST, "redirect"); req.AddJsonBody(new { redirect }); return await RequestEngine.ExecuteRequestAsync<ShopifyRedirect>(_RestClient, req); }
/// <summary> /// Updates the given <see cref="ShopifyRedirect"/>. Id must not be null. /// </summary> /// <param name="redirect">The <see cref="ShopifyRedirect"/> to update.</param> /// <returns>The updated <see cref="ShopifyRedirect"/>.</returns> public async Task<ShopifyRedirect> UpdateAsync(ShopifyRedirect redirect) { IRestRequest req = RequestEngine.CreateRequest("redirects/{0}.json".FormatWith(redirect.Id.Value), Method.PUT, "redirect"); req.AddJsonBody(new { redirect }); return await RequestEngine.ExecuteRequestAsync<ShopifyRedirect>(_RestClient, req); }