コード例 #1
0
        /// <inheritdoc/>
        protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Owner != null && Name != null && Number != null && MergePullRequest != null)
            {
                var ownerValue            = Owner.GetValue(dc.State);
                var nameValue             = Name.GetValue(dc.State);
                var numberValue           = Number.GetValue(dc.State);
                var mergePullRequestValue = MergePullRequest.GetValue(dc.State);
                return(await gitHubClient.Repository.PullRequest.Merge(ownerValue, nameValue, (Int32)numberValue, mergePullRequestValue).ConfigureAwait(false));
            }
            if (RepositoryId != null && Number != null && MergePullRequest != null)
            {
                var repositoryIdValue     = RepositoryId.GetValue(dc.State);
                var numberValue           = Number.GetValue(dc.State);
                var mergePullRequestValue = MergePullRequest.GetValue(dc.State);
                return(await gitHubClient.Repository.PullRequest.Merge((Int64)repositoryIdValue, (Int32)numberValue, mergePullRequestValue).ConfigureAwait(false));
            }

            throw new ArgumentNullException("Required [number,mergePullRequest] arguments missing for GitHubClient.Repository.PullRequest.Merge");
        }