list method
Retrieves all groups of a domain or of a user given a userKey (paginated).
Request parameters:
customer
- The unique ID for the customer's Google Workspace account. In
case of a multi-domain account, to fetch all groups for a customer, use
this field instead of domain
. You can also use the my_customer
alias
to represent your account's customerId
. The customerId
is also
returned as part of the [Users](/admin-sdk/directory/v1/reference/users)
resource. You must provide either the customer
or the domain
parameter.
domain
- The domain name. Use this field to get groups from only one
domain. To return all domains for a customer account, use the customer
query parameter instead.
maxResults
- Maximum number of results to return. Max allowed value is
200.
orderBy
- Column to use for sorting results
Possible string values are:
- "email" : Email of the group.
pageToken
- Token to specify next page in the list
query
- Query string search. Should be of the form "". Complete
documentation is at https:
//developers.google.com/admin-sdk/directory/v1/guides/search-groups
sortOrder
- Whether to return results in ascending or descending order.
Only of use when orderBy is also used
Possible string values are:
- "ASCENDING" : Ascending order.
- "DESCENDING" : Descending order.
userKey
- Email or immutable ID of the user if only those groups are to
be listed, the given user is a member of. If it's an ID, it should match
with the ID of the user object.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Groups.
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<Groups> list({
core.String? customer,
core.String? domain,
core.int? maxResults,
core.String? orderBy,
core.String? pageToken,
core.String? query,
core.String? sortOrder,
core.String? userKey,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (customer != null) 'customer': [customer],
if (domain != null) 'domain': [domain],
if (maxResults != null) 'maxResults': ['${maxResults}'],
if (orderBy != null) 'orderBy': [orderBy],
if (pageToken != null) 'pageToken': [pageToken],
if (query != null) 'query': [query],
if (sortOrder != null) 'sortOrder': [sortOrder],
if (userKey != null) 'userKey': [userKey],
if ($fields != null) 'fields': [$fields],
};
const url_ = 'admin/directory/v1/groups';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Groups.fromJson(response_ as core.Map<core.String, core.dynamic>);
}