SDK
SDK C# v2.x
2

UpdateSelfAsync #

Updates the current user object in Kuzzle.

Arguments #

public async Task<JObject> UpdateSelfAsync(JObject content);
ArgumentTypeDescription
content
JObject
JObject representing the user content

Return #

Return a JObject with the following properties:

PropertyTypeDescription
_id
string
User's kuid
_source
JObject
Additional (and optional) user properties

Exceptions #

Throws a KuzzleException if there is an error. See how to handle error.

Usage #

try {
  await kuzzle.Auth.LoginAsync(
    "local",
    JObject.Parse("{username: 'foo', password: 'bar'}"));
  JObject updatedUser = await kuzzle.Auth.UpdateSelfAsync(
    JObject.Parse("{age: 42}"));
  Console.WriteLine(updatedUser.ToString(Formatting.None));
  /*
  {
    "_id": "foo",
    "_source": {
      "profileIds": [
        "default"
      ],
      "_kuzzle_info": {
        "author": "-1",
        "createdAt": 1564566023173,
        "updatedAt": null,
        "updater": null
      },
      "age": 42
    }
  }
  */
} catch (KuzzleException e) {
  Console.WriteLine(e);
}