Beispiel #1
0
        /// <inheritdoc/>
        protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Owner != null && Name != null && MarkAsReadRequest != null)
            {
                var ownerValue             = Owner.GetValue(dc.State);
                var nameValue              = Name.GetValue(dc.State);
                var markAsReadRequestValue = MarkAsReadRequest.GetValue(dc.State);
                return(gitHubClient.Activity.Notifications.MarkAsReadForRepository(ownerValue, nameValue, markAsReadRequestValue));
            }
            if (Owner != null && Name != null)
            {
                var ownerValue = Owner.GetValue(dc.State);
                var nameValue  = Name.GetValue(dc.State);
                return(gitHubClient.Activity.Notifications.MarkAsReadForRepository(ownerValue, nameValue));
            }
            if (RepositoryId != null && MarkAsReadRequest != null)
            {
                var repositoryIdValue      = RepositoryId.GetValue(dc.State);
                var markAsReadRequestValue = MarkAsReadRequest.GetValue(dc.State);
                return(gitHubClient.Activity.Notifications.MarkAsReadForRepository((Int64)repositoryIdValue, markAsReadRequestValue));
            }
            if (RepositoryId != null)
            {
                var repositoryIdValue = RepositoryId.GetValue(dc.State);
                return(gitHubClient.Activity.Notifications.MarkAsReadForRepository((Int64)repositoryIdValue));
            }

            throw new ArgumentNullException("Required [] arguments missing for GitHubClient.Activity.Notifications.MarkAsReadForRepository");
        }
        /// <summary>
        /// Marks the notifications for a given repository as read.
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="markAsReadRequest">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
        /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository</remarks>
        /// <returns></returns>
        public IObservable <Unit> MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsReadRequest)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");

            return(_notificationsClient.MarkAsReadForRepository(owner, name, markAsReadRequest).ToObservable());
        }
            public void RequestsCorrectUrlParameterizedWithRepositoryId()
            {
                var endpoint   = new Uri("repositories/1/notifications", UriKind.Relative);
                var connection = Substitute.For <IApiConnection>();
                var client     = new NotificationsClient(connection);

                var markAsReadRequest = new MarkAsReadRequest();

                client.MarkAsReadForRepository(1, markAsReadRequest);

                connection.Received().Put <object>(endpoint, markAsReadRequest);
            }
            public void RequestsCorrectUrlParameterized()
            {
                var endpoint     = new Uri("repos/banana/split/notifications", UriKind.Relative);
                var connection   = Substitute.For <IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client       = new ObservableNotificationsClient(gitHubClient);

                var markAsReadRequest = new MarkAsReadRequest();

                client.MarkAsReadForRepository("banana", "split", markAsReadRequest);

                connection.Received().Put <object>(endpoint, markAsReadRequest);
            }
Beispiel #5
0
 /// <inheritdoc/>
 protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken))
 {
     if (MarkAsReadRequest != null)
     {
         var markAsReadRequestValue = MarkAsReadRequest.GetValue(dc.State);
         return(gitHubClient.Activity.Notifications.MarkAsRead(markAsReadRequestValue));
     }
     if (Id != null)
     {
         var idValue = Id.GetValue(dc.State);
         return(gitHubClient.Activity.Notifications.MarkAsRead((Int32)idValue));
     }
     else
     {
         return(gitHubClient.Activity.Notifications.MarkAsRead());
     }
 }
 /// <summary>
 /// Marks all notifications as read.
 /// </summary>
 /// <param name="markAsReadRequest">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
 /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-as-read</remarks>
 /// <returns></returns>
 public IObservable <Unit> MarkAsRead(MarkAsReadRequest markAsReadRequest)
 {
     return(_notificationsClient.MarkAsRead(markAsReadRequest).ToObservable());
 }
 /// <summary>
 /// Marks the notifications for a given repository as read.
 /// </summary>
 /// <param name="owner">The owner of the repository</param>
 /// <param name="name">The name of the repository</param>
 /// <param name="markAsRead">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
 /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository</remarks>
 /// <returns></returns>
 public IObservable <Unit> MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsRead)
 {
     return(_notificationsClient.MarkAsReadForRepository(owner, name, markAsRead).ToObservable());
 }
