/// <summary>
        /// Gets a list of up to 250 of the order's fulfillments.
        /// </summary>
        /// <param name="orderId">The order id to which the fulfillments belong.</param>
        /// <param name="options">Options for filtering the list.</param>
        /// <returns>The list of fulfillments matching the filter.</returns>
        public virtual async Task <IEnumerable <Fulfillment> > ListAsync(long orderId, ListFilter options = null)
        {
            var req = PrepareRequest($"orders/{orderId}/fulfillments.json");

            if (options != null)
            {
                req.QueryParams.AddRange(options.ToParameters());
            }

            return(await ExecuteRequestAsync <List <Fulfillment> >(req, HttpMethod.Get, rootElement : "fulfillments"));
        }
        /// <summary>
        /// Gets a list of up to 250 of the shop's customers.
        /// </summary>
        /// <returns></returns>
        public virtual async Task <IEnumerable <Customer> > ListAsync(ListFilter filter = null)
        {
            var req = PrepareRequest("customers.json");

            if (filter != null)
            {
                req.Url.QueryParams.AddRange(filter.ToParameters());
            }

            return(await ExecuteRequestAsync <List <Customer> >(req, HttpMethod.Get, rootElement : "customers"));
        }
示例#3
0
        /// <summary>
        /// Gets a list of up to 250 of the shop customers's addresses.
        /// </summary>
        /// <param name="customerId">The id of the customer to retrieve.</param>
        /// <returns></returns>
        public virtual async Task <IEnumerable <Address> > ListAsync(long customerId, ListFilter filter = null)
        {
            var req = PrepareRequest($"customers/{customerId}/addresses.json");

            if (filter != null)
            {
                req.Url.QueryParams.AddRange(filter.ToParameters());
            }

            return(await ExecuteRequestAsync <List <Address> >(req, HttpMethod.Get, rootElement : "addresses"));
        }
        public virtual async Task <IEnumerable <InventoryItem> > ListAsync(ListFilter filterOptions)
        {
            var req = PrepareRequest($"inventory_items.json");

            if (filterOptions != null)
            {
                req.QueryParams.AddRange(filterOptions.ToParameters());
            }

            return(await ExecuteRequestAsync <List <InventoryItem> >(req, HttpMethod.Get, rootElement : "inventory_items"));
        }
示例#5
0
        public virtual async Task <IEnumerable <ProductVariant> > ListAsync(long productId, ListFilter filterOptions = null)
        {
            var req = PrepareRequest($"products/{productId}/variants.json");

            if (filterOptions != null)
            {
                req.QueryParams.AddRange(filterOptions.ToParameters());
            }

            return(await ExecuteRequestAsync <List <ProductVariant> >(req, HttpMethod.Get, rootElement : "variants"));
        }
        /// <summary>
        ///     Gets a list of up to 100 of the shop's customers.
        /// </summary>
        /// <returns></returns>
        public virtual async Task <IEnumerable <Entities.TictailCustomer> > ListAsync(string storeId, ListFilter filter = null)
        {
            var req = PrepareRequest($"stores/{storeId}/customers");

            if (filter != null)
            {
                req.QueryParams.AddRange(filter.ToParameters());
            }

            return(await ExecuteRequestAsync <List <Entities.TictailCustomer> >(req, HttpMethod.Get, new JsonContent(null)));
        }
示例#7
0
        /// <summary>
        /// Gets a list of up to 250 of the shop's customers.
        /// </summary>
        /// <returns></returns>
        public virtual Task <List <CustomerSavedSearch> > ListAsync(ListFilter filter = null)
        {
            var req = PrepareRequest($"{RootResource}.json");

            if (filter != null)
            {
                req.QueryParams.AddRange(filter.ToParameters());
            }

            return(ExecuteRequestAsync <List <CustomerSavedSearch> >(req, HttpMethod.Get, rootElement: RootResource));
        }
示例#8
0
        /// <summary>
        /// Returns a list of all <see cref="Customer"/> that are in the saved search
        /// </summary>
        /// <param name="customerSavedSearchId">Id of the Customer Saved Search</param>
        /// <returns></returns>
        public Task <List <Customer> > GetCustomersFromSavedSearch(long customerSavedSearchId, string query = null, ListFilter filter = null)
        {
            var req = PrepareRequest($"{RootResource}/{customerSavedSearchId}/customers.json");

            if (query != null)
            {
                req.QueryParams.Add("query", query);
            }

            if (filter != null)
            {
                req.QueryParams.AddRange(filter.ToParameters());
            }

            return(ExecuteRequestAsync <List <Customer> >(req, HttpMethod.Get, rootElement: "customers"));
        }
        /// <summary>
        /// Searches through a shop's customers for the given search query. NOTE: Assumes the <paramref name="query"/> and <paramref name="order"/> strings are not encoded.
        /// </summary>
        /// <param name="query">The (unencoded) search query, in format of 'Bob country:United States', which would search for customers in the United States with a name like 'Bob'.</param>
        /// <param name="order">An (unencoded) optional string to order the results, in format of 'field_name DESC'. Default is 'last_order_date DESC'.</param>
        /// <param name="filter">Options for filtering the results.</param>
        /// <returns>A list of matching customers.</returns>
        public virtual async Task <IEnumerable <Customer> > SearchAsync(string query, string order = null, ListFilter filter = null)
        {
            var req = PrepareRequest("customers/search.json");

            req.Url.QueryParams.Add("query", query, false);

            if (!string.IsNullOrEmpty(order))
            {
                req.Url.QueryParams.Add("order", order, false);
            }

            if (filter != null)
            {
                req.Url.QueryParams.AddRange(filter.ToParameters());
            }

            return(await ExecuteRequestAsync <List <Customer> >(req, HttpMethod.Get, rootElement : "customers"));
        }
示例#10
0
        /// <summary>
        /// Searches through a shop's customers for the given search query. NOTE: Assumes the <paramref name="query"/> and <paramref name="order"/> strings are not encoded.
        /// </summary>
        /// <param name="query">The (unencoded) search query, in format of 'Bob country:United States', which would search for customers in the United States with a name like 'Bob'.</param>
        /// <param name="sinceId">Restricts results to after a given id.</param>
        /// <param name="filter">Options for filtering the results.</param>
        /// <returns>A list of matching customers.</returns>
        public virtual Task <List <CustomerSavedSearch> > SearchAsync(string query, string sinceId = null, ListFilter filter = null)
        {
            var req = PrepareRequest($"{RootResource}.json");

            req.QueryParams.Add("query", query);

            if (!string.IsNullOrEmpty(sinceId))
            {
                req.QueryParams.Add("since_id", sinceId);
            }

            if (filter != null)
            {
                req.QueryParams.AddRange(filter.ToParameters());
            }

            return(ExecuteRequestAsync <List <CustomerSavedSearch> >(req, HttpMethod.Get, rootElement: RootResource));
        }