updateUser method

Future<User> updateUser({
  1. String? newName,
  2. String? newEmail,
  3. String? newBlog,
  4. String? newTwitterUsername,
  5. String? newCompany,
  6. String? newLocation,
  7. bool? newHireable,
  8. String? newBio,
  9. GithubClientAuth? githubClientAuth,
})

Implementation

Future<github_scheme_respond_scheme.User> updateUser({
  String? newName,
  String? newEmail,
  String? newBlog,
  String? newTwitterUsername,
  String? newCompany,
  String? newLocation,
  bool? newHireable,
  String? newBio,
  GithubClientAuth? githubClientAuth,
}) async {
  Map jsonData = {
    "name": newName,
    "email": newEmail,
    "blog": newBlog,
    "twitter_username": newTwitterUsername,
    "company": newCompany,
    "location": newLocation,
    "hireable": newHireable,
    "bio": newBio,
  };

  jsonData.removeWhere((key, value) => value == null);
  Map result = await invoke(
    uriPath: "user",
    parameters: jsonData,
    method_request: "patch",
    statusCodes: [200, 304],
    specialTypeName: "user",
    githubClientAuth: githubClientAuth,
  );
  github_scheme_respond_scheme.User user =
      github_scheme_respond_scheme.User(result);
  return user;
}