whoAmI

// Using callbacks (NodeJS or Web Browser)
kuzzle.whoAmI(function (err, result) {
  // "result" is a User object
});

// Using promises (NodeJS only)
kuzzle.whoAmIPromise()
  .then(res => {
    // "res" is a User object
  });
kuzzle.whoAmI(new ResponseListener<User>() {
  @Override
  public void onSuccess(User myself) {

  }

  @Override
  public void onError(JSONObject error) {

  }
});
<?php
use \Kuzzle\Kuzzle;
use \Kuzzle\Security\User;

$kuzzle = new Kuzzle('localhost');

try {
  $me = $kuzzle->whoAmI();
  // $me instanceof User
}
catch (ErrorException $e) {

}

Retrieves informations about the currently logged user.


whoAmI(callback)

ArgumentsTypeDescription
callbackfunctionCallback handling the response

Callback response

An instantiated User object.