Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some cleanup of the project #2063

Merged
merged 2 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public interface IObservableOrganizationMembersClient
/// <param name="user">The login for the user</param>
/// <returns></returns>
IObservable<Unit> Conceal(string org, string user);

/// <summary>
/// Get a user's membership with an organization.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public interface IObservableRepoCollaboratorsClient
/// <param name="options">Options for changing the API response</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(long repositoryId, ApiOptions options);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
Expand All @@ -77,7 +77,7 @@ public interface IObservableRepoCollaboratorsClient
/// <param name="request">Used to request and filter a list of repository collaborators</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(long repositoryId, RepositoryCollaboratorListRequest request);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
Expand All @@ -90,7 +90,7 @@ public interface IObservableRepoCollaboratorsClient
/// <param name="options">Options for changing the API response</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
IObservable<User> GetAll(string owner, string name, RepositoryCollaboratorListRequest request, ApiOptions options);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions Octokit.Reactive/Clients/ObservableRepoCollaboratorsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public IObservable<User> GetAll(string owner, string name, ApiOptions options)
public IObservable<User> GetAll(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));

return GetAll(repositoryId, new RepositoryCollaboratorListRequest(), options);
}

Expand All @@ -108,7 +108,7 @@ public IObservable<User> GetAll(string owner, string name, RepositoryCollaborato
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(request, nameof(request));

return GetAll(owner, name, request, ApiOptions.None);
}

Expand All @@ -124,7 +124,7 @@ public IObservable<User> GetAll(string owner, string name, RepositoryCollaborato
public IObservable<User> GetAll(long repositoryId, RepositoryCollaboratorListRequest request)
{
Ensure.ArgumentNotNull(request, nameof(request));

return GetAll(repositoryId, request, ApiOptions.None);
}

Expand Down
5 changes: 5 additions & 0 deletions Octokit.Reactive/Octokit.Reactive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<RepositoryUrl>https://github.com/octokit/octokit.net</RepositoryUrl>
<PackageProjectUrl>https://github.com/octokit/octokit.net</PackageProjectUrl>
<PackageIconUrl>https://f.cloud.github.com/assets/19977/1510987/64af2b26-4a9d-11e3-89fc-96a185171c75.png</PackageIconUrl>
<PackageIcon>octokit.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>GitHub API Octokit linqpad-samples dotnetcore</PackageTags>
<Copyright>Copyright GitHub 2017</Copyright>
Expand All @@ -41,6 +42,10 @@
<ProjectReference Include="..\Octokit\Octokit.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="images\octokit.png" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Reactive" Version="3.1.0" />
<PackageReference Include="SourceLink.Create.GitHub" Version="2.8.3" PrivateAssets="all" />
Expand Down
Binary file added Octokit.Reactive/images/octokit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ public async Task ReturnsUsersMembershipOrganizationMembership()
using (var teamContext = await _gitHub.CreateTeamContext(Helper.Organization, new NewTeam(Helper.MakeNameWithTimestamp("team"))))
{
teamContext.InviteMember("alfhenrik-test-2");

var organizationMemberhip = await _gitHub.Organization.Member.GetOrganizationMembership(Helper.Organization, "alfhenrik-test-2");
Assert.Equal(MembershipState.Pending, organizationMemberhip.State);
Assert.Equal(MembershipRole.Member, organizationMemberhip.Role);
}
}
}

