Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JiraApiHelper is a wrapper around the .net jira api, with a function to get all users by iterating over the alphabet
public class JiraApiHelper
{
private readonly Jira inner_client;
public JiraApiHelper()
{
this.inner_client = Jira.CreateRestClient("JiraUrl", "UserName", "Password");
}
public List<User> GetAllUsers()
{
var users = new List<User>();
foreach (var item in "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".Split(','))
{
var search_result = inner_client.RestClient.ExecuteRequest<List<User>>(Method.GET,
$"/rest/api/2/user/search?username={item}");
foreach (var user in search_result)
{
if (!users.Any(x => x.Key.Equals(user.Key, StringComparison.CurrentCultureIgnoreCase)))
users.Add(user);
}
}
return users;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.