public async Task <Milestone> UpdateMilestone(long repoId, int number, MilestoneUpdate milestoneUpdate, GitHubClient authorizedGitHubClient)
 {
     if (_issuesClient == null)
     {
         _issuesClient = new IssuesClient(new ApiConnection(authorizedGitHubClient.Connection));
     }
     return(await _issuesClient.Milestone.Update(repoId, number, milestoneUpdate));
 }
        /// <summary>
        /// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
        /// Milestone.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="number">The Milestone number</param>
        /// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
        /// </param>
        /// <returns></returns>
        public IObservable <Milestone> Update(string owner, string name, int number, MilestoneUpdate milestoneUpdate)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(milestoneUpdate, "milestoneUpdate");

            return(_client.Update(owner, name, number, milestoneUpdate).ToObservable());
        }
            public void UpdatesClientIssueMilestoneWithRepositoryId()
            {
                var milestoneUpdate = new MilestoneUpdate();
                var gitHubClient    = Substitute.For <IGitHubClient>();
                var client          = new ObservableMilestonesClient(gitHubClient);

                client.Update(1, 42, milestoneUpdate);

                gitHubClient.Issue.Milestone.Received().Update(1, 42, milestoneUpdate);
            }
        private static async Task RenameMilestone(this IGitHubClient gitHubClient, Milestone existingMilestone, string version)
        {
            var milestoneUpdate = new MilestoneUpdate {
                Title = version
            };

            Console.WriteLine($"Renaming milestone '{existingMilestone.Title}' to '{milestoneUpdate.Title}'...");
            var updatedMilestone = await gitHubClient.Issue.Milestone.Update(RepoOwner, repoName, existingMilestone.Number, milestoneUpdate);

            Console.WriteLine($"Renamed milestone '{existingMilestone.Title}' to '{updatedMilestone.Title}'");
        }
Exemple #5
0
            public void PostsToCorrectUrl()
            {
                var milestoneUpdate = new MilestoneUpdate();
                var connection      = Substitute.For <IApiConnection>();
                var client          = new MilestonesClient(connection);

                client.Update("fake", "repo", 42, milestoneUpdate);

                connection.Received().Patch <Milestone>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/milestones/42"),
                                                        milestoneUpdate);
            }
Exemple #6
0
        /// <inheritdoc/>
        protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Owner != null && Name != null && Number != null && MilestoneUpdate != null)
            {
                var ownerValue           = Owner.GetValue(dc.State);
                var nameValue            = Name.GetValue(dc.State);
                var numberValue          = Number.GetValue(dc.State);
                var milestoneUpdateValue = MilestoneUpdate.GetValue(dc.State);
                return(await gitHubClient.Issue.Milestone.Update(ownerValue, nameValue, (Int32)numberValue, milestoneUpdateValue).ConfigureAwait(false));
            }
            if (RepositoryId != null && Number != null && MilestoneUpdate != null)
            {
                var repositoryIdValue    = RepositoryId.GetValue(dc.State);
                var numberValue          = Number.GetValue(dc.State);
                var milestoneUpdateValue = MilestoneUpdate.GetValue(dc.State);
                return(await gitHubClient.Issue.Milestone.Update((Int64)repositoryIdValue, (Int32)numberValue, milestoneUpdateValue).ConfigureAwait(false));
            }

            throw new ArgumentNullException("Required [number,milestoneUpdate] arguments missing for GitHubClient.Issue.Milestone.Update");
        }
        /// <summary>
        /// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
        /// Milestone.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="number">The Milestone number</param>
        /// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
        /// </param>
        /// <returns></returns>
        public IObservable <Milestone> Update(int repositoryId, int number, MilestoneUpdate milestoneUpdate)
        {
            Ensure.ArgumentNotNull(milestoneUpdate, "milestoneUpdate");

            return(_client.Update(repositoryId, number, milestoneUpdate).ToObservable());
        }
            public void UpdatesClientIssueMilestoneWithRepositoryId()
            {
                var milestoneUpdate = new MilestoneUpdate();
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableMilestonesClient(gitHubClient);

                client.Update(1, 42, milestoneUpdate);

                gitHubClient.Issue.Milestone.Received().Update(1, 42, milestoneUpdate);
            }
        /// <summary>
        /// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
        /// Milestone.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="number">The Milestone number</param>
        /// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
        /// </param>
        /// <returns></returns>
        public IObservable<Milestone> Update(string owner, string name, int number, MilestoneUpdate milestoneUpdate)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(milestoneUpdate, "milestoneUpdate");

            return _client.Update(owner, name, number, milestoneUpdate).ToObservable();
        }
 public Edit(ProgressContext context)
 {
     _context = context;
     _useCase = new MilestoneUpdate(context);
 }
        /// <summary>
        /// Updates a milestone for the specified repository. Any user with pull access to a repository can create a
        /// Milestone.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/issues/milestones/#update-a-milestone</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="number">The Milestone number</param>
        /// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone
        /// </param>
        /// <returns></returns>
        public IObservable<Milestone> Update(long repositoryId, int number, MilestoneUpdate milestoneUpdate)
        {
            Ensure.ArgumentNotNull(milestoneUpdate, "milestoneUpdate");

            return _client.Update(repositoryId, number, milestoneUpdate).ToObservable();
        }
            public void PostsToCorrectUrl()
            {
                var milestoneUpdate = new MilestoneUpdate();
                var connection = Substitute.For<IApiConnection>();
                var client = new MilestonesClient(connection);

                client.Update("fake", "repo", 42, milestoneUpdate);

                connection.Received().Patch<Milestone>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/milestones/42"),
                    milestoneUpdate);
            }
Exemple #13
0
 public async Task <Milestone> UpdateMilestone(long repoId, int number, MilestoneUpdate milestoneUpdate, GitHubClient authorizedGitHubClient)
 {
     return(await _issueRepository.UpdateMilestone(repoId, number, milestoneUpdate, authorizedGitHubClient));
 }