Code to test URL for an enterprise instance. (#1404)

* Code to test URL for an enterprise instance.

Based on code we use in GitHub Desktop for Windows.

* Add an example of the enterprise probe

* Add helpful constructor to EnterpriseProbe

* Suppress code analysis warning
Add xml comments to ctors and make consistent with GitHubClient/Connection etc

* Update getting started to use the new EnterpriseProbe ctor
This commit is contained in:
Phil Haack
2016-09-20 22:28:12 -07:00
committed by Ryan Gribble
parent 93ae832311
commit 693cc29dd5
12 changed files with 258 additions and 1 deletions
+9 -1
View File
@@ -39,11 +39,19 @@ When authenticated, you have 5000 requests per hour available. So this is the re
Octokit also supports connecting to GitHub Enterprise environments - just provide the URL to your GitHub Enterprise server when creating the client.
```
```csharp
var ghe = new Uri("https://github.myenterprise.com/");
var client = new GitHubClient(new ProductHeaderValue("my-cool-app"), ghe);
```
You can use the `EnterpriseProbe` class to test whether a URL points to a Github Enterprise instance.
```csharp
var probe = new EnterpriseProbe(new ProductHeaderValue("my-cool-app"));
var result = await probe.Probe(new Uri("http://ghe.example.com/"));
Assert.Equal(EnterpriseProbeResult.Ok, result);
```
### Get some data
Once you have that setup, the simplest thing to experiment with is fetching details about a specific user: