findAssignableUsers method

Future<List<User>> findAssignableUsers({
  1. String? query,
  2. String? sessionId,
  3. String? username,
  4. String? accountId,
  5. String? project,
  6. String? issueKey,
  7. int? startAt,
  8. int? maxResults,
  9. int? actionDescriptorId,
  10. bool? recommend,
})

Returns a list of users that can be assigned to an issue. Use this operation to find the list of users who can be assigned to:

  • a new issue, by providing the projectKeyOrId.
  • an updated issue, by providing the issueKey.
  • to an issue during a transition (workflow action), by providing the issueKey and the transition id in actionDescriptorId. You can obtain the IDs of an issue's valid transitions using the transitions option in the expand parameter of Get issue.

In all these cases, you can pass an account ID to determine if a user can be assigned to an issue. The user is returned in the response if they can be assigned to the issue or issue transition.

This operation takes the users in the range defined by startAt and maxResults, up to the thousandth user, and then returns only the users from that range that can be assigned the issue. This means the operation usually returns fewer users than specified in maxResults. To get all the users who can be assigned the issue, use Get all users and filter the records in your code.

Privacy controls are applied to the response based on the users' preferences. This could mean, for example, that the user's email address is hidden. See the Profile visibility overview for more details.

Permissions required: Permission to access Jira.

Implementation

Future<List<User>> findAssignableUsers(
    {String? query,
    String? sessionId,
    String? username,
    String? accountId,
    String? project,
    String? issueKey,
    int? startAt,
    int? maxResults,
    int? actionDescriptorId,
    bool? recommend}) async {
  return (await _client.send(
    'get',
    'rest/api/3/user/assignable/search',
    queryParameters: {
      if (query != null) 'query': query,
      if (sessionId != null) 'sessionId': sessionId,
      if (username != null) 'username': username,
      if (accountId != null) 'accountId': accountId,
      if (project != null) 'project': project,
      if (issueKey != null) 'issueKey': issueKey,
      if (startAt != null) 'startAt': '$startAt',
      if (maxResults != null) 'maxResults': '$maxResults',
      if (actionDescriptorId != null)
        'actionDescriptorId': '$actionDescriptorId',
      if (recommend != null) 'recommend': '$recommend',
    },
  ) as List<Object?>)
      .map((i) => User.fromJson(i as Map<String, Object?>? ?? const {}))
      .toList();
}