Website for visualizing a persons github network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.8 KiB

5 years ago
  1. /**
  2. * Simple file which uses jQuery's ajax
  3. * calls to make it easier to get data
  4. * from the github api.
  5. *
  6. * @author Jeffery Russell 2-16-19
  7. */
  8. const APIROOT = "api";
  9. const API_USER_PATH = "/users/";
  10. const API_ORG_PATH = "/orgs/";
  11. const API_ORG_MEMBERS = "/members";
  12. const API_REPOS = "/repos";
  13. const API_FOLLOWING = "/following";
  14. const API_FOLLOWERS = "/followers";
  15. const API_REPOSITORIES = "/repos";
  16. const API_ORGANIZATIONS = "/orgs";
  17. /**
  18. * Builds a query for the github rest api and
  19. * allows you to get at the data using a
  20. * callback which gives you a json object.
  21. *
  22. * @param apiPath the path on the github api ie API_FOLLOWING
  23. * @param user the username to query
  24. * @param successCallBack callback to complete when data is returned
  25. * @param errorCallBack callback which is invoked on error
  26. */
  27. function queryAPIByUser(apiPath, user, successCallBack, errorCallBack) {
  28. const urlpath = APIROOT + API_USER_PATH + user + apiPath;
  29. console.log(urlpath);
  30. $.ajax({
  31. type:'GET',
  32. url: urlpath,
  33. crossDomain: true,
  34. dataType: "json",
  35. success: successCallBack,
  36. error:errorCallBack,
  37. timeout: 4000
  38. });
  39. }
  40. function queryAPIByOrg(apiPath, org, successCallBack, errorCallBack) {
  41. const urlpath = APIROOT + API_ORG_PATH + org + apiPath;
  42. $.ajax({
  43. type:'GET',
  44. url: urlpath,
  45. crossDomain: true,
  46. dataType: "json",
  47. success: successCallBack,
  48. error:errorCallBack,
  49. timeout: 4000
  50. });
  51. console.log("past");
  52. }
  53. /*
  54. function queryAPIByRepo(apiPath, org, successCallBack, errorCallBack) {
  55. const urlpath = APIROOT + API_ORG_PATH + org + apiPath;
  56. $.ajax({
  57. type:'GET',
  58. url: urlpath,
  59. crossDomain: true,
  60. dataType: "json",
  61. success: successCallBack,
  62. error:errorCallBack,
  63. timeout: 4000
  64. });
  65. }*/