mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-04 11:24:44 +00:00
Allow fully qualified or short references to be used to generate "reference" Uri (#2110)
Co-authored-by: Brian <brian.hart@xylogix.net>
This commit is contained in:
@@ -146,7 +146,12 @@ namespace Octokit.Reactive
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="subNamespace">The sub-namespace to get references for</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// The subNamespace parameter supports either the fully-qualified ref
|
||||
/// (prefixed with "refs/", e.g. "refs/heads/master" or
|
||||
/// "refs/tags/release-1") or the shortened form (omitting "refs/", e.g.
|
||||
/// "heads/master" or "tags/release-1")
|
||||
/// </remarks>
|
||||
public IObservable<Reference> GetAllForSubNamespace(string owner, string name, string subNamespace, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
|
||||
@@ -154,6 +159,11 @@ namespace Octokit.Reactive
|
||||
Ensure.ArgumentNotNullOrEmptyString(subNamespace, nameof(subNamespace));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
if (subNamespace.StartsWith("refs/"))
|
||||
{
|
||||
subNamespace = subNamespace.Replace("refs/", string.Empty);
|
||||
}
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(owner, name, subNamespace), options);
|
||||
}
|
||||
|
||||
@@ -180,12 +190,22 @@ namespace Octokit.Reactive
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="subNamespace">The sub-namespace to get references for</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// The subNamespace parameter supports either the fully-qualified ref
|
||||
/// (prefixed with "refs/", e.g. "refs/heads/master" or
|
||||
/// "refs/tags/release-1") or the shortened form (omitting "refs/", e.g.
|
||||
/// "heads/master" or "tags/release-1")
|
||||
/// </remarks>
|
||||
public IObservable<Reference> GetAllForSubNamespace(long repositoryId, string subNamespace, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(subNamespace, nameof(subNamespace));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
if (subNamespace.StartsWith("refs/"))
|
||||
{
|
||||
subNamespace = subNamespace.Replace("refs/", string.Empty);
|
||||
}
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(repositoryId, subNamespace), options);
|
||||
}
|
||||
|
||||
@@ -298,4 +318,4 @@ namespace Octokit.Reactive
|
||||
return _reference.Delete(repositoryId, reference).ToObservable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user