Skip to content

Students APIs

Jia-Yao Liao edited this page Jul 16, 2016 · 11 revisions

登入

  • login(String userName, String password)
Response:
{
  code: OK (enum ErrorCode),
  content: {
    "role": 角色 (enum Role),
    "user": 物件 (Teacher or Student)
  }
}
  • register(String userName, String password, String name, Role role, String studentId, String email, int graduateYear, byte[] image)
Response:
{
  code: 錯誤代碼 (enum ErrorCode),
  content: null
}
  • forgetPassword(String userName)
Response:
{
  code: 錯誤代碼 (enum ErrorCode),
  content: null
}

考試列表

  • queryCourses() christine現在沒有設定課程功能
Response:
{
  code: OK (enum ErrorCode),
  content: {
    "courses": [
      {
        "courseName": 課程名稱 (String),
        "year": 學年度 (int),
        "semester": 學期 (int),
        "teacherName": 老師名稱 (String)
      }, ...
    ]
  }
}
  • queryExams(int courseId)
Response:
{
  code: OK (enum ErrorCode),
  content: {
    "exams": [
      {
        "examId": 考試編號 (int),
        "examName": 考試名稱 (String),
        "startTime": 開始時間 (Timestamp),
        "duration": 考試時長 (int)
      }, ...
    ]
  }
}
  • queryProblems(int courseId, int examId)
Response:
{
  code: OK (enum ErrorCode),
  content: {
    "problems": [
      {
        "problemId": 題目編號 (int),
        "problemName": 題目名稱 (String),
        "description": 題目敘述 (String)
      }, ...
    ]
  }
}
  • attendExam(int courseId, int examId)
Response:
{
  code: 錯誤代碼 (enum ErrorCode),
  content: null
}

考試中

  • submitSourceCode(int courseId, int examId, int problemId, String sourceCode, String sourceCodeFileName)
Response:
{
  code: 錯誤代碼 (enum ErrorCode),
  content: null
}
  • queryHistoryMessages(int courseId, int examId)
Response:
{
  code: OK (enum ErrorCode),
  content: {
    "messages": [
      {
        "message": 訊息內容 (String),
        "from": 發話者名稱 (String),
        "role": 發話者角色 (enum Role),
        "time": 發話時間 (Timestamp)
      }, ...
    ]
  }
}
  • sendMessage(int courseId, int examId, String message)
Response:
{
  code: 錯誤代碼 (enum ErrorCode),
  content: null
}
  • sendSnapshot(int courseId, int examId, byte[] snapshot)
Response:
{
  code: 錯誤代碼 (enum ErrorCode),
  content: null
}
  • getTestData(int courseId, int examId, int problemId)
Response:
{
  code: OK (enum ErrorCode),
  content: {
    "testdata": [
      {
        "input": 輸入 (String),
        "output": 輸出 (String)
      }, ...
    ]
  }
}
  • sendKeyEvent(int courseId, int examId, KeyEvent keyEvent)
Response:
{
  code: 錯誤代碼 (enum ErrorCode),
  content: null
}

考試結果

  • queryExamResults(int courseId, int examId)
Response:
{
  code: OK (enum ErrorCode),
  content: {
    "score": 該次考試成績 (int),
    "comment": 該次考試評語 (String),
    "problems": [
      {
        "id": 題目編號 (int),
        "name": 題目名稱 (String),
        "score": 該題成績 (int),
        "comment": 該題評語 (String)
      }, ...
    ]
  }
}

個人資料

  • getProfile()
Response:
{
  code: OK (enum ErrorCode),
  content: {
    "id": 學號 (String),
    "name": 姓名 (String),
    "userName": 帳號 (String),
    "email": 電子郵件地址 (String),
    "graduateYear": 畢業年度 (int)
  }
}
  • resetPassword(String oldPassword, String newPassword)
Response:
{
  code: 錯誤代碼 (enum ErrorCode),
  content: null
}
  • getProfilePhoto()
Response:
{
  code: OK (enum ErrorCode),
  content: {
    "profilePhoto": 大頭貼 (byte[])
  }
}
  • resetProfilePhoto(byte[] image)
Response:
{
  code: OK (enum ErrorCode),
  content: {
    code: 錯誤代碼 (enum ErrorCode),
    content: null
  }
}

登出

  • logout()
Response:
{
  code: 錯誤代碼 (enum ErrorCode),
  content: null
}