editCurrentUser method

Future<CurrentUser> editCurrentUser({
  1. String? name,
  2. String? email,
  3. String? blog,
  4. String? company,
  5. String? location,
  6. bool? hireable,
  7. String? bio,
})

Updates the Current User.

API docs: https://developer.github.com/v3/users/#update-the-authenticated-user

Implementation

Future<CurrentUser> editCurrentUser({
  String? name,
  String? email,
  String? blog,
  String? company,
  String? location,
  bool? hireable,
  String? bio,
}) {
  final map = createNonNullMap(<String, dynamic>{
    'name': name,
    'email': email,
    'blog': blog,
    'company': company,
    'location': location,
    'hireable': hireable,
    'bio': bio,
  });

  return github.postJSON(
    '/user',
    body: GitHubJson.encode(map),
    statusCode: 200,
    convert: CurrentUser.fromJson,
  );
}