-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Splitting out the misc client into separate clients as per current do…
…cumentation (#2574)
- Loading branch information
1 parent
05aa951
commit 3c05db4
Showing
49 changed files
with
1,729 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's Emojis APIs. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/emojis">Emojis API documentation</a> for more details. | ||
/// </remarks> | ||
public interface IObservableEmojisClient | ||
{ | ||
/// <summary> | ||
/// Gets all the emojis available to use on GitHub. | ||
/// </summary> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>An <see cref="IObservable{Emoji}"/> of emoji and their URI.</returns> | ||
IObservable<Emoji> GetAllEmojis(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's gitignore APIs. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/gitignore">GitIgnore API documentation</a> for more details. | ||
/// </remarks> | ||
public interface IObservableGitIgnoreClient | ||
{ | ||
/// <summary> | ||
/// List all templates available to pass as an option when creating a repository. | ||
/// </summary> | ||
/// <returns>An observable list of gitignore template names.</returns> | ||
IObservable<string> GetAllGitIgnoreTemplates(); | ||
|
||
/// <summary> | ||
/// Retrieves the source for a single GitIgnore template | ||
/// </summary> | ||
/// <param name="templateName">Returns the template source for the given template</param> | ||
IObservable<GitIgnoreTemplate> GetGitIgnoreTemplate(string templateName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's licenses APIs. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/licenses">Licenses API documentation</a> for more details. | ||
/// </remarks> | ||
public interface IObservableLicensesClient | ||
{ | ||
/// <summary> | ||
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive | ||
/// list of all possible OSS licenses. | ||
/// </summary> | ||
/// <returns>A list of licenses available on the site</returns> | ||
IObservable<LicenseMetadata> GetAllLicenses(); | ||
|
||
/// <summary> | ||
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive | ||
/// list of all possible OSS licenses. | ||
/// </summary> | ||
/// <param name="options">Options for changing the API response</param> | ||
/// <returns>A list of licenses available on the site</returns> | ||
IObservable<LicenseMetadata> GetAllLicenses(ApiOptions options); | ||
|
||
/// <summary> | ||
/// Retrieves a license based on the license key such as "MIT" | ||
/// </summary> | ||
/// <param name="key"></param> | ||
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns> | ||
IObservable<License> GetLicense(string key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's markdown APIs. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/markdown">Markdown API documentation</a> for more details. | ||
/// </remarks> | ||
public interface IObservableMarkdownClient | ||
{ | ||
/// <summary> | ||
/// Gets the rendered Markdown for an arbitrary markdown document. | ||
/// </summary> | ||
/// <param name="markdown">An arbitrary Markdown document</param> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>The rendered Markdown.</returns> | ||
IObservable<string> RenderArbitraryMarkdown(NewArbitraryMarkdown markdown); | ||
|
||
/// <summary> | ||
/// Gets the rendered Markdown for the specified plain-text Markdown document. | ||
/// </summary> | ||
/// <param name="markdown">A plain-text Markdown document</param> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>The rendered Markdown.</returns> | ||
IObservable<string> RenderRawMarkdown(string markdown); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's meta APIs. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/meta">Meta API documentation</a> for more details. | ||
/// </remarks> | ||
public interface IObservableMetaClient | ||
{ | ||
/// <summary> | ||
/// Retrieves information about GitHub.com, the service or a GitHub Enterprise installation. | ||
/// </summary> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>An <see cref="Meta"/> containing metadata about the GitHub instance.</returns> | ||
IObservable<Meta> GetMetadata(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's rate-limit APIs. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/rate-limit">Rate-Limit API documentation</a> for more details. | ||
/// </remarks> | ||
public interface IObservableRateLimitClient | ||
{ | ||
/// <summary> | ||
/// Gets API Rate Limits (API service rather than header info). | ||
/// </summary> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>An <see cref="MiscellaneousRateLimit"/> of Rate Limits.</returns> | ||
IObservable<MiscellaneousRateLimit> GetRateLimits(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Reactive.Linq; | ||
using System.Reactive.Threading.Tasks; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's Emojis APIs. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/emojis">Emojis API documentation</a> for more details. | ||
/// </remarks> | ||
public class ObservableEmojisClient : IObservableEmojisClient | ||
{ | ||
private readonly IEmojisClient _client; | ||
|
||
public ObservableEmojisClient(IGitHubClient client) | ||
{ | ||
Ensure.ArgumentNotNull(client, nameof(client)); | ||
|
||
_client = client.Emojis; | ||
} | ||
|
||
/// <summary> | ||
/// Gets all the emojis available to use on GitHub. | ||
/// </summary> | ||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception> | ||
/// <returns>An <see cref="IObservable{Emoji}"/> of emoji and their URI.</returns> | ||
public IObservable<Emoji> GetAllEmojis() | ||
{ | ||
return _client.GetAllEmojis().ToObservable().SelectMany(e => e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Reactive.Linq; | ||
using System.Reactive.Threading.Tasks; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's gitignore APIs. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/gitignore">GitIgnore API documentation</a> for more details. | ||
/// </remarks> | ||
public class ObservableGitIgnoreClient : IObservableGitIgnoreClient | ||
{ | ||
private readonly IGitIgnoreClient _client; | ||
|
||
public ObservableGitIgnoreClient(IGitHubClient client) | ||
{ | ||
Ensure.ArgumentNotNull(client, nameof(client)); | ||
|
||
_client = client.GitIgnore; | ||
} | ||
|
||
/// <summary> | ||
/// List all templates available to pass as an option when creating a repository. | ||
/// </summary> | ||
/// <returns>An observable list of gitignore template names.</returns> | ||
public IObservable<string> GetAllGitIgnoreTemplates() | ||
{ | ||
return _client.GetAllGitIgnoreTemplates().ToObservable().SelectMany(t => t); | ||
} | ||
|
||
/// <summary> | ||
/// Retrieves the source for a single GitIgnore template | ||
/// </summary> | ||
/// <param name="templateName">Returns the template source for the given template</param> | ||
public IObservable<GitIgnoreTemplate> GetGitIgnoreTemplate(string templateName) | ||
{ | ||
return _client.GetGitIgnoreTemplate(templateName).ToObservable(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
using System.Reactive.Linq; | ||
using System.Reactive.Threading.Tasks; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's licenses APIs. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/licenses">Licenses API documentation</a> for more details. | ||
/// </remarks> | ||
public class ObservableLicensesClient : IObservableLicensesClient | ||
{ | ||
private readonly ILicensesClient _client; | ||
|
||
public ObservableLicensesClient(IGitHubClient client) | ||
{ | ||
Ensure.ArgumentNotNull(client, nameof(client)); | ||
|
||
_client = client.Licenses; | ||
} | ||
|
||
/// <summary> | ||
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive | ||
/// list of all possible OSS licenses. | ||
/// </summary> | ||
/// <returns>A list of licenses available on the site</returns> | ||
public IObservable<LicenseMetadata> GetAllLicenses() | ||
{ | ||
return GetAllLicenses(ApiOptions.None); | ||
} | ||
|
||
/// <summary> | ||
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive | ||
/// list of all possible OSS licenses. | ||
/// </summary> | ||
/// <param name="options">Options for changing the API response</param> | ||
/// <returns>A list of licenses available on the site</returns> | ||
public IObservable<LicenseMetadata> GetAllLicenses(ApiOptions options) | ||
{ | ||
return _client.GetAllLicenses(options).ToObservable().SelectMany(l => l); | ||
} | ||
|
||
/// <summary> | ||
/// Retrieves a license based on the license key such as "MIT" | ||
/// </summary> | ||
/// <param name="key"></param> | ||
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns> | ||
public IObservable<License> GetLicense(string key) | ||
{ | ||
return _client.GetLicense(key).ToObservable(); | ||
} | ||
} | ||
} |
Oops, something went wrong.