/// <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
        public void EventListFilter_DoesNotHaveRequiredFields()
        {
            // Arrange
            _filter = new EventListFilter();

            // Act
            var keyValuePairs = StripeClient.GetModelKeyValuePairs(_filter).ToList();

            // Assert
            keyValuePairs.Should().HaveCount(0);
        }
Пример #3
0
        public IActionResult Statistics()
        {
            var filter = new EventListFilter
            {
                OrganizerId = Guid.Parse(User.FindFirst("userId").Value)
            };

            var events = _eventService.GetList(filter);

            return(View(events));
        }
Пример #4
0
        public async Task <StripeResponse <Pagination <Event> > > GetEvents(EventListFilter filter,
                                                                            CancellationToken cancellationToken = default(CancellationToken))
        {
            var request = new StripeRequest <EventListFilter, Pagination <Event> >
            {
                UrlPath = Paths.Events,
                Model   = filter
            };

            return(await _client.Get(request, cancellationToken));
        }
Пример #5
0
        public IActionResult Events()
        {
            Expression <Func <Event, bool> > waitingFilter = x => x.IsApproved == null;
            var filter = new EventListFilter
            {
                AdditionalFilters = new [] { waitingFilter },
                Ordering          = EventListOrder.CreateDate
            };
            var list = _eventService.GetList(filter);

            return(View(list));
        }
Пример #6
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"));
        }
        public async Task GetEventsTest()
        {
            // Arrange
            var filter = new EventListFilter();

            _stripe.Get(
                Arg.Is <StripeRequest <EventListFilter, Pagination <Event> > >(
                    a => a.UrlPath == "events" && a.Model == filter), _cancellationToken)
            .Returns(Task.FromResult(new StripeResponse <Pagination <Event> >()));

            // Act
            var response = await _client.GetEvents(filter, _cancellationToken);

            // Assert
            response.Should().NotBeNull();
        }
Пример #8
0
        public EventListViewModel GetPage(int page, EventListFilter filter)
        {
            var events = _unitOfWork.EventRepository.GetPage(ItemsPerPage, page, out var totalPages,
                                                             filter.OrderKeySelector, filter.IsDescending, filter.BuildFilters().ToArray());

            var pageViewModel = new PageViewModel(page, totalPages)
            {
                Parameters = filter.ToDictionary()
            };

            var model = new EventListViewModel
            {
                Events          = events,
                Page            = pageViewModel,
                EventCategories = _unitOfWork.EventCategoryRepository.All()
            };

            return(model);
        }
Пример #9
0
        public IActionResult Events(int?category, bool?onlyActive, bool?onlyApproved, string order, int page = 1)
        {
            Enum.TryParse(typeof(EventListOrder), order, true, out var orderValue);

            var filter = new EventListFilter
            {
                OrganizerId  = Guid.Parse(User.FindFirst("userId").Value),
                OnlyActive   = onlyActive,
                OnlyApproved = onlyApproved,
                CategoryId   = category,
                Ordering     = (EventListOrder?)orderValue
            };

            var model = _eventService.GetPage(page, filter);

            if (page < 1 || page > model.Page.Total)
            {
                return(NotFound());
            }

            return(View(model));
        }
Пример #10
0
        public IActionResult List(int?category, string order, int page = 1)
        {
            Expression <Func <Event, bool> > visibilityFilter = x => x.DateTime >= DateTime.Now;

            Enum.TryParse(typeof(EventListOrder), order, true, out var orderValue);

            var filter = new EventListFilter
            {
                CategoryId        = category,
                OnlyApproved      = true,
                AdditionalFilters = new[] { visibilityFilter },
                Ordering          = (EventListOrder?)orderValue
            };

            var model = _eventService.GetPage(page, filter);

            if (page < 1 || page > model.Page.Total)
            {
                return(NotFound());
            }

            return(View(model));
        }
Пример #11
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="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>
 /// <param name="cancellationToken">Cancellation Token</param>
 public virtual async Task <ListResult <Entities.Event> > ListAsync(long subjectId, string subjectType, EventListFilter filter, CancellationToken cancellationToken = default)
 {
     return(await ListAsync(subjectId, subjectType, (ListFilter <Entities.Event>) filter, cancellationToken));
 }
Пример #12
0
 public void Init()
 {
     _filter = GenFu.GenFu.New <EventListFilter>();
 }
Пример #13
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"));
        }
Пример #14
0
 public IEnumerable <Event> GetList(EventListFilter filter)
 {
     return(_unitOfWork.EventRepository.All(filter.BuildFilters().ToArray()));
 }
Пример #15
0
 /// <summary>
 /// Returns a list of events.
 /// </summary>
 public virtual async Task <ListResult <Event> > ListAsync(EventListFilter filter = null)
 {
     return(await ListAsync(filter?.AsListFilter()));
 }
Пример #16
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="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 <ListResult <Event> > ListAsync(long subjectId, string subjectType, EventListFilter filter)
 {
     return(await ListAsync(subjectId, subjectType, (ListFilter <Event>) filter));
 }
Пример #17
0
 /// <summary>
 /// Returns a list of events.
 /// </summary>
 public virtual async Task <ListResult <Entities.Event> > ListAsync(EventListFilter filter = null, CancellationToken cancellationToken = default)
 {
     return(await ListAsync(filter?.AsListFilter(), cancellationToken));
 }