/// <summary>
        ///     Returns a list of events.
        /// </summary>
        /// <param name="appId">ID for application owning the hook.</param>
        /// <param name="hookId">ID for hook owning the event.</param>
        /// <param name="options">Options for filtering the result.</param>
        public virtual async Task<IEnumerable<Entities.TictailEvent>> ListAsync(string hookId, string appId,
            EventListFilter options = null)
        {
            var req = PrepareRequest($"apps/{appId}/hooks/{hookId}/events");

            //Add optional parameters to request
            if (options != null) req.QueryParams.AddRange(options.ToParameters());

            return await ExecuteRequestAsync<List<Entities.TictailEvent>>(req, HttpMethod.Get);
        }
Пример #2
0
        /// <summary>
        /// Returns a list of events.
        /// </summary>
        /// <param name="options">Options for filtering the result.</param>
        public virtual async Task <IEnumerable <Event> > ListAsync(EventListFilter options = null)
        {
            var req = PrepareRequest("events.json");

            //Add optional parameters to request
            if (options != null)
            {
                req.Url.QueryParams.AddRange(options.ToParameters());
            }

            return(await ExecuteRequestAsync <List <Event> >(req, HttpMethod.Get, rootElement : "events"));
        }
Пример #3
0
        /// <summary>
        /// Returns a list of events for the given subject and subject type. A full list of supported subject types can be found at https://help.shopify.com/api/reference/event
        /// </summary>
        /// <param name="options">Options for filtering the result.</param>
        /// <param name="subjectId">Restricts results to just one subject item, e.g. all changes on a product.</param>
        /// <param name="subjectType">The subject's type, e.g. 'Order' or 'Product'. Known subject types are 'Articles', 'Blogs', 'Custom_Collections', 'Comments', 'Orders', 'Pages', 'Products' and 'Smart_Collections'.  A current list of subject types can be found at https://help.shopify.com/api/reference/event </param>
        public virtual async Task <IEnumerable <Event> > ListAsync(long subjectId, string subjectType, EventListFilter options = null)
        {
            // Ensure the subject type is plural
            if (!subjectType.Substring(subjectType.Length - 1).Equals("s", System.StringComparison.OrdinalIgnoreCase))
            {
                subjectType = subjectType + "s";
            }

            var req = PrepareRequest($"{subjectType?.ToLower()}/{subjectId}/events.json");

            //Add optional parameters to request
            if (options != null)
            {
                req.Url.QueryParams.AddRange(options.ToParameters());
            }

            return(await ExecuteRequestAsync <List <Event> >(req, HttpMethod.Get, rootElement : "events"));
        }