<commit_before>var env = require('./environment');
var server = env.server + ':' + env.port;

module.exports = {
  login: (username, password) => {
    return fetch(server + '/login', {
        method: 'POST',
        credentials: 'include',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          username: username,
          password: password
        })
      });
  },

  signup: (firstName, lastName, username, email, password, teacherOrStudent) => {
    return fetch(server + '/signup', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        // add firstName and lastName
        body: JSON.stringify({
          firstName: firstName,
          lastName: lastName,
          username: username,
          email: email,
          password: password,
          accountType: teacherOrStudent
        })
      });
  },

  checkForSession: () => {
    return fetch(server + '/checkAuth', {
      credentials: 'include'
    });
  },

  logout: () => {
    return fetch(server + '/logout');
  },

  addLesson: (classId, lessonName, lessonDate) => {
    return fetch(server + '/teachers/lessons', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        classId: classId,
        lessonName: lessonName,
        lessonDate: lessonDate
      })
    }); 
  },


  getLessons: (classId) => {
    return fetch(server + '/teachers/lessons/' + classId);
  },

  getLessonData: (lessonId) => {
    return fetch(server + '/teachers/polls/' + lessonId);
  },
  
  startPoll: (pollObject, lessonId, classId) => {    
    return fetch(server + '/teachers/polls', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        pollObject: pollObject,
        lessonId: lessonId,
        classId: classId
      })
    });
  },

  getClasses: (teacherId) => {
    return fetch(server + '/teachers/classes/' + teacherId);
  },

  getClassData: (classId) => {
    return fetch(server + '/classes/lessons/' + classId);
  },

  getAllStudents: () => {
    
  },

  addStudentToClass: (classId, studentEmail) => {
    return fetch(server + '/teachers/class/student', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        classId: classId,
        studentEmail: studentEmail
      })
    });
  }



}

<commit_msg>Add client api routes for data fetching<commit_after>var env = require('./environment');
var server = env.server + ':' + env.port;

module.exports = {
  login: (username, password) => {
    return fetch(server + '/login', {
        method: 'POST',
        credentials: 'include',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          username: username,
          password: password
        })
      });
  },

  signup: (firstName, lastName, username, email, password, teacherOrStudent) => {
    return fetch(server + '/signup', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        // add firstName and lastName
        body: JSON.stringify({
          firstName: firstName,
          lastName: lastName,
          username: username,
          email: email,
          password: password,
          accountType: teacherOrStudent
        })
      });
  },

  checkForSession: () => {
    return fetch(server + '/checkAuth', {
      credentials: 'include'
    });
  },

  logout: () => {
    return fetch(server + '/logout');
  },

  addLesson: (classId, lessonName, lessonDate) => {
    return fetch(server + '/teachers/lessons', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        classId: classId,
        lessonName: lessonName,
        lessonDate: lessonDate
      })
    }); 
  },


  getLessons: (classId) => {
    return fetch(server + '/teachers/lessons/' + classId);
  },

  getLessonData: (lessonId) => {
    return fetch(server + '/teachers/polls/' + lessonId);
  },
  
  startPoll: (pollObject, lessonId, classId) => {    
    return fetch(server + '/teachers/polls', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        pollObject: pollObject,
        lessonId: lessonId,
        classId: classId
      })
    });
  },

  getClasses: (teacherId) => {
    return fetch(server + '/teachers/classes/' + teacherId);
  },

  getClassData: (classId) => {
    return fetch(server + '/classes/lessons/' + classId);
  },

  getAllStudents: () => {
    
  },

  addStudentToClass: (classId, studentEmail) => {
    return fetch(server + '/teachers/class/student', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        classId: classId,
        studentEmail: studentEmail
      })
    });
  },

  // Get teacher desktop data:
  getClassLessonsData: (classId) => {
    return fetch(server + '/classes/' + classId + '/lessons');
  },

  getLessonPollsData: (lessonId) => {
    return fetch(server + '/lessons/' + lessonId + '/polls');
  },

  getClassStudentsData: (classId) => {
    return fetch(server + '/classes/' + classId + '/students');
  },

  getStudentPollsData: (classId, studentId) => {
    return fetch(server + '/classes/' + classId + '/students/' + studentId);
  },

}


{'fraction_non_alphanumeric': 0.15709005376344087, 'fraction_numerical': 0.0, 'mean_word_length': 2.186830835117773, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6177689', 'n_tokens_mistral': 1806, 'n_tokens_neox': 1781, 'n_words': 364}