private static async Task <ProjectCard> CreateIssueCardHelper(IObservableGitHubClient githubClient, int issueId, int columnId) { var newCard = new NewProjectCard(issueId, ProjectCardContentType.Issue); var result = await githubClient.Repository.Project.Card.Create(columnId, newCard); return(result); }
private static async Task <ProjectCard> CreatePullRequestCardHelper(IGitHubClient githubClient, long pullRequestId, int columnId) { var newCard = new NewProjectCard(pullRequestId, ProjectCardContentType.PullRequest); var result = await githubClient.Repository.Project.Card.Create(columnId, newCard); return(result); }
private static async Task <ProjectCard> CreateCardHelper(IObservableGitHubClient githubClient, int columnId) { var newCard = new NewProjectCard(Helper.MakeNameWithTimestamp("new-card")); var result = await githubClient.Repository.Project.Card.Create(columnId, newCard); return(result); }
public async Task EnsuresNonNullArguments() { var client = new ProjectCardsClient(Substitute.For <IApiConnection>()); var newCard = new NewProjectCard("someNote"); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(1, null)); }
private static async Task <ProjectCard> CreateArchivedCardHelper(IGitHubClient githubClient, int columnId) { var newCard = new NewProjectCard(Helper.MakeNameWithTimestamp("new-card")); var card = await githubClient.Repository.Project.Card.Create(columnId, newCard); var result = await githubClient.Repository.Project.Card.Update(card.Id, new ProjectCardUpdate { Archived = true }); return(result); }
public void PostsToCorrectURL() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableProjectCardsClient(gitHubClient); var newCard = new NewProjectCard("someNote"); client.Create(1, newCard); gitHubClient.Repository.Project.Card.Received().Create(1, newCard); }
/// <summary> /// projectへ追加 /// </summary> /// <param name="context"></param> /// <param name="project"></param> /// <returns></returns> public async Task IssueEntry(IDialogContext context, Project project) { //対象プロジェクトのIDからカラムのリストを取得する var columnList = await GitHubDialog.github.Repository.Project.Column.GetAll(project.Id); //対象issueのIDからプロジェクトのカードを生成する NewProjectCard card = new NewProjectCard(targetIssueId, ProjectCardContentType.Issue); //カラムの1番目に生成したプロジェクトカードを挿入する var newCard = await GitHubDialog.github.Repository.Project.Card.Create(columnList[0].Id, card); }
public async Task PostsToCorrectURL() { var connection = Substitute.For <IApiConnection>(); var client = new ProjectCardsClient(connection); var newCard = new NewProjectCard("someNote"); await client.Create(1, newCard); connection.Received().Post <ProjectCard>( Arg.Is <Uri>(u => u.ToString() == "projects/columns/1/cards"), newCard, "application/vnd.github.inertia-preview+json"); }
public async Task AddIssueToProjectAsync(int projectId, string columnName, int issueId) { var allProjectColumns = await _githubClient.Repository.Project.Column.GetAll(projectId); var foundProjectColumn = allProjectColumns.FirstOrDefault(column => column.Name.Equals(columnName, StringComparison.InvariantCultureIgnoreCase)); if (foundProjectColumn == null) { var newProjectColumn = new NewProjectColumn(columnName); foundProjectColumn = await _githubClient.Repository.Project.Column.Create(projectId, newProjectColumn); } var projectCard = new NewProjectCard(issueId, ProjectCardContentType.Issue); await _githubClient.Repository.Project.Card.Create(foundProjectColumn.Id, projectCard); }
/// <summary> /// Creates a card. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/projects/#create-a-project-card">API documentation</a> for more information. /// </remarks> /// <param name="columnId">The id of the column</param> /// <param name="newProjectCard">The card to create</param> public IObservable <ProjectCard> Create(int columnId, NewProjectCard newProjectCard) { Ensure.ArgumentNotNull(newProjectCard, "newProjectCard"); return(_client.Create(columnId, newProjectCard).ToObservable()); }