/// <summary> /// Returns a list of events. /// </summary> /// <param name="options">Options for filtering the result.</param> public async Task <IEnumerable <ShopifyEvent> > ListAsync(ShopifyEventListFilter options = null) { var req = RequestEngine.CreateRequest("events.json", Method.GET, "events"); //Add optional parameters to request if (options != null) { req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost)); } return(await RequestEngine.ExecuteRequestAsync <List <ShopifyEvent> >(_RestClient, req)); }
/* * I have implemented the API as best as I can but this method keeps returning nothing * /// <summary> * /// Returns a list of Events on a paticular item eg. all events on a product * /// </summary> * /// <param name="subjectType">Resticts resluts to just one subject type</param> * /// <param name="subjectId">Restics results to just one subject id</param> * /// <param name="options">(optional) Filters</param> * /// <returns></returns> * public async Task<IEnumerable<ShopifyEvent>> ListAsync(string subjectType, long subjectId, ShopifyEventListFilter options = null) * { * return await ListAsync(options, subjectType, subjectId); * } */ /// <summary> /// Returns a list of Events /// </summary> /// <param name="options">(optional) Filters</param> /// <param name="subjectType">(optional) Resticts resluts to just one subject type</param> /// <param name="subjectId">(optional) Restics results to just one subject item eg.all changes on a product (subjectType must not be null for this to work)</param> /// <returns></returns> private async Task <IEnumerable <ShopifyEvent> > ListAsync(ShopifyEventListFilter options = null, string subjectType = null, long?subjectId = null) { IRestRequest req; if (subjectType == null) { req = RequestEngine.CreateRequest("events.json", Method.GET, "events"); } else { // As noted above this is currently always returing nothing I am unsure why var subjectTypeName = subjectType.ToLower(); req = RequestEngine.CreateRequest(string.Format("{0}s/#{1}/events.json", subjectTypeName, subjectId), Method.GET, "events"); } //Add optional parameters to request if (options != null) { req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost)); } return(await RequestEngine.ExecuteRequestAsync <List <ShopifyEvent> >(_RestClient, req)); }
/// <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 async Task <IEnumerable <ShopifyEvent> > ListAsync(long subjectId, string subjectType, ShopifyEventListFilter options = null) { // Ensure the subject type is plural if (!subjectType.Substring(subjectType.Length - 1).Equals("s", System.StringComparison.OrdinalIgnoreCase)) { subjectType = subjectType + "s"; } var req = RequestEngine.CreateRequest($"{subjectType?.ToLower()}/{subjectId}/events.json", Method.GET, "events"); //Add optional parameters to request if (options != null) { req.Parameters.AddRange(options.ToParameters(ParameterType.GetOrPost)); } return(await RequestEngine.ExecuteRequestAsync <List <ShopifyEvent> >(_RestClient, req)); }
/// <summary> /// Returns a list of Events /// </summary> /// <param name="options">(optional) Filters</param> /// <returns></returns> public async Task <IEnumerable <ShopifyEvent> > ListAsync(ShopifyEventListFilter options = null) { return(await ListAsync(options, null, null)); }