listInvitations method
List all invitations
Returns all non-revoked invitations for your application, sorted by creation date
Parameters:
-
String status: Filter invitations based on their status
-
String query: Filter invitations based on their
email_address
orid
-
String orderBy: Allows to return organizations in a particular order. At the moment, you can order the returned organizations either by their
name
,created_at
ormembers_count
. In order to specify the direction, you can use the+/-
symbols prepended in the property to order by. For example, if you want organizations to be returned in descending order according to theircreated_at
property, you can use-created_at
. If you don't use+
or-
, then+
is implied. -
bool paginated: Whether to paginate the results. If true, the results will be paginated. If false, the results will not be paginated.
-
int limit: Applies a limit to the number of results returned. Can be used for paginating the results together with
offset
. -
int offset: Skip the first
offset
results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction withlimit
.
Implementation
Future<List<Invitation>?> listInvitations({
String? status,
String? query,
String? orderBy,
bool? paginated,
int? limit,
int? offset,
}) async {
final response = await listInvitationsWithHttpInfo(
status: status,
query: query,
orderBy: orderBy,
paginated: paginated,
limit: limit,
offset: offset,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty &&
response.statusCode != HttpStatus.noContent) {
final responseBody = await _decodeBodyBytes(response);
return (await apiClient.deserializeAsync(responseBody, 'List<Invitation>')
as List)
.cast<Invitation>()
.toList(growable: false);
}
return null;
}