forked from octokit/octokit.net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObservableEnvironmentsClient.cs
More file actions
52 lines (42 loc) · 1.89 KB
/
Copy pathObservableEnvironmentsClient.cs
File metadata and controls
52 lines (42 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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<DeploymentEnvironmentsResponse> GetAll(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return GetAll(owner, name, ApiOptions.None);
}
public IObservable<DeploymentEnvironmentsResponse> GetAll(long repositoryId)
{
return GetAll(repositoryId, ApiOptions.None);
}
public IObservable<DeploymentEnvironmentsResponse> 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<DeploymentEnvironmentsResponse>(
ApiUrls.DeploymentEnvironments(owner, name), options);
}
public IObservable<DeploymentEnvironmentsResponse> GetAll(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages<DeploymentEnvironmentsResponse>(
ApiUrls.DeploymentEnvironments(repositoryId), options);
}
}
}