mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 14:15:12 +00:00
Merge branch 'master' into repositoriesclient
Conflicts: Octokit.Reactive/Clients/IObservableRepositoriesClient.cs Octokit.Reactive/Clients/ObservableRepositoriesClient.cs Octokit/Helpers/ApiUrls.cs Octokit/Octokit-Mono.csproj Octokit/Octokit-MonoAndroid.csproj Octokit/Octokit-Monotouch.csproj Octokit/Octokit-netcore45.csproj
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
public interface IObservableActivitiesClient
|
public interface IObservableActivitiesClient
|
||||||
{
|
{
|
||||||
IObservableEventsClient Events { get; }
|
IObservableEventsClient Events { get; }
|
||||||
IObservableWatchedClient Watched { get; }
|
IObservableWatchedClient Watching { get; }
|
||||||
IObservableStarredClient Starred { get; }
|
IObservableStarredClient Starring { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Octokit.Reactive
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public interface IObservableBlobClient
|
public interface IObservableBlobsClient
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a single Blob by SHA.
|
/// Gets a single Blob by SHA.
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Reactive.Threading.Tasks;
|
||||||
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
|
namespace Octokit.Reactive.Clients
|
||||||
|
{
|
||||||
|
public interface IObservableDeploymentStatusClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the statuses for the given deployment. Any user with pull access to a repository can
|
||||||
|
/// view deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#list-deployment-statuses
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository.</param>
|
||||||
|
/// <param name="name">The name of the repository.</param>
|
||||||
|
/// <param name="deploymentId">The id of the deployment.</param>
|
||||||
|
/// <returns>All deployment statuses for the given deployment.</returns>
|
||||||
|
IObservable<DeploymentStatus> GetAll(string owner, string name, int deploymentId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new status for the given deployment. Users with push access can create deployment
|
||||||
|
/// statuses for a given deployment.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository.</param>
|
||||||
|
/// <param name="name">The name of the repository.</param>
|
||||||
|
/// <param name="deploymentId">The id of the deployment.</param>
|
||||||
|
/// <param name="newDeploymentStatus">The new deployment status to create.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<DeploymentStatus> Create(string owner, string name, int deploymentId, NewDeploymentStatus newDeploymentStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
32
Octokit.Reactive/Clients/IObservableDeploymentsClient.cs
Normal file
32
Octokit.Reactive/Clients/IObservableDeploymentsClient.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Octokit.Reactive.Clients
|
||||||
|
{
|
||||||
|
public interface IObservableDeploymentsClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the deployments for the specified repository. Any user with pull access
|
||||||
|
/// to a repository can view deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#list-deployments
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <returns>All the <see cref="Deployment"/>s for the specified repository.</returns>
|
||||||
|
IObservable<Deployment> GetAll(string owner, string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new deployment for the specified repository.
|
||||||
|
/// Users with push access can create a deployment for a given ref.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="newDeployment">A <see cref="NewDeployment"/> instance describing the new deployment to create</param>
|
||||||
|
/// <returns>The created <see cref="Deployment"></returns>
|
||||||
|
IObservable<Deployment> Create(string owner, string name, NewDeployment newDeployment);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,10 +5,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IObservableGitDatabaseClient
|
public interface IObservableGitDatabaseClient
|
||||||
{
|
{
|
||||||
IObservableBlobClient Blob { get; set; }
|
IObservableBlobsClient Blob { get; }
|
||||||
IObservableTagsClient Tag { get; set; }
|
IObservableTagsClient Tag { get; }
|
||||||
IObservableTreesClient Tree { get; set; }
|
IObservableTreesClient Tree { get; }
|
||||||
IObservableCommitsClient Commit { get; set; }
|
IObservableCommitsClient Commit { get; }
|
||||||
IObservableReferencesClient Reference { get; set; }
|
IObservableReferencesClient Reference { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Reactive;
|
||||||
|
|
||||||
namespace Octokit.Reactive
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
@@ -57,5 +58,15 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="commentUpdate">The modified comment</param>
|
/// <param name="commentUpdate">The modified comment</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IObservable<IssueComment> Update(string owner, string name, int number, string commentUpdate);
|
IObservable<IssueComment> Update(string owner, string name, int number, string commentUpdate);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the specified Issue Comment
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>http://developer.github.com/v3/issues/comments/#delete-a-comment</remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="number">The comment number</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<Unit> Delete(string owner, string name, int number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ namespace Octokit.Reactive
|
|||||||
{
|
{
|
||||||
public interface IObservableIssuesClient
|
public interface IObservableIssuesClient
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Client for managing assignees.
|
||||||
|
/// </summary>
|
||||||
IObservableAssigneesClient Assignee { get; }
|
IObservableAssigneesClient Assignee { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -12,6 +15,23 @@ namespace Octokit.Reactive
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
IObservableMilestonesClient Milestone { get; }
|
IObservableMilestonesClient Milestone { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Client for reading various event information associated with issues/pull requests.
|
||||||
|
/// This is useful both for display on issue/pull request information pages and also to
|
||||||
|
/// determine who should be notified of comments.
|
||||||
|
/// </summary>
|
||||||
|
IObservableIssuesEventsClient Events { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Client for managing labels.
|
||||||
|
/// </summary>
|
||||||
|
IObservableIssuesLabelsClient Labels { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Client for managing comments.
|
||||||
|
/// </summary>
|
||||||
|
IObservableIssueCommentsClient Comment { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a single Issue by number.
|
/// Gets a single Issue by number.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
146
Octokit.Reactive/Clients/IObservableIssuesLabelsClient.cs
Normal file
146
Octokit.Reactive/Clients/IObservableIssuesLabelsClient.cs
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Reactive;
|
||||||
|
|
||||||
|
namespace Octokit.Reactive
|
||||||
|
{
|
||||||
|
public interface IObservableIssuesLabelsClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all labels for the issue.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#list-labels-on-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <returns>The list of labels</returns>
|
||||||
|
IObservable<Label> GetForIssue(string owner, string repo, int number);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all labels for the repository.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <returns>The list of labels</returns>
|
||||||
|
IObservable<Label> GetForRepository(string owner, string repo);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a single Label by name.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#get-a-single-label">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="name">The name of the label</param>
|
||||||
|
/// <returns>The label</returns>
|
||||||
|
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
|
||||||
|
Justification = "Method makes a network request")]
|
||||||
|
IObservable<Label> Get(string owner, string repo, string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a label.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#delete-a-label">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="name">The name of the label</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<Unit> Delete(string owner, string repo, string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a label.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#create-a-label">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="newLabel">The data for the label to be created</param>
|
||||||
|
/// <returns>The created label</returns>
|
||||||
|
IObservable<Label> Create(string owner, string repo, NewLabel newLabel);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a label.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#update-a-label">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="name">The name of the label</param>
|
||||||
|
/// <param name="labelUpdate">The data for the label to be updated</param>
|
||||||
|
/// <returns>The updated label</returns>
|
||||||
|
IObservable<Label> Update(string owner, string repo, string name, LabelUpdate labelUpdate);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a label to an issue
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#add-labels-to-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <param name="labels">The names of the labels to add</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<Label> AddToIssue(string owner, string repo, int number, string[] labels);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a label from an issue
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <param name="label">The name of the label to remove</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<Unit> RemoveFromIssue(string owner, string repo, int number, string label);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replaces all labels on the specified issues with the provided labels
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <param name="labels">The names of the labels to set</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<Label> ReplaceAllForIssue(string owner, string repo, int number, string[] labels);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes all labels from an issue
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<Unit> RemoveAllFromIssue(string owner, string repo, int number);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets labels for every issue in a milestone
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the milestone</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<Label> GetForMilestone(string owner, string repo, int number);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ namespace Octokit.Reactive
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a client to manage teams for an organization.
|
/// Returns a client to manage teams for an organization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IObservableOrganizationTeamsClient Teams { get; }
|
IObservableTeamsClient Team { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the specified organization.
|
/// Returns the specified organization.
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="name">The name 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="subNamespace">The sub-namespace to get references for</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IObservable<Reference> GetAll(string owner, string name, string subNamespace);
|
IObservable<Reference> GetAllForSubNamespace(string owner, string name, string subNamespace);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a reference for a given repository
|
/// Creates a reference for a given repository
|
||||||
|
|||||||
@@ -10,35 +10,35 @@ namespace Octokit.Reactive
|
|||||||
/// Gets all the available collaborators on this repo.
|
/// Gets all the available collaborators on this repo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="repo">The name of the repository</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IObservable<User> GetAll(string owner, string name);
|
IObservable<User> GetAll(string owner, string repo);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks to see if a user is an assignee for a repository.
|
/// Checks to see if a user is an assignee for a repository.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="repo">The name of the repository</param>
|
||||||
/// <param name="user">Username of the prospective collaborator</param>
|
/// <param name="user">Username of the prospective collaborator</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IObservable<bool> IsCollaborator(string owner, string name, string user);
|
IObservable<bool> IsCollaborator(string owner, string repo, string user);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a user as a collaborator to a repository.
|
/// Adds a user as a collaborator to a repository.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="repo">The name of the repository</param>
|
||||||
/// <param name="user">Username of the prospective collaborator</param>
|
/// <param name="user">Username of the prospective collaborator</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IObservable<Unit> Add(string owner, string name, string user);
|
IObservable<Unit> Add(string owner, string repo, string user);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes a user as a collaborator for a repository.
|
/// Removes a user as a collaborator for a repository.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="repo">The name of the repository</param>
|
||||||
/// <param name="user">Username of the prospective collaborator</param>
|
/// <param name="user">Username of the prospective collaborator</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IObservable<Unit> Delete(string owner, string name, string user);
|
IObservable<Unit> Delete(string owner, string repo, string user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,5 +187,12 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="update">New values to update the repository with</param>
|
/// <param name="update">New values to update the repository with</param>
|
||||||
/// <returns>The updated <see cref="T:Octokit.Repository"/></returns>
|
/// <returns>The updated <see cref="T:Octokit.Repository"/></returns>
|
||||||
IObservable<Repository> Edit(string owner, string name, RepositoryUpdate update);
|
IObservable<Repository> Edit(string owner, string name, RepositoryUpdate update);
|
||||||
|
|
||||||
|
/// A client for GitHub's Repo Collaborators.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/repos/collaborators/">Collaborators API documentation</a> for more details
|
||||||
|
/// </remarks>
|
||||||
|
IObservableRepoCollaboratorsClient RepoCollaborators { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,32 +13,32 @@ namespace Octokit.Reactive
|
|||||||
/// search repos
|
/// search repos
|
||||||
/// http://developer.github.com/v3/search/#search-repositories
|
/// http://developer.github.com/v3/search/#search-repositories
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="search"></param>
|
||||||
/// <returns>List of repositories</returns>
|
/// <returns>List of repositories</returns>
|
||||||
IObservable<Repository> SearchRepo(SearchRepositoriesRequest request);
|
IObservable<Repository> SearchRepo(SearchRepositoriesRequest search);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// search users
|
/// search users
|
||||||
/// http://developer.github.com/v3/search/#search-users
|
/// http://developer.github.com/v3/search/#search-users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="search"></param>
|
||||||
/// <returns>List of users</returns>
|
/// <returns>List of users</returns>
|
||||||
IObservable<User> SearchUsers(SearchUsersRequest request);
|
IObservable<User> SearchUsers(SearchUsersRequest search);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// search issues
|
/// search issues
|
||||||
/// http://developer.github.com/v3/search/#search-issues
|
/// http://developer.github.com/v3/search/#search-issues
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="search"></param>
|
||||||
/// <returns>List of issues</returns>
|
/// <returns>List of issues</returns>
|
||||||
IObservable<Issue> SearchIssues(SearchIssuesRequest request);
|
IObservable<Issue> SearchIssues(SearchIssuesRequest search);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// search code
|
/// search code
|
||||||
/// http://developer.github.com/v3/search/#search-code
|
/// http://developer.github.com/v3/search/#search-code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="search"></param>
|
||||||
/// <returns>List of files</returns>
|
/// <returns>List of files</returns>
|
||||||
IObservable<SearchCode> SearchCode(SearchCodeRequest request);
|
IObservable<SearchCode> SearchCode(SearchCodeRequest search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
|
|
||||||
namespace Octokit.Reactive
|
namespace Octokit.Reactive
|
||||||
@@ -10,7 +9,7 @@ namespace Octokit.Reactive
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// See the <a href="http://developer.github.com/v3/orgs/teams/">Orgs API documentation</a> for more information.
|
/// See the <a href="http://developer.github.com/v3/orgs/teams/">Orgs API documentation</a> for more information.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public interface IObservableOrganizationTeamsClient
|
public interface IObservableTeamsClient
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all <see cref="Team" />s for the current org.
|
/// Returns all <see cref="Team" />s for the current org.
|
||||||
35
Octokit.Reactive/Clients/IObservableUserEmailsClient.cs
Normal file
35
Octokit.Reactive/Clients/IObservableUserEmailsClient.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Octokit.Reactive
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A client for GitHub's User Emails API.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/users/emails/">User Emails API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
public interface IObservableUserEmailsClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all email addresses for the authenticated user.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>The <see cref="EmailAddress"/>es for the authenticated user.</returns>
|
||||||
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||||
|
IObservable<EmailAddress> GetAll();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds email addresses for the authenticated user.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/users/emails/#add-email-addresses
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="emailAddresses">The email addresses to add.</param>
|
||||||
|
/// <returns>Returns the added <see cref="EmailAddress"/>es.</returns>
|
||||||
|
IObservable<string> Add(params string[] emailAddresses);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,10 +29,11 @@ namespace Octokit.Reactive
|
|||||||
IObservable<User> Update(UserUpdate user);
|
IObservable<User> Update(UserUpdate user);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns emails for the current user.
|
/// A client for GitHub's User Followers API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <remarks>
|
||||||
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
/// See the <a href="http://developer.github.com/v3/users/followers/">Followers API documentation</a> for more information.
|
||||||
IObservable<EmailAddress> GetEmails();
|
///</remarks>
|
||||||
|
IObservableFollowersClient Followers { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="name">The name of the repository</param>
|
||||||
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated</exception>
|
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated</exception>
|
||||||
/// <returns>A <c>bool</c> representing the success of the operation</returns>
|
/// <returns>A <c>bool</c> representing the success of the operation</returns>
|
||||||
IObservable<bool> CheckStarred(string owner, string name);
|
IObservable<bool> CheckWatched(string owner, string name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stars a repository for the authenticated user.
|
/// Stars a repository for the authenticated user.
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
Ensure.ArgumentNotNull(client, "client");
|
Ensure.ArgumentNotNull(client, "client");
|
||||||
|
|
||||||
Events = new ObservableEventsClient(client);
|
Events = new ObservableEventsClient(client);
|
||||||
Watched = new ObservableWatchedClient(client);
|
Watching = new ObservableWatchedClient(client);
|
||||||
Starred = new ObservableStarredClient(client);
|
Starring = new ObservableStarredClient(client);
|
||||||
}
|
}
|
||||||
public IObservableEventsClient Events { get; private set; }
|
public IObservableEventsClient Events { get; private set; }
|
||||||
|
|
||||||
public IObservableWatchedClient Watched { get; private set; }
|
public IObservableWatchedClient Watching { get; private set; }
|
||||||
|
|
||||||
public IObservableStarredClient Starred { get; private set; }
|
public IObservableStarredClient Starring { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ using System.Reactive.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Octokit.Reactive
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableBlobClient : IObservableBlobClient
|
public class ObservableBlobClient : IObservableBlobsClient
|
||||||
{
|
{
|
||||||
readonly IBlobsClient _client;
|
readonly IBlobsClient _client;
|
||||||
|
|
||||||
|
|||||||
59
Octokit.Reactive/Clients/ObservableDeploymentStatusClient.cs
Normal file
59
Octokit.Reactive/Clients/ObservableDeploymentStatusClient.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using Octokit.Reactive.Internal;
|
||||||
|
using System;
|
||||||
|
using System.Reactive.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Octokit.Reactive.Clients
|
||||||
|
{
|
||||||
|
public class ObservableDeploymentStatusClient : IObservableDeploymentStatusClient
|
||||||
|
{
|
||||||
|
const string acceptsHeader = "application/vnd.github.cannonball-preview+json";
|
||||||
|
private IDeploymentStatusClient _client;
|
||||||
|
private IConnection _connection;
|
||||||
|
|
||||||
|
public ObservableDeploymentStatusClient(IGitHubClient client)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNull(client, "client");
|
||||||
|
|
||||||
|
_client = client.Deployment.Status;
|
||||||
|
_connection = client.Connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the statuses for the given deployment. Any user with pull access to a repository can
|
||||||
|
/// view deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#list-deployment-statuses
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository.</param>
|
||||||
|
/// <param name="name">The name of the repository.</param>
|
||||||
|
/// <param name="deploymentId">The id of the deployment.</param>
|
||||||
|
/// <returns>All deployment statuses for the given deployment.</returns>
|
||||||
|
public IObservable<DeploymentStatus> GetAll(string owner, string name, int deploymentId)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
|
return _connection.GetAndFlattenAllPages<DeploymentStatus>(
|
||||||
|
ApiUrls.DeploymentStatuses(owner, name, deploymentId),
|
||||||
|
null, acceptsHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new status for the given deployment. Users with push access can create deployment
|
||||||
|
/// statuses for a given deployment.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository.</param>
|
||||||
|
/// <param name="name">The name of the repository.</param>
|
||||||
|
/// <param name="deploymentId">The id of the deployment.</param>
|
||||||
|
/// <param name="newDeploymentStatus">The new deployment status to create.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<DeploymentStatus> Create(string owner, string name, int deploymentId, NewDeploymentStatus newDeploymentStatus)
|
||||||
|
{
|
||||||
|
return _client.Create(owner, name, deploymentId, newDeploymentStatus).ToObservable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
55
Octokit.Reactive/Clients/ObservableDeploymentsClient.cs
Normal file
55
Octokit.Reactive/Clients/ObservableDeploymentsClient.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using Octokit.Reactive.Internal;
|
||||||
|
using System;
|
||||||
|
using System.Reactive.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Octokit.Reactive.Clients
|
||||||
|
{
|
||||||
|
public class ObservableDeploymentsClient : IObservableDeploymentsClient
|
||||||
|
{
|
||||||
|
readonly IDeploymentsClient _client;
|
||||||
|
readonly IConnection _connection;
|
||||||
|
|
||||||
|
public ObservableDeploymentsClient(IGitHubClient client)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNull(client, "client");
|
||||||
|
|
||||||
|
_client = client.Deployment;
|
||||||
|
_connection = client.Connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the deployments for the specified repository. Any user with pull access
|
||||||
|
/// to a repository can view deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#list-deployments
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <returns>All the <see cref="Deployment"/>s for the specified repository.</returns>
|
||||||
|
public IObservable<Deployment> GetAll(string owner, string name)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
|
return _connection.GetAndFlattenAllPages<Deployment>(
|
||||||
|
ApiUrls.Deployments(owner, name), null, "application/vnd.github.cannonball-preview+json");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new deployment for the specified repository.
|
||||||
|
/// Users with push access can create a deployment for a given ref.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="newDeployment">A <see cref="NewDeployment"/> instance describing the new deployment to create</param>
|
||||||
|
/// <returns>The created <see cref="Deployment"></returns>
|
||||||
|
public IObservable<Deployment> Create(string owner, string name, NewDeployment newDeployment)
|
||||||
|
{
|
||||||
|
return _client.Create(owner, name, newDeployment).ToObservable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
Reference = new ObservableReferencesClient(client);
|
Reference = new ObservableReferencesClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IObservableBlobClient Blob { get; set; }
|
public IObservableBlobsClient Blob { get; set; }
|
||||||
public IObservableTagsClient Tag { get; set; }
|
public IObservableTagsClient Tag { get; set; }
|
||||||
public IObservableTreesClient Tree { get; set; }
|
public IObservableTreesClient Tree { get; set; }
|
||||||
public IObservableCommitsClient Commit { get; set; }
|
public IObservableCommitsClient Commit { get; set; }
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Reactive;
|
||||||
using System.Reactive.Threading.Tasks;
|
using System.Reactive.Threading.Tasks;
|
||||||
using Octokit.Reactive.Internal;
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
@@ -109,5 +110,21 @@ namespace Octokit.Reactive
|
|||||||
|
|
||||||
return _client.Update(owner, name, number, commentUpdate).ToObservable();
|
return _client.Update(owner, name, number, commentUpdate).ToObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the specified Issue Comment
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>http://developer.github.com/v3/issues/comments/#delete-a-comment</remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="number">The comment number</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<Unit> Delete(string owner, string name, int number)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
|
return _client.Delete(owner, name, number).ToObservable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ namespace Octokit.Reactive
|
|||||||
readonly IConnection _connection;
|
readonly IConnection _connection;
|
||||||
|
|
||||||
public IObservableAssigneesClient Assignee { get; private set; }
|
public IObservableAssigneesClient Assignee { get; private set; }
|
||||||
|
public IObservableIssueCommentsClient Comment { get; private set; }
|
||||||
|
public IObservableIssuesEventsClient Events { get; private set; }
|
||||||
|
public IObservableIssuesLabelsClient Labels { get; private set; }
|
||||||
public IObservableMilestonesClient Milestone { get; private set; }
|
public IObservableMilestonesClient Milestone { get; private set; }
|
||||||
public IObservableIssueCommentsClient Comments { get; private set; }
|
|
||||||
|
|
||||||
public ObservableIssuesClient(IGitHubClient client)
|
public ObservableIssuesClient(IGitHubClient client)
|
||||||
{
|
{
|
||||||
@@ -20,8 +22,10 @@ namespace Octokit.Reactive
|
|||||||
_client = client.Issue;
|
_client = client.Issue;
|
||||||
_connection = client.Connection;
|
_connection = client.Connection;
|
||||||
Assignee = new ObservableAssigneesClient(client);
|
Assignee = new ObservableAssigneesClient(client);
|
||||||
|
Events = new ObservableIssuesEventsClient(client);
|
||||||
|
Labels = new ObservableIssuesLabelsClient(client);
|
||||||
Milestone = new ObservableMilestonesClient(client);
|
Milestone = new ObservableMilestonesClient(client);
|
||||||
Comments = new ObservableIssueCommentsClient(client);
|
Comment = new ObservableIssueCommentsClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
195
Octokit.Reactive/Clients/ObservableIssuesLabelsClient.cs
Normal file
195
Octokit.Reactive/Clients/ObservableIssuesLabelsClient.cs
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
using System;
|
||||||
|
using System.Reactive;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
using System.Reactive.Threading.Tasks;
|
||||||
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
|
namespace Octokit.Reactive
|
||||||
|
{
|
||||||
|
public class ObservableIssuesLabelsClient : IObservableIssuesLabelsClient
|
||||||
|
{
|
||||||
|
readonly IIssuesLabelsClient _client;
|
||||||
|
readonly IConnection _connection;
|
||||||
|
|
||||||
|
public ObservableIssuesLabelsClient(IGitHubClient client)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNull(client, "client");
|
||||||
|
|
||||||
|
_connection = client.Connection;
|
||||||
|
_client = client.Issue.Labels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all labels for the issue.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#list-labels-on-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <returns>The list of labels</returns>
|
||||||
|
public IObservable<Label> GetForIssue(string owner, string repo, int number)
|
||||||
|
{
|
||||||
|
return _connection.GetAndFlattenAllPages<Label>(ApiUrls.IssueLabels(owner, repo, number));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all labels for the repository.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <returns>The list of labels</returns>
|
||||||
|
public IObservable<Label> GetForRepository(string owner, string repo)
|
||||||
|
{
|
||||||
|
return _connection.GetAndFlattenAllPages<Label>(ApiUrls.Labels(owner, repo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a single Label by name.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#get-a-single-label">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="name">The name of the label</param>
|
||||||
|
/// <returns>The label</returns>
|
||||||
|
public IObservable<Label> Get(string owner, string repo, string name)
|
||||||
|
{
|
||||||
|
return _client.Get(owner, repo, name).ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes a label.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#delete-a-label">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="name">The name of the label</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<Unit> Delete(string owner, string repo, string name)
|
||||||
|
{
|
||||||
|
return _client.Delete(owner, repo, name).ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a label.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#create-a-label">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="newLabel">The data for the label to be created</param>
|
||||||
|
/// <returns>The created label</returns>
|
||||||
|
public IObservable<Label> Create(string owner, string repo, NewLabel newLabel)
|
||||||
|
{
|
||||||
|
return _client.Create(owner, repo, newLabel).ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a label.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#update-a-label">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="name">The name of the label</param>
|
||||||
|
/// <param name="labelUpdate">The data for the label to be updated</param>
|
||||||
|
/// <returns>The updated label</returns>'
|
||||||
|
public IObservable<Label> Update(string owner, string repo, string name, LabelUpdate labelUpdate)
|
||||||
|
{
|
||||||
|
return _client.Update(owner, repo, name, labelUpdate).ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a label to an issue
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#add-labels-to-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <param name="labels">The names of the labels to add</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<Label> AddToIssue(string owner, string repo, int number, string[] labels)
|
||||||
|
{
|
||||||
|
return _client.AddToIssue(owner, repo, number, labels)
|
||||||
|
.ToObservable()
|
||||||
|
.SelectMany(x => x); // HACK: POST is not compatible with GetAndFlattenPages
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a label from an issue
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <param name="label">The name of the label to remove</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<Unit> RemoveFromIssue(string owner, string repo, int number, string label)
|
||||||
|
{
|
||||||
|
return _client.RemoveFromIssue(owner, repo, number, label).ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replaces all labels on the specified issues with the provided labels
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <param name="labels">The names of the labels to set</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<Label> ReplaceAllForIssue(string owner, string repo, int number, string[] labels)
|
||||||
|
{
|
||||||
|
return _client.ReplaceAllForIssue(owner, repo, number, labels)
|
||||||
|
.ToObservable()
|
||||||
|
.SelectMany(x => x); // HACK: PUT is not compatible with GetAndFlattenPages
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes all labels from an issue
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the issue</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<Unit> RemoveAllFromIssue(string owner, string repo, int number)
|
||||||
|
{
|
||||||
|
return _client.RemoveAllFromIssue(owner, repo, number).ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets labels for every issue in a milestone
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="repo">The name of the repository</param>
|
||||||
|
/// <param name="number">The number of the milestone</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<Label> GetForMilestone(string owner, string repo, int number)
|
||||||
|
{
|
||||||
|
return _connection.GetAndFlattenAllPages<Label>(ApiUrls.MilestoneLabels(owner, repo, number));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ namespace Octokit.Reactive
|
|||||||
Ensure.ArgumentNotNull(client, "client");
|
Ensure.ArgumentNotNull(client, "client");
|
||||||
|
|
||||||
Member = new ObservableOrganizationMembersClient(client);
|
Member = new ObservableOrganizationMembersClient(client);
|
||||||
Teams = new ObservableOrganizationTeamsClient(client);
|
Team = new ObservableTeamsClient(client);
|
||||||
|
|
||||||
_client = client.Organization;
|
_client = client.Organization;
|
||||||
_connection = client.Connection;
|
_connection = client.Connection;
|
||||||
@@ -32,7 +32,7 @@ namespace Octokit.Reactive
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a client to manage teams for an organization.
|
/// Returns a client to manage teams for an organization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IObservableOrganizationTeamsClient Teams { get; private set; }
|
public IObservableTeamsClient Team { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the specified organization.
|
/// Returns the specified organization.
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="name">The name 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="subNamespace">The sub-namespace to get references for</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IObservable<Reference> GetAll(string owner, string name, string subNamespace)
|
public IObservable<Reference> GetAllForSubNamespace(string owner, string name, string subNamespace)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ namespace Octokit.Reactive
|
|||||||
/// Gets all the available collaborators on this repo.
|
/// Gets all the available collaborators on this repo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="repo">The name of the repository</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IObservable<User> GetAll(string owner, string name)
|
public IObservable<User> GetAll(string owner, string repo)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(owner, "owner");
|
Ensure.ArgumentNotNull(owner, "owner");
|
||||||
Ensure.ArgumentNotNull(name, "name");
|
Ensure.ArgumentNotNull(repo, "name");
|
||||||
var endpoint = ApiUrls.RepoCollaborators(owner, name);
|
var endpoint = ApiUrls.RepoCollaborators(owner, repo);
|
||||||
return _connection.GetAndFlattenAllPages<User>(endpoint);
|
return _connection.GetAndFlattenAllPages<User>(endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,36 +37,36 @@ namespace Octokit.Reactive
|
|||||||
/// Checks to see if a user is an assignee for a repository.
|
/// Checks to see if a user is an assignee for a repository.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="repo">The name of the repository</param>
|
||||||
/// <param name="user">Username of the prospective collaborator</param>
|
/// <param name="user">Username of the prospective collaborator</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IObservable<bool> IsCollaborator(string owner, string name, string user)
|
public IObservable<bool> IsCollaborator(string owner, string repo, string user)
|
||||||
{
|
{
|
||||||
return _client.IsCollaborator(owner, name, user).ToObservable();
|
return _client.IsCollaborator(owner, repo, user).ToObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a user as a collaborator to a repository.
|
/// Adds a user as a collaborator to a repository.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="repo">The name of the repository</param>
|
||||||
/// <param name="user">Username of the prospective collaborator</param>
|
/// <param name="user">Username of the prospective collaborator</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IObservable<Unit> Add(string owner, string name, string user)
|
public IObservable<Unit> Add(string owner, string repo, string user)
|
||||||
{
|
{
|
||||||
return _client.Add(owner, name, user).ToObservable();
|
return _client.Add(owner, repo, user).ToObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes a user as a collaborator for a repository.
|
/// Removes a user as a collaborator for a repository.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="owner">The owner of the repository</param>
|
/// <param name="owner">The owner of the repository</param>
|
||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="repo">The name of the repository</param>
|
||||||
/// <param name="user">Username of the prospective collaborator</param>
|
/// <param name="user">Username of the prospective collaborator</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IObservable<Unit> Delete(string owner, string name, string user)
|
public IObservable<Unit> Delete(string owner, string repo, string user)
|
||||||
{
|
{
|
||||||
return _client.Delete(owner, name, user).ToObservable();
|
return _client.Delete(owner, repo, user).ToObservable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace Octokit.Reactive
|
|||||||
_client = client.Repository;
|
_client = client.Repository;
|
||||||
_connection = client.Connection;
|
_connection = client.Connection;
|
||||||
CommitStatus = new ObservableCommitStatusClient(client);
|
CommitStatus = new ObservableCommitStatusClient(client);
|
||||||
|
RepoCollaborators = new ObservableRepoCollaboratorsClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -297,5 +298,12 @@ namespace Octokit.Reactive
|
|||||||
{
|
{
|
||||||
return _client.Edit(owner, name, update).ToObservable();
|
return _client.Edit(owner, name, update).ToObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A client for GitHub's Repo Collaborators.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/repos/collaborators/">Collaborators API documentation</a> for more details
|
||||||
|
/// </remarks>
|
||||||
|
public IObservableRepoCollaboratorsClient RepoCollaborators { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,48 +20,48 @@ namespace Octokit.Reactive
|
|||||||
/// search repos
|
/// search repos
|
||||||
/// http://developer.github.com/v3/search/#search-repositories
|
/// http://developer.github.com/v3/search/#search-repositories
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="search"></param>
|
||||||
/// <returns>List of repositories</returns>
|
/// <returns>List of repositories</returns>
|
||||||
public IObservable<Repository> SearchRepo(SearchRepositoriesRequest request)
|
public IObservable<Repository> SearchRepo(SearchRepositoriesRequest search)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(request, "request");
|
Ensure.ArgumentNotNull(search, "search");
|
||||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.SearchRepositories(), request.Parameters);
|
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.SearchRepositories(), search.Parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// search users
|
/// search users
|
||||||
/// http://developer.github.com/v3/search/#search-users
|
/// http://developer.github.com/v3/search/#search-users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="search"></param>
|
||||||
/// <returns>List of users</returns>
|
/// <returns>List of users</returns>
|
||||||
public IObservable<User> SearchUsers(SearchUsersRequest request)
|
public IObservable<User> SearchUsers(SearchUsersRequest search)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(request, "request");
|
Ensure.ArgumentNotNull(search, "search");
|
||||||
return _connection.GetAndFlattenAllPages<User>(ApiUrls.SearchUsers(), request.ToParametersDictionary());
|
return _connection.GetAndFlattenAllPages<User>(ApiUrls.SearchUsers(), search.Parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// search issues
|
/// search issues
|
||||||
/// http://developer.github.com/v3/search/#search-issues
|
/// http://developer.github.com/v3/search/#search-issues
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="search"></param>
|
||||||
/// <returns>List of issues</returns>
|
/// <returns>List of issues</returns>
|
||||||
public IObservable<Issue> SearchIssues(SearchIssuesRequest request)
|
public IObservable<Issue> SearchIssues(SearchIssuesRequest search)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(request, "request");
|
Ensure.ArgumentNotNull(search, "search");
|
||||||
return _connection.GetAndFlattenAllPages<Issue>(ApiUrls.SearchIssues(), request.Parameters);
|
return _connection.GetAndFlattenAllPages<Issue>(ApiUrls.SearchIssues(), search.Parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// search code
|
/// search code
|
||||||
/// http://developer.github.com/v3/search/#search-code
|
/// http://developer.github.com/v3/search/#search-code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="search"></param>
|
||||||
/// <returns>List of files</returns>
|
/// <returns>List of files</returns>
|
||||||
public IObservable<SearchCode> SearchCode(SearchCodeRequest request)
|
public IObservable<SearchCode> SearchCode(SearchCodeRequest search)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(request, "request");
|
Ensure.ArgumentNotNull(search, "search");
|
||||||
return _connection.GetAndFlattenAllPages<SearchCode>(ApiUrls.SearchCode(), request.Parameters);
|
return _connection.GetAndFlattenAllPages<SearchCode>(ApiUrls.SearchCode(), search.Parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ using Octokit.Reactive.Internal;
|
|||||||
|
|
||||||
namespace Octokit.Reactive
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableOrganizationTeamsClient : IObservableOrganizationTeamsClient
|
public class ObservableTeamsClient : IObservableTeamsClient
|
||||||
{
|
{
|
||||||
readonly IConnection _connection;
|
readonly IConnection _connection;
|
||||||
readonly ITeamsClient _client;
|
readonly ITeamsClient _client;
|
||||||
@@ -14,7 +14,7 @@ namespace Octokit.Reactive
|
|||||||
/// Initializes a new Organization Teams API client.
|
/// Initializes a new Organization Teams API client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client">An <see cref="IGitHubClient" /> used to make the requests</param>
|
/// <param name="client">An <see cref="IGitHubClient" /> used to make the requests</param>
|
||||||
public ObservableOrganizationTeamsClient(IGitHubClient client)
|
public ObservableTeamsClient(IGitHubClient client)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(client, "client");
|
Ensure.ArgumentNotNull(client, "client");
|
||||||
_connection = client.Connection;
|
_connection = client.Connection;
|
||||||
31
Octokit.Reactive/Clients/ObservableUserEmailsClient.cs
Normal file
31
Octokit.Reactive/Clients/ObservableUserEmailsClient.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Octokit.Reactive.Internal;
|
||||||
|
using System;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
using System.Reactive.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Octokit.Reactive
|
||||||
|
{
|
||||||
|
public class ObservableUserEmailsClient : IObservableUserEmailsClient
|
||||||
|
{
|
||||||
|
readonly IUserEmailsClient _client;
|
||||||
|
readonly IConnection _connection;
|
||||||
|
|
||||||
|
public ObservableUserEmailsClient(IGitHubClient client)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNull(client, "client");
|
||||||
|
|
||||||
|
_client = client.User.Email;
|
||||||
|
_connection = client.Connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IObservable<EmailAddress> GetAll()
|
||||||
|
{
|
||||||
|
return _connection.GetAndFlattenAllPages<EmailAddress>(ApiUrls.Emails());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IObservable<string> Add(params string[] emailAddresses)
|
||||||
|
{
|
||||||
|
return _client.Add(emailAddresses).ToObservable().SelectMany(a => a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reactive.Threading.Tasks;
|
using System.Reactive.Threading.Tasks;
|
||||||
using Octokit.Reactive.Internal;
|
|
||||||
|
|
||||||
namespace Octokit.Reactive
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableUsersClient : IObservableUsersClient
|
public class ObservableUsersClient : IObservableUsersClient
|
||||||
{
|
{
|
||||||
readonly IUsersClient _client;
|
readonly IUsersClient _client;
|
||||||
readonly IConnection _connection;
|
|
||||||
|
|
||||||
public ObservableUsersClient(IGitHubClient client)
|
public ObservableUsersClient(IGitHubClient client)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(client, "client");
|
Ensure.ArgumentNotNull(client, "client");
|
||||||
|
|
||||||
_client = client.User;
|
_client = client.User;
|
||||||
_connection = client.Connection;
|
|
||||||
|
Followers = new ObservableFollowersClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -52,12 +51,11 @@ namespace Octokit.Reactive
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns emails for the current user.
|
/// A client for GitHub's User Followers API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <remarks>
|
||||||
public IObservable<EmailAddress> GetEmails()
|
/// See the <a href="http://developer.github.com/v3/users/followers/">Followers API documentation</a> for more information.
|
||||||
{
|
///</remarks>
|
||||||
return _connection.GetAndFlattenAllPages<EmailAddress>(ApiUrls.Emails());
|
public IObservableFollowersClient Followers { get; private set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="name">The name of the repository</param>
|
/// <param name="name">The name of the repository</param>
|
||||||
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated</exception>
|
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated</exception>
|
||||||
/// <returns>A <c>bool</c> representing the success of the operation</returns>
|
/// <returns>A <c>bool</c> representing the success of the operation</returns>
|
||||||
public IObservable<bool> CheckStarred(string owner, string name)
|
public IObservable<bool> CheckWatched(string owner, string name)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|||||||
@@ -6,14 +6,16 @@
|
|||||||
|
|
||||||
IObservableAuthorizationsClient Authorization { get; }
|
IObservableAuthorizationsClient Authorization { get; }
|
||||||
IObservableActivitiesClient Activity { get; }
|
IObservableActivitiesClient Activity { get; }
|
||||||
IObservableBlobClient Blob { get; }
|
IObservableIssuesClient Issue { get; }
|
||||||
IObservableMiscellaneousClient Miscellaneous { get; }
|
IObservableMiscellaneousClient Miscellaneous { get; }
|
||||||
IObservableOrganizationsClient Organization { get; }
|
IObservableOrganizationsClient Organization { get; }
|
||||||
IObservableRepositoriesClient Repository { get; }
|
IObservableRepositoriesClient Repository { get; }
|
||||||
|
IObservableGistsClient Gist { get; }
|
||||||
|
IObservableReleasesClient Release { get; }
|
||||||
IObservableSshKeysClient SshKey { get; }
|
IObservableSshKeysClient SshKey { get; }
|
||||||
IObservableUsersClient User { get; }
|
IObservableUsersClient User { get; }
|
||||||
|
IObservableNotificationsClient Notification { get; }
|
||||||
IObservableGitDatabaseClient GitDatabase { get; }
|
IObservableGitDatabaseClient GitDatabase { get; }
|
||||||
IObservableTreesClient Tree { get; }
|
IObservableSearchClient Search { get; }
|
||||||
IObservableGistsClient Gist { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ namespace Octokit.Reactive
|
|||||||
_gitHubClient = gitHubClient;
|
_gitHubClient = gitHubClient;
|
||||||
Authorization = new ObservableAuthorizationsClient(gitHubClient);
|
Authorization = new ObservableAuthorizationsClient(gitHubClient);
|
||||||
Activity = new ObservableActivitiesClient(gitHubClient);
|
Activity = new ObservableActivitiesClient(gitHubClient);
|
||||||
Blob = new ObservableBlobClient(gitHubClient);
|
Issue = new ObservableIssuesClient(gitHubClient);
|
||||||
Miscellaneous = new ObservableMiscellaneousClient(gitHubClient.Miscellaneous);
|
Miscellaneous = new ObservableMiscellaneousClient(gitHubClient.Miscellaneous);
|
||||||
Notification = new ObservableNotificationsClient(gitHubClient);
|
Notification = new ObservableNotificationsClient(gitHubClient);
|
||||||
Organization = new ObservableOrganizationsClient(gitHubClient);
|
Organization = new ObservableOrganizationsClient(gitHubClient);
|
||||||
@@ -43,8 +43,8 @@ namespace Octokit.Reactive
|
|||||||
User = new ObservableUsersClient(gitHubClient);
|
User = new ObservableUsersClient(gitHubClient);
|
||||||
Release = new ObservableReleasesClient(gitHubClient);
|
Release = new ObservableReleasesClient(gitHubClient);
|
||||||
GitDatabase = new ObservableGitDatabaseClient(gitHubClient);
|
GitDatabase = new ObservableGitDatabaseClient(gitHubClient);
|
||||||
Tree = new ObservableTreesClient(gitHubClient);
|
|
||||||
Gist = new ObservableGistsClient(gitHubClient);
|
Gist = new ObservableGistsClient(gitHubClient);
|
||||||
|
Search = new ObservableSearchClient(gitHubClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConnection Connection
|
public IConnection Connection
|
||||||
@@ -54,16 +54,16 @@ namespace Octokit.Reactive
|
|||||||
|
|
||||||
public IObservableAuthorizationsClient Authorization { get; private set; }
|
public IObservableAuthorizationsClient Authorization { get; private set; }
|
||||||
public IObservableActivitiesClient Activity { get; private set; }
|
public IObservableActivitiesClient Activity { get; private set; }
|
||||||
public IObservableBlobClient Blob { get; private set; }
|
public IObservableIssuesClient Issue { get; private set; }
|
||||||
public IObservableMiscellaneousClient Miscellaneous { get; private set; }
|
public IObservableMiscellaneousClient Miscellaneous { get; private set; }
|
||||||
public IObservableNotificationsClient Notification { get; private set; }
|
|
||||||
public IObservableOrganizationsClient Organization { get; private set; }
|
public IObservableOrganizationsClient Organization { get; private set; }
|
||||||
public IObservableRepositoriesClient Repository { get; private set; }
|
public IObservableRepositoriesClient Repository { get; private set; }
|
||||||
|
public IObservableGistsClient Gist { get; private set; }
|
||||||
public IObservableReleasesClient Release { get; private set; }
|
public IObservableReleasesClient Release { get; private set; }
|
||||||
public IObservableSshKeysClient SshKey { get; private set; }
|
public IObservableSshKeysClient SshKey { get; private set; }
|
||||||
public IObservableUsersClient User { get; private set; }
|
public IObservableUsersClient User { get; private set; }
|
||||||
|
public IObservableNotificationsClient Notification { get; private set; }
|
||||||
public IObservableGitDatabaseClient GitDatabase { get; private set; }
|
public IObservableGitDatabaseClient GitDatabase { get; private set; }
|
||||||
public IObservableTreesClient Tree { get; private set; }
|
public IObservableSearchClient Search { get; private set; }
|
||||||
public IObservableGistsClient Gist { get; private set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,10 +118,21 @@
|
|||||||
<Compile Include="Clients\ObservableGistsClient.cs" />
|
<Compile Include="Clients\ObservableGistsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableSearchClient.cs" />
|
<Compile Include="Clients\IObservableSearchClient.cs" />
|
||||||
<Compile Include="Clients\ObservableSearchClient.cs" />
|
<Compile Include="Clients\ObservableSearchClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableDeploymentStatusClient.cs" />
|
||||||
<Compile Include="Clients\IObservableWatchedClient.cs" />
|
<Compile Include="Clients\IObservableWatchedClient.cs" />
|
||||||
<Compile Include="Clients\ObservableWatchedClient.cs" />
|
<Compile Include="Clients\ObservableWatchedClient.cs" />
|
||||||
<Compile Include="Clients\IObservableFollowersClient.cs" />
|
<Compile Include="Clients\IObservableFollowersClient.cs" />
|
||||||
<Compile Include="Clients\ObservableFollowersClient.cs" />
|
<Compile Include="Clients\ObservableFollowersClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableBlobsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableIssuesLabelsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableTeamsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableTeamsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableIssuesLabelsClient.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -127,10 +127,21 @@
|
|||||||
<Compile Include="Clients\ObservableGistsClient.cs" />
|
<Compile Include="Clients\ObservableGistsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableSearchClient.cs" />
|
<Compile Include="Clients\IObservableSearchClient.cs" />
|
||||||
<Compile Include="Clients\ObservableSearchClient.cs" />
|
<Compile Include="Clients\ObservableSearchClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableDeploymentStatusClient.cs" />
|
||||||
<Compile Include="Clients\IObservableWatchedClient.cs" />
|
<Compile Include="Clients\IObservableWatchedClient.cs" />
|
||||||
<Compile Include="Clients\ObservableWatchedClient.cs" />
|
<Compile Include="Clients\ObservableWatchedClient.cs" />
|
||||||
<Compile Include="Clients\IObservableFollowersClient.cs" />
|
<Compile Include="Clients\IObservableFollowersClient.cs" />
|
||||||
<Compile Include="Clients\ObservableFollowersClient.cs" />
|
<Compile Include="Clients\ObservableFollowersClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableBlobsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableIssuesLabelsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableTeamsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableTeamsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableIssuesLabelsClient.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -122,10 +122,21 @@
|
|||||||
<Compile Include="Clients\ObservableGistsClient.cs" />
|
<Compile Include="Clients\ObservableGistsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableSearchClient.cs" />
|
<Compile Include="Clients\IObservableSearchClient.cs" />
|
||||||
<Compile Include="Clients\ObservableSearchClient.cs" />
|
<Compile Include="Clients\ObservableSearchClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableDeploymentStatusClient.cs" />
|
||||||
<Compile Include="Clients\IObservableWatchedClient.cs" />
|
<Compile Include="Clients\IObservableWatchedClient.cs" />
|
||||||
<Compile Include="Clients\ObservableWatchedClient.cs" />
|
<Compile Include="Clients\ObservableWatchedClient.cs" />
|
||||||
<Compile Include="Clients\IObservableFollowersClient.cs" />
|
<Compile Include="Clients\IObservableFollowersClient.cs" />
|
||||||
<Compile Include="Clients\ObservableFollowersClient.cs" />
|
<Compile Include="Clients\ObservableFollowersClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableBlobsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableIssuesLabelsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableTeamsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableTeamsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableIssuesLabelsClient.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -44,21 +44,17 @@
|
|||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Net" />
|
<Reference Include="System.Net" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Reactive.Core, Version=2.1.30214.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Reactive.Core">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\Rx-Core.2.2.2\lib\net45\System.Reactive.Core.dll</HintPath>
|
||||||
<HintPath>..\packages\Rx-Core.2.1.30214.0\lib\Net40\System.Reactive.Core.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Reactive.Interfaces, Version=2.1.30214.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Reactive.Interfaces">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\Rx-Interfaces.2.2.2\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
||||||
<HintPath>..\packages\Rx-Interfaces.2.1.30214.0\lib\Net40\System.Reactive.Interfaces.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Reactive.Linq, Version=2.1.30214.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Reactive.Linq">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\Rx-Linq.2.2.2\lib\net45\System.Reactive.Linq.dll</HintPath>
|
||||||
<HintPath>..\packages\Rx-Linq.2.1.30214.0\lib\Net40\System.Reactive.Linq.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Reactive.PlatformServices, Version=2.1.30214.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Reactive.PlatformServices">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\Rx-PlatformServices.2.2.3\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
|
||||||
<HintPath>..\packages\Rx-PlatformServices.2.1.30214.0\lib\Net40\System.Reactive.PlatformServices.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
@@ -73,10 +69,17 @@
|
|||||||
<Compile Include="..\SolutionInfo.cs">
|
<Compile Include="..\SolutionInfo.cs">
|
||||||
<Link>Properties\SolutionInfo.cs</Link>
|
<Link>Properties\SolutionInfo.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Clients\IObservableDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\IObservableIssuesLabelsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableWatchedClient.cs" />
|
<Compile Include="Clients\IObservableWatchedClient.cs" />
|
||||||
<Compile Include="Clients\IObservableFollowersClient.cs" />
|
<Compile Include="Clients\IObservableFollowersClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableIssuesLabelsClient.cs" />
|
||||||
<Compile Include="Clients\ObservableSearchClient.cs" />
|
<Compile Include="Clients\ObservableSearchClient.cs" />
|
||||||
<Compile Include="Clients\IObservableBlobClient.cs" />
|
<Compile Include="Clients\IObservableBlobsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableGistCommentsClient.cs" />
|
<Compile Include="Clients\IObservableGistCommentsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableGistsClient.cs" />
|
<Compile Include="Clients\IObservableGistsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableReferencesClient.cs" />
|
<Compile Include="Clients\IObservableReferencesClient.cs" />
|
||||||
@@ -86,8 +89,8 @@
|
|||||||
<Compile Include="Clients\ObservableReferencesClient.cs" />
|
<Compile Include="Clients\ObservableReferencesClient.cs" />
|
||||||
<Compile Include="Clients\ObservableRepoCollaboratorsClient.cs" />
|
<Compile Include="Clients\ObservableRepoCollaboratorsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableRepoCollaboratorsClient.cs" />
|
<Compile Include="Clients\IObservableRepoCollaboratorsClient.cs" />
|
||||||
<Compile Include="Clients\ObservableOrganizationTeamsClient.cs" />
|
<Compile Include="Clients\ObservableTeamsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableOrganizationTeamsClient.cs" />
|
<Compile Include="Clients\IObservableTeamsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableCommitsClient.cs" />
|
<Compile Include="Clients\IObservableCommitsClient.cs" />
|
||||||
<Compile Include="Clients\IObservableStarredClient.cs" />
|
<Compile Include="Clients\IObservableStarredClient.cs" />
|
||||||
<Compile Include="Clients\ObservableCommitsClient.cs" />
|
<Compile Include="Clients\ObservableCommitsClient.cs" />
|
||||||
@@ -122,6 +125,7 @@
|
|||||||
<Compile Include="Clients\ObservableTagsClient.cs" />
|
<Compile Include="Clients\ObservableTagsClient.cs" />
|
||||||
<Compile Include="Clients\ObservableTreesClient.cs" />
|
<Compile Include="Clients\ObservableTreesClient.cs" />
|
||||||
<Compile Include="Clients\ObservableFollowersClient.cs" />
|
<Compile Include="Clients\ObservableFollowersClient.cs" />
|
||||||
|
<Compile Include="Clients\ObservableUserEmailsClient.cs" />
|
||||||
<Compile Include="Clients\ObservableUsersClient.cs" />
|
<Compile Include="Clients\ObservableUsersClient.cs" />
|
||||||
<Compile Include="Clients\IObservableAssigneesClient.cs" />
|
<Compile Include="Clients\IObservableAssigneesClient.cs" />
|
||||||
<Compile Include="Clients\IObservableNotificationsClient.cs" />
|
<Compile Include="Clients\IObservableNotificationsClient.cs" />
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Rx-Core" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-Core" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-Interfaces" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Linq" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-Linq" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Main" version="2.1.30214.0" targetFramework="net40" />
|
<package id="Rx-Main" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-PlatformServices" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-PlatformServices" version="2.2.3" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -33,13 +33,11 @@
|
|||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Reactive.Core, Version=2.1.30214.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Reactive.Core">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\Rx-Core.2.2.2\lib\net45\System.Reactive.Core.dll</HintPath>
|
||||||
<HintPath>..\packages\Rx-Core.2.1.30214.0\lib\Net45\System.Reactive.Core.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Reactive.Interfaces, Version=2.1.30214.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Reactive.Interfaces">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\Rx-Interfaces.2.2.2\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
||||||
<HintPath>..\packages\Rx-Interfaces.2.1.30214.0\lib\Net45\System.Reactive.Interfaces.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit">
|
<Reference Include="xunit">
|
||||||
<HintPath>..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
|
<HintPath>..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Octokit.Tests.Helpers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Extensions;
|
using Xunit.Extensions;
|
||||||
|
using Xunit.Sdk;
|
||||||
|
|
||||||
namespace Octokit.Tests.Conventions
|
namespace Octokit.Tests.Conventions
|
||||||
{
|
{
|
||||||
@@ -14,7 +16,7 @@ namespace Octokit.Tests.Conventions
|
|||||||
[Fact]
|
[Fact]
|
||||||
private void CheckObservableClientExample()
|
private void CheckObservableClientExample()
|
||||||
{
|
{
|
||||||
CheckObservableClients(typeof(IAssigneesClient));
|
CheckObservableClients(typeof(ISearchClient));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@@ -24,12 +26,15 @@ namespace Octokit.Tests.Conventions
|
|||||||
var observableClient = clientInterface.GetObservableClientInterface();
|
var observableClient = clientInterface.GetObservableClientInterface();
|
||||||
var mainMethods = clientInterface.GetMethodsOrdered();
|
var mainMethods = clientInterface.GetMethodsOrdered();
|
||||||
var observableMethods = observableClient.GetMethodsOrdered();
|
var observableMethods = observableClient.GetMethodsOrdered();
|
||||||
Assert.Equal(mainMethods.Length, observableMethods.Length);
|
var mainNames = Array.ConvertAll(mainMethods, m => m.Name);
|
||||||
|
var observableNames = Array.ConvertAll(observableMethods, m => m.Name);
|
||||||
|
AssertEx.Empty(observableNames.Except(mainNames), "Extra observable methods");
|
||||||
|
AssertEx.Empty(mainNames.Except(observableNames), "Missing observable methods");
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach(var mainMethod in mainMethods)
|
foreach(var mainMethod in mainMethods)
|
||||||
{
|
{
|
||||||
var observableMethod = observableMethods[index];
|
var observableMethod = observableMethods[index];
|
||||||
CheckMethod(mainMethod, observableMethod);
|
AssertEx.WithMessage(() => CheckMethod(mainMethod, observableMethod), "Invalid signature for " + observableMethod);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,12 @@ namespace Octokit.Tests.Conventions
|
|||||||
{
|
{
|
||||||
var observableClient = typeof(IObservableEventsClient);
|
var observableClient = typeof(IObservableEventsClient);
|
||||||
var observableClientName = observableClient.Namespace + "." + ObservablePrefix + type.Name.Substring(RealNameIndex);
|
var observableClientName = observableClient.Namespace + "." + ObservablePrefix + type.Name.Substring(RealNameIndex);
|
||||||
return observableClient.Assembly.GetType(observableClientName, throwOnError: true);
|
var observableInterface = observableClient.Assembly.GetType(observableClientName);
|
||||||
|
if(observableInterface == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Cannot find observable interface "+observableClientName);
|
||||||
|
}
|
||||||
|
return observableInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsTask(this Type type)
|
public static bool IsTask(this Type type)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Rx-Core" version="2.1.30214.0" targetFramework="net45" />
|
<package id="Rx-Core" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.1.30214.0" targetFramework="net45" />
|
<package id="Rx-Interfaces" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="xunit" version="1.9.2" targetFramework="net45" />
|
<package id="xunit" version="1.9.2" targetFramework="net45" />
|
||||||
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />
|
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
using Octokit;
|
||||||
|
using Octokit.Tests.Integration;
|
||||||
|
using System;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
public class DeploymentStatusClientTests : IDisposable
|
||||||
|
{
|
||||||
|
IGitHubClient _gitHubClient;
|
||||||
|
IDeploymentsClient _deploymentsClient;
|
||||||
|
Repository _repository;
|
||||||
|
Commit _commit;
|
||||||
|
Deployment _deployment;
|
||||||
|
string _repositoryOwner;
|
||||||
|
|
||||||
|
public DeploymentStatusClientTests()
|
||||||
|
{
|
||||||
|
_gitHubClient = new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
||||||
|
{
|
||||||
|
Credentials = Helper.Credentials
|
||||||
|
};
|
||||||
|
|
||||||
|
_deploymentsClient = _gitHubClient.Deployment;
|
||||||
|
|
||||||
|
var newRepository = new NewRepository
|
||||||
|
{
|
||||||
|
Name = Helper.MakeNameWithTimestamp("public-repo"),
|
||||||
|
AutoInit = true
|
||||||
|
};
|
||||||
|
|
||||||
|
_repository = _gitHubClient.Repository.Create(newRepository).Result;
|
||||||
|
_repositoryOwner = _repository.Owner.Login;
|
||||||
|
|
||||||
|
var blob = new NewBlob
|
||||||
|
{
|
||||||
|
Content = "Hello World!",
|
||||||
|
Encoding = EncodingType.Utf8
|
||||||
|
};
|
||||||
|
|
||||||
|
var blobResult = _gitHubClient.GitDatabase.Blob.Create(_repositoryOwner, _repository.Name, blob).Result;
|
||||||
|
|
||||||
|
var newTree = new NewTree();
|
||||||
|
newTree.Tree.Add(new NewTreeItem
|
||||||
|
{
|
||||||
|
Type = TreeType.Blob,
|
||||||
|
Mode = FileMode.File,
|
||||||
|
Path = "README.md",
|
||||||
|
Sha = blobResult.Sha
|
||||||
|
});
|
||||||
|
|
||||||
|
var treeResult = _gitHubClient.GitDatabase.Tree.Create(_repositoryOwner, _repository.Name, newTree).Result;
|
||||||
|
var newCommit = new NewCommit("test-commit", treeResult.Sha);
|
||||||
|
_commit = _gitHubClient.GitDatabase.Commit.Create(_repositoryOwner, _repository.Name, newCommit).Result;
|
||||||
|
|
||||||
|
var newDeployment = new NewDeployment { Ref = _commit.Sha };
|
||||||
|
_deployment = _deploymentsClient.Create(_repositoryOwner, _repository.Name, newDeployment).Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanCreateDeploymentStatus()
|
||||||
|
{
|
||||||
|
var newStatus = new NewDeploymentStatus { State = DeploymentState.Success };
|
||||||
|
|
||||||
|
var status = await _deploymentsClient.Status.Create(_repositoryOwner, _repository.Name, _deployment.Id, newStatus);
|
||||||
|
|
||||||
|
Assert.NotNull(status);
|
||||||
|
Assert.Equal(DeploymentState.Success, status.State);
|
||||||
|
}
|
||||||
|
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanReadDeploymentStatuses()
|
||||||
|
{
|
||||||
|
var newStatus = new NewDeploymentStatus { State = DeploymentState.Success };
|
||||||
|
await _deploymentsClient.Status.Create(_repositoryOwner, _repository.Name, _deployment.Id, newStatus);
|
||||||
|
|
||||||
|
var statuses = await _deploymentsClient.Status.GetAll(_repositoryOwner, _repository.Name, _deployment.Id);
|
||||||
|
|
||||||
|
Assert.NotEmpty(statuses);
|
||||||
|
Assert.Equal(DeploymentState.Success, statuses[0].State);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Helper.DeleteRepo(_repository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
81
Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs
Normal file
81
Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using Octokit;
|
||||||
|
using Octokit.Tests.Integration;
|
||||||
|
using System;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
public class DeploymentsClientTests : IDisposable
|
||||||
|
{
|
||||||
|
IGitHubClient _gitHubClient;
|
||||||
|
IDeploymentsClient _deploymentsClient;
|
||||||
|
Repository _repository;
|
||||||
|
Commit _commit;
|
||||||
|
string _repositoryOwner;
|
||||||
|
|
||||||
|
public DeploymentsClientTests()
|
||||||
|
{
|
||||||
|
_gitHubClient = new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
||||||
|
{
|
||||||
|
Credentials = Helper.Credentials
|
||||||
|
};
|
||||||
|
|
||||||
|
_deploymentsClient = _gitHubClient.Deployment;
|
||||||
|
|
||||||
|
var newRepository = new NewRepository
|
||||||
|
{
|
||||||
|
Name = Helper.MakeNameWithTimestamp("public-repo"),
|
||||||
|
AutoInit = true
|
||||||
|
};
|
||||||
|
|
||||||
|
_repository = _gitHubClient.Repository.Create(newRepository).Result;
|
||||||
|
_repositoryOwner = _repository.Owner.Login;
|
||||||
|
|
||||||
|
var blob = new NewBlob
|
||||||
|
{
|
||||||
|
Content = "Hello World!",
|
||||||
|
Encoding = EncodingType.Utf8
|
||||||
|
};
|
||||||
|
|
||||||
|
var blobResult = _gitHubClient.GitDatabase.Blob.Create(_repositoryOwner, _repository.Name, blob).Result;
|
||||||
|
|
||||||
|
var newTree = new NewTree();
|
||||||
|
newTree.Tree.Add(new NewTreeItem
|
||||||
|
{
|
||||||
|
Type = TreeType.Blob,
|
||||||
|
Mode = FileMode.File,
|
||||||
|
Path = "README.md",
|
||||||
|
Sha = blobResult.Sha
|
||||||
|
});
|
||||||
|
|
||||||
|
var treeResult = _gitHubClient.GitDatabase.Tree.Create(_repositoryOwner, _repository.Name, newTree).Result;
|
||||||
|
var newCommit = new NewCommit("test-commit", treeResult.Sha);
|
||||||
|
_commit = _gitHubClient.GitDatabase.Commit.Create(_repositoryOwner, _repository.Name, newCommit).Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanCreateDeployment()
|
||||||
|
{
|
||||||
|
var newDeployment = new NewDeployment { Ref = _commit.Sha };
|
||||||
|
|
||||||
|
var deployment = await _deploymentsClient.Create(_repositoryOwner, _repository.Name, newDeployment);
|
||||||
|
|
||||||
|
Assert.NotNull(deployment);
|
||||||
|
}
|
||||||
|
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanGetDeployments()
|
||||||
|
{
|
||||||
|
var newDeployment = new NewDeployment { Ref = _commit.Sha };
|
||||||
|
await _deploymentsClient.Create(_repositoryOwner, _repository.Name, newDeployment);
|
||||||
|
|
||||||
|
var deployments = await _deploymentsClient.GetAll(_repositoryOwner, _repository.Name);
|
||||||
|
|
||||||
|
Assert.NotEmpty(deployments);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Helper.DeleteRepo(_repository);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs
Normal file
21
Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Octokit.Tests.Integration.Clients
|
||||||
|
{
|
||||||
|
public class UserEmailsClientTests
|
||||||
|
{
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanGetEmail()
|
||||||
|
{
|
||||||
|
var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
||||||
|
{
|
||||||
|
Credentials = Helper.Credentials
|
||||||
|
};
|
||||||
|
|
||||||
|
var emails = await github.User.Email.GetAll();
|
||||||
|
Assert.NotEmpty(emails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -99,22 +99,4 @@ public class UsersClientTests
|
|||||||
Assert.Equal(HttpStatusCode.Unauthorized, e.StatusCode);
|
Assert.Equal(HttpStatusCode.Unauthorized, e.StatusCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TheGetEmailsMethod
|
|
||||||
{
|
|
||||||
[IntegrationTest]
|
|
||||||
public async Task RetrievesEmailsForUser()
|
|
||||||
{
|
|
||||||
var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
|
||||||
{
|
|
||||||
Credentials = Helper.Credentials
|
|
||||||
};
|
|
||||||
|
|
||||||
var emails = await github.User.GetEmails();
|
|
||||||
|
|
||||||
Assert.NotEmpty(emails);
|
|
||||||
var email = emails.First();
|
|
||||||
Assert.True(email.Primary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,13 +36,13 @@
|
|||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Reactive.Core">
|
<Reference Include="System.Reactive.Core">
|
||||||
<HintPath>..\packages\Rx-Core.2.1.30214.0\lib\Net45\System.Reactive.Core.dll</HintPath>
|
<HintPath>..\packages\Rx-Core.2.2.2\lib\net45\System.Reactive.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Reactive.Interfaces">
|
<Reference Include="System.Reactive.Interfaces">
|
||||||
<HintPath>..\packages\Rx-Interfaces.2.1.30214.0\lib\Net45\System.Reactive.Interfaces.dll</HintPath>
|
<HintPath>..\packages\Rx-Interfaces.2.2.2\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Reactive.Linq">
|
<Reference Include="System.Reactive.Linq">
|
||||||
<HintPath>..\packages\Rx-Linq.2.1.30214.0\lib\Net45\System.Reactive.Linq.dll</HintPath>
|
<HintPath>..\packages\Rx-Linq.2.2.2\lib\net45\System.Reactive.Linq.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@@ -62,6 +62,8 @@
|
|||||||
<Compile Include="Clients\BranchesClientTests.cs" />
|
<Compile Include="Clients\BranchesClientTests.cs" />
|
||||||
<Compile Include="Clients\CommitsClientTests.cs" />
|
<Compile Include="Clients\CommitsClientTests.cs" />
|
||||||
<Compile Include="Clients\CommitStatusClientTests.cs" />
|
<Compile Include="Clients\CommitStatusClientTests.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentsClientTests.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentStatusClientTests.cs" />
|
||||||
<Compile Include="Clients\EventsClientTests.cs" />
|
<Compile Include="Clients\EventsClientTests.cs" />
|
||||||
<Compile Include="Clients\IssuesLabelsClientTests.cs" />
|
<Compile Include="Clients\IssuesLabelsClientTests.cs" />
|
||||||
<Compile Include="Clients\GistsClientTests.cs" />
|
<Compile Include="Clients\GistsClientTests.cs" />
|
||||||
@@ -69,6 +71,7 @@
|
|||||||
<Compile Include="Clients\MilestonesClientTests.cs" />
|
<Compile Include="Clients\MilestonesClientTests.cs" />
|
||||||
<Compile Include="Clients\ReferencesClientTests.cs" />
|
<Compile Include="Clients\ReferencesClientTests.cs" />
|
||||||
<Compile Include="Clients\TreeClientTests.cs" />
|
<Compile Include="Clients\TreeClientTests.cs" />
|
||||||
|
<Compile Include="Clients\UserEmailsClientTests.cs" />
|
||||||
<Compile Include="Clients\FollowersClientTests.cs" />
|
<Compile Include="Clients\FollowersClientTests.cs" />
|
||||||
<Compile Include="IntegrationTestAttribute.cs" />
|
<Compile Include="IntegrationTestAttribute.cs" />
|
||||||
<Compile Include="Clients\IssuesClientTests.cs" />
|
<Compile Include="Clients\IssuesClientTests.cs" />
|
||||||
@@ -81,6 +84,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Helper.cs" />
|
<Compile Include="Helper.cs" />
|
||||||
<Compile Include="Clients\UsersClientTests.cs" />
|
<Compile Include="Clients\UsersClientTests.cs" />
|
||||||
|
<Compile Include="Reactive\ObservableUserEmailsClientTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Octokit.Reactive\Octokit.Reactive.csproj">
|
<ProjectReference Include="..\Octokit.Reactive\Octokit.Reactive.csproj">
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using Octokit.Reactive;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Octokit.Tests.Integration
|
||||||
|
{
|
||||||
|
public class ObservableUserEmailsClientTests
|
||||||
|
{
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanGetEmail()
|
||||||
|
{
|
||||||
|
var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
||||||
|
{
|
||||||
|
Credentials = Helper.Credentials
|
||||||
|
};
|
||||||
|
var client = new ObservableUserEmailsClient(github);
|
||||||
|
|
||||||
|
var email = await client.GetAll();
|
||||||
|
Assert.NotNull(email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Rx-Core" version="2.1.30214.0" targetFramework="net45" />
|
<package id="Rx-Core" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.1.30214.0" targetFramework="net45" />
|
<package id="Rx-Interfaces" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Linq" version="2.1.30214.0" targetFramework="net45" />
|
<package id="Rx-Linq" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="xunit" version="1.9.2" targetFramework="net45" />
|
<package id="xunit" version="1.9.2" targetFramework="net45" />
|
||||||
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />
|
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
146
Octokit.Tests/Clients/DeploymentStatusClientTests.cs
Normal file
146
Octokit.Tests/Clients/DeploymentStatusClientTests.cs
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
using NSubstitute;
|
||||||
|
using Octokit;
|
||||||
|
using Octokit.Tests.Helpers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Extensions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
public class DeploymentStatusClientTests
|
||||||
|
{
|
||||||
|
const string expectedAcceptsHeader = "application/vnd.github.cannonball-preview+json";
|
||||||
|
|
||||||
|
public class TheGetAllMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
var client = new DeploymentStatusClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "name", 1));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonEmptyArguments()
|
||||||
|
{
|
||||||
|
var client = new DeploymentStatusClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentException>(() => client.GetAll("", "name", 1));
|
||||||
|
Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData("\n")]
|
||||||
|
[InlineData("\t")]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData("\n\r")]
|
||||||
|
public void EnsureNonWhitespaceArguments(string whitespace)
|
||||||
|
{
|
||||||
|
var client = new DeploymentStatusClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentException>(() => client.GetAll(whitespace, "name", 1));
|
||||||
|
Assert.Throws<ArgumentException>(() => client.GetAll("owner", whitespace, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void RequestsCorrectUrl()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new DeploymentStatusClient(connection);
|
||||||
|
var expectedUrl = "repos/owner/name/deployments/1/statuses";
|
||||||
|
|
||||||
|
client.GetAll("owner", "name", 1);
|
||||||
|
connection.Received().GetAll<DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
|
||||||
|
Arg.Any<IDictionary<string, string>>(),
|
||||||
|
Arg.Any<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UsesPreviewAcceptHeader()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new DeploymentStatusClient(connection);
|
||||||
|
|
||||||
|
client.GetAll("owner", "name", 1);
|
||||||
|
connection.Received().GetAll<DeploymentStatus>(Arg.Any<Uri>(),
|
||||||
|
Arg.Any<IDictionary<string, string>>(),
|
||||||
|
expectedAcceptsHeader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCreateMethod
|
||||||
|
{
|
||||||
|
readonly NewDeploymentStatus newDeploymentStatus = new NewDeploymentStatus();
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
var client = new DeploymentStatusClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentNullException>(() => client.Create(null, "name", 1, newDeploymentStatus));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => client.Create("owner", null, 1, newDeploymentStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonEmptyArguments()
|
||||||
|
{
|
||||||
|
var client = new DeploymentStatusClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentException>(() => client.GetAll("", "name", 1));
|
||||||
|
Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData("\n")]
|
||||||
|
[InlineData("\t")]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData("\n\r")]
|
||||||
|
public void EnsureNonWhitespaceArguments(string whitespace)
|
||||||
|
{
|
||||||
|
var client = new DeploymentStatusClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Create(whitespace, "repo", 1, newDeploymentStatus));
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Create("owner", whitespace, 1, newDeploymentStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PostsToCorrectUrl()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new DeploymentStatusClient(connection);
|
||||||
|
var expectedUrl = "repos/owner/repo/deployments/1/statuses";
|
||||||
|
|
||||||
|
client.Create("owner", "repo", 1, newDeploymentStatus);
|
||||||
|
|
||||||
|
connection.Received().Post<DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
|
||||||
|
Arg.Any<NewDeploymentStatus>(),
|
||||||
|
Arg.Any<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UsesPreviewAcceptHeader()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new DeploymentStatusClient(connection);
|
||||||
|
|
||||||
|
client.Create("owner", "repo", 1, newDeploymentStatus);
|
||||||
|
|
||||||
|
connection.Received().Post<DeploymentStatus>(Arg.Any<Uri>(),
|
||||||
|
Arg.Any<NewDeploymentStatus>(),
|
||||||
|
expectedAcceptsHeader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCtor
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresArgument()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => new DeploymentStatusClient(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
165
Octokit.Tests/Clients/DeploymentsClientTests.cs
Normal file
165
Octokit.Tests/Clients/DeploymentsClientTests.cs
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
using NSubstitute;
|
||||||
|
using Octokit;
|
||||||
|
using Octokit.Tests.Helpers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Extensions;
|
||||||
|
|
||||||
|
public class DeploymentsClientTests
|
||||||
|
{
|
||||||
|
const string ExpectedAcceptHeader = "application/vnd.github.cannonball-preview+json";
|
||||||
|
|
||||||
|
public class TheGetAllMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async void EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
var client = new DeploymentsClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "name"));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async void EnsuresNonEmptyArguments()
|
||||||
|
{
|
||||||
|
var client = new DeploymentsClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentException>(() => client.GetAll("", "name"));
|
||||||
|
Assert.Throws<ArgumentException>(() => client.GetAll("owner", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData("\n")]
|
||||||
|
[InlineData("\t")]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData("\n\r")]
|
||||||
|
public async void EnsuresNonWhitespaceArguments(string whitespace)
|
||||||
|
{
|
||||||
|
var client = new DeploymentsClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
await AssertEx.Throws<ArgumentException>(() => client.GetAll(whitespace, "name"));
|
||||||
|
await AssertEx.Throws<ArgumentException>(() => client.GetAll("owner", whitespace));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void RequestsCorrectUrl()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new DeploymentsClient(connection);
|
||||||
|
var expectedUrl = "repos/owner/name/deployments";
|
||||||
|
|
||||||
|
client.GetAll("owner", "name");
|
||||||
|
connection.Received(1).GetAll<Deployment>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
|
||||||
|
Arg.Any<IDictionary<string, string>>(),
|
||||||
|
Arg.Any<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UsesPreviewAcceptsHeader()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new DeploymentsClient(connection);
|
||||||
|
|
||||||
|
client.GetAll("owner", "name");
|
||||||
|
connection.Received().GetAll<Deployment>(Arg.Any<Uri>(),
|
||||||
|
Arg.Any<IDictionary<string, string>>(),
|
||||||
|
ExpectedAcceptHeader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCreateMethod
|
||||||
|
{
|
||||||
|
readonly NewDeployment newDeployment = new NewDeployment { Ref = "aRef" };
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
var client = new DeploymentsClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
AssertEx.Throws<ArgumentNullException>(() => client.Create(null, "name", newDeployment));
|
||||||
|
AssertEx.Throws<ArgumentNullException>(() => client.Create("owner", null, newDeployment));
|
||||||
|
AssertEx.Throws<ArgumentNullException>(() => client.Create("owner", "name", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonEmptyArguments()
|
||||||
|
{
|
||||||
|
var client = new DeploymentsClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Create("", "name", newDeployment));
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Create("owner", "", newDeployment));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData("\n")]
|
||||||
|
[InlineData("\t")]
|
||||||
|
[InlineData(" ")]
|
||||||
|
[InlineData("\n\r")]
|
||||||
|
public void EnsuresNonWhitespaceArguments(string whitespace)
|
||||||
|
{
|
||||||
|
var client = new DeploymentsClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Create(whitespace, "name", newDeployment));
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Create("owner", whitespace, newDeployment));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PostsToDeploymentsUrl()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new DeploymentsClient(connection);
|
||||||
|
var expectedUrl = "repos/owner/name/deployments";
|
||||||
|
|
||||||
|
client.Create("owner", "name", newDeployment);
|
||||||
|
|
||||||
|
connection.Received(1).Post<Deployment>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
|
||||||
|
Arg.Any<NewDeployment>(),
|
||||||
|
Arg.Any<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PassesNewDeploymentRequest()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new DeploymentsClient(connection);
|
||||||
|
|
||||||
|
client.Create("owner", "name", newDeployment);
|
||||||
|
|
||||||
|
connection.Received(1).Post<Deployment>(Arg.Any<Uri>(),
|
||||||
|
newDeployment,
|
||||||
|
Arg.Any<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UsesPreviewAcceptsHeader()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new DeploymentsClient(connection);
|
||||||
|
|
||||||
|
client.Create("owner", "name", newDeployment);
|
||||||
|
connection.Received().Post<Deployment>(Arg.Any<Uri>(),
|
||||||
|
Arg.Any<NewDeployment>(),
|
||||||
|
Arg.Is(ExpectedAcceptHeader));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCtor
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresArgument()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => new DeploymentsClient(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void SetsStatusesClient()
|
||||||
|
{
|
||||||
|
var client = new DeploymentsClient(Substitute.For<IApiConnection>());
|
||||||
|
Assert.NotNull(client.Status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,6 +39,293 @@ namespace Octokit.Tests.Clients
|
|||||||
var client = new SearchClient(Substitute.For<IApiConnection>());
|
var client = new SearchClient(Substitute.For<IApiConnection>());
|
||||||
AssertEx.Throws<ArgumentNullException>(async () => await client.SearchUsers(null));
|
AssertEx.Throws<ArgumentNullException>(async () => await client.SearchUsers(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheTermParameter()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheAccountTypeQualifier()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.AccountType = AccountType.User;
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+type:User"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheAccountTypeQualifier_Org()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.AccountType = AccountType.Org;
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+type:Org"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheInQualifier()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
//get users where the fullname contains 'github'
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.In = new[] { UserInQualifier.Fullname };
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Fullname"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheInQualifier_Email()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.In = new[] { UserInQualifier.Email };
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Email"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheInQualifier_Username()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.In = new[] { UserInQualifier.Username };
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Username"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheInQualifier_Multiple()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.In = new[] { UserInQualifier.Username, UserInQualifier.Fullname, UserInQualifier.Email };
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+in:Username,Fullname,Email"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheReposQualifier_GreaterThan()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Repositories = Range.GreaterThan(5);
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+repos:>5"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheReposQualifier_GreaterThanOrEqualTo()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Repositories = Range.GreaterThanOrEquals(5);
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+repos:>=5"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheReposQualifier_LessThanOrEqualTo()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Repositories = Range.LessThanOrEquals(5);
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+repos:<=5"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheReposQualifier_LessThan()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Repositories = Range.LessThan(5);
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+repos:<5"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheLocationQualifier()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Location = "San Francisco";
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+location:San Francisco"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheLanguageQualifier()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
//get users who have mostly repos where language is Ruby
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Language = Language.Ruby;
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+language:Ruby"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheCreatedQualifier_GreaterThan()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Created = DateRange.GreaterThan(new DateTime(2014, 1, 1));
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+created:>2014-01-01"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheCreatedQualifier_GreaterThanOrEqualTo()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Created = DateRange.GreaterThanOrEquals(new DateTime(2014, 1, 1));
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+created:>=2014-01-01"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheCreatedQualifier_LessThanOrEqualTo()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Created = DateRange.LessThanOrEquals(new DateTime(2014, 1, 1));
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+created:<=2014-01-01"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheCreatedQualifier_LessThan()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Created = DateRange.LessThan(new DateTime(2014, 1, 1));
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+created:<2014-01-01"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheFollowersQualifier_GreaterThan()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Followers = Range.GreaterThan(1);
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+followers:>1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheFollowersQualifier_GreaterThanOrEqualTo()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Followers = Range.GreaterThanOrEquals(1);
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+followers:>=1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheFollowersQualifier_LessThan()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Followers = Range.LessThan(1);
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+followers:<1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheFollowersQualifier_LessThanOrEqualTo()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Followers = Range.LessThanOrEquals(1);
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+followers:<=1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void TestingTheFollowersQualifier_Range()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new SearchClient(connection);
|
||||||
|
var request = new SearchUsersRequest("github");
|
||||||
|
request.Followers = new Range(1, 1000);
|
||||||
|
client.SearchUsers(request);
|
||||||
|
connection.Received().GetAll<User>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "search/users"),
|
||||||
|
Arg.Is<Dictionary<string, string>>(d => d["q"] == "github+followers:1..1000"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TheSearchRepoMethod
|
public class TheSearchRepoMethod
|
||||||
|
|||||||
66
Octokit.Tests/Clients/UserEmailsClientTests.cs
Normal file
66
Octokit.Tests/Clients/UserEmailsClientTests.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using NSubstitute;
|
||||||
|
using Octokit.Tests.Helpers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Octokit.Tests.Clients
|
||||||
|
{
|
||||||
|
public class UserEmailsClientTests
|
||||||
|
{
|
||||||
|
public class TheGetAllMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void GetsCorrectUrl()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new UserEmailsClient(connection);
|
||||||
|
|
||||||
|
client.GetAll();
|
||||||
|
|
||||||
|
connection.Received(1)
|
||||||
|
.GetAll<EmailAddress>(Arg.Is<Uri>(u => u.ToString() == "user/emails"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheAddMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void PostsToCorrectUrl()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new UserEmailsClient(connection);
|
||||||
|
|
||||||
|
client.Add("octocat@github.com");
|
||||||
|
|
||||||
|
connection.Received(1)
|
||||||
|
.Post<IReadOnlyList<string>>(Arg.Is<Uri>(u => u.ToString() == "user/emails"), Arg.Any<string[]>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonNullArgument()
|
||||||
|
{
|
||||||
|
var client = new UserEmailsClient(Substitute.For<IApiConnection>());
|
||||||
|
Assert.Throws<ArgumentNullException>(() => client.Add(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNoNullEmails()
|
||||||
|
{
|
||||||
|
var client = new UserEmailsClient(Substitute.For<IApiConnection>());
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Add("octokit@github.com", null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCtor
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresArguments()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(
|
||||||
|
() => new UserEmailsClient(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -90,20 +90,5 @@ namespace Octokit.Tests.Clients
|
|||||||
await AssertEx.Throws<ArgumentNullException>(() => userEndpoint.Update(null));
|
await AssertEx.Throws<ArgumentNullException>(() => userEndpoint.Update(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TheGetEmailsMethod
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void SendsUpdateToCorrectUrl()
|
|
||||||
{
|
|
||||||
var endpoint = new Uri("user/emails", UriKind.Relative);
|
|
||||||
var client = Substitute.For<IApiConnection>();
|
|
||||||
var usersClient = new UsersClient(client);
|
|
||||||
|
|
||||||
usersClient.GetEmails();
|
|
||||||
|
|
||||||
client.Received().GetAll<EmailAddress>(endpoint, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,33 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
using Xunit.Sdk;
|
||||||
|
|
||||||
namespace Octokit.Tests.Helpers
|
namespace Octokit.Tests.Helpers
|
||||||
{
|
{
|
||||||
public static class AssertEx
|
public static class AssertEx
|
||||||
{
|
{
|
||||||
|
public static void Empty<T>(IEnumerable<T> actual, string message)
|
||||||
|
{
|
||||||
|
var empty = Enumerable.Empty<T>();
|
||||||
|
WithMessage(() => Assert.Equal(empty, actual.ToArray()), message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void WithMessage(Action assert, string message)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
assert();
|
||||||
|
}
|
||||||
|
catch(AssertException ex)
|
||||||
|
{
|
||||||
|
throw new Exception(message, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void HasAttribute<TAttribute>(MemberInfo memberInfo, bool inherit = false) where TAttribute : Attribute
|
public static void HasAttribute<TAttribute>(MemberInfo memberInfo, bool inherit = false) where TAttribute : Attribute
|
||||||
{
|
{
|
||||||
Assert.True(memberInfo.IsDefined(typeof(TAttribute), inherit), memberInfo.ToString() + Environment.NewLine);
|
Assert.True(memberInfo.IsDefined(typeof(TAttribute), inherit), memberInfo.ToString() + Environment.NewLine);
|
||||||
@@ -27,5 +48,15 @@ namespace Octokit.Tests.Helpers
|
|||||||
// Assert.Throws above will always throw.
|
// Assert.Throws above will always throw.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static readonly string[] whitespaceArguments = { " ", "\t", "\n", "\n\r", " " };
|
||||||
|
|
||||||
|
public static async Task ThrowsWhenGivenWhitespaceArgument(Func<string, Task> action)
|
||||||
|
{
|
||||||
|
foreach (var argument in whitespaceArguments)
|
||||||
|
{
|
||||||
|
await Throws<ArgumentException>(async () => await action(argument));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
86
Octokit.Tests/Models/DeploymentStatusTests.cs
Normal file
86
Octokit.Tests/Models/DeploymentStatusTests.cs
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
using Octokit.Internal;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Octokit.Tests.Models
|
||||||
|
{
|
||||||
|
public class DeploymentStatusTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void CanDeserialize()
|
||||||
|
{
|
||||||
|
var expected = new DeploymentStatus
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Url = "https://api.github.com/repos/octocat/example/deployments/1/statuses/42",
|
||||||
|
State = DeploymentState.Success,
|
||||||
|
Payload = "{\"environment\":\"production\"}",
|
||||||
|
TargetUrl = "https://gist.github.com/628b2736d379f",
|
||||||
|
CreatedAt = DateTimeOffset.Parse("2012-07-20T01:19:13Z"),
|
||||||
|
UpdatedAt = DateTimeOffset.Parse("2012-07-20T01:19:13Z"),
|
||||||
|
Description = "Deploy request from hubot"
|
||||||
|
};
|
||||||
|
|
||||||
|
var json =
|
||||||
|
@"{
|
||||||
|
""id"": 1,
|
||||||
|
""url"": ""https://api.github.com/repos/octocat/example/deployments/1/statuses/42"",
|
||||||
|
""state"": ""success"",
|
||||||
|
""creator"": {
|
||||||
|
""login"": ""octocat"",
|
||||||
|
""id"": 1,
|
||||||
|
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||||
|
""gravatar_id"": ""somehexcode"",
|
||||||
|
""url"": ""https://api.github.com/users/octocat"",
|
||||||
|
""html_url"": ""https://github.com/octocat"",
|
||||||
|
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||||
|
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||||
|
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||||
|
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||||
|
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||||
|
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||||
|
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||||
|
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||||
|
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||||
|
""type"": ""User"",
|
||||||
|
""site_admin"": false
|
||||||
|
},
|
||||||
|
""payload"": ""{\""environment\"":\""production\""}"",
|
||||||
|
""target_url"": ""https://gist.github.com/628b2736d379f"",
|
||||||
|
""created_at"": ""2012-07-20T01:19:13Z"",
|
||||||
|
""updated_at"": ""2012-07-20T01:19:13Z"",
|
||||||
|
""description"": ""Deploy request from hubot""
|
||||||
|
}";
|
||||||
|
|
||||||
|
var actual = new SimpleJsonSerializer().Deserialize<DeploymentStatus>(json);
|
||||||
|
|
||||||
|
Assert.Equal(expected, actual, new DeploymentStatusEqualityComparer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeploymentStatusEqualityComparer : IEqualityComparer<DeploymentStatus>
|
||||||
|
{
|
||||||
|
public bool Equals(DeploymentStatus x, DeploymentStatus y)
|
||||||
|
{
|
||||||
|
if (x == null && y == null)
|
||||||
|
return true;
|
||||||
|
if (x == null || y == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return x.Id == y.Id &&
|
||||||
|
x.Url == y.Url &&
|
||||||
|
x.State == y.State &&
|
||||||
|
x.Payload == y.Payload &&
|
||||||
|
x.TargetUrl == y.TargetUrl &&
|
||||||
|
x.CreatedAt == y.CreatedAt &&
|
||||||
|
x.UpdatedAt == y.UpdatedAt &&
|
||||||
|
x.Description == y.Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetHashCode(DeploymentStatus obj)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
89
Octokit.Tests/Models/DeploymentTests.cs
Normal file
89
Octokit.Tests/Models/DeploymentTests.cs
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
using Octokit.Internal;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Octokit.Tests.Models
|
||||||
|
{
|
||||||
|
public class DeploymentTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void CanDeserialize()
|
||||||
|
{
|
||||||
|
var expected = new Deployment {
|
||||||
|
Id = 1,
|
||||||
|
Sha = "topic-branch",
|
||||||
|
Url = "https://api.github.com/repos/octocat/example/deployments/1",
|
||||||
|
Payload = "{\"environment\":\"production\"}",
|
||||||
|
CreatedAt = DateTimeOffset.Parse("2012-07-20T01:19:13Z"),
|
||||||
|
UpdatedAt = DateTimeOffset.Parse("2012-07-20T01:19:13Z"),
|
||||||
|
Description = "Deploy request from hubot",
|
||||||
|
StatusesUrl = "https://api.github.com/repos/octocat/example/deployments/1/statuses"
|
||||||
|
};
|
||||||
|
|
||||||
|
var json =
|
||||||
|
@"{
|
||||||
|
""id"": 1,
|
||||||
|
""sha"": ""topic-branch"",
|
||||||
|
""url"": ""https://api.github.com/repos/octocat/example/deployments/1"",
|
||||||
|
""creator"": {
|
||||||
|
""login"": ""octocat"",
|
||||||
|
""id"": 1,
|
||||||
|
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||||
|
""gravatar_id"": ""somehexcode"",
|
||||||
|
""url"": ""https://api.github.com/users/octocat"",
|
||||||
|
""html_url"": ""https://github.com/octocat"",
|
||||||
|
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||||
|
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||||
|
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||||
|
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||||
|
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||||
|
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||||
|
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||||
|
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||||
|
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||||
|
""type"": ""User"",
|
||||||
|
""site_admin"": false
|
||||||
|
},
|
||||||
|
""payload"": ""{\""environment\"":\""production\""}"",
|
||||||
|
""created_at"": ""2012-07-20T01:19:13Z"",
|
||||||
|
""updated_at"": ""2012-07-20T01:19:13Z"",
|
||||||
|
""description"": ""Deploy request from hubot"",
|
||||||
|
""statuses_url"": ""https://api.github.com/repos/octocat/example/deployments/1/statuses""
|
||||||
|
}";
|
||||||
|
|
||||||
|
var actual = new SimpleJsonSerializer().Deserialize<Deployment>(json);
|
||||||
|
|
||||||
|
Assert.Equal(expected, actual, new DeploymentEqualityComparer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Equaliy for the sake of testing serialization/deserialization.
|
||||||
|
// Actual production equality should most likely just be a check
|
||||||
|
// of `Url` equality.
|
||||||
|
public class DeploymentEqualityComparer : IEqualityComparer<Deployment>
|
||||||
|
{
|
||||||
|
public bool Equals(Deployment x, Deployment y)
|
||||||
|
{
|
||||||
|
if (x == null && y == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (x == null || y == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return x.Id == y.Id &&
|
||||||
|
x.Sha == y .Sha &&
|
||||||
|
x.Url == y.Url &&
|
||||||
|
x.Payload == y.Payload &&
|
||||||
|
x.CreatedAt == y.CreatedAt &&
|
||||||
|
x.UpdatedAt == y.UpdatedAt &&
|
||||||
|
x.Description == y.Description &&
|
||||||
|
x.StatusesUrl == y.StatusesUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetHashCode(Deployment obj)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,13 +41,13 @@
|
|||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Reactive.Core">
|
<Reference Include="System.Reactive.Core">
|
||||||
<HintPath>..\packages\Rx-Core.2.1.30214.0\lib\Net45\System.Reactive.Core.dll</HintPath>
|
<HintPath>..\packages\Rx-Core.2.2.2\lib\net45\System.Reactive.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Reactive.Interfaces">
|
<Reference Include="System.Reactive.Interfaces">
|
||||||
<HintPath>..\packages\Rx-Interfaces.2.1.30214.0\lib\Net45\System.Reactive.Interfaces.dll</HintPath>
|
<HintPath>..\packages\Rx-Interfaces.2.2.2\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Reactive.Linq">
|
<Reference Include="System.Reactive.Linq">
|
||||||
<HintPath>..\packages\Rx-Linq.2.1.30214.0\lib\Net45\System.Reactive.Linq.dll</HintPath>
|
<HintPath>..\packages\Rx-Linq.2.2.2\lib\net45\System.Reactive.Linq.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.XML" />
|
<Reference Include="System.XML" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@@ -62,6 +62,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Authentication\CredentialsTests.cs" />
|
<Compile Include="Authentication\CredentialsTests.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentsClientTests.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentStatusClientTests.cs" />
|
||||||
<Compile Include="Clients\SearchClientTests.cs" />
|
<Compile Include="Clients\SearchClientTests.cs" />
|
||||||
<Compile Include="Clients\GistCommentsClientTests.cs" />
|
<Compile Include="Clients\GistCommentsClientTests.cs" />
|
||||||
<Compile Include="Clients\GistsClientTests.cs" />
|
<Compile Include="Clients\GistsClientTests.cs" />
|
||||||
@@ -86,6 +88,7 @@
|
|||||||
<Compile Include="Clients\ReleasesClientTests.cs" />
|
<Compile Include="Clients\ReleasesClientTests.cs" />
|
||||||
<Compile Include="Clients\SshKeysClientTests.cs" />
|
<Compile Include="Clients\SshKeysClientTests.cs" />
|
||||||
<Compile Include="Clients\TreesClientTests.cs" />
|
<Compile Include="Clients\TreesClientTests.cs" />
|
||||||
|
<Compile Include="Clients\UserEmailsClientTests.cs" />
|
||||||
<Compile Include="Clients\WatchedClientTests.cs" />
|
<Compile Include="Clients\WatchedClientTests.cs" />
|
||||||
<Compile Include="Clients\FollowersClientTests.cs" />
|
<Compile Include="Clients\FollowersClientTests.cs" />
|
||||||
<Compile Include="Exceptions\ApiExceptionTests.cs" />
|
<Compile Include="Exceptions\ApiExceptionTests.cs" />
|
||||||
@@ -117,6 +120,8 @@
|
|||||||
<Compile Include="Http\ResponseTests.cs" />
|
<Compile Include="Http\ResponseTests.cs" />
|
||||||
<Compile Include="Http\RequestTests.cs" />
|
<Compile Include="Http\RequestTests.cs" />
|
||||||
<Compile Include="Models\CommitTests.cs" />
|
<Compile Include="Models\CommitTests.cs" />
|
||||||
|
<Compile Include="Models\DeploymentStatusTests.cs" />
|
||||||
|
<Compile Include="Models\DeploymentTests.cs" />
|
||||||
<Compile Include="Models\NewReferenceTests.cs" />
|
<Compile Include="Models\NewReferenceTests.cs" />
|
||||||
<Compile Include="Models\MilestoneRequestTests.cs" />
|
<Compile Include="Models\MilestoneRequestTests.cs" />
|
||||||
<Compile Include="Models\IssueRequestTests.cs" />
|
<Compile Include="Models\IssueRequestTests.cs" />
|
||||||
@@ -130,6 +135,8 @@
|
|||||||
<Compile Include="Reactive\AuthorizationExtensionsTests.cs" />
|
<Compile Include="Reactive\AuthorizationExtensionsTests.cs" />
|
||||||
<Compile Include="Reactive\ObservableBlobClientTests.cs" />
|
<Compile Include="Reactive\ObservableBlobClientTests.cs" />
|
||||||
<Compile Include="Reactive\ObservableCommitsClientTests.cs" />
|
<Compile Include="Reactive\ObservableCommitsClientTests.cs" />
|
||||||
|
<Compile Include="Reactive\ObservableDeploymentsClientTests.cs" />
|
||||||
|
<Compile Include="Reactive\ObservableDeploymentStatusClientTests.cs" />
|
||||||
<Compile Include="Reactive\ObservableEventsClientTests.cs" />
|
<Compile Include="Reactive\ObservableEventsClientTests.cs" />
|
||||||
<Compile Include="Reactive\ObservableIssueCommentsClientTests.cs" />
|
<Compile Include="Reactive\ObservableIssueCommentsClientTests.cs" />
|
||||||
<Compile Include="Reactive\ObservableIssuesClientTests.cs" />
|
<Compile Include="Reactive\ObservableIssuesClientTests.cs" />
|
||||||
@@ -140,6 +147,7 @@
|
|||||||
<Compile Include="Reactive\ObservableStarredClientTests.cs" />
|
<Compile Include="Reactive\ObservableStarredClientTests.cs" />
|
||||||
<Compile Include="Reactive\ObservableTreesClientTests.cs" />
|
<Compile Include="Reactive\ObservableTreesClientTests.cs" />
|
||||||
<Compile Include="Reactive\ObservableFollowersTest.cs" />
|
<Compile Include="Reactive\ObservableFollowersTest.cs" />
|
||||||
|
<Compile Include="Reactive\ObservableUserEmailsClientTests.cs" />
|
||||||
<Compile Include="SimpleJsonSerializerTests.cs" />
|
<Compile Include="SimpleJsonSerializerTests.cs" />
|
||||||
<Compile Include="Clients\UsersClientTests.cs" />
|
<Compile Include="Clients\UsersClientTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
146
Octokit.Tests/Reactive/ObservableDeploymentStatusClientTests.cs
Normal file
146
Octokit.Tests/Reactive/ObservableDeploymentStatusClientTests.cs
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
using NSubstitute;
|
||||||
|
using Octokit.Reactive.Clients;
|
||||||
|
using Octokit.Tests.Helpers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Octokit.Tests.Reactive
|
||||||
|
{
|
||||||
|
public class ObservableDeploymentStatusClientTests
|
||||||
|
{
|
||||||
|
const string ExpectedAcceptHeader = "application/vnd.github.cannonball-preview+json";
|
||||||
|
|
||||||
|
public class TheGetAllMethod
|
||||||
|
{
|
||||||
|
readonly IGitHubClient _githubClient;
|
||||||
|
readonly ObservableDeploymentStatusClient _client;
|
||||||
|
|
||||||
|
public TheGetAllMethod()
|
||||||
|
{
|
||||||
|
_githubClient = new GitHubClient(Substitute.For<IConnection>());
|
||||||
|
_client = new ObservableDeploymentStatusClient(_githubClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.GetAll(null, "repo", 1));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.GetAll("owner", null, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonEmptyArguments()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentException>(() => _client.GetAll("", "repo", 1));
|
||||||
|
Assert.Throws<ArgumentException>(() => _client.GetAll("owner", "", 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsureNonWhitespaceArguments()
|
||||||
|
{
|
||||||
|
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||||
|
async whitespace => await _client.GetAll(whitespace, "repo", 1));
|
||||||
|
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||||
|
async whitespace => await _client.GetAll("owner", whitespace, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void GetsFromCorrectUrl()
|
||||||
|
{
|
||||||
|
var expectedUri = ApiUrls.DeploymentStatuses("owner", "repo", 1);
|
||||||
|
|
||||||
|
_client.GetAll("owner", "repo", 1);
|
||||||
|
|
||||||
|
_githubClient.Connection.Received(1)
|
||||||
|
.GetAsync<List<DeploymentStatus>>(Arg.Is(expectedUri),
|
||||||
|
Arg.Any<IDictionary<string, string>>(),
|
||||||
|
Arg.Any<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UsesPreviewAcceptHeader()
|
||||||
|
{
|
||||||
|
_client.GetAll("owner", "repo", 1);
|
||||||
|
|
||||||
|
_githubClient.Connection
|
||||||
|
.Received(1)
|
||||||
|
.GetAsync<List<DeploymentStatus>>(Arg.Any<Uri>(),
|
||||||
|
Arg.Any<IDictionary<string, string>>(),
|
||||||
|
Arg.Is(ExpectedAcceptHeader));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCreateMethod
|
||||||
|
{
|
||||||
|
IGitHubClient _githubClient = Substitute.For<IGitHubClient>();
|
||||||
|
ObservableDeploymentStatusClient _client;
|
||||||
|
|
||||||
|
public void SetupWithoutNonReactiveClient()
|
||||||
|
{
|
||||||
|
_client = new ObservableDeploymentStatusClient(_githubClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetupWithNonReactiveClient()
|
||||||
|
{
|
||||||
|
var deploymentStatusClient = new DeploymentStatusClient(Substitute.For<IApiConnection>());
|
||||||
|
_githubClient.Deployment.Status.Returns(deploymentStatusClient);
|
||||||
|
_client = new ObservableDeploymentStatusClient(_githubClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
SetupWithNonReactiveClient();
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.Create(null, "repo", 1, new NewDeploymentStatus()));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.Create("owner", null, 1, new NewDeploymentStatus()));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.Create("owner", "repo", 1, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresNonEmptyArguments()
|
||||||
|
{
|
||||||
|
SetupWithNonReactiveClient();
|
||||||
|
Assert.Throws<ArgumentException>(() => _client.Create("", "repo", 1, new NewDeploymentStatus()));
|
||||||
|
Assert.Throws<ArgumentException>(() => _client.Create("owner", "", 1, new NewDeploymentStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsureNonWhitespaceArguments()
|
||||||
|
{
|
||||||
|
SetupWithNonReactiveClient();
|
||||||
|
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||||
|
async whitespace => await _client.Create(whitespace, "repo", 1, new NewDeploymentStatus()));
|
||||||
|
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||||
|
async whitespace => await _client.Create("owner", whitespace, 1, new NewDeploymentStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CallsIntoDeploymentStatusClient()
|
||||||
|
{
|
||||||
|
SetupWithoutNonReactiveClient();
|
||||||
|
|
||||||
|
var newStatus = new NewDeploymentStatus();
|
||||||
|
_client.Create("owner", "repo", 1, newStatus);
|
||||||
|
_githubClient.Deployment.Status.Received(1)
|
||||||
|
.Create(Arg.Is("owner"),
|
||||||
|
Arg.Is("repo"),
|
||||||
|
Arg.Is(1),
|
||||||
|
Arg.Is(newStatus));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCtor
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresArgument()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(
|
||||||
|
() => new ObservableDeploymentStatusClient(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
149
Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs
Normal file
149
Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
using NSubstitute;
|
||||||
|
using Octokit.Reactive.Clients;
|
||||||
|
using Octokit.Tests.Helpers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Octokit.Tests.Reactive
|
||||||
|
{
|
||||||
|
public class ObservableDeploymentsClientTests
|
||||||
|
{
|
||||||
|
const string ExpectedAcceptHeader = "application/vnd.github.cannonball-preview+json";
|
||||||
|
|
||||||
|
public class TheGetAllMethod
|
||||||
|
{
|
||||||
|
readonly IGitHubClient _githubClient;
|
||||||
|
readonly ObservableDeploymentsClient _client;
|
||||||
|
|
||||||
|
public TheGetAllMethod()
|
||||||
|
{
|
||||||
|
_githubClient = Substitute.For<IGitHubClient>();
|
||||||
|
_client = new ObservableDeploymentsClient(_githubClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.GetAll(null, "repo"));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.GetAll("owner", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonEmptyArguments()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentException>(() => _client.GetAll("", "repo"));
|
||||||
|
Assert.Throws<ArgumentException>(() => _client.GetAll("owner", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresNonWhitespaceArguments()
|
||||||
|
{
|
||||||
|
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||||
|
async whitespace => await _client.GetAll(whitespace, "repo"));
|
||||||
|
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||||
|
async whitespace => await _client.GetAll("owner", whitespace));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CallsDeploymentsUrl()
|
||||||
|
{
|
||||||
|
var expectedUri = ApiUrls.Deployments("owner", "repo");
|
||||||
|
|
||||||
|
_client.GetAll("owner", "repo");
|
||||||
|
_githubClient.Connection
|
||||||
|
.Received(1)
|
||||||
|
.GetAsync<List<Deployment>>(Arg.Is(expectedUri),
|
||||||
|
Arg.Any<IDictionary<string, string>>(),
|
||||||
|
Arg.Any<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UsesPreviewAcceptHeader()
|
||||||
|
{
|
||||||
|
_client.GetAll("owner", "repo");
|
||||||
|
_githubClient.Connection.Received(1)
|
||||||
|
.GetAsync<List<Deployment>>(Arg.Any<Uri>(),
|
||||||
|
Arg.Any<IDictionary<string, string>>(),
|
||||||
|
ExpectedAcceptHeader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCreateMethod
|
||||||
|
{
|
||||||
|
IGitHubClient _githubClient;
|
||||||
|
ObservableDeploymentsClient _client;
|
||||||
|
|
||||||
|
public TheCreateMethod()
|
||||||
|
{
|
||||||
|
_githubClient = Substitute.For<IGitHubClient>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetupWithoutNonReactiveClient()
|
||||||
|
{
|
||||||
|
_client = new ObservableDeploymentsClient(_githubClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetupWithNonReactiveClient()
|
||||||
|
{
|
||||||
|
var deploymentsClient = new DeploymentsClient(Substitute.For<IApiConnection>());
|
||||||
|
_githubClient.Deployment.Returns(deploymentsClient);
|
||||||
|
_client = new ObservableDeploymentsClient(_githubClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
SetupWithNonReactiveClient();
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.Create(null, "repo", new NewDeployment()));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.Create("owner", null, new NewDeployment()));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => _client.Create("owner", "repo", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonEmptyArguments()
|
||||||
|
{
|
||||||
|
SetupWithNonReactiveClient();
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentException>(() => _client.Create("", "repo", new NewDeployment()));
|
||||||
|
Assert.Throws<ArgumentException>(() => _client.Create("owner", "", new NewDeployment()));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresNonWhitespaceArguments()
|
||||||
|
{
|
||||||
|
SetupWithNonReactiveClient();
|
||||||
|
|
||||||
|
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||||
|
async whitespace => await _client.Create(whitespace, "repo", new NewDeployment()));
|
||||||
|
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||||
|
async whitespace => await _client.Create("owner", whitespace, new NewDeployment()));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CallsCreateOnRegularDeploymentsClient()
|
||||||
|
{
|
||||||
|
SetupWithoutNonReactiveClient();
|
||||||
|
|
||||||
|
var newDeployment = new NewDeployment();
|
||||||
|
_client.Create("owner", "repo", newDeployment);
|
||||||
|
_githubClient.Deployment.Received(1).Create(Arg.Is("owner"),
|
||||||
|
Arg.Is("repo"),
|
||||||
|
Arg.Is(newDeployment));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCtor
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresArguments()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => new ObservableDeploymentsClient(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
81
Octokit.Tests/Reactive/ObservableUserEmailsClientTests.cs
Normal file
81
Octokit.Tests/Reactive/ObservableUserEmailsClientTests.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using NSubstitute;
|
||||||
|
using Octokit.Reactive;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Octokit.Tests
|
||||||
|
{
|
||||||
|
public class ObservableUserEmailsClientTests
|
||||||
|
{
|
||||||
|
private static ObservableUserEmailsClient CreateFixtureWithNonReactiveClient()
|
||||||
|
{
|
||||||
|
var nonreactiveClient = new UserEmailsClient(Substitute.For<IApiConnection>());
|
||||||
|
var github = Substitute.For<IGitHubClient>();
|
||||||
|
github.User.Email.Returns(nonreactiveClient);
|
||||||
|
return new ObservableUserEmailsClient(github);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheGetAllMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void GetsCorrectUrl()
|
||||||
|
{
|
||||||
|
var expectedUri = new Uri("user/emails", UriKind.Relative);
|
||||||
|
var github = Substitute.For<IGitHubClient>();
|
||||||
|
var client = new ObservableUserEmailsClient(github);
|
||||||
|
|
||||||
|
client.GetAll();
|
||||||
|
|
||||||
|
github.Connection.Received(1).GetAsync<List<EmailAddress>>(expectedUri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheAddMethod
|
||||||
|
{
|
||||||
|
public IGitHubClient GitHubClient;
|
||||||
|
|
||||||
|
public ObservableUserEmailsClient Client;
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CallsAddOnClient()
|
||||||
|
{
|
||||||
|
var github = Substitute.For<IGitHubClient>();
|
||||||
|
var client = new ObservableUserEmailsClient(github);
|
||||||
|
string email = "octo@github.com";
|
||||||
|
|
||||||
|
client.Add(email);
|
||||||
|
|
||||||
|
github.User.Email.Received(1).Add(Arg.Is(email));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
var client = CreateFixtureWithNonReactiveClient();
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentNullException>(() => client.Add(null));
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Add("octo@github.com", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonEmptyArguments()
|
||||||
|
{
|
||||||
|
var client = CreateFixtureWithNonReactiveClient();
|
||||||
|
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Add(""));
|
||||||
|
Assert.Throws<ArgumentException>(() => client.Add("octo@github.com", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheCtor
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void EnsuresNonNullArguments()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(
|
||||||
|
() => new ObservableUserEmailsClient(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="NSubstitute" version="1.7.1.0" targetFramework="net45" />
|
<package id="NSubstitute" version="1.7.1.0" targetFramework="net45" />
|
||||||
<package id="Rx-Core" version="2.1.30214.0" targetFramework="net45" />
|
<package id="Rx-Core" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.1.30214.0" targetFramework="net45" />
|
<package id="Rx-Interfaces" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Linq" version="2.1.30214.0" targetFramework="net45" />
|
<package id="Rx-Linq" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="xunit" version="1.9.2" targetFramework="net45" />
|
<package id="xunit" version="1.9.2" targetFramework="net45" />
|
||||||
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />
|
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
65
Octokit/Clients/DeploymentStatusClient.cs
Normal file
65
Octokit/Clients/DeploymentStatusClient.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A client for GitHub's Repository Deployment Statuses API.
|
||||||
|
/// Gets and creates Deployment Statuses.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/repos/deployments/">Repository Deployment Statuses API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
public class DeploymentStatusClient : ApiClient, IDeploymentStatusClient
|
||||||
|
{
|
||||||
|
const string acceptsHeader = "application/vnd.github.cannonball-preview+json";
|
||||||
|
|
||||||
|
public DeploymentStatusClient(IApiConnection apiConnection)
|
||||||
|
: base(apiConnection)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the statuses for the given deployment. Any user with pull access to a repository can
|
||||||
|
/// view deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#list-deployment-statuses
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository.</param>
|
||||||
|
/// <param name="name">The name of the repository.</param>
|
||||||
|
/// <param name="deploymentId">The id of the deployment.</param>
|
||||||
|
/// <returns>All deployment statuses for the given deployment.</returns>
|
||||||
|
public Task<IReadOnlyList<DeploymentStatus>> GetAll(string owner, string name, int deploymentId)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
|
return ApiConnection.GetAll<DeploymentStatus>(ApiUrls.DeploymentStatuses(owner, name, deploymentId),
|
||||||
|
null, acceptsHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new status for the given deployment. Users with push access can create deployment
|
||||||
|
/// statuses for a given deployment.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository.</param>
|
||||||
|
/// <param name="name">The name of the repository.</param>
|
||||||
|
/// <param name="deploymentId">The id of the deployment.</param>
|
||||||
|
/// <param name="newDeploymentStatus"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<DeploymentStatus> Create(string owner, string name, int deploymentId, NewDeploymentStatus newDeploymentStatus)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
Ensure.ArgumentNotNull(newDeploymentStatus, "newDeploymentStatus");
|
||||||
|
|
||||||
|
return ApiConnection.Post<DeploymentStatus>(ApiUrls.DeploymentStatuses(owner, name, deploymentId),
|
||||||
|
newDeploymentStatus, acceptsHeader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
72
Octokit/Clients/DeploymentsClient.cs
Normal file
72
Octokit/Clients/DeploymentsClient.cs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A client for GitHub's Repository Deployments API.
|
||||||
|
/// Gets and creates Deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/repos/deployments/">Repository Deployments API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
public class DeploymentsClient : ApiClient, IDeploymentsClient
|
||||||
|
{
|
||||||
|
const string acceptsHeader = "application/vnd.github.cannonball-preview+json";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Instantiates a new GitHub Repository Deployments API client.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="apiConnection">An API connection</param>
|
||||||
|
public DeploymentsClient(IApiConnection apiConnection)
|
||||||
|
: base(apiConnection)
|
||||||
|
{
|
||||||
|
Status = new DeploymentStatusClient(apiConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the deployments for the specified repository. Any user with pull access
|
||||||
|
/// to a repository can view deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#list-deployments
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <returns>All the <see cref="Deployment"/>s for the specified repository.</returns>
|
||||||
|
public Task<IReadOnlyList<Deployment>> GetAll(string owner, string name)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(owner, "login");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
|
return ApiConnection.GetAll<Deployment>(ApiUrls.Deployments(owner, name),
|
||||||
|
null, acceptsHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new deployment for the specified repository.
|
||||||
|
/// Users with push access can create a deployment for a given ref.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="newDeployment">A <see cref="NewDeployment"/> instance describing the new deployment to create</param>
|
||||||
|
/// <returns>The created <see cref="Deployment"></returns>
|
||||||
|
public Task<Deployment> Create(string owner, string name, NewDeployment newDeployment)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
Ensure.ArgumentNotNull(newDeployment, "deployment");
|
||||||
|
|
||||||
|
return ApiConnection.Post<Deployment>(ApiUrls.Deployments(owner, name),
|
||||||
|
newDeployment, acceptsHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Client for managing deployment status.
|
||||||
|
/// </summary>
|
||||||
|
public IDeploymentStatusClient Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
42
Octokit/Clients/IDeploymentStatusClient.cs
Normal file
42
Octokit/Clients/IDeploymentStatusClient.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A client for GitHub's Repository Deployment Statuses API.
|
||||||
|
/// Gets and creates Deployment Statuses.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/repos/deployments/">Repository Deployment Statuses API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
public interface IDeploymentStatusClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the statuses for the given deployment. Any user with pull access to a repository can
|
||||||
|
/// view deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#list-deployment-statuses
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository.</param>
|
||||||
|
/// <param name="name">The name of the repository.</param>
|
||||||
|
/// <param name="deploymentId">The id of the deployment.</param>
|
||||||
|
/// <returns>All deployment statuses for the given deployment.</returns>
|
||||||
|
Task<IReadOnlyList<DeploymentStatus>> GetAll(string owner, string name, int deploymentId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new status for the given deployment. Users with push access can create deployment
|
||||||
|
/// statuses for a given deployment.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository.</param>
|
||||||
|
/// <param name="name">The name of the repository.</param>
|
||||||
|
/// <param name="deploymentId">The id of the deployment.</param>
|
||||||
|
/// <param name="newDeploymentStatus"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<DeploymentStatus> Create(string owner, string name, int deploymentId, NewDeploymentStatus newDeploymentStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
45
Octokit/Clients/IDeploymentsClient.cs
Normal file
45
Octokit/Clients/IDeploymentsClient.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A client for GitHub's Repository Deployments API.
|
||||||
|
/// Gets and creates Deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/repos/deployments/">Repository Deployments API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
public interface IDeploymentsClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the deployments for the specified repository. Any user with pull access
|
||||||
|
/// to a repository can view deployments.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#list-deployments
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <returns>All the <see cref="Deployment"/>s for the specified repository.</returns>
|
||||||
|
Task<IReadOnlyList<Deployment>> GetAll(string owner, string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new deployment for the specified repository.
|
||||||
|
/// Users with push access can create a deployment for a given ref.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/repos/deployments/#create-a-deployment
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="newDeployment">A <see cref="NewDeployment"/> instance describing the new deployment to create</param>
|
||||||
|
/// <returns>The created <see cref="Deployment"></returns>
|
||||||
|
Task<Deployment> Create(string owner, string name, NewDeployment newDeployment);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Client for managing deployment status.
|
||||||
|
/// </summary>
|
||||||
|
IDeploymentStatusClient Status { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,9 @@ namespace Octokit
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public interface IIssuesClient
|
public interface IIssuesClient
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Client for managing assignees.
|
||||||
|
/// </summary>
|
||||||
IAssigneesClient Assignee { get; }
|
IAssigneesClient Assignee { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
35
Octokit/Clients/IUserEmailsClient.cs
Normal file
35
Octokit/Clients/IUserEmailsClient.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A client for GitHub's User Emails API.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/users/emails/">User Emails API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
public interface IUserEmailsClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all email addresses for the authenticated user.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>The <see cref="EmailAddress"/>es for the authenticated user.</returns>
|
||||||
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||||
|
Task<IReadOnlyList<EmailAddress>> GetAll();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds email addresses for the authenticated user.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/users/emails/#add-email-addresses
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="emailAddresses">The email addresses to add.</param>
|
||||||
|
/// <returns>Returns the added <see cref="EmailAddress"/>es.</returns>
|
||||||
|
Task<IReadOnlyList<string>> Add(params string[] emailAddresses);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,8 @@ namespace Octokit
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public interface IUsersClient
|
public interface IUsersClient
|
||||||
{
|
{
|
||||||
|
IUserEmailsClient Email { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the user specified by the login.
|
/// Returns the user specified by the login.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -35,13 +37,6 @@ namespace Octokit
|
|||||||
/// <returns>A <see cref="User"/></returns>
|
/// <returns>A <see cref="User"/></returns>
|
||||||
Task<User> Update(UserUpdate user);
|
Task<User> Update(UserUpdate user);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns emails for the current user.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
|
||||||
Task<IReadOnlyList<EmailAddress>> GetEmails();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A client for GitHub's User Followers API
|
/// A client for GitHub's User Followers API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ namespace Octokit
|
|||||||
Comment = new IssueCommentsClient(apiConnection);
|
Comment = new IssueCommentsClient(apiConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Client for managing assignees.
|
||||||
|
/// </summary>
|
||||||
public IAssigneesClient Assignee { get; private set; }
|
public IAssigneesClient Assignee { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Client for reading various event information associated with issues/pull requests.
|
/// Client for reading various event information associated with issues/pull requests.
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Octokit
|
|||||||
public Task<IReadOnlyList<User>> SearchUsers(SearchUsersRequest search)
|
public Task<IReadOnlyList<User>> SearchUsers(SearchUsersRequest search)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(search, "search");
|
Ensure.ArgumentNotNull(search, "search");
|
||||||
return ApiConnection.GetAll<User>(ApiUrls.SearchUsers(), search.ToParametersDictionary());
|
return ApiConnection.GetAll<User>(ApiUrls.SearchUsers(), search.Parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
53
Octokit/Clients/UserEmailsClient.cs
Normal file
53
Octokit/Clients/UserEmailsClient.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A client for GitHub's User Emails API.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// See the <a href="http://developer.github.com/v3/users/emails/">User Emails API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
public class UserEmailsClient : ApiClient, IUserEmailsClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Instantiates a new GitHub User Emails API client.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="apiConnection">An API connection</param>
|
||||||
|
public UserEmailsClient(IApiConnection apiConnection)
|
||||||
|
: base(apiConnection)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all email addresses for the authenticated user.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>The <see cref="EmailAddress"/>es for the authenticated user.</returns>
|
||||||
|
public Task<IReadOnlyList<EmailAddress>> GetAll()
|
||||||
|
{
|
||||||
|
return ApiConnection.GetAll<EmailAddress>(ApiUrls.Emails());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds email addresses for the authenticated user.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// http://developer.github.com/v3/users/emails/#add-email-addresses
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="emailAddresses">The email addresses to add.</param>
|
||||||
|
/// <returns>Returns the added <see cref="EmailAddress"/>es.</returns>
|
||||||
|
public Task<IReadOnlyList<string>> Add(params string[] emailAddresses)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNull(emailAddresses, "emailAddresses");
|
||||||
|
if (emailAddresses.Any(String.IsNullOrWhiteSpace))
|
||||||
|
throw new ArgumentException("Cannot contain null, empty or whitespace values", "emailAddresses");
|
||||||
|
|
||||||
|
return ApiConnection.Post<IReadOnlyList<string>>(ApiUrls.Emails(), emailAddresses);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,9 +23,12 @@ namespace Octokit
|
|||||||
/// <param name="apiConnection">An API connection</param>
|
/// <param name="apiConnection">An API connection</param>
|
||||||
public UsersClient(IApiConnection apiConnection) : base(apiConnection)
|
public UsersClient(IApiConnection apiConnection) : base(apiConnection)
|
||||||
{
|
{
|
||||||
|
Email = new UserEmailsClient(apiConnection);
|
||||||
Followers = new FollowersClient(apiConnection);
|
Followers = new FollowersClient(apiConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IUserEmailsClient Email { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the user specified by the login.
|
/// Returns the user specified by the login.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -61,15 +64,6 @@ namespace Octokit
|
|||||||
return ApiConnection.Patch<User>(_userEndpoint, user);
|
return ApiConnection.Patch<User>(_userEndpoint, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns emails for the current user.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public Task<IReadOnlyList<EmailAddress>> GetEmails()
|
|
||||||
{
|
|
||||||
return ApiConnection.GetAll<EmailAddress>(ApiUrls.Emails(), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A client for GitHub's User Followers API
|
/// A client for GitHub's User Followers API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ namespace Octokit
|
|||||||
SshKey = new SshKeysClient(apiConnection);
|
SshKey = new SshKeysClient(apiConnection);
|
||||||
GitDatabase = new GitDatabaseClient(apiConnection);
|
GitDatabase = new GitDatabaseClient(apiConnection);
|
||||||
Search = new SearchClient(apiConnection);
|
Search = new SearchClient(apiConnection);
|
||||||
|
Deployment = new DeploymentsClient(apiConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -141,6 +142,7 @@ namespace Octokit
|
|||||||
public INotificationsClient Notification { get; private set; }
|
public INotificationsClient Notification { get; private set; }
|
||||||
public IGitDatabaseClient GitDatabase { get; private set; }
|
public IGitDatabaseClient GitDatabase { get; private set; }
|
||||||
public ISearchClient Search { get; private set; }
|
public ISearchClient Search { get; private set; }
|
||||||
|
public IDeploymentsClient Deployment { get; private set; }
|
||||||
|
|
||||||
static Uri FixUpBaseUri(Uri uri)
|
static Uri FixUpBaseUri(Uri uri)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -950,6 +950,28 @@ namespace Octokit
|
|||||||
return "repos/{0}/{1}".FormatUri(owner, name);
|
return "repos/{0}/{1}".FormatUri(owner, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the <see cref="System.Uri"/> for the Deployments API for the given repository.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="owner">Owner of the repository</param>
|
||||||
|
/// <param name="name">Name of the repository</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Uri Deployments(string owner, string name)
|
||||||
|
{
|
||||||
|
return "repos/{0}/{1}/deployments".FormatUri(owner, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the <see cref="System.Uri"/> for the Deployment Statuses API for the given deployment.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="owner">Owner of the repository</param>
|
||||||
|
/// <param name="name">Name of the repository</param>
|
||||||
|
/// <param name="deploymentId">Id of the deployment</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Uri DeploymentStatuses(string owner, string name, int deploymentId)
|
||||||
|
{
|
||||||
|
return "repos/{0}/{1}/deployments/{2}/statuses".FormatUri(owner, name, deploymentId);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the relative <see cref="Uri"/> for retrieving the
|
/// Creates the relative <see cref="Uri"/> for retrieving the
|
||||||
/// current users followers
|
/// current users followers
|
||||||
|
|||||||
@@ -22,5 +22,6 @@ namespace Octokit
|
|||||||
INotificationsClient Notification { get; }
|
INotificationsClient Notification { get; }
|
||||||
IGitDatabaseClient GitDatabase { get; }
|
IGitDatabaseClient GitDatabase { get; }
|
||||||
ISearchClient Search { get; }
|
ISearchClient Search { get; }
|
||||||
|
IDeploymentsClient Deployment { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
35
Octokit/Models/Request/NewDeployment.cs
Normal file
35
Octokit/Models/Request/NewDeployment.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a new deployment status to create.
|
||||||
|
/// </summary>
|
||||||
|
public class NewDeployment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The ref to deploy. This can be a branch, tag, or sha.
|
||||||
|
/// </summary>
|
||||||
|
public string Ref { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional parameter to bypass any ahead/behind checks or commit status checks.
|
||||||
|
/// </summary>
|
||||||
|
public bool? Force { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// JSON payload with extra information about the deployment.
|
||||||
|
/// </summary>
|
||||||
|
public string Payload { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Merges the default branch into the requested deployment branch if true;
|
||||||
|
/// Does nothing if false.
|
||||||
|
/// </summary>
|
||||||
|
public bool? AutoMerge { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A short description of the deployment.
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Octokit/Models/Request/NewDeploymentStatus.cs
Normal file
25
Octokit/Models/Request/NewDeploymentStatus.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a new deployment status to create.
|
||||||
|
/// </summary>
|
||||||
|
public class NewDeploymentStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The state of the status.
|
||||||
|
/// </summary>
|
||||||
|
public DeploymentState State { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The target URL to associate with this status. This URL should contain
|
||||||
|
/// output to keep the user updated while the task is running or serve as
|
||||||
|
/// historical information for what happened in the deployment
|
||||||
|
/// </summary>
|
||||||
|
public string TargetUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A short description of the status.
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -326,7 +326,7 @@ namespace Octokit
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// helper method to create a LessThan Date Comparision
|
/// helper method to create a LessThan Date Comparision
|
||||||
/// e.g. "<" 2011
|
/// e.g. < 2011
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">date to be used for comparision (times are ignored)</param>
|
/// <param name="date">date to be used for comparision (times are ignored)</param>
|
||||||
/// <returns><see cref="DateRange"/></returns>
|
/// <returns><see cref="DateRange"/></returns>
|
||||||
@@ -337,7 +337,7 @@ namespace Octokit
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// helper method to create a LessThanOrEqualTo Date Comparision
|
/// helper method to create a LessThanOrEqualTo Date Comparision
|
||||||
/// e.g. "<=" 2011
|
/// e.g. <= 2011
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">date to be used for comparision (times are ignored)</param>
|
/// <param name="date">date to be used for comparision (times are ignored)</param>
|
||||||
/// <returns><see cref="DateRange"/></returns>
|
/// <returns><see cref="DateRange"/></returns>
|
||||||
@@ -348,7 +348,7 @@ namespace Octokit
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// helper method to create a GreaterThan Date Comparision
|
/// helper method to create a GreaterThan Date Comparision
|
||||||
/// e.g. ">" 2011
|
/// e.g. > 2011
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">date to be used for comparision (times are ignored)</param>
|
/// <param name="date">date to be used for comparision (times are ignored)</param>
|
||||||
/// <returns><see cref="DateRange"/></returns>
|
/// <returns><see cref="DateRange"/></returns>
|
||||||
@@ -359,7 +359,7 @@ namespace Octokit
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// helper method to create a GreaterThanOrEqualTo Date Comparision
|
/// helper method to create a GreaterThanOrEqualTo Date Comparision
|
||||||
/// e.g. ">=" 2011
|
/// e.g. >= 2011
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="date">date to be used for comparision (times are ignored)</param>
|
/// <param name="date">date to be used for comparision (times are ignored)</param>
|
||||||
/// <returns><see cref="DateRange"/></returns>
|
/// <returns><see cref="DateRange"/></returns>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Octokit.Internal;
|
using Octokit.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,43 +12,140 @@ namespace Octokit
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Searching Users
|
/// Searching Users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SearchUsersRequest : RequestParameters
|
public class SearchUsersRequest : BaseSearchRequest
|
||||||
{
|
{
|
||||||
public SearchUsersRequest(string term)
|
public SearchUsersRequest(string term) : base(term)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(term, "term");
|
|
||||||
Term = term;
|
|
||||||
Page = 1;
|
|
||||||
PerPage = 100;
|
|
||||||
Order = SortDirection.Descending;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The search terms. This can be any combination of the supported repository search parameters:
|
/// Optional Sort field. One of followers, repositories, or joined. If not provided (null), results are sorted by best match.
|
||||||
/// http://developer.github.com/v3/search/#search-code
|
/// <remarks>https://help.github.com/articles/searching-users#sorting</remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Parameter(Key="q")]
|
public UsersSearchSort? SortField { get; set; }
|
||||||
public string Term { get; private set; }
|
|
||||||
|
public override string Sort
|
||||||
|
{
|
||||||
|
get { return SortField.ToParameter(); }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For http://developer.github.com/v3/search/#search-users
|
/// Filter users based on the number of followers they have.
|
||||||
/// Optional Sort field. One of followers, repositories, or joined. If not provided, results are sorted by best match.
|
/// <remarks>https://help.github.com/articles/searching-users#followers</remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//public string Sort { get; set; } //re-add later
|
public Range Followers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Optional Sort order if sort parameter is provided. One of asc or desc; the default is desc.
|
/// Filter users based on when they joined.
|
||||||
|
/// <remarks>https://help.github.com/articles/searching-users#created</remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SortDirection Order { get; set; }
|
public DateRange Created { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Page of paginated results
|
/// Filter users by the location indicated in their profile.
|
||||||
|
/// <remarks>https://help.github.com/articles/searching-users#location</remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Page { get; set; }
|
public string Location { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of items per page
|
/// Filters users based on the number of repositories they have.
|
||||||
|
/// <remarks>https://help.github.com/articles/searching-users#repository-count</remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PerPage { get; set; }
|
public Range Repositories { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Search for users that have repositories that match a certain language.
|
||||||
|
/// <remarks>https://help.github.com/articles/searching-users#language</remarks>
|
||||||
|
/// </summary>
|
||||||
|
public Language? Language { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// With this qualifier you can restrict the search to just personal accounts or just organization accounts.
|
||||||
|
/// <remarks>https://help.github.com/articles/searching-users#type</remarks>
|
||||||
|
/// </summary>
|
||||||
|
public AccountType? AccountType { get; set; }
|
||||||
|
|
||||||
|
private IEnumerable<UserInQualifier> _inQualifier;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Qualifies which fields are searched. With this qualifier you can restrict the search to just the username, public email, full name, or any combination of these.
|
||||||
|
/// <remarks>https://help.github.com/articles/searching-users#search-in</remarks>
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<UserInQualifier> In
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _inQualifier;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != null && value.Any())
|
||||||
|
_inQualifier = value.Distinct().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IReadOnlyCollection<string> MergedQualifiers()
|
||||||
|
{
|
||||||
|
var parameters = new List<string>();
|
||||||
|
|
||||||
|
if (AccountType != null)
|
||||||
|
{
|
||||||
|
parameters.Add(String.Format(CultureInfo.InvariantCulture, "type:{0}", AccountType));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (In != null)
|
||||||
|
{
|
||||||
|
parameters.Add(String.Format(CultureInfo.InvariantCulture, "in:{0}", String.Join(",", In)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Repositories != null)
|
||||||
|
{
|
||||||
|
parameters.Add(String.Format(CultureInfo.InvariantCulture, "repos:{0}", Repositories));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Location.IsNotBlank())
|
||||||
|
{
|
||||||
|
parameters.Add(String.Format(CultureInfo.InvariantCulture, "location:{0}", Location));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Language != null)
|
||||||
|
{
|
||||||
|
parameters.Add(String.Format(CultureInfo.InvariantCulture, "language:{0}", Language));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Created != null)
|
||||||
|
{
|
||||||
|
parameters.Add(String.Format(CultureInfo.InvariantCulture, "created:{0}", Created));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Followers != null)
|
||||||
|
{
|
||||||
|
parameters.Add(String.Format(CultureInfo.InvariantCulture, "followers:{0}", Followers));
|
||||||
|
}
|
||||||
|
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AccountType
|
||||||
|
{
|
||||||
|
User,
|
||||||
|
Org
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum UserInQualifier
|
||||||
|
{
|
||||||
|
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Username")]
|
||||||
|
Username,
|
||||||
|
Email,
|
||||||
|
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Fullname")]
|
||||||
|
Fullname
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum UsersSearchSort
|
||||||
|
{
|
||||||
|
Followers,
|
||||||
|
Repositories,
|
||||||
|
Joined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
55
Octokit/Models/Response/Deployment.cs
Normal file
55
Octokit/Models/Response/Deployment.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
[SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces",
|
||||||
|
Justification="People can use fully qualified names if they want to use both.")]
|
||||||
|
public class Deployment
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id of this deployment.
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Sha { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The API URL for this deployment.
|
||||||
|
/// </summary>
|
||||||
|
public string Url { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <seealso cref="User"/> that created the deployment.
|
||||||
|
/// </summary>
|
||||||
|
public User Creator { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// JSON payload with extra information about the deployment.
|
||||||
|
/// </summary>
|
||||||
|
public string Payload { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Date and time that the deployment was created.
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset CreatedAt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Date and time that the deployment was updated.
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset UpdatedAt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A short description of the deployment.
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The API URL for the <seealso cref="DeploymentStatus"/>es of this deployment.
|
||||||
|
/// </summary>
|
||||||
|
public string StatusesUrl { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
62
Octokit/Models/Response/DeploymentStatus.cs
Normal file
62
Octokit/Models/Response/DeploymentStatus.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
public class DeploymentStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id of this deployment status.
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The API URL for this deployment status.
|
||||||
|
/// </summary>
|
||||||
|
public string Url { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The state of this deployment status.
|
||||||
|
/// </summary>
|
||||||
|
public DeploymentState State { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <seealso cref="User"/> that created this deployment status.
|
||||||
|
/// </summary>
|
||||||
|
public User Creator { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// JSON payload with extra information about the deployment.
|
||||||
|
/// </summary>
|
||||||
|
public string Payload { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The target URL of this deployment status. This URL should contain
|
||||||
|
/// output to keep the user updated while the task is running or serve
|
||||||
|
/// as historical information for what happened in the deployment
|
||||||
|
/// </summary>
|
||||||
|
public string TargetUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The date and time that the status was created.
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset CreatedAt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The date and time that the status was updated.
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset UpdatedAt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A short description of the status.
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DeploymentState
|
||||||
|
{
|
||||||
|
Pending,
|
||||||
|
Success,
|
||||||
|
Error,
|
||||||
|
Failure
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Octokit
|
namespace Octokit
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A users email
|
||||||
|
/// </summary>
|
||||||
|
[DebuggerDisplay("DebuggerDisplay,nq")]
|
||||||
public class EmailAddress
|
public class EmailAddress
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The email address
|
||||||
|
/// </summary>
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// true if the email is verified; otherwise false
|
||||||
|
/// </summary>
|
||||||
public bool Verified { get; set; }
|
public bool Verified { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// true if this is the users primary email; otherwise false
|
||||||
|
/// </summary>
|
||||||
public bool Primary { get; set; }
|
public bool Primary { get; set; }
|
||||||
|
|
||||||
|
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode",
|
||||||
|
Justification="Used by DebuggerDisplayAttribute")]
|
||||||
|
private string DebuggerDisplay
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return String.Format(CultureInfo.InvariantCulture,
|
||||||
|
"EmailAddress: Email: {0}; Primary: {1}, Verified: {2}", Email, Primary, Verified);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,11 +250,21 @@
|
|||||||
<Compile Include="Clients\IGistCommentsClient.cs" />
|
<Compile Include="Clients\IGistCommentsClient.cs" />
|
||||||
<Compile Include="Models\Response\GistComment.cs" />
|
<Compile Include="Models\Response\GistComment.cs" />
|
||||||
<Compile Include="Models\Request\BodyWrapper.cs" />
|
<Compile Include="Models\Request\BodyWrapper.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeployment.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeploymentStatus.cs" />
|
||||||
|
<Compile Include="Models\Response\DeploymentStatus.cs" />
|
||||||
|
<Compile Include="Models\Response\Deployment.cs" />
|
||||||
<Compile Include="Models\Request\BaseSearchRequest.cs" />
|
<Compile Include="Models\Request\BaseSearchRequest.cs" />
|
||||||
<Compile Include="Helpers\EnumExtensions.cs" />
|
<Compile Include="Helpers\EnumExtensions.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryTag.cs" />
|
<Compile Include="Models\Response\RepositoryTag.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryUpdate.cs" />
|
<Compile Include="Models\Request\RepositoryUpdate.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryLanguage.cs" />
|
<Compile Include="Models\Response\RepositoryLanguage.cs" />
|
||||||
|
<Compile Include="Clients\IUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\UserEmailsClient.cs" />
|
||||||
<Compile Include="Models\Response\Emoji.cs" />
|
<Compile Include="Models\Response\Emoji.cs" />
|
||||||
<Compile Include="Clients\FollowersClient.cs" />
|
<Compile Include="Clients\FollowersClient.cs" />
|
||||||
<Compile Include="Clients\IFollowersClient.cs" />
|
<Compile Include="Clients\IFollowersClient.cs" />
|
||||||
|
|||||||
@@ -256,11 +256,21 @@
|
|||||||
<Compile Include="Models\Request\LabelUpdate.cs" />
|
<Compile Include="Models\Request\LabelUpdate.cs" />
|
||||||
<Compile Include="Models\Request\NewLabel.cs" />
|
<Compile Include="Models\Request\NewLabel.cs" />
|
||||||
<Compile Include="Models\Response\Branch.cs" />
|
<Compile Include="Models\Response\Branch.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeployment.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeploymentStatus.cs" />
|
||||||
|
<Compile Include="Models\Response\DeploymentStatus.cs" />
|
||||||
|
<Compile Include="Models\Response\Deployment.cs" />
|
||||||
<Compile Include="Models\Request\BaseSearchRequest.cs" />
|
<Compile Include="Models\Request\BaseSearchRequest.cs" />
|
||||||
<Compile Include="Helpers\EnumExtensions.cs" />
|
<Compile Include="Helpers\EnumExtensions.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryTag.cs" />
|
<Compile Include="Models\Response\RepositoryTag.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryUpdate.cs" />
|
<Compile Include="Models\Request\RepositoryUpdate.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryLanguage.cs" />
|
<Compile Include="Models\Response\RepositoryLanguage.cs" />
|
||||||
|
<Compile Include="Clients\IUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\UserEmailsClient.cs" />
|
||||||
<Compile Include="Clients\IWatchedClient.cs" />
|
<Compile Include="Clients\IWatchedClient.cs" />
|
||||||
<Compile Include="Clients\WatchedClient.cs" />
|
<Compile Include="Clients\WatchedClient.cs" />
|
||||||
<Compile Include="Models\Request\NewSubscription.cs" />
|
<Compile Include="Models\Request\NewSubscription.cs" />
|
||||||
|
|||||||
@@ -251,11 +251,21 @@
|
|||||||
<Compile Include="Models\Request\LabelUpdate.cs" />
|
<Compile Include="Models\Request\LabelUpdate.cs" />
|
||||||
<Compile Include="Models\Request\NewLabel.cs" />
|
<Compile Include="Models\Request\NewLabel.cs" />
|
||||||
<Compile Include="Models\Response\Branch.cs" />
|
<Compile Include="Models\Response\Branch.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeployment.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeploymentStatus.cs" />
|
||||||
|
<Compile Include="Models\Response\DeploymentStatus.cs" />
|
||||||
|
<Compile Include="Models\Response\Deployment.cs" />
|
||||||
<Compile Include="Models\Request\BaseSearchRequest.cs" />
|
<Compile Include="Models\Request\BaseSearchRequest.cs" />
|
||||||
<Compile Include="Helpers\EnumExtensions.cs" />
|
<Compile Include="Helpers\EnumExtensions.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryTag.cs" />
|
<Compile Include="Models\Response\RepositoryTag.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryUpdate.cs" />
|
<Compile Include="Models\Request\RepositoryUpdate.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryLanguage.cs" />
|
<Compile Include="Models\Response\RepositoryLanguage.cs" />
|
||||||
|
<Compile Include="Clients\IUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\UserEmailsClient.cs" />
|
||||||
<Compile Include="Clients\IWatchedClient.cs" />
|
<Compile Include="Clients\IWatchedClient.cs" />
|
||||||
<Compile Include="Clients\WatchedClient.cs" />
|
<Compile Include="Clients\WatchedClient.cs" />
|
||||||
<Compile Include="Models\Request\NewSubscription.cs" />
|
<Compile Include="Models\Request\NewSubscription.cs" />
|
||||||
|
|||||||
@@ -252,10 +252,20 @@
|
|||||||
<Compile Include="Clients\IGistCommentsClient.cs" />
|
<Compile Include="Clients\IGistCommentsClient.cs" />
|
||||||
<Compile Include="Models\Response\GistComment.cs" />
|
<Compile Include="Models\Response\GistComment.cs" />
|
||||||
<Compile Include="Models\Request\BodyWrapper.cs" />
|
<Compile Include="Models\Request\BodyWrapper.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeployment.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeploymentStatus.cs" />
|
||||||
|
<Compile Include="Models\Response\DeploymentStatus.cs" />
|
||||||
|
<Compile Include="Models\Response\Deployment.cs" />
|
||||||
<Compile Include="Models\Request\BaseSearchRequest.cs" />
|
<Compile Include="Models\Request\BaseSearchRequest.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryTag.cs" />
|
<Compile Include="Models\Response\RepositoryTag.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryUpdate.cs" />
|
<Compile Include="Models\Request\RepositoryUpdate.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryLanguage.cs" />
|
<Compile Include="Models\Response\RepositoryLanguage.cs" />
|
||||||
|
<Compile Include="Clients\IUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\UserEmailsClient.cs" />
|
||||||
<Compile Include="Models\Response\Emoji.cs" />
|
<Compile Include="Models\Response\Emoji.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -47,6 +47,18 @@
|
|||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Net" />
|
<Reference Include="System.Net" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Reactive.Core">
|
||||||
|
<HintPath>..\packages\Rx-Core.2.2.2\lib\net45\System.Reactive.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.Interfaces">
|
||||||
|
<HintPath>..\packages\Rx-Interfaces.2.2.2\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.Linq">
|
||||||
|
<HintPath>..\packages\Rx-Linq.2.2.2\lib\net45\System.Reactive.Linq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.PlatformServices">
|
||||||
|
<HintPath>..\packages\Rx-PlatformServices.2.2.3\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -54,6 +66,16 @@
|
|||||||
<Link>Properties\SolutionInfo.cs</Link>
|
<Link>Properties\SolutionInfo.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Clients\ActivitiesClient.cs" />
|
<Compile Include="Clients\ActivitiesClient.cs" />
|
||||||
|
<Compile Include="Models\Response\DeploymentStatus.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentStatusClient.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeploymentStatus.cs" />
|
||||||
|
<Compile Include="Models\Request\NewDeployment.cs" />
|
||||||
|
<Compile Include="Models\Response\Deployment.cs" />
|
||||||
|
<Compile Include="Clients\DeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IDeploymentsClient.cs" />
|
||||||
|
<Compile Include="Clients\IUserEmailsClient.cs" />
|
||||||
|
<Compile Include="Clients\UserEmailsClient.cs" />
|
||||||
<Compile Include="Clients\IWatchedClient.cs" />
|
<Compile Include="Clients\IWatchedClient.cs" />
|
||||||
<Compile Include="Models\Request\ReleaseAssetUpdate.cs" />
|
<Compile Include="Models\Request\ReleaseAssetUpdate.cs" />
|
||||||
<Compile Include="Clients\SearchClient.cs" />
|
<Compile Include="Clients\SearchClient.cs" />
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Rx-Core" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-Core" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-Interfaces" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Linq" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-Linq" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-Main" version="2.1.30214.0" targetFramework="net40" />
|
<package id="Rx-Main" version="2.2.2" targetFramework="net45" />
|
||||||
<package id="Rx-PlatformServices" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-PlatformServices" version="2.2.3" targetFramework="net45" />
|
||||||
<package id="SimpleJson" version="0.30.0" targetFramework="net45" developmentDependency="true" />
|
<package id="SimpleJson" version="0.30.0" targetFramework="net45" developmentDependency="true" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -153,6 +153,9 @@ Target "CreatePackages" DoNothing
|
|||||||
"UnitTests"
|
"UnitTests"
|
||||||
==> "Default"
|
==> "Default"
|
||||||
|
|
||||||
|
"ConventionTests"
|
||||||
|
==> "Default"
|
||||||
|
|
||||||
"IntegrationTests"
|
"IntegrationTests"
|
||||||
==> "Default"
|
==> "Default"
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,20 @@
|
|||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||||
</startup>
|
</startup>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.1.30214.0" newVersion="2.1.30214.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user