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.

43 lines
1.1 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 = "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. const urlpath = APIROOT + API_USER_PATH + user + apiPath;
  26. console.log(urlpath);
  27. $.ajax({
  28. type:'GET',
  29. url: urlpath,
  30. crossDomain: true,
  31. dataType: "json",
  32. success: successCallBack,
  33. error:errorCallBack
  34. });
  35. }