deleteOrganization method

Future<DeletedObject?> deleteOrganization(
  1. String organizationId
)

Delete an organization

Deletes the given organization. Please note that deleting an organization will also delete all memberships and invitations. This is not reversible. After the organization is deleted, any user's active sessions that contain the deleted organization will be cleared.

Parameters:

  • String organizationId (required): The ID of the organization to delete

Implementation

Future<DeletedObject?> deleteOrganization(
  String organizationId,
) async {
  final response = await deleteOrganizationWithHttpInfo(
    organizationId,
  );
  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) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'DeletedObject',
    ) as DeletedObject;
  }
  return null;
}