/// <summary> /// Gets a list of up to 250 of the shop's orders. /// </summary> /// <param name="options">Options for filtering the list.</param> /// <returns>The list of orders matching the filter.</returns> public async Task<IEnumerable<ShopifyOrder>> ListAsync(ShopifyOrderFilterOptions options = null) { IRestRequest req = RequestEngine.CreateRequest("orders.json", Method.GET, "orders"); //Add optional parameters to request if (options != null) req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost)); return await RequestEngine.ExecuteRequestAsync<List<ShopifyOrder>>(_RestClient, req); }
/// <summary> /// Gets a list of up to 250 of the customer's orders. /// </summary> /// <param name="customerId">The id of the customer to list orders for.</param> /// <param name="options">Options for filtering the list.</param> /// <returns>The list of orders matching the filter.</returns> public async Task<IEnumerable<ShopifyOrder>> ListForCustomerAsync(long customerId, ShopifyOrderFilterOptions options = null) { IRestRequest req = RequestEngine.CreateRequest("orders.json", Method.GET, "orders"); //Add the customer id to the filter req.Parameters.Add(new Parameter() { Name = "customer_id", Value = customerId, Type = ParameterType.GetOrPost }); //Add optional parameters to request if (options != null) req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost)); return await RequestEngine.ExecuteRequestAsync<List<ShopifyOrder>>(_RestClient, req); }
/// <summary> /// Gets a count of all of the shop's orders. /// </summary> /// <param name="options">Options for filtering the count.</param> /// <returns>The count of all orders for the shop.</returns> public async Task<int> CountAsync(ShopifyOrderFilterOptions options = null) { IRestRequest req = RequestEngine.CreateRequest("orders/count.json", Method.GET); //Add optional parameters to request if (options != null) req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost)); JToken responseObject = await RequestEngine.ExecuteRequestAsync(_RestClient, req); //Response looks like { "count" : 123 }. Does not warrant its own class. return responseObject.Value<int>("count"); }
/// <summary> /// Gets a list of up to 250 of the shop's orders. /// </summary> /// <param name="options">Options for filtering the list.</param> /// <returns>The list of orders matching the filter.</returns> public async Task <IEnumerable <ShopifyOrder> > ListAsync(ShopifyOrderFilterOptions options = null) { IRestRequest req = RequestEngine.CreateRequest("orders.json", Method.GET, "orders"); //Add optional parameters to request if (options != null) { req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost)); } return(await RequestEngine.ExecuteRequestAsync <List <ShopifyOrder> >(_RestClient, req)); }
/// <summary> /// Gets a count of all of the shop's orders. /// </summary> /// <param name="options">Options for filtering the count.</param> /// <returns>The count of all orders for the shop.</returns> public async Task <int> CountAsync(ShopifyOrderFilterOptions options = null) { IRestRequest req = RequestEngine.CreateRequest("orders/count.json", Method.GET); //Add optional parameters to request if (options != null) { req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost)); } JToken responseObject = await RequestEngine.ExecuteRequestAsync(_RestClient, req); //Response looks like { "count" : 123 }. Does not warrant its own class. return(responseObject.Value <int>("count")); }
/// <summary> /// Gets a list of up to 250 of the customer's orders. /// </summary> /// <param name="customerId">The id of the customer to list orders for.</param> /// <param name="options">Options for filtering the list.</param> /// <returns>The list of orders matching the filter.</returns> public async Task <IEnumerable <ShopifyOrder> > ListForCustomerAsync(long customerId, ShopifyOrderFilterOptions options = null) { IRestRequest req = RequestEngine.CreateRequest("orders.json", Method.GET, "orders"); //Add the customer id to the filter req.Parameters.Add(new Parameter() { Name = "customer_id", Value = customerId, Type = ParameterType.GetOrPost }); //Add optional parameters to request if (options != null) { req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost)); } return(await RequestEngine.ExecuteRequestAsync <List <ShopifyOrder> >(_RestClient, req)); }