listTenants method
Retrieves a list of tenants (single batch only) with a size of maxResults
starting from the offset as specified by pageToken. This is used to
retrieve all the tenants of a specified project in batches.
maxResults - The page size, 1000 if not specified. This is also
the maximum allowed limit.
pageToken - The next page token. If not specified, returns
tenants starting without any offset.
Returns a Future that resolves with a batch of downloaded tenants and the next page token.
Implementation
Future<ListTenantsResult> listTenants({
int maxResults = 1000,
String? pageToken,
}) async {
final response = await _authRequestHandler.listTenants(
maxResults: maxResults,
pageToken: pageToken,
);
final tenants = <Tenant>[];
final tenantsList = response['tenants'] as List<dynamic>?;
if (tenantsList != null) {
for (final tenantResponse in tenantsList) {
tenants.add(
Tenant._fromResponse(tenantResponse as Map<String, dynamic>),
);
}
}
return ListTenantsResult(
tenants: tenants,
pageToken: response['nextPageToken'] as String?,
);
}