Beispiel #8
0
 /// <summary>
 /// Marks all notifications as read.
 /// </summary>
 /// <param name="markAsReadRequest">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
 /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-as-read</remarks>
 /// <returns></returns>
 public IObservable<Unit> MarkAsRead(MarkAsReadRequest markAsReadRequest)
 {
     return _notificationsClient.MarkAsRead(markAsReadRequest).ToObservable();
 }
Beispiel #9
0
 /// <summary>
 /// Marks the notifications for a given repository as read.
 /// </summary>
 /// <param name="owner">The owner of the repository</param>
 /// <param name="name">The name of the repository</param>
 /// <param name="markAsRead">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
 /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository</remarks>
 /// <returns></returns>
 public IObservable<Unit> MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsRead)
 {
     return _notificationsClient.MarkAsReadForRepository(owner, name, markAsRead).ToObservable();
 }
        /// <summary>
        /// Marks all notifications as read.
        /// </summary>
        /// <param name="markAsReadRequest">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
        /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-as-read</remarks>
        /// <returns></returns>
        public IObservable <Unit> MarkAsRead(MarkAsReadRequest markAsReadRequest)
        {
            Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");

            return(_notificationsClient.MarkAsRead(markAsReadRequest).ToObservable());
        }
Beispiel #11
0
        /// <summary>
        /// Marks the notifications for a given repository as read.
        /// </summary>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="markAsReadRequest">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
        /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository</remarks>
        public IObservable <Unit> MarkAsReadForRepository(long repositoryId, MarkAsReadRequest markAsReadRequest)
        {
            Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");

            return(_notificationsClient.MarkAsReadForRepository(repositoryId, markAsReadRequest).ToObservable());
        }
            public void RequestsCorrectUrlParameterizedWithRepositoryId()
            {
                var endpoint = new Uri("repositories/1/notifications", UriKind.Relative);
                var connection = Substitute.For<IApiConnection>();
                var client = new NotificationsClient(connection);

                var markAsReadRequest = new MarkAsReadRequest();

                client.MarkAsReadForRepository(1, markAsReadRequest);

                connection.Received().Put<object>(endpoint, markAsReadRequest);
            }
        /// <summary>
        /// Marks the notifications for a given repository as read.
        /// </summary>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="markAsReadRequest">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
        /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository</remarks>
        public IObservable<Unit> MarkAsReadForRepository(int repositoryId, MarkAsReadRequest markAsReadRequest)
        {
            Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");

            return _notificationsClient.MarkAsReadForRepository(repositoryId, markAsReadRequest).ToObservable();
        }
        /// <summary>
        /// Marks the notifications for a given repository as read.
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="markAsReadRequest">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
        /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository</remarks>
        public IObservable<Unit> MarkAsReadForRepository(string owner, string name, MarkAsReadRequest markAsReadRequest)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");

            return _notificationsClient.MarkAsReadForRepository(owner, name, markAsReadRequest).ToObservable();
        }
        /// <summary>
        /// Marks all notifications as read.
        /// </summary>
        /// <param name="markAsReadRequest">The <see cref="MarkAsReadRequest"/> parameter which specifies which notifications to mark.</param>
        /// <remarks>http://developer.github.com/v3/activity/notifications/#mark-as-read</remarks>
        public IObservable<Unit> MarkAsRead(MarkAsReadRequest markAsReadRequest)
        {
            Ensure.ArgumentNotNull(markAsReadRequest, "markAsReadRequest");

            return _notificationsClient.MarkAsRead(markAsReadRequest).ToObservable();
        }
            public void RequestsCorrectUrlParameterized()
            {
                var endpoint = new Uri("repos/banana/split/notifications", UriKind.Relative);
                var connection = Substitute.For<IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client = new ObservableNotificationsClient(gitHubClient);

                var markAsReadRequest = new MarkAsReadRequest();

                client.MarkAsReadForRepository("banana", "split", markAsReadRequest);

                connection.Received().Put<object>(endpoint, markAsReadRequest);
            }