markNotificationsRead method

Future<bool> markNotificationsRead(
  1. {DateTime? lastRead}
)

Marks all notifications up to lastRead as read.

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

Implementation

Future<bool> markNotificationsRead({DateTime? lastRead}) {
  final data = {};

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

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