diff --git a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
index 169f86e2ac..8e22e4622e 100644
--- a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs
@@ -226,10 +226,18 @@ public interface IObservableRepositoriesClient
/// Client for GitHub's Repository Deployments API
///
///
- /// See the Collaborators API documentation for more details
+ /// See the Deployments API documentation for more details
///
IObservableDeploymentsClient Deployment { get; }
+ ///
+ /// Client for GitHub's Repository Envirinments API
+ ///
+ ///
+ /// See the Envirinments API documentation for more details
+ ///
+ IObservableRepositoryDeployEnvironmentsClient Environment { get; }
+
///
/// Client for GitHub's Repository Statistics API.
/// Note that the GitHub API uses caching on these endpoints,
diff --git a/Octokit.Reactive/Clients/IObservableRepositoryDeployEnvironmentsClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryDeployEnvironmentsClient.cs
new file mode 100644
index 0000000000..4ac2577dec
--- /dev/null
+++ b/Octokit.Reactive/Clients/IObservableRepositoryDeployEnvironmentsClient.cs
@@ -0,0 +1,57 @@
+using Octokit.Models.Response;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Octokit.Reactive
+{
+ public interface IObservableRepositoryDeployEnvironmentsClient
+ {
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view deployments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ IObservable GetAll(string owner, string name);
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view deployments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// The Id of the repository
+ IObservable GetAll(long repositoryId);
+
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view deployments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Paging options
+ IObservable GetAll(string owner, string name, ApiOptions options);
+
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view deployments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// Repository ID
+ /// Paging options
+ IObservable GetAll(long repositoryId, ApiOptions options);
+ }
+}
diff --git a/Octokit.Reactive/Clients/ObservableEnvironmentsClient.cs b/Octokit.Reactive/Clients/ObservableEnvironmentsClient.cs
new file mode 100644
index 0000000000..f100b0708c
--- /dev/null
+++ b/Octokit.Reactive/Clients/ObservableEnvironmentsClient.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Reactive.Threading.Tasks;
+using Octokit.Models.Response;
+using Octokit.Reactive.Internal;
+
+namespace Octokit.Reactive.Clients
+{
+ public class ObservableEnvironmentsClient : IObservableRepositoryDeployEnvironmentsClient
+ {
+ readonly IRepositoryDeployEnvironmentsClient _client;
+ readonly IConnection _connection;
+
+ public ObservableEnvironmentsClient(IGitHubClient client)
+ {
+ Ensure.ArgumentNotNull(client, nameof(client));
+
+ _client = client.Repository.Environment;
+ _connection = client.Connection;
+ }
+
+ public IObservable GetAll(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
+ Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
+
+ return GetAll(owner, name, ApiOptions.None);
+ }
+
+ public IObservable GetAll(long repositoryId)
+ {
+ return GetAll(repositoryId, ApiOptions.None);
+ }
+
+ public IObservable GetAll(string owner, string name, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
+ Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
+ Ensure.ArgumentNotNull(options, nameof(options));
+
+ return _connection.GetAndFlattenAllPages(
+ ApiUrls.DeploymentEnvironments(owner, name), options);
+ }
+
+ public IObservable GetAll(long repositoryId, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, nameof(options));
+
+ return _connection.GetAndFlattenAllPages(
+ ApiUrls.DeploymentEnvironments(repositoryId), options);
+ }
+ }
+}
diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
index 199fc6fa00..bbef7b3968 100644
--- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
+++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs
@@ -27,6 +27,7 @@ public ObservableRepositoriesClient(IGitHubClient client)
Forks = new ObservableRepositoryForksClient(client);
Collaborator = new ObservableRepoCollaboratorsClient(client);
Deployment = new ObservableDeploymentsClient(client);
+ Environment = new ObservableEnvironmentsClient(client);
Statistics = new ObservableStatisticsClient(client);
PullRequest = new ObservablePullRequestsClient(client);
Branch = new ObservableRepositoryBranchesClient(client);
@@ -347,10 +348,19 @@ public IObservable GetAllForOrg(string organization, ApiOptions opti
/// Client for GitHub's Repository Deployments API
///
///
- /// See the Collaborators API documentation for more details
+ /// See the Deployments API documentation for more details
///
public IObservableDeploymentsClient Deployment { get; private set; }
+
+ ///
+ /// Client for GitHub's Repository Environments API
+ ///
+ ///
+ /// See the Environments API documentation for more details
+ ///
+ public IObservableRepositoryDeployEnvironmentsClient Environment { get; private set; }
+
///
/// Client for GitHub's Repository Statistics API
/// Note that the GitHub API uses caching on these endpoints,
diff --git a/Octokit.Tests/Clients/EnvironmentsClientTests.cs b/Octokit.Tests/Clients/EnvironmentsClientTests.cs
new file mode 100644
index 0000000000..629845ddac
--- /dev/null
+++ b/Octokit.Tests/Clients/EnvironmentsClientTests.cs
@@ -0,0 +1,145 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using NSubstitute;
+using Octokit;
+using Octokit.Models.Response;
+using Octokit.Tests;
+using Xunit;
+
+
+namespace Octokit.Tests.Clients
+{
+ public class EnvironmentsClientTests
+ {
+ public class TheGetAllMethod
+ {
+ const string name = "name";
+ const string owner = "owner";
+ const long repositoryId = 1;
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
+ {
+ var client = new DeploymentEnvironmentsClient(Substitute.For());
+
+ await Assert.ThrowsAsync(() => client.GetAll(null, name));
+ await Assert.ThrowsAsync(() => client.GetAll(owner, null));
+ await Assert.ThrowsAsync(() => client.GetAll(owner, name, null));
+
+ await Assert.ThrowsAsync(() => client.GetAll(repositoryId, null));
+ }
+
+ [Fact]
+ public async Task EnsuresNonEmptyArguments()
+ {
+ var client = new DeploymentEnvironmentsClient(Substitute.For());
+
+ await Assert.ThrowsAsync(() => client.GetAll("", name));
+ await Assert.ThrowsAsync(() => client.GetAll(owner, ""));
+ }
+
+ [Theory]
+ [InlineData(" ")]
+ [InlineData("\n")]
+ [InlineData("\t")]
+ [InlineData(" ")]
+ [InlineData("\n\r")]
+ public async Task EnsuresNonWhitespaceArguments(string whitespace)
+ {
+ var client = new DeploymentEnvironmentsClient(Substitute.For());
+
+ await Assert.ThrowsAsync(() => client.GetAll(whitespace, name));
+ await Assert.ThrowsAsync(() => client.GetAll(owner, whitespace));
+ }
+
+ [Fact]
+ public async Task RequestsCorrectUrl()
+ {
+ var connection = Substitute.For();
+ var client = new DeploymentEnvironmentsClient(connection);
+ var expectedUrl = string.Format("repos/{0}/{1}/environments", owner, name);
+
+ var res = await client.GetAll(owner, name);
+
+ connection.Received()
+ .Get(
+ Arg.Is(u => u.ToString() == expectedUrl));
+ }
+
+ [Fact]
+ public async Task RequestsCorrectUrlWithRepositoryId()
+ {
+ var connection = Substitute.For();
+ var client = new DeploymentEnvironmentsClient(connection);
+ var expectedUrl = string.Format("repositories/{0}/environments", repositoryId);
+
+ await client.GetAll(repositoryId);
+
+ connection.Received()
+ .Get(Arg.Is(u => u.ToString() == expectedUrl));
+ }
+
+ [Fact]
+ public async Task RequestsCorrectUrlWithApiOptions()
+ {
+ var connection = Substitute.For();
+ var client = new DeploymentEnvironmentsClient(connection);
+ var expectedUrl = string.Format("repos/{0}/{1}/environments", owner, name);
+
+ var options = new ApiOptions
+ {
+ PageSize = 10,
+ StartPage = 1
+ };
+
+ await client.GetAll(owner, name, options);
+
+ connection.Received()
+ .Get(Arg.Is(u => u.ToString() == expectedUrl),
+ Arg.Is>(u => u["per_page"] == "10" && u["page"] == "1"));
+ }
+
+ [Fact]
+ public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions()
+ {
+ var connection = Substitute.For();
+ var client = new DeploymentEnvironmentsClient(connection);
+ var expectedUrl = string.Format("repositories/{0}/environments", repositoryId);
+
+ var options = new ApiOptions
+ {
+ PageSize = 10,
+ StartPage = 1
+ };
+
+ await client.GetAll(repositoryId, options);
+
+ connection.Received()
+ .Get(Arg.Is(u => u.ToString() == expectedUrl),
+ Arg.Is>(u => u["per_page"] == "10" && u["page"] == "1"));
+ }
+
+ [Fact]
+ public void RequestsCorrectUrlWithPreviewAcceptHeaders()
+ {
+ var connection = Substitute.For();
+ var client = new DeploymentEnvironmentsClient(connection);
+ var expectedUrl = string.Format("repos/{0}/{1}/environments", owner, name);
+
+ client.GetAll(owner, name);
+ connection.Received()
+ .Get(Arg.Is(u => u.ToString() == expectedUrl));
+ }
+ }
+
+ public class TheCtor
+ {
+ [Fact]
+ public void EnsuresNonNullArguments()
+ {
+ Assert.Throws(() => new DeploymentEnvironmentsClient(null));
+ }
+ }
+ }
+}
diff --git a/Octokit/Clients/DeploymentEnvironmentsClient.cs b/Octokit/Clients/DeploymentEnvironmentsClient.cs
new file mode 100644
index 0000000000..b5a245fa1c
--- /dev/null
+++ b/Octokit/Clients/DeploymentEnvironmentsClient.cs
@@ -0,0 +1,115 @@
+using Octokit.Models.Response;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Xml.Linq;
+
+namespace Octokit
+{
+ ///
+ /// A client for GitHub's Repository Deployment Environments API.
+ /// Gets Deployment Environments.
+ ///
+ ///
+ /// See the Repository Deployment Environments API documentation for more information.
+ ///
+ public class DeploymentEnvironmentsClient : ApiClient, IRepositoryDeployEnvironmentsClient
+ {
+ ///
+ /// Instantiates a new GitHub Repository Environments API client.
+ ///
+ /// An API connection
+ public DeploymentEnvironmentsClient(IApiConnection apiConnection) : base(apiConnection) { }
+
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view environments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ [ManualRoute("GET", "/repos/{owner}/{repo}/environments")]
+ public Task GetAll(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
+ Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
+
+ return GetAll(owner, name, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view environments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// The Id of the repository
+ [ManualRoute("GET", "/repositories/{id}/environments")]
+ public Task GetAll(long repositoryId)
+ {
+ return GetAll(repositoryId, ApiOptions.None);
+ }
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view environments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Paging options
+ [ManualRoute("GET", "/repos/{owner}/{repo}/environments")]
+ public Task GetAll(string owner, string name, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
+ Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
+ Ensure.ArgumentNotNull(options, nameof(options));
+
+ Dictionary prms = null;
+ if (options != ApiOptions.None)
+ {
+ prms = new Dictionary();
+ prms.Add("per_page", options.PageSize.ToString());
+ prms.Add("page", options.StartPage.ToString());
+ }
+
+ if (prms != null)
+ return ApiConnection.Get(ApiUrls.DeploymentEnvironments(owner, name), prms);
+ else
+ return ApiConnection.Get(ApiUrls.DeploymentEnvironments(owner, name));
+ }
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view environments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// Repository ID
+ /// Paging options
+ [ManualRoute("GET", "/repositories/{id}/environments")]
+ public Task GetAll(long repositoryId, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, nameof(options));
+
+ Dictionary prms = null;
+ if (options != ApiOptions.None)
+ {
+ prms = new Dictionary();
+ prms.Add("per_page", options.PageSize.ToString());
+ prms.Add("page", options.StartPage.ToString());
+ }
+
+ if (prms != null)
+ return ApiConnection.Get(ApiUrls.DeploymentEnvironments(repositoryId), prms);
+ else
+ return ApiConnection.Get(ApiUrls.DeploymentEnvironments(repositoryId));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit/Clients/IRepositoriesClient.cs b/Octokit/Clients/IRepositoriesClient.cs
index b8976f0706..5ccb62c744 100644
--- a/Octokit/Clients/IRepositoriesClient.cs
+++ b/Octokit/Clients/IRepositoriesClient.cs
@@ -344,6 +344,14 @@ public interface IRepositoriesClient
///
IDeploymentsClient Deployment { get; }
+ ///
+ /// Client for GitHub's Repository Environments API
+ ///
+ ///
+ /// See the Environments API documentation for more details
+ ///
+ IRepositoryDeployEnvironmentsClient Environment { get; }
+
///
/// Client for GitHub's Repository Statistics API.
/// Note that the GitHub API uses caching on these endpoints,
@@ -739,4 +747,4 @@ public interface IRepositoriesClient
[ManualRoute("GET", "/repositories/{id}/codeowners/errors")]
Task GetAllCodeOwnersErrors(long repositoryId);
}
-}
+}
\ No newline at end of file
diff --git a/Octokit/Clients/IRepositoryDeployEnvironmentsClient.cs b/Octokit/Clients/IRepositoryDeployEnvironmentsClient.cs
new file mode 100644
index 0000000000..a67a2270a9
--- /dev/null
+++ b/Octokit/Clients/IRepositoryDeployEnvironmentsClient.cs
@@ -0,0 +1,61 @@
+using Octokit.Models.Response;
+using System.Threading.Tasks;
+
+namespace Octokit
+{
+ ///
+ /// A client for GitHub's Repository Deployment Environments API.
+ /// Gets Deployment Environments.
+ ///
+ ///
+ /// See the Repository Deployment Environments API documentation for more information.
+ ///
+ public interface IRepositoryDeployEnvironmentsClient
+ {
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view deployments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ Task GetAll(string owner, string name);
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view deployments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// The Id of the repository
+ Task GetAll(long repositoryId);
+
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view deployments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Paging options
+ Task GetAll(string owner, string name, ApiOptions options);
+
+
+ ///
+ /// Gets all the environments for the specified repository. Any user with pull access
+ /// to a repository can view deployments.
+ ///
+ ///
+ /// https://docs.github.com/en/rest/deployments/environments#list-environments
+ ///
+ /// Repository ID
+ /// Paging options
+ Task GetAll(long repositoryId, ApiOptions options);
+ }
+}
diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs
index 9d208a7b6f..29e8563bf2 100644
--- a/Octokit/Clients/RepositoriesClient.cs
+++ b/Octokit/Clients/RepositoriesClient.cs
@@ -4,6 +4,7 @@
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
+using System.Net.Http.Headers;
namespace Octokit
{
@@ -27,6 +28,7 @@ public RepositoriesClient(IApiConnection apiConnection) : base(apiConnection)
Collaborator = new RepoCollaboratorsClient(apiConnection);
Statistics = new StatisticsClient(apiConnection);
Deployment = new DeploymentsClient(apiConnection);
+ Environment = new DeploymentEnvironmentsClient(apiConnection);
PullRequest = new PullRequestsClient(apiConnection);
Comment = new RepositoryCommentsClient(apiConnection);
Commit = new RepositoryCommitsClient(apiConnection);
@@ -538,6 +540,14 @@ public Task> GetAllForOrg(string organization, ApiOpti
///
public IDeploymentsClient Deployment { get; private set; }
+ ///
+ /// Client for GitHub's Repository Deployment Environments API
+ ///
+ ///
+ /// See the Deployments Environments API documentation for more details
+ ///
+ public IRepositoryDeployEnvironmentsClient Environment { get; private set; }
+
///
/// Client for GitHub's Repository Statistics API
/// Note that the GitHub API uses caching on these endpoints,
diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs
index c6d57704ca..88a8b95270 100644
--- a/Octokit/Helpers/ApiUrls.cs
+++ b/Octokit/Helpers/ApiUrls.cs
@@ -2478,6 +2478,17 @@ public static Uri Deployments(string owner, string name)
return "repos/{0}/{1}/deployments".FormatUri(owner, name);
}
+ ///
+ /// Returns the for the Deployment Environments API for the given repository.
+ ///
+ /// Owner of the repository
+ /// Name of the repository
+ /// The for the Deployments API for the given repository.
+ public static Uri DeploymentEnvironments(string owner, string name)
+ {
+ return "repos/{0}/{1}/environments".FormatUri(owner, name);
+ }
+
///
/// Returns the for the Deployment Statuses API for the given deployment.
///
@@ -3137,6 +3148,16 @@ public static Uri Deployments(long repositoryId)
return "repositories/{0}/deployments".FormatUri(repositoryId);
}
+ ///
+ /// Returns the for the Deployment Environments API for the given repository.
+ ///
+ /// The Id of the repository
+ /// The for the Deployments API for the given repository.
+ public static Uri DeploymentEnvironments(long repositoryId)
+ {
+ return "repositories/{0}/environments".FormatUri(repositoryId);
+ }
+
///
/// Returns the for the Deployment Statuses API for the given deployment.
///
diff --git a/Octokit/Models/Request/ApiOptions.cs b/Octokit/Models/Request/ApiOptions.cs
index cdc3cbf379..3dbfd1d40a 100644
--- a/Octokit/Models/Request/ApiOptions.cs
+++ b/Octokit/Models/Request/ApiOptions.cs
@@ -7,9 +7,11 @@ namespace Octokit
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class ApiOptions
{
+ private static ApiOptions emptyOptions = new ApiOptions();
+
public static ApiOptions None
{
- get { return new ApiOptions(); }
+ get { return emptyOptions; }
}
///
diff --git a/Octokit/Models/Response/DeploymentEnvironment.cs b/Octokit/Models/Response/DeploymentEnvironment.cs
new file mode 100644
index 0000000000..88fe5c97d7
--- /dev/null
+++ b/Octokit/Models/Response/DeploymentEnvironment.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Diagnostics;
+using System.Text;
+using System.Globalization;
+
+namespace Octokit.Models.Response
+{
+ [SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces",
+ Justification = "People can use fully qualified names if they want to use both.")]
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ public class DeploymentEnvironment
+ {
+ public DeploymentEnvironment() { }
+
+ public DeploymentEnvironment(int id, string nodeID, string name, string url, string htmlUrl, DateTimeOffset createdAt, DateTimeOffset updatedAt)
+ {
+ Id = id;
+ NodeId = nodeID;
+ Name = name;
+ Url = url;
+ HtmlUrl = htmlUrl;
+ CreatedAt = createdAt;
+ UpdatedAt = updatedAt;
+ }
+
+ ///
+ /// Id of this deployment environment
+ ///
+ public int Id { get; private set; }
+
+ ///
+ /// GraphQL Node Id
+ ///
+ public string NodeId{ get; private set; }
+
+ ///
+ /// Environment Name
+ ///
+ public string Name { get; private set; }
+
+ ///
+ /// Environment API URL
+ ///
+ public string Url { get; private set; }
+
+ ///
+ /// Environment HTML URL
+ ///
+ public string HtmlUrl { get; private set; }
+
+ ///
+ /// Date and time that the environment was created.
+ ///
+ public DateTimeOffset CreatedAt { get; private set; }
+
+ ///
+ /// Date and time that the environment was updated.
+ ///
+ public DateTimeOffset UpdatedAt { get; private set; }
+
+ internal string DebuggerDisplay
+ {
+ get
+ {
+ return string.Format(CultureInfo.InvariantCulture, "Name: {0}, CreatedAt: {1}", Name, CreatedAt);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit/Models/Response/DeploymentEnvironmentsResponse.cs b/Octokit/Models/Response/DeploymentEnvironmentsResponse.cs
new file mode 100644
index 0000000000..e4ef6bd412
--- /dev/null
+++ b/Octokit/Models/Response/DeploymentEnvironmentsResponse.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Diagnostics;
+using System.Text;
+using System.Globalization;
+
+namespace Octokit.Models.Response
+{
+ [SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces",
+ Justification = "People can use fully qualified names if they want to use both.")]
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ public class DeploymentEnvironmentsResponse
+ {
+ public DeploymentEnvironmentsResponse() { }
+
+
+ public DeploymentEnvironmentsResponse(int totalCount, IReadOnlyList environments)
+ {
+ TotalCount = totalCount;
+ Environments = environments;
+ }
+
+ ///
+ /// The total count of secrets for the repository
+ ///
+ public int TotalCount { get; private set; }
+
+ ///
+ /// The list of secrets for the repository
+ ///
+ public IReadOnlyList Environments { get; private set; }
+
+ internal string DebuggerDisplay
+ {
+ get
+ {
+ return string.Format(CultureInfo.InvariantCulture, "Count: {0}", TotalCount);
+ }
+ }
+ }
+}
\ No newline at end of file