add active lock reason to PR (#2543)

* add active lock reason to PR

* update docs

* refactor: extract lock and unlock from IIssuesClient
create ILockUnlockClient so both IIssuesClient and IPullRequestClient can
access lock and unlock methods.

* refactor LockUnlock for reactive clients

* Update doc to include lock unlock sample code

* Use Assert.Null to check null value in test

Co-authored-by: notauserx <notauserx@users.noreply.github.com>
This commit is contained in:
notauserx
2022-08-19 23:36:47 +06:00
committed by GitHub
parent b866d669d6
commit 595e35d641
20 changed files with 405 additions and 255 deletions
+20
View File
@@ -120,3 +120,23 @@ Label changes probably requires some explanation:
If you're trying to populate the `Labels` collection by hand, you might hit
some exceptional behaviour due to these rules.
### Lock / Unlock
The lock and unlock methods are available on the ILockUnlockClient on IIssuesClient.
Heres a sample code for locking an issue:
```csharp
var issue = await client.Issue.Get("octokit", "octokit.net", 405);
await client.LockUnlock.Lock("octokit", "octokit.net", 405, LockReason.OffTopic);
```
The active lock reason can be accessed via the LockReason property on Issues class.
The code below demonstrates how to unlock an issue:
```csharp
var issue = await client.Issue.Get("octokit", "octokit.net", 405);
await client.LockUnlock.Unlock("octokit", "octokit.net", 405);
```