diff --git a/Octokit/Clients/IReleasesClient.cs b/Octokit/Clients/IReleasesClient.cs
index f3480134..b07e655f 100644
--- a/Octokit/Clients/IReleasesClient.cs
+++ b/Octokit/Clients/IReleasesClient.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
#endif
using System.Threading.Tasks;
+using System.Diagnostics.CodeAnalysis;
namespace Octokit
{
@@ -25,6 +26,17 @@ namespace Octokit
/// The list of s for the specified repository.
Task> GetAll(string owner, string name);
+ ///
+ /// Gets a single for the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the release
+ /// Thrown when a general API error occurs.
+ /// The specified by the id
+ [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
+ Task Get(string owner, string name, int number);
+
///
/// Creates a new for the specified repository.
///
@@ -38,6 +50,36 @@ namespace Octokit
/// The created .
Task CreateRelease(string owner, string name, ReleaseUpdate data);
+ ///
+ /// Edits an existing for the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// A description of the release to edit
+ /// Thrown when a general API error occurs.
+ /// The updated .
+ Task EditRelease(string owner, string name, ReleaseUpdate data);
+
+ ///
+ /// Deletes an existing for the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the release to delete
+ /// Thrown when a general API error occurs.
+ ///
+ Task DeleteRelease(string owner, string name, int number);
+
+ ///
+ /// Gets all for the specified release of the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the .
+ /// Thrown when a general API error occurs.
+ /// The list of for the specified release of the specified repository.
+ Task> GetAssets(string owner, string name, int number);
+
///
/// Uploads a for the specified release.
///
@@ -49,5 +91,36 @@ namespace Octokit
/// Thrown when a general API error occurs.
/// The created .
Task UploadAsset(Release release, ReleaseAssetUpload data);
+
+ ///
+ /// Gets the specified for the specified release of the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the
+ /// The id of the
+ /// The specified by the asset id.
+ Task GetAsset(string owner, string name, int releaseId, int assetId);
+
+ ///
+ /// Edits the for the specified release of the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the
+ /// The id of the
+ /// Description of the asset with its amended data
+ /// The edited .
+ Task EditAsset(string owner, string name, int releaseId, int assetId, ReleaseAssetUpdate data);
+
+ ///
+ /// Deletes the specified from the specified repository
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the .
+ ///
+ Task DeleteAsset(string owner, string name, int number);
+
}
}
diff --git a/Octokit/Clients/ReleasesClient.cs b/Octokit/Clients/ReleasesClient.cs
index 6ba6d73e..7324c7d3 100644
--- a/Octokit/Clients/ReleasesClient.cs
+++ b/Octokit/Clients/ReleasesClient.cs
@@ -40,6 +40,24 @@ namespace Octokit
return ApiConnection.GetAll(endpoint, null, "application/vnd.github.v3");
}
+ ///
+ /// Gets a single for the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the release
+ /// Thrown when a general API error occurs.
+ /// The specified by the id
+ public Task Get(string owner, string name, int number)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(number, "number");
+
+ var endpoint = ApiUrls.Releases(owner, name, number);
+ return ApiConnection.Get(endpoint);
+ }
+
///
/// Creates a new for the specified repository.
///
@@ -61,6 +79,60 @@ namespace Octokit
return ApiConnection.Post(endpoint, data, "application/vnd.github.v3");
}
+ ///
+ /// Edits an existing for the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// A description of the release to edit
+ /// Thrown when a general API error occurs.
+ /// The updated .
+ public Task EditRelease(string owner, string name, ReleaseUpdate data)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(data, "data");
+
+ var endpoint = ApiUrls.Releases(owner, name);
+ return ApiConnection.Patch(endpoint, data);
+ }
+
+ ///
+ /// Deletes an existing for the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the release to delete
+ /// Thrown when a general API error occurs.
+ ///
+ public Task DeleteRelease(string owner, string name, int number)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(number, "number");
+
+ var endpoint = ApiUrls.Releases(owner, name, number);
+ return ApiConnection.Delete(endpoint);
+ }
+
+ ///
+ /// Gets all for the specified release of the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the .
+ /// Thrown when a general API error occurs.
+ /// The list of for the specified release of the specified repository.
+ public Task> GetAssets(string owner, string name, int number)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(number, "number");
+
+ var endpoint = ApiUrls.ReleaseAssets(owner, name, number);
+ return ApiConnection.GetAll(endpoint, null, "application/vnd.github.v3");
+ }
+
///
/// Uploads a for the specified release.
///
@@ -76,12 +148,70 @@ namespace Octokit
Ensure.ArgumentNotNull(release, "release");
Ensure.ArgumentNotNull(data, "data");
- var endpoint = release.UploadUrl.ExpandUriTemplate(new {name = data.FileName});
+ var endpoint = release.UploadUrl.ExpandUriTemplate(new { name = data.FileName });
return ApiConnection.Post(
endpoint,
data.RawData,
"application/vnd.github.v3",
data.ContentType);
}
+
+ ///
+ /// Gets the specified for the specified release of the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the
+ /// The id of the
+ /// The specified by the asset id.
+ public Task GetAsset(string owner, string name, int releaseId, int assetId)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(releaseId, "releaseId");
+ Ensure.ArgumentNotNull(assetId, "assetId");
+
+ var endpoint = ApiUrls.ReleaseAssets(owner, name, releaseId, assetId);
+ return ApiConnection.Get(endpoint);
+ }
+
+ ///
+ /// Edits the for the specified release of the specified repository.
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the
+ /// The id of the
+ /// Description of the asset with its amended data
+ /// The edited .
+ public Task EditAsset(string owner, string name, int releaseId, int assetId, ReleaseAssetUpdate data)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(releaseId, "releaseId");
+ Ensure.ArgumentNotNull(assetId, "assetId");
+ Ensure.ArgumentNotNull(data, "data");
+ Ensure.ArgumentNotNullOrEmptyString(data.Name, "data.Name");
+
+ var endpoint = ApiUrls.ReleaseAssets(owner, name, releaseId, assetId);
+ return ApiConnection.Patch(endpoint, data);
+ }
+
+ ///
+ /// Deletes the specified from the specified repository
+ ///
+ /// The repository's owner
+ /// The repository's name
+ /// The id of the .
+ ///
+ public Task DeleteAsset(string owner, string name, int number)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(number, "number");
+
+ var endpoint = ApiUrls.Assets(owner, name, number);
+ return ApiConnection.Delete(endpoint);
+ }
}
}
diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs
index be4379eb..be0980ee 100644
--- a/Octokit/Helpers/ApiUrls.cs
+++ b/Octokit/Helpers/ApiUrls.cs
@@ -107,6 +107,55 @@ namespace Octokit
return "repos/{0}/{1}/releases".FormatUri(owner, name);
}
+ ///
+ /// Returns the that returns a single release for the specified repository
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The id of the release
+ ///
+ public static Uri Releases(string owner, string name, int number)
+ {
+ return "repos/{0}/{1}/releases/{2}".FormatUri(owner, name, number);
+ }
+
+ ///
+ /// Returns the that returns all the assets for the specified release for the specified repository.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The id of the release
+ ///
+ public static Uri ReleaseAssets(string owner, string name, int number)
+ {
+ return "repos/{0}/{1}/releases/{2}/assets".FormatUri(owner, name, number);
+ }
+
+ ///
+ /// Returns the that returns a single asset for the specified release for the specified repository.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The id of the release
+ /// The id of the release asset
+ ///
+ public static Uri ReleaseAssets(string owner, string name, int releaseId, int assetId)
+ {
+ return "repos/{0}/{1}/releases/{2}/assets/{3}".FormatUri(owner, name, releaseId, assetId);
+ }
+
+ ///
+ /// Returns the that returns all the assets for the specified repository.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The id of the release asset
+ ///
+ public static Uri Assets(string owner, string name, int number)
+ {
+ return "repos/{0}/{1}/releases/assets/{2}".FormatUri(owner, name, number);
+ }
+
///
/// Returns the that returns all of the authorizations for the currently logged in user.
///
diff --git a/Octokit/Models/Request/ReleaseAssetUpdate.cs b/Octokit/Models/Request/ReleaseAssetUpdate.cs
new file mode 100644
index 00000000..d97c6c94
--- /dev/null
+++ b/Octokit/Models/Request/ReleaseAssetUpdate.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Octokit
+{
+ public class ReleaseAssetUpdate
+ {
+ public string Name { get; set; }
+ public string Label { get; set; }
+ }
+}
diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj
index cc349c25..44aff67c 100644
--- a/Octokit/Octokit-Mono.csproj
+++ b/Octokit/Octokit-Mono.csproj
@@ -255,6 +255,7 @@
+
\ No newline at end of file
diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj
index f196e297..e2adfa43 100644
--- a/Octokit/Octokit-MonoAndroid.csproj
+++ b/Octokit/Octokit-MonoAndroid.csproj
@@ -265,6 +265,7 @@
+
\ No newline at end of file
diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj
index 1908e4b1..3728fac7 100644
--- a/Octokit/Octokit-Monotouch.csproj
+++ b/Octokit/Octokit-Monotouch.csproj
@@ -260,6 +260,7 @@
+
\ No newline at end of file
diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj
index c855b507..e59d2c0b 100644
--- a/Octokit/Octokit-netcore45.csproj
+++ b/Octokit/Octokit-netcore45.csproj
@@ -181,6 +181,7 @@
+
diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj
index 6402442c..43c87938 100644
--- a/Octokit/Octokit.csproj
+++ b/Octokit/Octokit.csproj
@@ -55,6 +55,7 @@
+