lock method

Future<void> lock(
  1. RepositorySlug slug,
  2. int number, {
  3. String? lockReason,
})

Lock an issue.

API docs: https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#lock-an-issue

The lockReason, if specified, must be one of: off-topic, too heated, resolved, spam.

Implementation

Future<void> lock(RepositorySlug slug, int number,
    {String? lockReason}) async {
  String body;
  if (lockReason != null) {
    body = GitHubJson.encode({'lock_reason': lockReason});
  } else {
    body = '{}';
  }
  await github.postJSON('/repos/${slug.fullName}/issues/$number/lock',
      body: body, statusCode: 204);
}