public async Task ChangePasswordAsync(string oldPassword, string newPassword) { JsonResponse response = await _json.PatchAsync(_url, new JsonDict { ["oldPassword"] = oldPassword, ["password"] = newPassword }); switch (response.StatusCode) { case HttpStatusCode.Unauthorized: throw new IdentityException(response.StatusCode, "The existing password does not match"); case HttpStatusCode.Conflict: throw new IdentityException(response.StatusCode, "The new password must differ from the existing one"); case HttpStatusCode.NoContent: return; default: response.StatusCode.Throw(); break; } }