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.0 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 = "api";
  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. $.ajax({
  27. type:'GET',
  28. url: urlpath,
  29. crossDomain: true,
  30. dataType: "json",
  31. success: successCallBack,
  32. error:errorCallBack,
  33. timeout: 1500
  34. });
  35. }