getOrganization method
Retrieve an organization by ID or slug
Fetches the organization whose ID or slug matches the provided id_or_slug
URL query parameter.
Parameters:
-
String organizationId (required): The ID or slug of the organization
-
bool includeMembersCount: Flag to denote whether or not the organization's members count should be included in the response.
-
bool includeMissingMemberWithElevatedPermissions: Flag to denote whether or not to include a member with elevated permissions who is not currently a member of the organization.
Implementation
Future<Organization?> getOrganization(
String organizationId, {
bool? includeMembersCount,
bool? includeMissingMemberWithElevatedPermissions,
}) async {
final response = await getOrganizationWithHttpInfo(
organizationId,
includeMembersCount: includeMembersCount,
includeMissingMemberWithElevatedPermissions:
includeMissingMemberWithElevatedPermissions,
);
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),
'Organization',
) as Organization;
}
return null;
}