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
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. Contains one or more search clauses, each
with a field, operator, and value. For complete documentation, go to
Search for 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. Cannot be used with the customer
parameter.
$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>>{
'customer': ?customer == null ? null : [customer],
'domain': ?domain == null ? null : [domain],
'maxResults': ?maxResults == null ? null : ['${maxResults}'],
'orderBy': ?orderBy == null ? null : [orderBy],
'pageToken': ?pageToken == null ? null : [pageToken],
'query': ?query == null ? null : [query],
'sortOrder': ?sortOrder == null ? null : [sortOrder],
'userKey': ?userKey == null ? null : [userKey],
'fields': ?$fields == null ? null : [$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>);
}