listOrganizationsWithHttpInfo method
Get a list of organizations for an instance
This request returns the list of organizations for an instance. Results can be paginated using the optional limit
and offset
query parameters. The organizations are ordered by descending creation date. Most recent organizations will be returned first.
Note: This method returns the HTTP Response
.
Parameters:
-
bool includeMembersCount: Flag to denote whether the member counts of each organization should be included in the response or not.
-
bool includeMissingMemberWithElevatedPermissions: Flag to denote whether or not to include a member with elevated permissions who is not currently a member of the organization.
-
String query: Returns organizations with ID, name, or slug that match the given query. Uses exact match for organization ID and partial match for name and slug.
-
List<String> userId: Returns organizations with the user ids specified. Any user ids not found are ignored. For each user id, the
+
and-
can be prepended to the id, which denote whether the respective organization should be included or excluded from the result set. -
List<String> organizationId: Returns organizations with the organization ids specified. Any organization ids not found are ignored. For each organization id, the
+
and-
can be prepended to the id, which denote whether the respective organization should be included or excluded from the result set. Accepts up to 100 organization ids. Example: ?organization_id=+org_1&organization_id=-org_2 -
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. Defaults to-created_at
. -
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<http.Response> listOrganizationsWithHttpInfo({
bool? includeMembersCount,
bool? includeMissingMemberWithElevatedPermissions,
String? query,
List<String>? userId,
List<String>? organizationId,
String? orderBy,
int? limit,
int? offset,
}) async {
// ignore: prefer_const_declarations
final path = r'/organizations';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (includeMembersCount != null) {
queryParams.addAll(
_queryParams('', 'include_members_count', includeMembersCount));
}
if (includeMissingMemberWithElevatedPermissions != null) {
queryParams.addAll(_queryParams(
'',
'include_missing_member_with_elevated_permissions',
includeMissingMemberWithElevatedPermissions));
}
if (query != null) {
queryParams.addAll(_queryParams('', 'query', query));
}
if (userId != null) {
queryParams.addAll(_queryParams('multi', 'user_id', userId));
}
if (organizationId != null) {
queryParams
.addAll(_queryParams('multi', 'organization_id', organizationId));
}
if (orderBy != null) {
queryParams.addAll(_queryParams('', 'order_by', orderBy));
}
if (limit != null) {
queryParams.addAll(_queryParams('', 'limit', limit));
}
if (offset != null) {
queryParams.addAll(_queryParams('', 'offset', offset));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}