mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 11:40:42 +00:00
Fixed code analysis errors
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
public interface IReferencesClient
|
||||
{
|
||||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
|
||||
Justification = "Method makes a network request")]
|
||||
Task<Reference> Get(string owner, string name, string reference);
|
||||
|
||||
Task<IReadOnlyList<Reference>> GetAll(string owner, string name, string subNamespace = null);
|
||||
Task<IReadOnlyList<Reference>> GetAll(string owner, string name);
|
||||
|
||||
Task<IReadOnlyList<Reference>> GetAll(string owner, string name, string subNamespace);
|
||||
|
||||
Task<Reference> Create(string owner, string name, NewReference reference);
|
||||
|
||||
Task<Reference> Update(string owner, string name, string reference, ReferenceUpdate update);
|
||||
Task<Reference> Update(string owner, string name, string reference, ReferenceUpdate referenceUpdate);
|
||||
|
||||
Task Delete(string owner, string name, string reference);
|
||||
}
|
||||
|
||||
@@ -19,11 +19,20 @@ namespace Octokit
|
||||
return ApiConnection.Get<Reference>(ApiUrls.Reference(owner, name, reference));
|
||||
}
|
||||
|
||||
public Task<IReadOnlyList<Reference>> GetAll(string owner, string name, string subNamespace = null)
|
||||
public Task<IReadOnlyList<Reference>> GetAll(string owner, string name)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return ApiConnection.GetAll<Reference>(ApiUrls.Reference(owner, name));
|
||||
}
|
||||
|
||||
public Task<IReadOnlyList<Reference>> GetAll(string owner, string name, string subNamespace)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(subNamespace, "subNamespace");
|
||||
|
||||
return ApiConnection.GetAll<Reference>(ApiUrls.Reference(owner, name, subNamespace));
|
||||
}
|
||||
|
||||
@@ -36,14 +45,14 @@ namespace Octokit
|
||||
return ApiConnection.Post<Reference>(ApiUrls.Reference(owner, name), reference);
|
||||
}
|
||||
|
||||
public Task<Reference> Update(string owner, string name, string reference, ReferenceUpdate update)
|
||||
public Task<Reference> Update(string owner, string name, string reference, ReferenceUpdate referenceUpdate)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
|
||||
Ensure.ArgumentNotNull(update, "update");
|
||||
Ensure.ArgumentNotNull(referenceUpdate, "update");
|
||||
|
||||
return ApiConnection.Patch<Reference>(ApiUrls.Reference(owner, name, reference), update);
|
||||
return ApiConnection.Patch<Reference>(ApiUrls.Reference(owner, name, reference), referenceUpdate);
|
||||
}
|
||||
|
||||
public Task Delete(string owner, string name, string reference)
|
||||
|
||||
@@ -474,16 +474,22 @@ namespace Octokit
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="reference">The reference name</param>
|
||||
/// <returns></returns>
|
||||
public static Uri Reference(string owner, string name, string reference = null)
|
||||
public static Uri Reference(string owner, string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(reference))
|
||||
{
|
||||
return "repos/{0}/{1}/git/refs".FormatUri(owner, name);
|
||||
}
|
||||
return "repos/{0}/{1}/git/refs".FormatUri(owner, name);
|
||||
}
|
||||
|
||||
return "repos/{0}/{1}/git/refs/{2}".FormatUri(owner, name, reference);
|
||||
/// <summary>
|
||||
/// Returns the <see cref="Uri"/> for the specified reference.
|
||||
/// </summary>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="referenceName">The reference name</param>
|
||||
/// <returns></returns>
|
||||
public static Uri Reference(string owner, string name, string referenceName)
|
||||
{
|
||||
return "repos/{0}/{1}/git/refs/{2}".FormatUri(owner, name, referenceName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
{
|
||||
public class ReferenceUpdate
|
||||
{
|
||||
public ReferenceUpdate(string sha, bool force = false)
|
||||
public ReferenceUpdate(string sha) : this(sha, false)
|
||||
{
|
||||
}
|
||||
|
||||
public ReferenceUpdate(string sha, bool force)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(sha, "sha");
|
||||
|
||||
|
||||
@@ -234,6 +234,11 @@
|
||||
<Compile Include="Models\Response\GistFile.cs" />
|
||||
<Compile Include="Models\Response\GistFork.cs" />
|
||||
<Compile Include="Models\Response\GistHistory.cs" />
|
||||
<Compile Include="Clients\IReferencesClient.cs" />
|
||||
<Compile Include="Clients\ReferencesClient.cs" />
|
||||
<Compile Include="Models\Request\NewReference.cs" />
|
||||
<Compile Include="Models\Request\ReferenceUpdate.cs" />
|
||||
<Compile Include="Models\Response\Reference.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -229,6 +229,11 @@
|
||||
<Compile Include="Models\Response\GistFile.cs" />
|
||||
<Compile Include="Models\Response\GistFork.cs" />
|
||||
<Compile Include="Models\Response\GistHistory.cs" />
|
||||
<Compile Include="Clients\IReferencesClient.cs" />
|
||||
<Compile Include="Clients\ReferencesClient.cs" />
|
||||
<Compile Include="Models\Request\NewReference.cs" />
|
||||
<Compile Include="Models\Request\ReferenceUpdate.cs" />
|
||||
<Compile Include="Models\Response\Reference.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user