mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-31 02:05:39 +00:00
Add ApiOptions overloads to methods on I(Observable)IssuesLabelsClient (#1329)
This commit is contained in:
committed by
Brendan Forster
parent
9e08884594
commit
2ed5769154
@@ -26,12 +26,35 @@ namespace Octokit.Reactive
|
||||
/// 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="name">The name of the repository</param>
|
||||
/// <param name="number">The number of the issue</param>
|
||||
/// <returns>The list of labels</returns>
|
||||
public IObservable<Label> GetAllForIssue(string owner, string repo, int number)
|
||||
public IObservable<Label> GetAllForIssue(string owner, string name, int number)
|
||||
{
|
||||
return _connection.GetAndFlattenAllPages<Label>(ApiUrls.IssueLabels(owner, repo, number));
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return GetAllForIssue(owner, name, number, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <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="name">The name of the repository</param>
|
||||
/// <param name="number">The number of the issue</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>The list of labels</returns>
|
||||
public IObservable<Label> GetAllForIssue(string owner, string name, int number, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Label>(ApiUrls.IssueLabels(owner, name, number), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -41,11 +64,71 @@ namespace Octokit.Reactive
|
||||
/// 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>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <returns>The list of labels</returns>
|
||||
public IObservable<Label> GetAllForRepository(string owner, string repo)
|
||||
public IObservable<Label> GetAllForRepository(string owner, string name)
|
||||
{
|
||||
return _connection.GetAndFlattenAllPages<Label>(ApiUrls.Labels(owner, repo));
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return GetAllForRepository(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <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="name">The name of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns>The list of labels</returns>
|
||||
public IObservable<Label> GetAllForRepository(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Label>(ApiUrls.Labels(owner, name), options);
|
||||
}
|
||||
|
||||
/// <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="name">The name of the repository</param>
|
||||
/// <param name="number">The number of the milestone</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<Label> GetAllForMilestone(string owner, string name, int number)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return GetAllForMilestone(owner, name, number, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <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="name">The name of the repository</param>
|
||||
/// <param name="number">The number of the milestone</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<Label> GetAllForMilestone(string owner, string name, int number, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Label>(ApiUrls.MilestoneLabels(owner, name, number), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -55,12 +138,16 @@ namespace Octokit.Reactive
|
||||
/// 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>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="labelName">The name of the label</param>
|
||||
/// <returns>The label</returns>
|
||||
public IObservable<Label> Get(string owner, string repo, string name)
|
||||
public IObservable<Label> Get(string owner, string name, string labelName)
|
||||
{
|
||||
return _client.Get(owner, repo, name).ToObservable();
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(labelName, "labelName");
|
||||
|
||||
return _client.Get(owner, name, labelName).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,12 +157,16 @@ namespace Octokit.Reactive
|
||||
/// 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>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="labelName">The name of the label</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<Unit> Delete(string owner, string repo, string name)
|
||||
public IObservable<Unit> Delete(string owner, string name, string labelName)
|
||||
{
|
||||
return _client.Delete(owner, repo, name).ToObservable();
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(labelName, "labelName");
|
||||
|
||||
return _client.Delete(owner, name, labelName).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -85,12 +176,16 @@ namespace Octokit.Reactive
|
||||
/// 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="name">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)
|
||||
public IObservable<Label> Create(string owner, string name, NewLabel newLabel)
|
||||
{
|
||||
return _client.Create(owner, repo, newLabel).ToObservable();
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(newLabel, "newLabel");
|
||||
|
||||
return _client.Create(owner, name, newLabel).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -100,13 +195,18 @@ namespace Octokit.Reactive
|
||||
/// 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="name">The name of the repository</param>
|
||||
/// <param name="labelName">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)
|
||||
public IObservable<Label> Update(string owner, string name, string labelName, LabelUpdate labelUpdate)
|
||||
{
|
||||
return _client.Update(owner, repo, name, labelUpdate).ToObservable();
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(labelName, "labelName");
|
||||
Ensure.ArgumentNotNull(labelUpdate, "labelUpdate");
|
||||
|
||||
return _client.Update(owner, name, labelName, labelUpdate).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -116,13 +216,17 @@ namespace Octokit.Reactive
|
||||
/// 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="name">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)
|
||||
public IObservable<Label> AddToIssue(string owner, string name, int number, string[] labels)
|
||||
{
|
||||
return _client.AddToIssue(owner, repo, number, labels)
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(labels, "labels");
|
||||
|
||||
return _client.AddToIssue(owner, name, number, labels)
|
||||
.ToObservable()
|
||||
.SelectMany(x => x); // HACK: POST is not compatible with GetAndFlattenPages
|
||||
}
|
||||
@@ -135,13 +239,17 @@ namespace Octokit.Reactive
|
||||
/// 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="name">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>
|
||||
/// <param name="labelName">The name of the label to remove</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<Unit> RemoveFromIssue(string owner, string repo, int number, string label)
|
||||
public IObservable<Unit> RemoveFromIssue(string owner, string name, int number, string labelName)
|
||||
{
|
||||
return _client.RemoveFromIssue(owner, repo, number, label).ToObservable();
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(labelName, "labelName");
|
||||
|
||||
return _client.RemoveFromIssue(owner, name, number, labelName).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -151,13 +259,17 @@ namespace Octokit.Reactive
|
||||
/// 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="name">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)
|
||||
public IObservable<Label> ReplaceAllForIssue(string owner, string name, int number, string[] labels)
|
||||
{
|
||||
return _client.ReplaceAllForIssue(owner, repo, number, labels)
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(labels, "labels");
|
||||
|
||||
return _client.ReplaceAllForIssue(owner, name, number, labels)
|
||||
.ToObservable()
|
||||
.SelectMany(x => x); // HACK: PUT is not compatible with GetAndFlattenPages
|
||||
}
|
||||
@@ -169,27 +281,15 @@ namespace Octokit.Reactive
|
||||
/// 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="name">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)
|
||||
public IObservable<Unit> RemoveAllFromIssue(string owner, string name, int number)
|
||||
{
|
||||
return _client.RemoveAllFromIssue(owner, repo, number).ToObservable();
|
||||
}
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
/// <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> GetAllForMilestone(string owner, string repo, int number)
|
||||
{
|
||||
return _connection.GetAndFlattenAllPages<Label>(ApiUrls.MilestoneLabels(owner, repo, number));
|
||||
return _client.RemoveAllFromIssue(owner, name, number).ToObservable();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user