Skip to content

Commit 3c05db4

Browse files
authored
Splitting out the misc client into separate clients as per current documentation (#2574)
1 parent 05aa951 commit 3c05db4

49 files changed

Lines changed: 1729 additions & 30 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
3+
namespace Octokit.Reactive
4+
{
5+
/// <summary>
6+
/// A client for GitHub's Emojis APIs.
7+
/// </summary>
8+
/// <remarks>
9+
/// See the <a href="https://docs.github.com/rest/emojis">Emojis API documentation</a> for more details.
10+
/// </remarks>
11+
public interface IObservableEmojisClient
12+
{
13+
/// <summary>
14+
/// Gets all the emojis available to use on GitHub.
15+
/// </summary>
16+
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
17+
/// <returns>An <see cref="IObservable{Emoji}"/> of emoji and their URI.</returns>
18+
IObservable<Emoji> GetAllEmojis();
19+
}
20+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
3+
namespace Octokit.Reactive
4+
{
5+
/// <summary>
6+
/// A client for GitHub's gitignore APIs.
7+
/// </summary>
8+
/// <remarks>
9+
/// See the <a href="https://docs.github.com/rest/gitignore">GitIgnore API documentation</a> for more details.
10+
/// </remarks>
11+
public interface IObservableGitIgnoreClient
12+
{
13+
/// <summary>
14+
/// List all templates available to pass as an option when creating a repository.
15+
/// </summary>
16+
/// <returns>An observable list of gitignore template names.</returns>
17+
IObservable<string> GetAllGitIgnoreTemplates();
18+
19+
/// <summary>
20+
/// Retrieves the source for a single GitIgnore template
21+
/// </summary>
22+
/// <param name="templateName">Returns the template source for the given template</param>
23+
IObservable<GitIgnoreTemplate> GetGitIgnoreTemplate(string templateName);
24+
}
25+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
3+
namespace Octokit.Reactive
4+
{
5+
/// <summary>
6+
/// A client for GitHub's licenses APIs.
7+
/// </summary>
8+
/// <remarks>
9+
/// See the <a href="https://docs.github.com/rest/licenses">Licenses API documentation</a> for more details.
10+
/// </remarks>
11+
public interface IObservableLicensesClient
12+
{
13+
/// <summary>
14+
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive
15+
/// list of all possible OSS licenses.
16+
/// </summary>
17+
/// <returns>A list of licenses available on the site</returns>
18+
IObservable<LicenseMetadata> GetAllLicenses();
19+
20+
/// <summary>
21+
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive
22+
/// list of all possible OSS licenses.
23+
/// </summary>
24+
/// <param name="options">Options for changing the API response</param>
25+
/// <returns>A list of licenses available on the site</returns>
26+
IObservable<LicenseMetadata> GetAllLicenses(ApiOptions options);
27+
28+
/// <summary>
29+
/// Retrieves a license based on the license key such as "MIT"
30+
/// </summary>
31+
/// <param name="key"></param>
32+
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns>
33+
IObservable<License> GetLicense(string key);
34+
}
35+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
3+
namespace Octokit.Reactive
4+
{
5+
/// <summary>
6+
/// A client for GitHub's markdown APIs.
7+
/// </summary>
8+
/// <remarks>
9+
/// See the <a href="https://docs.github.com/rest/markdown">Markdown API documentation</a> for more details.
10+
/// </remarks>
11+
public interface IObservableMarkdownClient
12+
{
13+
/// <summary>
14+
/// Gets the rendered Markdown for an arbitrary markdown document.
15+
/// </summary>
16+
/// <param name="markdown">An arbitrary Markdown document</param>
17+
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
18+
/// <returns>The rendered Markdown.</returns>
19+
IObservable<string> RenderArbitraryMarkdown(NewArbitraryMarkdown markdown);
20+
21+
/// <summary>
22+
/// Gets the rendered Markdown for the specified plain-text Markdown document.
23+
/// </summary>
24+
/// <param name="markdown">A plain-text Markdown document</param>
25+
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
26+
/// <returns>The rendered Markdown.</returns>
27+
IObservable<string> RenderRawMarkdown(string markdown);
28+
}
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
3+
namespace Octokit.Reactive
4+
{
5+
/// <summary>
6+
/// A client for GitHub's meta APIs.
7+
/// </summary>
8+
/// <remarks>
9+
/// See the <a href="https://docs.github.com/rest/meta">Meta API documentation</a> for more details.
10+
/// </remarks>
11+
public interface IObservableMetaClient
12+
{
13+
/// <summary>
14+
/// Retrieves information about GitHub.com, the service or a GitHub Enterprise installation.
15+
/// </summary>
16+
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
17+
/// <returns>An <see cref="Meta"/> containing metadata about the GitHub instance.</returns>
18+
IObservable<Meta> GetMetadata();
19+
}
20+
}
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
using System;
2-
using System.Diagnostics.CodeAnalysis;
32

43
namespace Octokit.Reactive
54
{
5+
[Obsolete("Use individual clients for these methods")]
66
public interface IObservableMiscellaneousClient
77
{
88
/// <summary>
99
/// Gets all the emojis available to use on GitHub.
1010
/// </summary>
1111
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
1212
/// <returns>An <see cref="IObservable{Emoji}"/> of emoji and their URI.</returns>
13-
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
14-
Justification = "Makes a network request")]
13+
[Obsolete("This client is being deprecated and will be removed in the future. Use EmojisClient.GetAllEmojis instead.")]
1514
IObservable<Emoji> GetAllEmojis();
1615

1716
/// <summary>
@@ -20,6 +19,7 @@ public interface IObservableMiscellaneousClient
2019
/// <param name="markdown">An arbitrary Markdown document</param>
2120
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
2221
/// <returns>The rendered Markdown.</returns>
22+
[Obsolete("This client is being deprecated and will be removed in the future. Use MarkdownClient.RenderArbitraryMarkdown instead.")]
2323
IObservable<string> RenderArbitraryMarkdown(NewArbitraryMarkdown markdown);
2424

2525
/// <summary>
@@ -28,27 +28,29 @@ public interface IObservableMiscellaneousClient
2828
/// <param name="markdown">A plain-text Markdown document</param>
2929
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
3030
/// <returns>The rendered Markdown.</returns>
31+
[Obsolete("This client is being deprecated and will be removed in the future. Use MarkdownClient.RenderRawMarkdown instead.")]
3132
IObservable<string> RenderRawMarkdown(string markdown);
3233

3334
/// <summary>
3435
/// List all templates available to pass as an option when creating a repository.
3536
/// </summary>
3637
/// <returns>An observable list of gitignore template names.</returns>
37-
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
38+
[Obsolete("This client is being deprecated and will be removed in the future. Use GitIgnoreClient.GetAllGitIgnoreTemplates instead.")]
3839
IObservable<string> GetAllGitIgnoreTemplates();
3940

4041
/// <summary>
4142
/// Retrieves the source for a single GitIgnore template
4243
/// </summary>
4344
/// <param name="templateName">Returns the template source for the given template</param>
45+
[Obsolete("This client is being deprecated and will be removed in the future. Use GitIgnoreClient.GetGitIgnoreTemplate instead.")]
4446
IObservable<GitIgnoreTemplate> GetGitIgnoreTemplate(string templateName);
4547

4648
/// <summary>
4749
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive
4850
/// list of all possible OSS licenses.
4951
/// </summary>
5052
/// <returns>A list of licenses available on the site</returns>
51-
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
53+
[Obsolete("This client is being deprecated and will be removed in the future. Use LicensesClient.GetAllLicenses instead.")]
5254
IObservable<LicenseMetadata> GetAllLicenses();
5355

5456
/// <summary>
@@ -57,29 +59,31 @@ public interface IObservableMiscellaneousClient
5759
/// </summary>
5860
/// <param name="options">Options for changing the API response</param>
5961
/// <returns>A list of licenses available on the site</returns>
62+
[Obsolete("This client is being deprecated and will be removed in the future. Use LicensesClient.GetAllLicenses instead.")]
6063
IObservable<LicenseMetadata> GetAllLicenses(ApiOptions options);
6164

6265
/// <summary>
6366
/// Retrieves a license based on the license key such as "MIT"
6467
/// </summary>
6568
/// <param name="key"></param>
6669
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns>
70+
[Obsolete("This client is being deprecated and will be removed in the future. Use LicensesClient.GetLicense instead.")]
6771
IObservable<License> GetLicense(string key);
6872

6973
/// <summary>
7074
/// Gets API Rate Limits (API service rather than header info).
7175
/// </summary>
7276
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
7377
/// <returns>An <see cref="MiscellaneousRateLimit"/> of Rate Limits.</returns>
74-
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
78+
[Obsolete("This client is being deprecated and will be removed in the future. Use RateLimitClient.GetRateLimits instead.")]
7579
IObservable<MiscellaneousRateLimit> GetRateLimits();
7680

7781
/// <summary>
7882
/// Retrieves information about GitHub.com, the service or a GitHub Enterprise installation.
7983
/// </summary>
8084
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
8185
/// <returns>An <see cref="Meta"/> containing metadata about the GitHub instance.</returns>
82-
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
86+
[Obsolete("This client is being deprecated and will be removed in the future. Use MetaClient.GetMetadata instead.")]
8387
IObservable<Meta> GetMetadata();
8488
}
8589
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
3+
namespace Octokit.Reactive
4+
{
5+
/// <summary>
6+
/// A client for GitHub's rate-limit APIs.
7+
/// </summary>
8+
/// <remarks>
9+
/// See the <a href="https://docs.github.com/rest/rate-limit">Rate-Limit API documentation</a> for more details.
10+
/// </remarks>
11+
public interface IObservableRateLimitClient
12+
{
13+
/// <summary>
14+
/// Gets API Rate Limits (API service rather than header info).
15+
/// </summary>
16+
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
17+
/// <returns>An <see cref="MiscellaneousRateLimit"/> of Rate Limits.</returns>
18+
IObservable<MiscellaneousRateLimit> GetRateLimits();
19+
}
20+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Reactive.Linq;
3+
using System.Reactive.Threading.Tasks;
4+
5+
namespace Octokit.Reactive
6+
{
7+
/// <summary>
8+
/// A client for GitHub's Emojis APIs.
9+
/// </summary>
10+
/// <remarks>
11+
/// See the <a href="https://docs.github.com/rest/emojis">Emojis API documentation</a> for more details.
12+
/// </remarks>
13+
public class ObservableEmojisClient : IObservableEmojisClient
14+
{
15+
private readonly IEmojisClient _client;
16+
17+
public ObservableEmojisClient(IGitHubClient client)
18+
{
19+
Ensure.ArgumentNotNull(client, nameof(client));
20+
21+
_client = client.Emojis;
22+
}
23+
24+
/// <summary>
25+
/// Gets all the emojis available to use on GitHub.
26+
/// </summary>
27+
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
28+
/// <returns>An <see cref="IObservable{Emoji}"/> of emoji and their URI.</returns>
29+
public IObservable<Emoji> GetAllEmojis()
30+
{
31+
return _client.GetAllEmojis().ToObservable().SelectMany(e => e);
32+
}
33+
}
34+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.Reactive.Linq;
3+
using System.Reactive.Threading.Tasks;
4+
5+
namespace Octokit.Reactive
6+
{
7+
/// <summary>
8+
/// A client for GitHub's gitignore APIs.
9+
/// </summary>
10+
/// <remarks>
11+
/// See the <a href="https://docs.github.com/rest/gitignore">GitIgnore API documentation</a> for more details.
12+
/// </remarks>
13+
public class ObservableGitIgnoreClient : IObservableGitIgnoreClient
14+
{
15+
private readonly IGitIgnoreClient _client;
16+
17+
public ObservableGitIgnoreClient(IGitHubClient client)
18+
{
19+
Ensure.ArgumentNotNull(client, nameof(client));
20+
21+
_client = client.GitIgnore;
22+
}
23+
24+
/// <summary>
25+
/// List all templates available to pass as an option when creating a repository.
26+
/// </summary>
27+
/// <returns>An observable list of gitignore template names.</returns>
28+
public IObservable<string> GetAllGitIgnoreTemplates()
29+
{
30+
return _client.GetAllGitIgnoreTemplates().ToObservable().SelectMany(t => t);
31+
}
32+
33+
/// <summary>
34+
/// Retrieves the source for a single GitIgnore template
35+
/// </summary>
36+
/// <param name="templateName">Returns the template source for the given template</param>
37+
public IObservable<GitIgnoreTemplate> GetGitIgnoreTemplate(string templateName)
38+
{
39+
return _client.GetGitIgnoreTemplate(templateName).ToObservable();
40+
}
41+
}
42+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using System.Reactive.Linq;
3+
using System.Reactive.Threading.Tasks;
4+
5+
namespace Octokit.Reactive
6+
{
7+
/// <summary>
8+
/// A client for GitHub's licenses APIs.
9+
/// </summary>
10+
/// <remarks>
11+
/// See the <a href="https://docs.github.com/rest/licenses">Licenses API documentation</a> for more details.
12+
/// </remarks>
13+
public class ObservableLicensesClient : IObservableLicensesClient
14+
{
15+
private readonly ILicensesClient _client;
16+
17+
public ObservableLicensesClient(IGitHubClient client)
18+
{
19+
Ensure.ArgumentNotNull(client, nameof(client));
20+
21+
_client = client.Licenses;
22+
}
23+
24+
/// <summary>
25+
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive
26+
/// list of all possible OSS licenses.
27+
/// </summary>
28+
/// <returns>A list of licenses available on the site</returns>
29+
public IObservable<LicenseMetadata> GetAllLicenses()
30+
{
31+
return GetAllLicenses(ApiOptions.None);
32+
}
33+
34+
/// <summary>
35+
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive
36+
/// list of all possible OSS licenses.
37+
/// </summary>
38+
/// <param name="options">Options for changing the API response</param>
39+
/// <returns>A list of licenses available on the site</returns>
40+
public IObservable<LicenseMetadata> GetAllLicenses(ApiOptions options)
41+
{
42+
return _client.GetAllLicenses(options).ToObservable().SelectMany(l => l);
43+
}
44+
45+
/// <summary>
46+
/// Retrieves a license based on the license key such as "MIT"
47+
/// </summary>
48+
/// <param name="key"></param>
49+
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns>
50+
public IObservable<License> GetLicense(string key)
51+
{
52+
return _client.GetLicense(key).ToObservable();
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)