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.

44 lines
1.1 KiB

  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 = "https://api.github.com";
  9. const API_USER_PATH = "/users/";
  10. const API_FOLLOWING = "/following";
  11. const API_FOLLOWERS = "/followers";
  12. const API_REPOSITORIES = "/repos";
  13. const API_ORGANIZATIONS = "/orgs";
  14. /**
  15. * Builds a query for the github rest api and
  16. * allows you to get at the data using a
  17. * callback which gives you a json object.
  18. *
  19. * @param apiPath the path on the github api ie API_FOLLOWING
  20. * @param user the username to query
  21. * @param successCallBack callback to complete when data is returned
  22. * @param errorCallBack callback which is invoked on error
  23. */
  24. function queryAPIByUser(apiPath, user, successCallBack, errorCallBack)
  25. {
  26. const urlpath = APIROOT + API_USER_PATH + user + apiPath;
  27. console.log(urlpath);
  28. $.ajax({
  29. type:'GET',
  30. url: urlpath,
  31. crossDomain: true,
  32. dataType: "json",
  33. success: successCallBack,
  34. error:errorCallBack
  35. });
  36. }