public class TheAddOrUpdateOrganizationMembershipMethod
{
readonly IGitHubClient _gitHub;
Expand All @@ -165,7 +165,7 @@ public async Task ReturnsUsersPendingMemberOrganizationMembership()
[OrganizationTest]
public async Task ReturnsUsersPendingAdminOrganizationMembership()
{
var organizationMembership = await _gitHub.Organization.Member.AddOrUpdateOrganizationMembership(Helper.Organization, "alfhenrik-test-2", new OrganizationMembershipUpdate { Role = MembershipRole.Admin});
var organizationMembership = await _gitHub.Organization.Member.AddOrUpdateOrganizationMembership(Helper.Organization, "alfhenrik-test-2", new OrganizationMembershipUpdate { Role = MembershipRole.Admin });
Assert.Equal(MembershipState.Pending, organizationMembership.State);
Assert.Equal(MembershipRole.Admin, organizationMembership.Role);
await _gitHub.Organization.Member.RemoveOrganizationMembership(Helper.Organization, "alfhenrik-test-2");
Expand All @@ -175,12 +175,12 @@ public async Task ReturnsUsersPendingAdminOrganizationMembership()
public class TheRemoveOrganizationMembershipMethod
{
readonly IGitHubClient _gitHub;

public TheRemoveOrganizationMembershipMethod()
{
_gitHub = Helper.GetAuthenticatedClient();
}

[OrganizationTest]
public async Task RemovesOrganizationMembership()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public async Task ReturnsUsersMembershipOrganizationMembership()
using (var teamContext = await _gitHub.CreateTeamContext(Helper.Organization, new NewTeam(Helper.MakeNameWithTimestamp("team"))))
{
teamContext.InviteMember("alfhenrik-test-2");

var organizationMemberhip = await _client.GetOrganizationMembership(Helper.Organization, "alfhenrik-test-2");
Assert.Equal(MembershipState.Pending, organizationMemberhip.State);
Assert.Equal(MembershipRole.Member, organizationMemberhip.Role);
await _client.RemoveOrganizationMembership(Helper.Organization, "alfhenrik-test-2");
}
}
}

public class TheAddOrUpdateOrganizationMembershipMethod
{
readonly ObservableOrganizationMembersClient _client;
Expand All @@ -56,7 +56,7 @@ public async Task ReturnsUsersPendingMemberOrganizationMembership()
[OrganizationTest]
public async Task ReturnsUsersPendingAdminOrganizationMembership()
{
var organizationMembership = await _client.AddOrUpdateOrganizationMembership(Helper.Organization, "alfhenrik-test-2", new OrganizationMembershipUpdate { Role = MembershipRole.Admin});
var organizationMembership = await _client.AddOrUpdateOrganizationMembership(Helper.Organization, "alfhenrik-test-2", new OrganizationMembershipUpdate { Role = MembershipRole.Admin });
Assert.Equal(MembershipState.Pending, organizationMembership.State);
Assert.Equal(MembershipRole.Admin, organizationMembership.Role);
await _client.RemoveOrganizationMembership(Helper.Organization, "alfhenrik-test-2");
Expand All @@ -66,12 +66,12 @@ public async Task ReturnsUsersPendingAdminOrganizationMembership()
public class TheRemoveOrganizationMembershipMethod
{
readonly ObservableOrganizationMembersClient _client;

public TheRemoveOrganizationMembershipMethod()
{
_client = new ObservableOrganizationMembersClient(Helper.GetAuthenticatedClient());
}

[OrganizationTest]
public async Task RemovesOrganizationMembership()
{
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Clients/OrganizationMembersClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,10 @@ public class TheAddOrUpdateOrganizationMembershipMethod
public void PostsToTheCorrectUrl()
{
var orgMembershipUpdate = new OrganizationMembershipUpdate();

var connection = Substitute.For<IApiConnection>();
var client = new OrganizationMembersClient(connection);

client.AddOrUpdateOrganizationMembership("org", "username", orgMembershipUpdate);

connection.Received().Put<OrganizationMembership>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/memberships/username"), Arg.Any<object>());
Expand Down
8 changes: 4 additions & 4 deletions Octokit.Tests/Clients/RepoCollaboratorsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void RequestsCorrectUrlWithCollaboratorFilter()
Arg.Is<Dictionary<string, string>>(d => d["affiliation"] == "all"),
"application/vnd.github.hellcat-preview+json",
Args.ApiOptions);

request = new RepositoryCollaboratorListRequest
{
Affiliation = CollaboratorAffiliation.Direct
Expand All @@ -105,7 +105,7 @@ public void RequestsCorrectUrlWithCollaboratorFilter()
Arg.Is<Dictionary<string, string>>(d => d["affiliation"] == "direct"),
"application/vnd.github.hellcat-preview+json",
Args.ApiOptions);

request = new RepositoryCollaboratorListRequest
{
Affiliation = CollaboratorAffiliation.Outside
Expand Down Expand Up @@ -150,7 +150,7 @@ public void RequestsCorrectUrlWithCollaboratorFilterAndRepositoryId()
var client = new RepoCollaboratorsClient(connection);

var request = new RepositoryCollaboratorListRequest();

client.GetAll(1, request);

connection.Received()
Expand All @@ -173,7 +173,7 @@ public void RequestsCorrectUrlWithCollaboratorFilterAndRepositoryId()
Arg.Is<Dictionary<string, string>>(d => d["affiliation"] == "direct"),
"application/vnd.github.hellcat-preview+json",
Args.ApiOptions);

request = new RepositoryCollaboratorListRequest
{
Affiliation = CollaboratorAffiliation.Outside
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public class TheAddOrUpdateOrganizationMembershipMethod
public void PostsToTheCorrectUrl()
{
var orgMembershipUpdate = new OrganizationMembershipUpdate();

var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableOrganizationMembersClient(gitHubClient);

Expand Down
2 changes: 1 addition & 1 deletion Octokit/Clients/IOrganizationMembersClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public interface IOrganizationMembersClient
/// <param name="user">The login for the user</param>
/// <returns></returns>
Task Conceal(string org, string user);

/// <summary>
/// Get a user's membership with an organization.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions Octokit/Clients/IRepoCollaboratorsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public interface IRepoCollaboratorsClient
/// <param name="options">Options for changing the API response</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
Task<IReadOnlyList<User>> GetAll(long repositoryId, ApiOptions options);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
Expand All @@ -77,7 +77,7 @@ public interface IRepoCollaboratorsClient
/// <param name="request">Used to request and filter a list of repository collaborators</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
Task<IReadOnlyList<User>> GetAll(long repositoryId, RepositoryCollaboratorListRequest request);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
Expand All @@ -90,7 +90,7 @@ public interface IRepoCollaboratorsClient
/// <param name="options">Options for changing the API response</param>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
Task<IReadOnlyList<User>> GetAll(string owner, string name, RepositoryCollaboratorListRequest request, ApiOptions options);

/// <summary>
/// Gets all the collaborators on a repository.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Clients/OrganizationMembersClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public enum OrganizationMembersRole
[Parameter(Value = "member")]
Member
}

public enum MembershipRole
{
[Parameter(Value = "admin")]
Expand Down
6 changes: 3 additions & 3 deletions Octokit/Clients/RepoCollaboratorsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Task<IReadOnlyList<User>> GetAll(string owner, string name, ApiOptions op
public Task<IReadOnlyList<User>> GetAll(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));

return GetAll(repositoryId, new RepositoryCollaboratorListRequest(), options);
}

Expand All @@ -100,7 +100,7 @@ public Task<IReadOnlyList<User>> GetAll(string owner, string name, RepositoryCol
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(request, nameof(request));

return GetAll(owner, name, request, ApiOptions.None);
}

Expand All @@ -116,7 +116,7 @@ public Task<IReadOnlyList<User>> GetAll(string owner, string name, RepositoryCol
public Task<IReadOnlyList<User>> GetAll(long repositoryId, RepositoryCollaboratorListRequest request)
{
Ensure.ArgumentNotNull(request, nameof(request));

return GetAll(repositoryId, request, ApiOptions.None);
}

Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Request/OrganizationMembershipUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public OrganizationMembershipUpdate()
{
Role = MembershipRole.Member;
}

/// <summary>
/// The role to give the user in the organization. The default is <see cref="MembershipRole.Member"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public RepositoryCollaboratorListRequest()
{
Affiliation = CollaboratorAffiliation.All; // Default in accordance with the documentation
}

/// <summary>
/// Gets or sets the collaborator affiliation property.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Octokit/Models/Response/EventInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public enum EventInfoState
/// </summary>
[Parameter(Value = "head_ref_restored")]
HeadRefRestored,

/// <summary>
/// The pull request’s branch was force pushed to.
/// </summary>
Expand Down Expand Up @@ -303,7 +303,7 @@ public enum EventInfoState
/// </summary>
[Parameter(Value = "comment_deleted")]
CommentDeleted,

/// <summary>
/// An issue was transferred.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Octokit/Models/Response/OrganizationMembership.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class OrganizationMembership
{
public OrganizationMembership()
{

}

public OrganizationMembership(string url, StringEnum<MembershipState> state, StringEnum<MembershipRole> role, string organizationUrl, Organization organization, User user)
Expand All @@ -19,7 +19,7 @@ public OrganizationMembership(string url, StringEnum<MembershipState> state, Str
Organization = organization;
User = user;
}

public string Url { get; protected set; }
public StringEnum<MembershipState> State { get; protected set; }
public StringEnum<MembershipRole> Role { get; protected set; }
Expand Down
5 changes: 5 additions & 0 deletions Octokit/Octokit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<RepositoryUrl>https://github.com/octokit/octokit.net</RepositoryUrl>
<PackageProjectUrl>https://github.com/octokit/octokit.net</PackageProjectUrl>
<PackageIconUrl>https://f.cloud.github.com/assets/19977/1510987/64af2b26-4a9d-11e3-89fc-96a185171c75.png</PackageIconUrl>
<PackageIcon>octokit.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>GitHub API Octokit linqpad-samples dotnetcore</PackageTags>
<Copyright>Copyright GitHub 2017</Copyright>
Expand Down Expand Up @@ -47,6 +48,10 @@
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<None Include="images\octokit.png" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="SourceLink.Create.GitHub" Version="2.8.3" PrivateAssets="all" />
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.8.2" />
Expand Down
Binary file added Octokit/images/octokit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.