Graph database Analysis of the Steam 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.

73 lines
1.5 KiB

  1. /**
  2. * Simple file which uses jQuery's ajax
  3. * calls to make it easier to get data
  4. * from the steam api.
  5. *
  6. * @author Jeffery Russell 2-16-19, 7-12-20
  7. */
  8. const APIROOT = "";
  9. const API_USER_PATH = "/player/";
  10. const API_GAMES_PATH = "/games/"
  11. /**
  12. * Fetches a list of fiends for a user.
  13. *
  14. * @param {*} userName
  15. * @param {*} suc
  16. * @param {*} err
  17. */
  18. function getPersonAPI(userID, suc, err)
  19. {
  20. // api/friends/jrtechs
  21. const urlpath = APIROOT + API_USER_PATH + userID;
  22. runAjax(urlpath, suc, err);
  23. }
  24. function getUserGames(userID, suc, err)
  25. {
  26. //ex: http://localhost:7000/api/repositories/jwflory
  27. const urlpath = APIROOT + "/repositories/" + userID;
  28. runAjax(urlpath, suc, err);
  29. }
  30. /**
  31. * Queries github API end points with the backend
  32. * proxy server for github graphs.
  33. *
  34. * @param {*} url
  35. * @param {*} successCallBack
  36. * @param {*} errorCallBack
  37. */
  38. function queryUrl(url, successCallBack, errorCallBack)
  39. {
  40. url = url.split("https://api.github.com/").join("api/");
  41. runAjax(url, successCallBack, errorCallBack);
  42. }
  43. /**
  44. * Wrapper for AJAX calls so we can unify
  45. * all of our settings.
  46. *
  47. * @param {*} url -- url to query
  48. * @param {*} successCallBack -- callback with data retrieved
  49. * @param {*} errorCallBack -- callback with error message
  50. */
  51. function runAjax(url, successCallBack, errorCallBack)
  52. {
  53. console.log(url);
  54. $.ajax({
  55. type:'GET',
  56. url: url,
  57. crossDomain: true,
  58. dataType: "json",
  59. success: successCallBack,
  60. error:errorCallBack,
  61. timeout: 300000
  62. });
  63. }