Last active
January 3, 2018 14:51
-
-
Save JustLogic/fb66ff29390dc1abbf9f1439a0e20993 to your computer and use it in GitHub Desktop.
JiraApiHelper is a wrapper around the .net jira api, with a function to get all users by iterating over the alphabet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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