Skip to content

Commit

Permalink
Merge branch 'master' into feature/#1663_AddPaginationHandlingToMisce…
Browse files Browse the repository at this point in the history
…llaneousClients
  • Loading branch information
gdziadkiewicz committed Dec 9, 2017
2 parents 4da7873 + 01d16b7 commit 8e51c89
Show file tree
Hide file tree
Showing 19 changed files with 899 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ matrix:
- os: linux
dist: trusty
sudo: required
dotnet: 1.0.1
dotnet: 1.0.4
- os: osx
osx_image: xcode8
dotnet: 1.0.1
dotnet: 1.0.4

before_script:
- if test "$TRAVIS_OS_NAME" == "osx"; then export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/; else export FrameworkPathOverride=/usr/lib/mono/4.5/; fi
Expand Down
48 changes: 48 additions & 0 deletions Octokit.Reactive/Clients/IObservableReferencesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ public interface IObservableReferencesClient
/// <returns></returns>
IObservable<Reference> GetAll(string owner, string name);

/// <summary>
/// Gets all references for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Reference> GetAll(string owner, string name, ApiOptions options);

/// <summary>
/// Gets all references for a given repository
/// </summary>
Expand All @@ -60,6 +72,17 @@ public interface IObservableReferencesClient
/// <returns></returns>
IObservable<Reference> GetAll(long repositoryId);

/// <summary>
/// Gets all references for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Reference> GetAll(long repositoryId, ApiOptions options);

/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
Expand All @@ -72,6 +95,19 @@ public interface IObservableReferencesClient
/// <returns></returns>
IObservable<Reference> GetAllForSubNamespace(string owner, string name, string subNamespace);

/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Reference> GetAllForSubNamespace(string owner, string name, string subNamespace, ApiOptions options);

/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
Expand All @@ -83,6 +119,18 @@ public interface IObservableReferencesClient
/// <returns></returns>
IObservable<Reference> GetAllForSubNamespace(long repositoryId, string subNamespace);

/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
IObservable<Reference> GetAllForSubNamespace(long repositoryId, string subNamespace, ApiOptions options);

/// <summary>
/// Creates a reference for a given repository
/// </summary>
Expand Down
20 changes: 20 additions & 0 deletions Octokit.Reactive/Clients/IObservableRepositoryInvitationsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ public interface IObservableRepositoryInvitationsClient
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<RepositoryInvitation> GetAllForCurrent();

/// <summary>
/// Gets all invitations for the current user.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/invitations/#list-a-users-repository-invitations">API documentation</a> for more information.
/// </remarks>
/// <param name="options">Options for changing the API response</param>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<RepositoryInvitation> GetAllForCurrent(ApiOptions options);

/// <summary>
/// Gets all the invitations on a repository.
/// </summary>
Expand All @@ -52,6 +62,16 @@ public interface IObservableRepositoryInvitationsClient
/// <param name="repositoryId">The id of the repository</param>
IObservable<RepositoryInvitation> GetAllForRepository(long repositoryId);

/// <summary>
/// Gets all the invitations on a repository.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/invitations/#list-invitations-for-a-repository">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// /// <param name="options">Options for changing the API response</param>
IObservable<RepositoryInvitation> GetAllForRepository(long repositoryId, ApiOptions options);

/// <summary>
/// Updates a repository invitation.
/// </summary>
Expand Down
73 changes: 69 additions & 4 deletions Octokit.Reactive/Clients/ObservableReferencesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,27 @@ public IObservable<Reference> Get(long repositoryId, string reference)
/// <param name="name">The name of the repository</param>
/// <returns></returns>
public IObservable<Reference> GetAll(string owner, string name)
{
return GetAll(owner, name, ApiOptions.None);
}

/// <summary>
/// Gets all references for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Reference> GetAll(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(owner, name));
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(owner, name), options);
}

