retrieve method

Future<User> retrieve()

Retrieves the current authenticated user's information.

This method fetches the complete user profile for the currently authenticated user, including their ID, email, name, avatar, tags, and creation timestamp.

Returns

A Future that resolves to a User object containing the current user's information

Throws

  • CalljmpException if the user is not authenticated
  • HttpException if there's a network error

Example

try {
  final user = await calljmp.users.retrieve();
  print('Current user: ${user.name} (${user.email})');
} catch (e) {
  print('Failed to retrieve user: $e');
}

Implementation

Future<User> retrieve() => http
    .request("${_config.serviceUrl}/users")
    .use(http.context(_config))
    .use(http.access())
    .get()
    .json((json) => User.fromJson(json));