list method

Future<UserRolesListResponse> list(
  1. String profileId, {
  2. bool? accountUserRoleOnly,
  3. List<String>? ids,
  4. int? maxResults,
  5. String? pageToken,
  6. String? searchString,
  7. String? sortField,
  8. String? sortOrder,
  9. String? subaccountId,
  10. String? $fields,
})

Retrieves a list of user roles, possibly filtered.

This method supports paging.

Request parameters:

profileId - User profile ID associated with this request. Value must have pattern ^\[^/\]+$.

accountUserRoleOnly - Select only account level user roles not associated with any specific subaccount.

ids - Select only user roles with the specified IDs.

maxResults - Maximum number of results to return.

pageToken - Value of the nextPageToken from the previous result page.

searchString - Allows searching for objects by name or ID. Wildcards () are allowed. For example, "userrole2015" will return objects with names like "userrole June 2015", "userrole April 2015", or simply "userrole 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "userrole" will match objects with name "my userrole", "userrole 2015", or simply "userrole".

sortField - Field by which to sort the list. Possible string values are:

  • "ID"
  • "NAME"

sortOrder - Order of sorted results. Possible string values are:

  • "ASCENDING" : Ascending order.
  • "DESCENDING" : Descending order.

subaccountId - Select only user roles that belong to this subaccount.

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

Completes with a UserRolesListResponse.

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<UserRolesListResponse> list(
  core.String profileId, {
  core.bool? accountUserRoleOnly,
  core.List<core.String>? ids,
  core.int? maxResults,
  core.String? pageToken,
  core.String? searchString,
  core.String? sortField,
  core.String? sortOrder,
  core.String? subaccountId,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (accountUserRoleOnly != null)
      'accountUserRoleOnly': ['${accountUserRoleOnly}'],
    if (ids != null) 'ids': ids,
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (searchString != null) 'searchString': [searchString],
    if (sortField != null) 'sortField': [sortField],
    if (sortOrder != null) 'sortOrder': [sortOrder],
    if (subaccountId != null) 'subaccountId': [subaccountId],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      'userprofiles/' + core.Uri.encodeFull('$profileId') + '/userRoles';

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