/// <summary>
Expand All @@ -86,7 +102,23 @@ public IObservable<Reference> GetAll(string owner, string name)
/// <returns></returns>
public IObservable<Reference> GetAll(long repositoryId)
{
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(repositoryId));
return GetAll(repositoryId, ApiOptions.None);
}

/// <summary>
/// Gets all references for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Reference> GetAll(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(repositoryId), options);
}

/// <summary>
Expand All @@ -100,12 +132,29 @@ public IObservable<Reference> GetAll(long repositoryId)
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <returns></returns>
public IObservable<Reference> GetAllForSubNamespace(string owner, string name, string subNamespace)
{
return GetAllForSubNamespace(owner, name, subNamespace, ApiOptions.None);
}

/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Reference> GetAllForSubNamespace(string owner, string name, string subNamespace, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(subNamespace, "subNamespace");
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(owner, name, subNamespace));
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(owner, name, subNamespace), options);
}

/// <summary>
Expand All @@ -118,10 +167,26 @@ public IObservable<Reference> GetAllForSubNamespace(string owner, string name, s
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <returns></returns>
public IObservable<Reference> GetAllForSubNamespace(long repositoryId, string subNamespace)
{
return GetAllForSubNamespace(repositoryId, subNamespace, ApiOptions.None);
}

/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <param name="options">Options for changing the API response</param>
/// <returns></returns>
public IObservable<Reference> GetAllForSubNamespace(long repositoryId, string subNamespace, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(subNamespace, "subNamespace");
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(repositoryId, subNamespace));
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(repositoryId, subNamespace), options);
}

/// <summary>
Expand Down
31 changes: 29 additions & 2 deletions Octokit.Reactive/Clients/ObservableRepositoryInvitationsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,20 @@ public IObservable<RepositoryInvitation> Edit(long repositoryId, int invitationI
/// </remarks>
public IObservable<RepositoryInvitation> GetAllForCurrent()
{
return _connection.GetAndFlattenAllPages<RepositoryInvitation>(ApiUrls.UserInvitations(), null, AcceptHeaders.InvitationsApiPreview, ApiOptions.None);
return GetAllForCurrent(ApiOptions.None);
}

/// <summary>
/// Gets all invitations for the current user.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/invitations/#list-a-users-repository-invitations">API documentation</a> for more information.
/// </remarks>
/// <param name="options">Options for changing the API response</param>
public IObservable<RepositoryInvitation> GetAllForCurrent(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<RepositoryInvitation>(ApiUrls.UserInvitations(), null, AcceptHeaders.InvitationsApiPreview, options);
}

/// <summary>
Expand All @@ -92,7 +105,21 @@ public IObservable<RepositoryInvitation> GetAllForCurrent()
/// <param name="repositoryId">The id of the repository</param>
public IObservable<RepositoryInvitation> GetAllForRepository(long repositoryId)
{
return _connection.GetAndFlattenAllPages<RepositoryInvitation>(ApiUrls.RepositoryInvitations(repositoryId), null, AcceptHeaders.InvitationsApiPreview, ApiOptions.None);
return GetAllForRepository(repositoryId, ApiOptions.None);
}

/// <summary>
/// Gets all the invitations on a repository.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/invitations/#list-invitations-for-a-repository">API documentation</a> for more information.
/// </remarks>
/// <param name="repositoryId">The id of the repository</param>
/// <param name="options">Options for changing the API response</param>
public IObservable<RepositoryInvitation> GetAllForRepository(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages<RepositoryInvitation>(ApiUrls.RepositoryInvitations(repositoryId), null, AcceptHeaders.InvitationsApiPreview, options);
}
}
}
1 change: 1 addition & 0 deletions Octokit.Reactive/Octokit.Reactive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Version>0.0.0-dev</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFrameworks>netstandard1.1;net45</TargetFrameworks>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<AssemblyName>Octokit.Reactive</AssemblyName>
<PackageId>Octokit.Reactive</PackageId>
<DebugType>embedded</DebugType>
Expand Down
Loading

0 comments on commit 8e51c89

Please sign in to comment.