listInvitations method

Future<List<Invitation>?> listInvitations({
  1. String? status,
  2. String? query,
  3. String? orderBy,
  4. bool? paginated,
  5. int? limit,
  6. int? offset,
})

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 or id

  • 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 or members_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 their created_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 with limit.

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;
}