markRepositoryNotificationsRead method

Future<bool> markRepositoryNotificationsRead(
  1. RepositorySlug slug, {
  2. DateTime? lastRead,
})

Marks all notifications up to lastRead in the specified repository as read.

API docs:https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository

Implementation

Future<bool> markRepositoryNotificationsRead(
  RepositorySlug slug, {
  DateTime? lastRead,
}) {
  final data = {};

  if (lastRead != null) {
    data['last_read_at'] = lastRead.toIso8601String();
  }

  return github
      .request('PUT', '/repos/${slug.fullName}/notifications',
          body: GitHubJson.encode(data))
      .then((response) {
    return response.statusCode == 205;
  });
}