get method

Future<User> get(
  1. String userKey, {
  2. String? customFieldMask,
  3. String? projection,
  4. String? viewType,
  5. String? $fields,
})

Retrieves a user.

Request parameters:

userKey - Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.

customFieldMask - A comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.

projection - What subset of fields to fetch for this user. Possible string values are:

  • "basic" : Do not include any custom fields for the user.
  • "custom" : Include custom fields from schemas requested in customFieldMask.
  • "full" : Include all fields associated with this user.

viewType - Whether to fetch the administrator-only or domain-wide public view of the user. For more information, see [Retrieve a user as a non-administrator](/admin-sdk/directory/v1/guides/manage-users#retrieve_users_non_admin). Possible string values are:

  • "admin_view" : Results include both administrator-only and domain-public fields for the user.
  • "domain_public" : Results only include fields for the user that are publicly visible to other users in the domain.

$fields - Selector specifying which fields to include in a partial response.

Completes with a User.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<User> get(
  core.String userKey, {
  core.String? customFieldMask,
  core.String? projection,
  core.String? viewType,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (customFieldMask != null) 'customFieldMask': [customFieldMask],
    if (projection != null) 'projection': [projection],
    if (viewType != null) 'viewType': [viewType],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      'admin/directory/v1/users/' + commons.escapeVariable('$userKey');

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return User.fromJson(response_ as core.Map<core.String, core.dynamic>);
}