Skip to content

Commit

Permalink
Fixes #1750, changing description of productInformation param for cla…
Browse files Browse the repository at this point in the history
…rity (#1751)

* Updated GitHubClient.cs XML Docs to match dev docs.

* Updated Connection.cs XML Docs to match dev docs.

* Updated ProductHeaderValue.cs XML Docs to match GitHub dev docs.

* Updated EnterpriseProbe.cs XML Docs to match GitHub dev docs.

* Updated GitHubClient.cs XML Docs to match GitHub dev docs, corrected grammar issue.

* Updated Connection.cs XML Docs to match GitHub dev docs, corrected grammar issue.

* Updated ProductHeaderValue.cs XML Docs to match GitHub dev docs, corrected grammar issue.

* Removed my tabs, replaced with spaces to match format.

* Removed tabs again

* There seems to be some kind of bug where tabs are being shown though my local editor show none, so I'm submitting a bug to GitHub.com and editing in-browser to fix.

* Update GitHubClient.cs

* There seems to be some kind of bug where tabs are being shown though my local editor show none, so I'm submitting a bug to GitHub.com and editing in-browser to fix.

* Update Connection.cs

* There seems to be some kind of bug where tabs are being shown though my local editor show none, so I'm submitting a bug to GitHub.com and editing in-browser to fix.

* Change a couple of tabs to spaces

* tabs to spaces

* tabs to spaces
  • Loading branch information
IAmHughes authored and ryangribble committed Jan 31, 2018
1 parent 11e1c30 commit 81635c6
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 40 deletions.
18 changes: 12 additions & 6 deletions Octokit/Clients/Enterprise/EnterpriseProbe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ public class EnterpriseProbe : IEnterpriseProbe
/// <summary>
/// Creates a new EnterpriseProbe, used to check for the existence of GitHub Enterprise Instances
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public EnterpriseProbe(ProductHeaderValue productInformation)
Expand All @@ -32,9 +35,12 @@ public EnterpriseProbe(ProductHeaderValue productInformation)
/// <summary>
/// Creates a new EnterpriseProbe, used to check for the existence of GitHub Enterprise Instances
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
/// <param name="httpClient">
/// The client to use for executing requests
Expand All @@ -60,7 +66,7 @@ public EnterpriseProbe(ProductHeaderValue productInformation, IHttpClient httpCl
/// <see cref="EnterpriseProbeResult.NotFound"/>, or <see cref="EnterpriseProbeResult.Failed"/> in the case the request failed</returns>
public async Task<EnterpriseProbeResult> Probe(Uri enterpriseBaseUrl)
{
// This method should return NotFound if you happen to point it
// This method should return NotFound if you happen to point it
if (enterpriseBaseUrl.Host.Equals("github.com", StringComparison.OrdinalIgnoreCase)
|| enterpriseBaseUrl.Host.Equals("api.github.com", StringComparison.OrdinalIgnoreCase))
throw new ArgumentException("This method should not be passed a github.com or api.github.com URL", "enterpriseBaseUrl");
Expand Down Expand Up @@ -114,7 +120,7 @@ public enum EnterpriseProbeResult
NotFound,

/// <summary>
/// Request timed out or DNS failed. So it's probably the case it's not an enterprise server but
/// Request timed out or DNS failed. So it's probably the case it's not an enterprise server but
/// we can't know for sure.
/// </summary>
Failed
Expand Down
42 changes: 27 additions & 15 deletions Octokit/GitHubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,31 @@ public class GitHubClient : IGitHubClient
internal static readonly Uri GitHubDotComUrl = new Uri("https://github.com/");

/// <summary>
/// Create a new instance of the GitHub API v3 client pointing to
/// Create a new instance of the GitHub API v3 client pointing to
/// https://api.github.com/
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
public GitHubClient(ProductHeaderValue productInformation)
: this(new Connection(productInformation, GitHubApiUrl))
{
}

/// <summary>
/// Create a new instance of the GitHub API v3 client pointing to
/// Create a new instance of the GitHub API v3 client pointing to
/// https://api.github.com/
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
/// <param name="credentialStore">Provides credentials to the client when making requests</param>
public GitHubClient(ProductHeaderValue productInformation, ICredentialStore credentialStore)
Expand All @@ -44,12 +50,15 @@ public GitHubClient(ProductHeaderValue productInformation, ICredentialStore cred
/// <summary>
/// Create a new instance of the GitHub API v3 client pointing to the specified baseAddress.
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
/// <param name="baseAddress">
/// The address to point this client to. Typically used for GitHub Enterprise
/// The address to point this client to. Typically used for GitHub Enterprise
/// instances</param>
public GitHubClient(ProductHeaderValue productInformation, Uri baseAddress)
: this(new Connection(productInformation, FixUpBaseUri(baseAddress)))
Expand All @@ -59,13 +68,16 @@ public GitHubClient(ProductHeaderValue productInformation, Uri baseAddress)
/// <summary>
/// Create a new instance of the GitHub API v3 client pointing to the specified baseAddress.
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
/// <param name="credentialStore">Provides credentials to the client when making requests</param>
/// <param name="baseAddress">
/// The address to point this client to. Typically used for GitHub Enterprise
/// The address to point this client to. Typically used for GitHub Enterprise
/// instances</param>
public GitHubClient(ProductHeaderValue productInformation, ICredentialStore credentialStore, Uri baseAddress)
: this(new Connection(productInformation, FixUpBaseUri(baseAddress), credentialStore))
Expand Down Expand Up @@ -125,9 +137,9 @@ public ApiInfo GetLastApiInfo()
/// Convenience property for getting and setting credentials.
/// </summary>
/// <remarks>
/// You can use this property if you only have a single hard-coded credential. Otherwise, pass in an
/// <see cref="ICredentialStore"/> to the constructor.
/// Setting this property will change the <see cref="ICredentialStore"/> to use
/// You can use this property if you only have a single hard-coded credential. Otherwise, pass in an
/// <see cref="ICredentialStore"/> to the constructor.
/// Setting this property will change the <see cref="ICredentialStore"/> to use
/// the default <see cref="InMemoryCredentialStore"/> with just these credentials.
/// </remarks>
public Credentials Credentials
Expand Down
44 changes: 31 additions & 13 deletions Octokit/Http/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Octokit
{
// NOTE: Every request method must go through the `RunRequest` code path. So if you need to add a new method
// ensure it goes through there. :)
// ensure it goes through there. :)
/// <summary>
/// A connection for making HTTP requests against URI endpoints.
/// </summary>
Expand All @@ -31,9 +31,12 @@ public class Connection : IConnection
/// <summary>
/// Creates a new connection instance used to make requests of the GitHub API.
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
public Connection(ProductHeaderValue productInformation)
: this(productInformation, _defaultGitHubApiUrl, _anonymousCredentials)
Expand All @@ -43,9 +46,12 @@ public Connection(ProductHeaderValue productInformation)
/// <summary>
/// Creates a new connection instance used to make requests of the GitHub API.
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
/// <param name="httpClient">
/// The client to use for executing requests
Expand All @@ -58,9 +64,12 @@ public Connection(ProductHeaderValue productInformation, IHttpClient httpClient)
/// <summary>
/// Creates a new connection instance used to make requests of the GitHub API.
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
/// <param name="baseAddress">
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
Expand All @@ -73,9 +82,12 @@ public Connection(ProductHeaderValue productInformation, Uri baseAddress)
/// <summary>
/// Creates a new connection instance used to make requests of the GitHub API.
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
/// <param name="credentialStore">Provides credentials to the client when making requests</param>
public Connection(ProductHeaderValue productInformation, ICredentialStore credentialStore)
Expand All @@ -86,9 +98,12 @@ public Connection(ProductHeaderValue productInformation, ICredentialStore creden
/// <summary>
/// Creates a new connection instance used to make requests of the GitHub API.
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
/// <param name="baseAddress">
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
Expand All @@ -103,9 +118,12 @@ public Connection(ProductHeaderValue productInformation, Uri baseAddress, ICrede
/// <summary>
/// Creates a new connection instance used to make requests of the GitHub API.
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productInformation">
/// The name (and optionally version) of the product using this library. This is sent to the server as part of
/// the user agent for analytics purposes.
/// The name (and optionally version) of the product using this library, the name of your GitHub organization, or your GitHub username (in that order of preference). This is sent to the server as part of
/// the user agent for analytics purposes, and used by GitHub to contact you if there are problems.
/// </param>
/// <param name="baseAddress">
/// The address to point this client to such as https://api.github.com or the URL to a GitHub Enterprise
Expand Down
22 changes: 16 additions & 6 deletions Octokit/Http/ProductHeaderValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@
{
/// <summary>
/// Represents a product header value. This is used to generate the User Agent string sent with each request. The
/// name used should represent the product that's using Octokit.net.
/// name used should represent the product, the GitHub Organization, or the GitHub username that's using Octokit.net (in that order of preference).
/// </summary>
/// <remarks>
/// This class is a wrapper around <seealso href="https://msdn.microsoft.com/en-us/library/system.net.http.headers.productheadervalue(v=vs.118).aspx"/>
/// This class is a wrapper around <seealso href="https://msdn.microsoft.com/en-us/library/system.net.http.headers.productheadervalue(v=vs.118).aspx"/>
/// so that consumers of Octokit.net would not have to add a reference to the System.Net.Http.Headers namespace.
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
public class ProductHeaderValue
public class ProductHeaderValue
{
readonly System.Net.Http.Headers.ProductHeaderValue _productHeaderValue;

/// <summary>
/// Initializes a new instance of the <see cref="ProductHeaderValue"/> class.
/// </summary>
/// <param name="name">The name of the product that's using Octokit</param>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="name">The name of the product, the GitHub Organization, or the GitHub Username (in that order of preference) that's using Octokit</param>
public ProductHeaderValue(string name)
: this(new System.Net.Http.Headers.ProductHeaderValue(name))
{
Expand All @@ -24,7 +28,10 @@ public ProductHeaderValue(string name)
/// <summary>
/// Initializes a new instance of the <see cref="ProductHeaderValue"/> class.
/// </summary>
/// <param name="name">The name of the product that's using Octokit</param>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="name">The name of the product, the GitHub Organization, or the GitHub Username (in that order of preference) that's using Octokit</param>
/// <param name="version">The version of the product that's using Octokit</param>
public ProductHeaderValue(string name, string version)
: this(new System.Net.Http.Headers.ProductHeaderValue(name, version))
Expand All @@ -37,8 +44,11 @@ public ProductHeaderValue(string name, string version)
}

/// <summary>
/// The name of the product that's using Octokit
/// The name of the product, the GitHub Organization, or the GitHub Username that's using Octokit (in that order of preference)
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
public string Name
{
get { return _productHeaderValue.Name; }
Expand Down

0 comments on commit 81635c6

Please sign in to comment.