mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-01 10:25:36 +00:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user