/// <summary> /// Updates the given <see cref="ShopifyScriptTag"/>. Id must not be null. /// </summary> /// <param name="tag">The <see cref="ShopifyScriptTag"/> to update.</param> /// <returns>The updated <see cref="ShopifyScriptTag"/>.</returns> public async Task <ShopifyScriptTag> UpdateAsync(ShopifyScriptTag tag) { IRestRequest req = RequestEngine.CreateRequest("script_tags/{0}.json".FormatWith(tag.Id.Value), Method.PUT, "script_tag"); req.AddJsonBody(new { script_tag = tag }); return(await RequestEngine.ExecuteRequestAsync <ShopifyScriptTag>(_RestClient, req)); }
/// <summary> /// Creates a new <see cref="ShopifyScriptTag"/> on the store. /// </summary> /// <param name="tag">A new <see cref="ShopifyScriptTag"/>. Id should be set to null.</param> /// <returns>The new <see cref="ShopifyScriptTag"/>.</returns> public async Task <ShopifyScriptTag> CreateAsync(ShopifyScriptTag tag) { IRestRequest req = RequestEngine.CreateRequest("script_tags.json", Method.POST, "script_tag"); //Build the request body var body = new Dictionary <string, object>() { { "script_tag", tag } }; req.AddJsonBody(body); return(await RequestEngine.ExecuteRequestAsync <ShopifyScriptTag>(_RestClient, req)); }
/// <summary> /// Creates a new <see cref="ShopifyScriptTag"/> on the store. /// </summary> /// <param name="tag">A new <see cref="ShopifyScriptTag"/>. Id should be set to null.</param> /// <returns>The new <see cref="ShopifyScriptTag"/>.</returns> public async Task<ShopifyScriptTag> CreateAsync(ShopifyScriptTag tag) { IRestRequest req = RequestEngine.CreateRequest("script_tags.json", Method.POST, "script_tag"); //Build the request body var body = new Dictionary<string, object>() { { "script_tag", tag } }; req.AddJsonBody(body); return await RequestEngine.ExecuteRequestAsync<ShopifyScriptTag>(_RestClient, req); }
/// <summary> /// Updates the given <see cref="ShopifyScriptTag"/>. Id must not be null. /// </summary> /// <param name="tag">The <see cref="ShopifyScriptTag"/> to update.</param> /// <returns>The updated <see cref="ShopifyScriptTag"/>.</returns> public async Task<ShopifyScriptTag> UpdateAsync(ShopifyScriptTag tag) { IRestRequest req = RequestEngine.CreateRequest($"script_tags/{tag.Id.Value}.json", Method.PUT, "script_tag"); req.AddJsonBody(new { script_tag = tag }); return await RequestEngine.ExecuteRequestAsync<ShopifyScriptTag>(_RestClient, req); }