mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 14:15:12 +00:00
- added support for content APIs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit.Models.Request;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
@@ -32,5 +33,19 @@ namespace Octokit
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns></returns>
|
||||
Task<string> GetReadmeHtml(string owner, string name);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task<CreatedContent> CreateFile(string owner, string name, string path, CreateFileRequest request);
|
||||
|
||||
Task<CreatedContent> UpdateFile(string owner, string name, string path, UpdateFileRequest request);
|
||||
|
||||
Task DeleteFile(string owner, string name, string path, DeleteFileRequest request);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Net.Http;
|
||||
|
||||
namespace Octokit.Internal
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")]
|
||||
public class Request : IRequest
|
||||
{
|
||||
public Request()
|
||||
|
||||
15
Octokit/Models/Request/Committer.cs
Normal file
15
Octokit/Models/Request/Committer.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit.Models.Request
|
||||
{
|
||||
public class Committer
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Email { get; set; }
|
||||
}
|
||||
}
|
||||
33
Octokit/Models/Request/CreateFileRequest.cs
Normal file
33
Octokit/Models/Request/CreateFileRequest.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit.Models.Request
|
||||
{
|
||||
public class DeleteFileRequest
|
||||
{
|
||||
public string Message { get; set; }
|
||||
public string Branch { get; set; }
|
||||
public Committer Committer { get; set; }
|
||||
public string Sha { get; set; }
|
||||
}
|
||||
|
||||
public class CreateFileRequest
|
||||
{
|
||||
public string Message { get; set; }
|
||||
public string Content { get; set; }
|
||||
public string Branch { get; set; }
|
||||
public Committer Committer { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateFileRequest
|
||||
{
|
||||
public string Message { get; set; }
|
||||
public string Content { get; set; }
|
||||
public string Branch { get; set; }
|
||||
public Committer Committer { get; set; }
|
||||
public string Sha { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -48,4 +48,10 @@ namespace Octokit
|
||||
Symlink,
|
||||
Submodule
|
||||
}
|
||||
|
||||
public class CreatedContent
|
||||
{
|
||||
public DirectoryContent Content { get; set; }
|
||||
public Commit Commit { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,8 @@
|
||||
<Compile Include="Helpers\HttpClientExtensions.cs" />
|
||||
<Compile Include="Helpers\SerializeNullAttribute.cs" />
|
||||
<Compile Include="Http\ProductHeaderValue.cs" />
|
||||
<Compile Include="Models\Request\Committer.cs" />
|
||||
<Compile Include="Models\Request\CreateFileRequest.cs" />
|
||||
<Compile Include="Models\Request\MarkAsReadRequest.cs" />
|
||||
<Compile Include="Models\Request\NewDeployKey.cs" />
|
||||
<Compile Include="Models\Request\NewRelease.cs" />
|
||||
@@ -390,4 +392,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user