Example #1
0
        /// <summary>
        /// Filters a <see cref="ReadOnlyNotificationCollection"/> for a given <see cref="NotificationType"/>s.
        /// </summary>
        /// <param name="notifications">The <see cref="ReadOnlyNotificationCollection"/></param>
        /// <param name="filters">The new <see cref="NotificationType"/>s by which to filter.</param>
        /// <returns>The filtered collection.</returns>
        /// <remarks>The new filter parameters will function as OR parameters.</remarks>
        public static ReadOnlyNotificationCollection Filter(this ReadOnlyNotificationCollection notifications, IEnumerable <NotificationType> filters)
        {
            var collection = new ReadOnlyNotificationCollection(notifications, notifications.Auth);

            collection.AddFilter(filters);
            return(collection);
        }
Example #2
0
        /// <summary>
        /// Filters a <see cref="ReadOnlyNotificationCollection"/> for a given <see cref="NotificationType"/>.
        /// </summary>
        /// <param name="notifications">The <see cref="ReadOnlyNotificationCollection"/></param>
        /// <param name="filter">The new <see cref="NotificationType"/> by which to filter.  Can be combined using the bitwise OR operator.</param>
        /// <returns>The filtered collection.</returns>
        /// <remarks>The new filter parameter will function as an OR parameter.</remarks>
        public static ReadOnlyNotificationCollection Filter(this ReadOnlyNotificationCollection notifications, NotificationType filter)
        {
            var collection = new ReadOnlyNotificationCollection(notifications, notifications.Auth);

            collection.AddFilter(new[] { filter });
            return(collection);
        }
 internal ReadOnlyNotificationCollection(ReadOnlyNotificationCollection source, TrelloAuthorization auth)
     : this(() => source.OwnerId, auth)
 {
     if (source._additionalParameters != null)
     {
         _additionalParameters = new Dictionary <string, object>(source._additionalParameters);
     }
 }
Example #4
0
        internal Me()
            : base(GetId(), true, TrelloAuthorization.Default)
        {
            _email        = new Field <string>(_context, nameof(Email));
            Notifications = new ReadOnlyNotificationCollection(() => Id, TrelloAuthorization.Default);
            Preferences   = new MemberPreferences(_context.MemberPreferencesContext);

            _context.Merge(_myJson);
        }
Example #5
0
        /// <summary>
        /// Limits a <see cref="ReadOnlyNotificationCollection"/> to a specified count of items.
        /// </summary>
        /// <param name="notifications">The <see cref="ReadOnlyNotificationCollection"/></param>
        /// <param name="limit">The limit.</param>
        /// <returns>The limited collection.</returns>
        public static ReadOnlyNotificationCollection Limit(this ReadOnlyNotificationCollection notifications, int limit)
        {
            if (limit <= 0)
            {
                throw new ArgumentException("limit");
            }

            return(new ReadOnlyNotificationCollection(notifications, notifications.Auth)
            {
                Limit = limit
            });
        }