mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-02 02:45:32 +00:00
RepositoryContext class and Extension methods
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit.Tests.Integration.Helpers
|
||||
{
|
||||
internal static class GithubClientExtensions
|
||||
{
|
||||
internal async static Task<RepositoryContext> CreateRepositoryContext(this IGitHubClient client, string repositoryName)
|
||||
{
|
||||
var repoName = Helper.MakeNameWithTimestamp(repositoryName);
|
||||
var repo = await client.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||
|
||||
return new RepositoryContext(repo);
|
||||
}
|
||||
|
||||
internal async static Task<RepositoryContext> CreateRepositoryContext(this IGitHubClient client, string organizationLogin, NewRepository newRepository)
|
||||
{
|
||||
var repo = await client.Repository.Create(organizationLogin, newRepository);
|
||||
|
||||
return new RepositoryContext(repo);
|
||||
}
|
||||
|
||||
internal async static Task<RepositoryContext> CreateRepositoryContext(this IGitHubClient client, NewRepository newRepository)
|
||||
{
|
||||
var repo = await client.Repository.Create(newRepository);
|
||||
|
||||
return new RepositoryContext(repo);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user