diff --git a/public/passwordreset.gif b/public/passwordreset.gif new file mode 100644 index 0000000..31b7d79 Binary files /dev/null and b/public/passwordreset.gif differ diff --git a/src/App.tsx b/src/App.tsx index b3c2941..2665bd7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,6 +8,8 @@ import Dashboard from './pages/dashboardPage'; import SearchUserPage from './pages/searchUserPage'; import UserInfoPage from './pages/userInfoPage'; import { Box, CircularProgress, Typography } from '@mui/material'; +import CreateTopicPage from './pages/createTopicPage'; +import SearchTopicPage from './pages/searchTopicPage'; const App: React.FC = () => { const [isLoggedIn, setIsLoggedIn] = useState(apiClient.isLoggedIn()); @@ -33,52 +35,60 @@ const App: React.FC = () => { }, []); if (isLoading) { - return ( - - - - {CurrentAppTranslation.LoadingText} - - - Please wait while we load the content for you. - - - ); + return ( + + + + {CurrentAppTranslation.LoadingText} + + + Please wait while we load the content for you. + + + ); } return ( - : } + : } /> : } /> - : } + : } + /> + : } + /> + : } /> - : } + : } /> - : } + : } /> } /> diff --git a/src/api/api.ts b/src/api/api.ts index 3e242bf..9093bc2 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -72,12 +72,145 @@ export const APIErrorCode = { ErrCodeQueryParameterNotProvided: 2139, ErrCodeTooManyPasswordChangeAttempts: 2140, ErrCodeRequestExpired: 2141, - ErrCodeInvalidEmail: 2142 + ErrCodeInvalidEmail: 2142, + ErrCodeCourseAlreadyExists: 2143, + ErrCodeCourseNotFound: 2144, + ErrCodeExamNotFound: 2145, + ErrCodeNotParticipatedInExam: 2146, + ErrCodeExamNotStarted: 2147, + ErrCodeExamFinished: 2148, + ErrCodeExamQuestionNotFound: 2149, + ErrCodeInvalidAnswerOption: 2150, + ErrCodeGivenExamNotFound: 2151 } as const; export type APIErrorCode = typeof APIErrorCode[keyof typeof APIErrorCode]; +/** + * + * @export + * @interface AnswerExamQuestionV1200Response + */ +export interface AnswerExamQuestionV1200Response { + /** + * + * @type {EndpointError} + * @memberof AnswerExamQuestionV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {AnswerQuestionResult} + * @memberof AnswerExamQuestionV1200Response + */ + 'result'?: AnswerQuestionResult; + /** + * + * @type {boolean} + * @memberof AnswerExamQuestionV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface AnswerQuestionData + */ +export interface AnswerQuestionData { + /** + * + * @type {string} + * @memberof AnswerQuestionData + */ + 'answer_text'?: string; + /** + * + * @type {string} + * @memberof AnswerQuestionData + */ + 'chosen_option'?: string; + /** + * + * @type {number} + * @memberof AnswerQuestionData + */ + 'exam_id'?: number; + /** + * + * @type {number} + * @memberof AnswerQuestionData + */ + 'question_id'?: number; + /** + * + * @type {number} + * @memberof AnswerQuestionData + */ + 'seconds_taken'?: number; +} +/** + * + * @export + * @interface AnswerQuestionResult + */ +export interface AnswerQuestionResult { + /** + * + * @type {string} + * @memberof AnswerQuestionResult + */ + 'answered_at'?: string; + /** + * + * @type {string} + * @memberof AnswerQuestionResult + */ + 'answered_by'?: string; + /** + * + * @type {number} + * @memberof AnswerQuestionResult + */ + 'exam_id'?: number; + /** + * + * @type {number} + * @memberof AnswerQuestionResult + */ + 'question_id'?: number; +} +/** + * + * @export + * @interface AnsweredQuestionInfo + */ +export interface AnsweredQuestionInfo { + /** + * + * @type {string} + * @memberof AnsweredQuestionInfo + */ + 'answer'?: string; + /** + * + * @type {string} + * @memberof AnsweredQuestionInfo + */ + 'chosen_option'?: string; + /** + * + * @type {number} + * @memberof AnsweredQuestionInfo + */ + 'question_id'?: number; + /** + * + * @type {number} + * @memberof AnsweredQuestionInfo + */ + 'seconds_taken'?: number; +} /** * * @export @@ -246,6 +379,31 @@ export interface ChangePasswordData { */ 'user_id'?: string; } +/** + * + * @export + * @interface ChangePasswordResult + */ +export interface ChangePasswordResult { + /** + * + * @type {boolean} + * @memberof ChangePasswordResult + */ + 'email_sent'?: boolean; + /** + * + * @type {string} + * @memberof ChangePasswordResult + */ + 'lang'?: string; + /** + * + * @type {boolean} + * @memberof ChangePasswordResult + */ + 'password_changed'?: boolean; +} /** * * @export @@ -260,10 +418,10 @@ export interface ChangePasswordV1200Response { 'error'?: EndpointError; /** * - * @type {boolean} + * @type {ChangePasswordResult} * @memberof ChangePasswordV1200Response */ - 'result'?: boolean; + 'result'?: ChangePasswordResult; /** * * @type {boolean} @@ -274,568 +432,566 @@ export interface ChangePasswordV1200Response { /** * * @export - * @interface ConfirmChangePasswordData + * @interface ConfirmAccountData */ -export interface ConfirmChangePasswordData { +export interface ConfirmAccountData { /** * * @type {string} - * @memberof ConfirmChangePasswordData + * @memberof ConfirmAccountData */ - 'new_password'?: string; + 'confirm_token'?: string; /** * * @type {string} - * @memberof ConfirmChangePasswordData + * @memberof ConfirmAccountData */ - 'rq_id'?: string; + 'lt_token'?: string; /** * * @type {string} - * @memberof ConfirmChangePasswordData + * @memberof ConfirmAccountData */ - 'rt_hash'?: string; + 'raw_password'?: string; /** * * @type {string} - * @memberof ConfirmChangePasswordData + * @memberof ConfirmAccountData */ - 'rt_param'?: string; + 'rl_token'?: string; /** * * @type {string} - * @memberof ConfirmChangePasswordData + * @memberof ConfirmAccountData */ - 'rt_verifier'?: string; + 'user_id'?: string; } /** * * @export - * @interface CreateNewTopicData + * @interface ConfirmAccountV1200Response */ -export interface CreateNewTopicData { +export interface ConfirmAccountV1200Response { /** * - * @type {string} - * @memberof CreateNewTopicData + * @type {EndpointError} + * @memberof ConfirmAccountV1200Response */ - 'topicName'?: string; -} -/** - * - * @export - * @interface CreateNewTopicResult - */ -export interface CreateNewTopicResult { + 'error'?: EndpointError; /** * - * @type {number} - * @memberof CreateNewTopicResult + * @type {boolean} + * @memberof ConfirmAccountV1200Response */ - 'topicID'?: number; + 'result'?: boolean; /** * - * @type {string} - * @memberof CreateNewTopicResult + * @type {boolean} + * @memberof ConfirmAccountV1200Response */ - 'topicName'?: string; + 'success'?: boolean; } /** * * @export - * @interface CreateUserData + * @interface ConfirmChangePasswordData */ -export interface CreateUserData { +export interface ConfirmChangePasswordData { /** * * @type {string} - * @memberof CreateUserData + * @memberof ConfirmChangePasswordData */ - 'email'?: string; + 'new_password'?: string; /** * * @type {string} - * @memberof CreateUserData + * @memberof ConfirmChangePasswordData */ - 'full_name'?: string; + 'rq_id'?: string; /** * * @type {string} - * @memberof CreateUserData + * @memberof ConfirmChangePasswordData */ - 'password'?: string; + 'rt_hash'?: string; /** * * @type {string} - * @memberof CreateUserData + * @memberof ConfirmChangePasswordData */ - 'phone_number'?: string; + 'rt_param'?: string; /** * - * @type {UserRole} - * @memberof CreateUserData + * @type {string} + * @memberof ConfirmChangePasswordData */ - 'role'?: UserRole; + 'rt_verifier'?: string; +} +/** + * + * @export + * @interface CourseParticipantInfo + */ +export interface CourseParticipantInfo { /** * - * @type {boolean} - * @memberof CreateUserData + * @type {string} + * @memberof CourseParticipantInfo */ - 'setup_completed'?: boolean; + 'full_name'?: string; /** * * @type {string} - * @memberof CreateUserData + * @memberof CourseParticipantInfo */ - 'user_address'?: string; + 'user_id'?: string; +} +/** + * + * @export + * @interface CreateCourseData + */ +export interface CreateCourseData { /** * * @type {string} - * @memberof CreateUserData + * @memberof CreateCourseData */ - 'user_id'?: string; + 'course_description'?: string; + /** + * + * @type {string} + * @memberof CreateCourseData + */ + 'course_name'?: string; } - - /** * * @export - * @interface CreateUserResult + * @interface CreateCourseResult */ -export interface CreateUserResult { +export interface CreateCourseResult { /** * * @type {string} - * @memberof CreateUserResult + * @memberof CreateCourseResult */ - 'email'?: string; + 'added_by'?: string; /** * * @type {string} - * @memberof CreateUserResult + * @memberof CreateCourseResult */ - 'full_name'?: string; + 'course_description'?: string; /** * - * @type {string} - * @memberof CreateUserResult + * @type {number} + * @memberof CreateCourseResult */ - 'role'?: string; + 'course_id'?: number; /** * * @type {string} - * @memberof CreateUserResult + * @memberof CreateCourseResult */ - 'user_id'?: string; + 'course_name'?: string; } /** * * @export - * @interface CreateUserV1200Response + * @interface CreateCourseV1200Response */ -export interface CreateUserV1200Response { +export interface CreateCourseV1200Response { /** * * @type {EndpointError} - * @memberof CreateUserV1200Response + * @memberof CreateCourseV1200Response */ 'error'?: EndpointError; /** * - * @type {CreateUserResult} - * @memberof CreateUserV1200Response + * @type {CreateCourseResult} + * @memberof CreateCourseV1200Response */ - 'result'?: CreateUserResult; + 'result'?: CreateCourseResult; /** * * @type {boolean} - * @memberof CreateUserV1200Response + * @memberof CreateCourseV1200Response */ 'success'?: boolean; } /** * * @export - * @interface EditUserData + * @interface CreateExamData */ -export interface EditUserData { +export interface CreateExamData { /** * - * @type {string} - * @memberof EditUserData + * @type {number} + * @memberof CreateExamData */ - 'email'?: string; + 'course_id'?: number; /** * - * @type {string} - * @memberof EditUserData + * @type {number} + * @memberof CreateExamData */ - 'full_name'?: string; + 'duration'?: number; + /** + * + * @type {number} + * @memberof CreateExamData + */ + 'exam_date'?: number; /** * * @type {string} - * @memberof EditUserData + * @memberof CreateExamData */ - 'phone_number'?: string; + 'exam_description'?: string; /** * * @type {string} - * @memberof EditUserData + * @memberof CreateExamData */ - 'user_address'?: string; + 'exam_title'?: string; + /** + * + * @type {boolean} + * @memberof CreateExamData + */ + 'is_public'?: boolean; /** * * @type {string} - * @memberof EditUserData + * @memberof CreateExamData */ - 'user_id'?: string; + 'price'?: string; } /** * * @export - * @interface EditUserResult + * @interface CreateExamResult */ -export interface EditUserResult { +export interface CreateExamResult { + /** + * + * @type {number} + * @memberof CreateExamResult + */ + 'course_id'?: number; /** * * @type {string} - * @memberof EditUserResult + * @memberof CreateExamResult */ - 'email'?: string; + 'created_at'?: string; /** * * @type {string} - * @memberof EditUserResult + * @memberof CreateExamResult */ - 'full_name'?: string; + 'created_by'?: string; /** * - * @type {UserRole} - * @memberof EditUserResult + * @type {number} + * @memberof CreateExamResult */ - 'role'?: UserRole; + 'duration'?: number; /** * * @type {string} - * @memberof EditUserResult + * @memberof CreateExamResult */ - 'user_id'?: string; -} - - -/** - * - * @export - * @interface EditUserV1200Response - */ -export interface EditUserV1200Response { + 'exam_date'?: string; /** * - * @type {EndpointError} - * @memberof EditUserV1200Response + * @type {number} + * @memberof CreateExamResult */ - 'error'?: EndpointError; + 'exam_id'?: number; /** * - * @type {EditUserResult} - * @memberof EditUserV1200Response + * @type {boolean} + * @memberof CreateExamResult */ - 'result'?: EditUserResult; + 'is_public'?: boolean; /** * - * @type {boolean} - * @memberof EditUserV1200Response + * @type {string} + * @memberof CreateExamResult */ - 'success'?: boolean; + 'price'?: string; } /** * * @export - * @interface EndpointError + * @interface CreateExamV1200Response */ -export interface EndpointError { +export interface CreateExamV1200Response { /** * - * @type {APIErrorCode} - * @memberof EndpointError + * @type {EndpointError} + * @memberof CreateExamV1200Response */ - 'code'?: APIErrorCode; + 'error'?: EndpointError; /** * - * @type {string} - * @memberof EndpointError + * @type {CreateExamResult} + * @memberof CreateExamV1200Response */ - 'date'?: string; + 'result'?: CreateExamResult; /** * - * @type {string} - * @memberof EndpointError + * @type {boolean} + * @memberof CreateExamV1200Response */ - 'message'?: string; + 'success'?: boolean; +} +/** + * + * @export + * @interface CreateNewTopicData + */ +export interface CreateNewTopicData { /** * * @type {string} - * @memberof EndpointError + * @memberof CreateNewTopicData */ - 'origin'?: string; + 'topic_name'?: string; } - - /** * * @export - * @interface EndpointResponse + * @interface CreateNewTopicResult */ -export interface EndpointResponse { - /** - * - * @type {EndpointError} - * @memberof EndpointResponse - */ - 'error'?: EndpointError; +export interface CreateNewTopicResult { /** * - * @type {object} - * @memberof EndpointResponse + * @type {number} + * @memberof CreateNewTopicResult */ - 'result'?: object; + 'topic_id'?: number; /** * - * @type {boolean} - * @memberof EndpointResponse + * @type {string} + * @memberof CreateNewTopicResult */ - 'success'?: boolean; + 'topic_name'?: string; } /** * * @export - * @interface GenerateCaptchaV1200Response + * @interface CreateTopicV1200Response */ -export interface GenerateCaptchaV1200Response { +export interface CreateTopicV1200Response { /** * * @type {EndpointError} - * @memberof GenerateCaptchaV1200Response + * @memberof CreateTopicV1200Response */ 'error'?: EndpointError; /** * - * @type {CaptchaHandlersGetCaptchaResult} - * @memberof GenerateCaptchaV1200Response + * @type {CreateNewTopicResult} + * @memberof CreateTopicV1200Response */ - 'result'?: CaptchaHandlersGetCaptchaResult; + 'result'?: CreateNewTopicResult; /** * * @type {boolean} - * @memberof GenerateCaptchaV1200Response + * @memberof CreateTopicV1200Response */ 'success'?: boolean; } /** * * @export - * @interface GetMeResult + * @interface CreateUserData */ -export interface GetMeResult { +export interface CreateUserData { /** * * @type {string} - * @memberof GetMeResult + * @memberof CreateUserData + */ + 'email'?: string; + /** + * + * @type {string} + * @memberof CreateUserData */ 'full_name'?: string; /** * - * @type {UserRole} - * @memberof GetMeResult + * @type {string} + * @memberof CreateUserData */ - 'role'?: UserRole; + 'password'?: string; /** * * @type {string} - * @memberof GetMeResult + * @memberof CreateUserData */ - 'user_id'?: string; -} - - -/** - * - * @export - * @interface GetMeV1200Response - */ -export interface GetMeV1200Response { + 'phone_number'?: string; /** * - * @type {EndpointError} - * @memberof GetMeV1200Response + * @type {string} + * @memberof CreateUserData */ - 'error'?: EndpointError; + 'primary_language'?: string; /** * - * @type {GetMeResult} - * @memberof GetMeV1200Response + * @type {UserRole} + * @memberof CreateUserData */ - 'result'?: GetMeResult; + 'role'?: UserRole; /** * * @type {boolean} - * @memberof GetMeV1200Response + * @memberof CreateUserData */ - 'success'?: boolean; -} -/** - * - * @export - * @interface GetUserInfoResult - */ -export interface GetUserInfoResult { + 'setup_completed'?: boolean; /** * * @type {string} - * @memberof GetUserInfoResult + * @memberof CreateUserData */ - 'ban_reason'?: string; + 'user_address'?: string; /** * * @type {string} - * @memberof GetUserInfoResult + * @memberof CreateUserData */ - 'created_at'?: string; + 'user_id'?: string; +} + + +/** + * + * @export + * @interface CreateUserResult + */ +export interface CreateUserResult { /** * * @type {string} - * @memberof GetUserInfoResult + * @memberof CreateUserResult */ 'email'?: string; /** * * @type {string} - * @memberof GetUserInfoResult + * @memberof CreateUserResult */ 'full_name'?: string; /** * - * @type {boolean} - * @memberof GetUserInfoResult - */ - 'is_banned'?: boolean; - /** - * - * @type {UserRole} - * @memberof GetUserInfoResult + * @type {string} + * @memberof CreateUserResult */ - 'role'?: UserRole; + 'role'?: string; /** * * @type {string} - * @memberof GetUserInfoResult + * @memberof CreateUserResult */ 'user_id'?: string; } - - /** * * @export - * @interface GetUserInfoV1200Response + * @interface CreateUserV1200Response */ -export interface GetUserInfoV1200Response { +export interface CreateUserV1200Response { /** * * @type {EndpointError} - * @memberof GetUserInfoV1200Response + * @memberof CreateUserV1200Response */ 'error'?: EndpointError; /** * - * @type {GetUserInfoResult} - * @memberof GetUserInfoV1200Response + * @type {CreateUserResult} + * @memberof CreateUserV1200Response */ - 'result'?: GetUserInfoResult; + 'result'?: CreateUserResult; /** * * @type {boolean} - * @memberof GetUserInfoV1200Response + * @memberof CreateUserV1200Response */ 'success'?: boolean; } /** * * @export - * @interface LoginData + * @interface EditUserData */ -export interface LoginData { +export interface EditUserData { /** * * @type {string} - * @memberof LoginData + * @memberof EditUserData */ - 'captcha_answer'?: string; + 'email'?: string; /** * * @type {string} - * @memberof LoginData + * @memberof EditUserData */ - 'captcha_id'?: string; + 'full_name'?: string; /** * * @type {string} - * @memberof LoginData + * @memberof EditUserData */ - 'client_rid'?: string; + 'phone_number'?: string; /** * * @type {string} - * @memberof LoginData + * @memberof EditUserData */ - 'password'?: string; + 'user_address'?: string; /** * * @type {string} - * @memberof LoginData + * @memberof EditUserData */ 'user_id'?: string; } /** * * @export - * @interface LoginResult + * @interface EditUserResult */ -export interface LoginResult { +export interface EditUserResult { /** * * @type {string} - * @memberof LoginResult - */ - 'access_token'?: string; - /** - * - * @type {number} - * @memberof LoginResult + * @memberof EditUserResult */ - 'expiration'?: number; + 'email'?: string; /** * * @type {string} - * @memberof LoginResult + * @memberof EditUserResult */ 'full_name'?: string; - /** - * - * @type {string} - * @memberof LoginResult - */ - 'refresh_token'?: string; /** * * @type {UserRole} - * @memberof LoginResult + * @memberof EditUserResult */ 'role'?: UserRole; /** * * @type {string} - * @memberof LoginResult + * @memberof EditUserResult */ 'user_id'?: string; } @@ -844,184 +1000,3277 @@ export interface LoginResult { /** * * @export - * @interface LoginV1200Response + * @interface EditUserV1200Response */ -export interface LoginV1200Response { +export interface EditUserV1200Response { /** * * @type {EndpointError} - * @memberof LoginV1200Response + * @memberof EditUserV1200Response */ 'error'?: EndpointError; /** * - * @type {LoginResult} - * @memberof LoginV1200Response + * @type {EditUserResult} + * @memberof EditUserV1200Response */ - 'result'?: LoginResult; + 'result'?: EditUserResult; /** * * @type {boolean} - * @memberof LoginV1200Response + * @memberof EditUserV1200Response */ 'success'?: boolean; } /** * * @export - * @interface ReAuthV1200Response + * @interface EndpointError */ -export interface ReAuthV1200Response { +export interface EndpointError { /** * - * @type {EndpointError} - * @memberof ReAuthV1200Response + * @type {APIErrorCode} + * @memberof EndpointError */ - 'error'?: EndpointError; + 'code'?: APIErrorCode; /** * - * @type {AuthResult} - * @memberof ReAuthV1200Response + * @type {string} + * @memberof EndpointError */ - 'result'?: AuthResult; + 'date'?: string; /** * - * @type {boolean} - * @memberof ReAuthV1200Response + * @type {string} + * @memberof EndpointError + */ + 'message'?: string; + /** + * + * @type {string} + * @memberof EndpointError + */ + 'origin'?: string; +} + + +/** + * + * @export + * @interface EndpointResponse + */ +export interface EndpointResponse { + /** + * + * @type {EndpointError} + * @memberof EndpointResponse + */ + 'error'?: EndpointError; + /** + * + * @type {object} + * @memberof EndpointResponse + */ + 'result'?: object; + /** + * + * @type {boolean} + * @memberof EndpointResponse */ 'success'?: boolean; } /** * * @export - * @interface SearchUserData + * @interface ExamQuestionInfo */ -export interface SearchUserData { +export interface ExamQuestionInfo { + /** + * + * @type {string} + * @memberof ExamQuestionInfo + */ + 'created_at'?: string; + /** + * + * @type {string} + * @memberof ExamQuestionInfo + */ + 'description'?: string; + /** + * + * @type {string} + * @memberof ExamQuestionInfo + */ + 'option1'?: string; + /** + * + * @type {string} + * @memberof ExamQuestionInfo + */ + 'option2'?: string; + /** + * + * @type {string} + * @memberof ExamQuestionInfo + */ + 'option3'?: string; + /** + * + * @type {string} + * @memberof ExamQuestionInfo + */ + 'option4'?: string; /** * * @type {number} - * @memberof SearchUserData + * @memberof ExamQuestionInfo */ - 'limit'?: number; + 'question_id'?: number; + /** + * + * @type {string} + * @memberof ExamQuestionInfo + */ + 'question_title'?: string; + /** + * + * @type {AnsweredQuestionInfo} + * @memberof ExamQuestionInfo + */ + 'user_answer'?: AnsweredQuestionInfo; +} +/** + * + * @export + * @interface GenerateCaptchaV1200Response + */ +export interface GenerateCaptchaV1200Response { + /** + * + * @type {EndpointError} + * @memberof GenerateCaptchaV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {CaptchaHandlersGetCaptchaResult} + * @memberof GenerateCaptchaV1200Response + */ + 'result'?: CaptchaHandlersGetCaptchaResult; + /** + * + * @type {boolean} + * @memberof GenerateCaptchaV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetAllUserTopicStatsResult + */ +export interface GetAllUserTopicStatsResult { + /** + * + * @type {Array} + * @memberof GetAllUserTopicStatsResult + */ + 'stats'?: Array; + /** + * + * @type {string} + * @memberof GetAllUserTopicStatsResult + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface GetAllUserTopicStatsV1200Response + */ +export interface GetAllUserTopicStatsV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetAllUserTopicStatsV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetAllUserTopicStatsResult} + * @memberof GetAllUserTopicStatsV1200Response + */ + 'result'?: GetAllUserTopicStatsResult; + /** + * + * @type {boolean} + * @memberof GetAllUserTopicStatsV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetCourseInfoResult + */ +export interface GetCourseInfoResult { + /** + * + * @type {string} + * @memberof GetCourseInfoResult + */ + 'added_by'?: string; + /** + * + * @type {string} + * @memberof GetCourseInfoResult + */ + 'course_description'?: string; /** * * @type {number} - * @memberof SearchUserData + * @memberof GetCourseInfoResult */ - 'offset'?: number; + 'course_id'?: number; /** * * @type {string} - * @memberof SearchUserData + * @memberof GetCourseInfoResult */ - 'query'?: string; + 'course_name'?: string; + /** + * + * @type {string} + * @memberof GetCourseInfoResult + */ + 'created_at'?: string; +} +/** + * + * @export + * @interface GetCourseInfoV1200Response + */ +export interface GetCourseInfoV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetCourseInfoV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetCourseInfoResult} + * @memberof GetCourseInfoV1200Response + */ + 'result'?: GetCourseInfoResult; + /** + * + * @type {boolean} + * @memberof GetCourseInfoV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetCourseParticipantsData + */ +export interface GetCourseParticipantsData { + /** + * + * @type {number} + * @memberof GetCourseParticipantsData + */ + 'course_id'?: number; +} +/** + * + * @export + * @interface GetCourseParticipantsResult + */ +export interface GetCourseParticipantsResult { + /** + * + * @type {Array} + * @memberof GetCourseParticipantsResult + */ + 'participants'?: Array; +} +/** + * + * @export + * @interface GetCourseParticipantsV1200Response + */ +export interface GetCourseParticipantsV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetCourseParticipantsV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetCourseParticipantsResult} + * @memberof GetCourseParticipantsV1200Response + */ + 'result'?: GetCourseParticipantsResult; + /** + * + * @type {boolean} + * @memberof GetCourseParticipantsV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetCreatedCoursesData + */ +export interface GetCreatedCoursesData { + /** + * + * @type {string} + * @memberof GetCreatedCoursesData + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface GetCreatedCoursesResult + */ +export interface GetCreatedCoursesResult { + /** + * + * @type {Array} + * @memberof GetCreatedCoursesResult + */ + 'courses'?: Array; +} +/** + * + * @export + * @interface GetCreatedCoursesV1200Response + */ +export interface GetCreatedCoursesV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetCreatedCoursesV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetCreatedCoursesResult} + * @memberof GetCreatedCoursesV1200Response + */ + 'result'?: GetCreatedCoursesResult; + /** + * + * @type {boolean} + * @memberof GetCreatedCoursesV1200Response + */ + 'success'?: boolean; } /** - * + * + * @export + * @interface GetExamInfoResult + */ +export interface GetExamInfoResult { + /** + * + * @type {number} + * @memberof GetExamInfoResult + */ + 'course_id'?: number; + /** + * + * @type {string} + * @memberof GetExamInfoResult + */ + 'created_at'?: string; + /** + * + * @type {string} + * @memberof GetExamInfoResult + */ + 'created_by'?: string; + /** + * + * @type {number} + * @memberof GetExamInfoResult + */ + 'duration'?: number; + /** + * + * @type {string} + * @memberof GetExamInfoResult + */ + 'exam_date'?: string; + /** + * + * @type {string} + * @memberof GetExamInfoResult + */ + 'exam_description'?: string; + /** + * + * @type {number} + * @memberof GetExamInfoResult + */ + 'exam_id'?: number; + /** + * + * @type {string} + * @memberof GetExamInfoResult + */ + 'exam_title'?: string; + /** + * + * @type {number} + * @memberof GetExamInfoResult + */ + 'finishes_in'?: number; + /** + * + * @type {boolean} + * @memberof GetExamInfoResult + */ + 'has_finished'?: boolean; + /** + * + * @type {boolean} + * @memberof GetExamInfoResult + */ + 'has_started'?: boolean; + /** + * + * @type {boolean} + * @memberof GetExamInfoResult + */ + 'is_public'?: boolean; + /** + * + * @type {string} + * @memberof GetExamInfoResult + */ + 'price'?: string; + /** + * + * @type {number} + * @memberof GetExamInfoResult + */ + 'question_count'?: number; + /** + * + * @type {number} + * @memberof GetExamInfoResult + */ + 'starts_in'?: number; +} +/** + * + * @export + * @interface GetExamInfoV1200Response + */ +export interface GetExamInfoV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetExamInfoV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetExamInfoResult} + * @memberof GetExamInfoV1200Response + */ + 'result'?: GetExamInfoResult; + /** + * + * @type {boolean} + * @memberof GetExamInfoV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetExamQuestionsData + */ +export interface GetExamQuestionsData { + /** + * + * @type {number} + * @memberof GetExamQuestionsData + */ + 'exam_id'?: number; +} +/** + * + * @export + * @interface GetExamQuestionsResult + */ +export interface GetExamQuestionsResult { + /** + * + * @type {number} + * @memberof GetExamQuestionsResult + */ + 'exam_id'?: number; + /** + * + * @type {Array} + * @memberof GetExamQuestionsResult + */ + 'questions'?: Array; +} +/** + * + * @export + * @interface GetExamQuestionsV1200Response + */ +export interface GetExamQuestionsV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetExamQuestionsV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetExamQuestionsResult} + * @memberof GetExamQuestionsV1200Response + */ + 'result'?: GetExamQuestionsResult; + /** + * + * @type {boolean} + * @memberof GetExamQuestionsV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetGivenExamData + */ +export interface GetGivenExamData { + /** + * + * @type {string} + * @memberof GetGivenExamData + */ + 'added_by'?: string; + /** + * + * @type {string} + * @memberof GetGivenExamData + */ + 'created_at'?: string; + /** + * + * @type {number} + * @memberof GetGivenExamData + */ + 'exam_id'?: number; + /** + * + * @type {string} + * @memberof GetGivenExamData + */ + 'final_score'?: string; + /** + * + * @type {string} + * @memberof GetGivenExamData + */ + 'price'?: string; + /** + * + * @type {string} + * @memberof GetGivenExamData + */ + 'scored_by'?: string; + /** + * + * @type {string} + * @memberof GetGivenExamData + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface GetGivenExamV1200Response + */ +export interface GetGivenExamV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetGivenExamV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetGivenExamData} + * @memberof GetGivenExamV1200Response + */ + 'result'?: GetGivenExamData; + /** + * + * @type {boolean} + * @memberof GetGivenExamV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetMeResult + */ +export interface GetMeResult { + /** + * + * @type {string} + * @memberof GetMeResult + */ + 'full_name'?: string; + /** + * + * @type {UserRole} + * @memberof GetMeResult + */ + 'role'?: UserRole; + /** + * + * @type {string} + * @memberof GetMeResult + */ + 'user_id'?: string; +} + + +/** + * + * @export + * @interface GetMeV1200Response + */ +export interface GetMeV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetMeV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetMeResult} + * @memberof GetMeV1200Response + */ + 'result'?: GetMeResult; + /** + * + * @type {boolean} + * @memberof GetMeV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetTopicInfoResult + */ +export interface GetTopicInfoResult { + /** + * + * @type {number} + * @memberof GetTopicInfoResult + */ + 'topic_id'?: number; + /** + * + * @type {string} + * @memberof GetTopicInfoResult + */ + 'topic_name'?: string; +} +/** + * + * @export + * @interface GetTopicInfoV1200Response + */ +export interface GetTopicInfoV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetTopicInfoV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetTopicInfoResult} + * @memberof GetTopicInfoV1200Response + */ + 'result'?: GetTopicInfoResult; + /** + * + * @type {boolean} + * @memberof GetTopicInfoV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetUserCoursesData + */ +export interface GetUserCoursesData { + /** + * + * @type {string} + * @memberof GetUserCoursesData + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface GetUserCoursesResult + */ +export interface GetUserCoursesResult { + /** + * + * @type {Array} + * @memberof GetUserCoursesResult + */ + 'courses'?: Array; +} +/** + * + * @export + * @interface GetUserCoursesV1200Response + */ +export interface GetUserCoursesV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetUserCoursesV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetUserCoursesResult} + * @memberof GetUserCoursesV1200Response + */ + 'result'?: GetUserCoursesResult; + /** + * + * @type {boolean} + * @memberof GetUserCoursesV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetUserExamsHistoryV1200Response + */ +export interface GetUserExamsHistoryV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetUserExamsHistoryV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetUsersExamHistoryResult} + * @memberof GetUserExamsHistoryV1200Response + */ + 'result'?: GetUsersExamHistoryResult; + /** + * + * @type {boolean} + * @memberof GetUserExamsHistoryV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetUserInfoResult + */ +export interface GetUserInfoResult { + /** + * + * @type {string} + * @memberof GetUserInfoResult + */ + 'ban_reason'?: string; + /** + * + * @type {string} + * @memberof GetUserInfoResult + */ + 'created_at'?: string; + /** + * + * @type {string} + * @memberof GetUserInfoResult + */ + 'email'?: string; + /** + * + * @type {string} + * @memberof GetUserInfoResult + */ + 'full_name'?: string; + /** + * + * @type {boolean} + * @memberof GetUserInfoResult + */ + 'is_banned'?: boolean; + /** + * + * @type {UserRole} + * @memberof GetUserInfoResult + */ + 'role'?: UserRole; + /** + * + * @type {string} + * @memberof GetUserInfoResult + */ + 'user_id'?: string; +} + + +/** + * + * @export + * @interface GetUserInfoV1200Response + */ +export interface GetUserInfoV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetUserInfoV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetUserInfoResult} + * @memberof GetUserInfoV1200Response + */ + 'result'?: GetUserInfoResult; + /** + * + * @type {boolean} + * @memberof GetUserInfoV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetUserOngoingExamsResult + */ +export interface GetUserOngoingExamsResult { + /** + * + * @type {Array} + * @memberof GetUserOngoingExamsResult + */ + 'exams'?: Array; +} +/** + * + * @export + * @interface GetUserOngoingExamsV1200Response + */ +export interface GetUserOngoingExamsV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetUserOngoingExamsV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetUserOngoingExamsResult} + * @memberof GetUserOngoingExamsV1200Response + */ + 'result'?: GetUserOngoingExamsResult; + /** + * + * @type {boolean} + * @memberof GetUserOngoingExamsV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetUserTopicStatData + */ +export interface GetUserTopicStatData { + /** + * + * @type {number} + * @memberof GetUserTopicStatData + */ + 'topic_id'?: number; + /** + * + * @type {string} + * @memberof GetUserTopicStatData + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface GetUserTopicStatResult + */ +export interface GetUserTopicStatResult { + /** + * + * @type {UserTopicStatInfo} + * @memberof GetUserTopicStatResult + */ + 'stat'?: UserTopicStatInfo; +} +/** + * + * @export + * @interface GetUserTopicStatV1200Response + */ +export interface GetUserTopicStatV1200Response { + /** + * + * @type {EndpointError} + * @memberof GetUserTopicStatV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {GetUserTopicStatResult} + * @memberof GetUserTopicStatV1200Response + */ + 'result'?: GetUserTopicStatResult; + /** + * + * @type {boolean} + * @memberof GetUserTopicStatV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface GetUsersExamHistoryData + */ +export interface GetUsersExamHistoryData { + /** + * + * @type {number} + * @memberof GetUsersExamHistoryData + */ + 'limit'?: number; + /** + * + * @type {number} + * @memberof GetUsersExamHistoryData + */ + 'offset'?: number; + /** + * + * @type {string} + * @memberof GetUsersExamHistoryData + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface GetUsersExamHistoryResult + */ +export interface GetUsersExamHistoryResult { + /** + * + * @type {Array} + * @memberof GetUsersExamHistoryResult + */ + 'exams'?: Array; +} +/** + * + * @export + * @interface LoginData + */ +export interface LoginData { + /** + * + * @type {string} + * @memberof LoginData + */ + 'captcha_answer'?: string; + /** + * + * @type {string} + * @memberof LoginData + */ + 'captcha_id'?: string; + /** + * + * @type {string} + * @memberof LoginData + */ + 'client_rid'?: string; + /** + * + * @type {string} + * @memberof LoginData + */ + 'password'?: string; + /** + * + * @type {string} + * @memberof LoginData + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface LoginResult + */ +export interface LoginResult { + /** + * + * @type {string} + * @memberof LoginResult + */ + 'access_token'?: string; + /** + * + * @type {number} + * @memberof LoginResult + */ + 'expiration'?: number; + /** + * + * @type {string} + * @memberof LoginResult + */ + 'full_name'?: string; + /** + * + * @type {string} + * @memberof LoginResult + */ + 'refresh_token'?: string; + /** + * + * @type {UserRole} + * @memberof LoginResult + */ + 'role'?: UserRole; + /** + * + * @type {string} + * @memberof LoginResult + */ + 'user_id'?: string; +} + + +/** + * + * @export + * @interface LoginV1200Response + */ +export interface LoginV1200Response { + /** + * + * @type {EndpointError} + * @memberof LoginV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {LoginResult} + * @memberof LoginV1200Response + */ + 'result'?: LoginResult; + /** + * + * @type {boolean} + * @memberof LoginV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface ReAuthV1200Response + */ +export interface ReAuthV1200Response { + /** + * + * @type {EndpointError} + * @memberof ReAuthV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {AuthResult} + * @memberof ReAuthV1200Response + */ + 'result'?: AuthResult; + /** + * + * @type {boolean} + * @memberof ReAuthV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface SearchCourseData + */ +export interface SearchCourseData { + /** + * + * @type {string} + * @memberof SearchCourseData + */ + 'course_name'?: string; +} +/** + * + * @export + * @interface SearchCourseResult + */ +export interface SearchCourseResult { + /** + * + * @type {Array} + * @memberof SearchCourseResult + */ + 'courses'?: Array; +} +/** + * + * @export + * @interface SearchCourseV1200Response + */ +export interface SearchCourseV1200Response { + /** + * + * @type {EndpointError} + * @memberof SearchCourseV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {SearchCourseResult} + * @memberof SearchCourseV1200Response + */ + 'result'?: SearchCourseResult; + /** + * + * @type {boolean} + * @memberof SearchCourseV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface SearchTopicData + */ +export interface SearchTopicData { + /** + * + * @type {string} + * @memberof SearchTopicData + */ + 'topic_name'?: string; +} +/** + * + * @export + * @interface SearchTopicResult + */ +export interface SearchTopicResult { + /** + * + * @type {Array} + * @memberof SearchTopicResult + */ + 'topics'?: Array; +} +/** + * + * @export + * @interface SearchTopicV1200Response + */ +export interface SearchTopicV1200Response { + /** + * + * @type {EndpointError} + * @memberof SearchTopicV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {SearchTopicResult} + * @memberof SearchTopicV1200Response + */ + 'result'?: SearchTopicResult; + /** + * + * @type {boolean} + * @memberof SearchTopicV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface SearchUserData + */ +export interface SearchUserData { + /** + * + * @type {number} + * @memberof SearchUserData + */ + 'limit'?: number; + /** + * + * @type {number} + * @memberof SearchUserData + */ + 'offset'?: number; + /** + * + * @type {string} + * @memberof SearchUserData + */ + 'query'?: string; +} +/** + * + * @export + * @interface SearchUserResult + */ +export interface SearchUserResult { + /** + * + * @type {Array} + * @memberof SearchUserResult + */ + 'users'?: Array; +} +/** + * + * @export + * @interface SearchUserV1200Response + */ +export interface SearchUserV1200Response { + /** + * + * @type {EndpointError} + * @memberof SearchUserV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {SearchUserResult} + * @memberof SearchUserV1200Response + */ + 'result'?: SearchUserResult; + /** + * + * @type {boolean} + * @memberof SearchUserV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface SearchedCourseInfo + */ +export interface SearchedCourseInfo { + /** + * + * @type {string} + * @memberof SearchedCourseInfo + */ + 'added_by'?: string; + /** + * + * @type {string} + * @memberof SearchedCourseInfo + */ + 'course_description'?: string; + /** + * + * @type {number} + * @memberof SearchedCourseInfo + */ + 'course_id'?: number; + /** + * + * @type {string} + * @memberof SearchedCourseInfo + */ + 'course_name'?: string; + /** + * + * @type {string} + * @memberof SearchedCourseInfo + */ + 'created_at'?: string; +} +/** + * + * @export + * @interface SearchedTopicInfo + */ +export interface SearchedTopicInfo { + /** + * + * @type {number} + * @memberof SearchedTopicInfo + */ + 'topic_id'?: number; + /** + * + * @type {string} + * @memberof SearchedTopicInfo + */ + 'topic_name'?: string; +} +/** + * + * @export + * @interface SearchedUserInfo + */ +export interface SearchedUserInfo { + /** + * + * @type {string} + * @memberof SearchedUserInfo + */ + 'ban_reason'?: string; + /** + * + * @type {string} + * @memberof SearchedUserInfo + */ + 'created_at'?: string; + /** + * + * @type {string} + * @memberof SearchedUserInfo + */ + 'email'?: string; + /** + * + * @type {string} + * @memberof SearchedUserInfo + */ + 'full_name'?: string; + /** + * + * @type {boolean} + * @memberof SearchedUserInfo + */ + 'is_banned'?: boolean; + /** + * + * @type {UserRole} + * @memberof SearchedUserInfo + */ + 'role'?: UserRole; + /** + * + * @type {string} + * @memberof SearchedUserInfo + */ + 'user_id'?: string; +} + + +/** + * + * @export + * @interface SetScoreData + */ +export interface SetScoreData { + /** + * ExamId is the exam we are trying to give this score to. + * @type {number} + * @memberof SetScoreData + */ + 'exam_id'?: number; + /** + * Score is the score we are trying to give to the user. + * @type {string} + * @memberof SetScoreData + */ + 'score'?: string; + /** + * UserId is the person we are trying to give this score to. + * @type {string} + * @memberof SetScoreData + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface SetScoreResult + */ +export interface SetScoreResult { + /** + * + * @type {number} + * @memberof SetScoreResult + */ + 'exam_id'?: number; + /** + * + * @type {string} + * @memberof SetScoreResult + */ + 'score'?: string; + /** + * + * @type {string} + * @memberof SetScoreResult + */ + 'scored_by'?: string; + /** + * + * @type {string} + * @memberof SetScoreResult + */ + 'user_id'?: string; +} +/** + * + * @export + * @interface SetScoreV1200Response + */ +export interface SetScoreV1200Response { + /** + * + * @type {EndpointError} + * @memberof SetScoreV1200Response + */ + 'error'?: EndpointError; + /** + * + * @type {SetScoreResult} + * @memberof SetScoreV1200Response + */ + 'result'?: SetScoreResult; + /** + * + * @type {boolean} + * @memberof SetScoreV1200Response + */ + 'success'?: boolean; +} +/** + * + * @export + * @interface UserExamHistoryInfo + */ +export interface UserExamHistoryInfo { + /** + * + * @type {number} + * @memberof UserExamHistoryInfo + */ + 'exam_id'?: number; + /** + * + * @type {string} + * @memberof UserExamHistoryInfo + */ + 'exam_title'?: string; + /** + * + * @type {string} + * @memberof UserExamHistoryInfo + */ + 'started_at'?: string; +} +/** + * + * @export + * @interface UserOngoingExamInfo + */ +export interface UserOngoingExamInfo { + /** + * + * @type {number} + * @memberof UserOngoingExamInfo + */ + 'course_id'?: number; + /** + * + * @type {number} + * @memberof UserOngoingExamInfo + */ + 'exam_id'?: number; + /** + * + * @type {string} + * @memberof UserOngoingExamInfo + */ + 'start_time'?: string; +} +/** + * + * @export + * @interface UserParticipatedCourse + */ +export interface UserParticipatedCourse { + /** + * + * @type {number} + * @memberof UserParticipatedCourse + */ + 'course_id'?: number; + /** + * + * @type {string} + * @memberof UserParticipatedCourse + */ + 'course_name'?: string; +} +/** + * UserRole is the role of the user. + * @export + * @enum {string} + */ + +export const UserRole = { + UserRoleOwner: 'owner', + UserRoleAdmin: 'admin', + UserRoleStudent: 'student', + UserRoleTeacher: 'teacher', + UserRoleUnknown: '' +} as const; + +export type UserRole = typeof UserRole[keyof typeof UserRole]; + + +/** + * + * @export + * @interface UserTopicStatInfo + */ +export interface UserTopicStatInfo { + /** + * + * @type {number} + * @memberof UserTopicStatInfo + */ + 'current_exp'?: number; + /** + * + * @type {number} + * @memberof UserTopicStatInfo + */ + 'current_level'?: number; + /** + * + * @type {string} + * @memberof UserTopicStatInfo + */ + 'last_visited'?: string; + /** + * + * @type {number} + * @memberof UserTopicStatInfo + */ + 'topic_id'?: number; + /** + * + * @type {number} + * @memberof UserTopicStatInfo + */ + 'total_exp'?: number; + /** + * + * @type {string} + * @memberof UserTopicStatInfo + */ + 'user_id'?: string; +} + +/** + * CourseApi - axios parameter creator + * @export + */ +export const CourseApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Allows a user to create a new course. + * @summary Create a new course + * @param {string} authorization Authorization token + * @param {CreateCourseData} data Data needed to create a new course + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createCourseV1: async (authorization: string, data: CreateCourseData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('createCourseV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('createCourseV1', 'data', data) + const localVarPath = `/api/v1/course/create`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows a user to get information about a course by its id. + * @summary Get course information + * @param {number} id Course ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCourseInfoV1: async (id: number, authorization: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('getCourseInfoV1', 'id', id) + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getCourseInfoV1', 'authorization', authorization) + const localVarPath = `/api/v1/course/info`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (id !== undefined) { + localVarQueryParameter['id'] = id; + } + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows a user to get all participants of a course. + * @summary Get course participants + * @param {string} authorization Authorization token + * @param {GetCourseParticipantsData} data Data needed to get course participants + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCourseParticipantsV1: async (authorization: string, data: GetCourseParticipantsData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getCourseParticipantsV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('getCourseParticipantsV1', 'data', data) + const localVarPath = `/api/v1/course/courseParticipants`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows a user to get all courses created by a user. + * @summary Get created courses + * @param {string} authorization Authorization token + * @param {GetCreatedCoursesData} data Data needed to get created courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCreatedCoursesV1: async (authorization: string, data: GetCreatedCoursesData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getCreatedCoursesV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('getCreatedCoursesV1', 'data', data) + const localVarPath = `/api/v1/course/createdCourses`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows a user to get all courses participated by a user. + * @summary Get user courses + * @param {string} authorization Authorization token + * @param {GetUserCoursesData} data Data needed to get user courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserCoursesV1: async (authorization: string, data: GetUserCoursesData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getUserCoursesV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('getUserCoursesV1', 'data', data) + const localVarPath = `/api/v1/course/userCourses`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows a user to search for courses by their name. + * @summary Search for courses + * @param {string} authorization Authorization token + * @param {SearchCourseData} data Data needed to search for courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchCourseV1: async (authorization: string, data: SearchCourseData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('searchCourseV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('searchCourseV1', 'data', data) + const localVarPath = `/api/v1/course/search`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * CourseApi - functional programming interface + * @export + */ +export const CourseApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = CourseApiAxiosParamCreator(configuration) + return { + /** + * Allows a user to create a new course. + * @summary Create a new course + * @param {string} authorization Authorization token + * @param {CreateCourseData} data Data needed to create a new course + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createCourseV1(authorization: string, data: CreateCourseData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createCourseV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CourseApi.createCourseV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows a user to get information about a course by its id. + * @summary Get course information + * @param {number} id Course ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCourseInfoV1(id: number, authorization: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getCourseInfoV1(id, authorization, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CourseApi.getCourseInfoV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows a user to get all participants of a course. + * @summary Get course participants + * @param {string} authorization Authorization token + * @param {GetCourseParticipantsData} data Data needed to get course participants + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCourseParticipantsV1(authorization: string, data: GetCourseParticipantsData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getCourseParticipantsV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CourseApi.getCourseParticipantsV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows a user to get all courses created by a user. + * @summary Get created courses + * @param {string} authorization Authorization token + * @param {GetCreatedCoursesData} data Data needed to get created courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCreatedCoursesV1(authorization: string, data: GetCreatedCoursesData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getCreatedCoursesV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CourseApi.getCreatedCoursesV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows a user to get all courses participated by a user. + * @summary Get user courses + * @param {string} authorization Authorization token + * @param {GetUserCoursesData} data Data needed to get user courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUserCoursesV1(authorization: string, data: GetUserCoursesData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserCoursesV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CourseApi.getUserCoursesV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows a user to search for courses by their name. + * @summary Search for courses + * @param {string} authorization Authorization token + * @param {SearchCourseData} data Data needed to search for courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async searchCourseV1(authorization: string, data: SearchCourseData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.searchCourseV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['CourseApi.searchCourseV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * CourseApi - factory interface + * @export + */ +export const CourseApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = CourseApiFp(configuration) + return { + /** + * Allows a user to create a new course. + * @summary Create a new course + * @param {string} authorization Authorization token + * @param {CreateCourseData} data Data needed to create a new course + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createCourseV1(authorization: string, data: CreateCourseData, options?: any): AxiosPromise { + return localVarFp.createCourseV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Allows a user to get information about a course by its id. + * @summary Get course information + * @param {number} id Course ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCourseInfoV1(id: number, authorization: string, options?: any): AxiosPromise { + return localVarFp.getCourseInfoV1(id, authorization, options).then((request) => request(axios, basePath)); + }, + /** + * Allows a user to get all participants of a course. + * @summary Get course participants + * @param {string} authorization Authorization token + * @param {GetCourseParticipantsData} data Data needed to get course participants + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCourseParticipantsV1(authorization: string, data: GetCourseParticipantsData, options?: any): AxiosPromise { + return localVarFp.getCourseParticipantsV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Allows a user to get all courses created by a user. + * @summary Get created courses + * @param {string} authorization Authorization token + * @param {GetCreatedCoursesData} data Data needed to get created courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCreatedCoursesV1(authorization: string, data: GetCreatedCoursesData, options?: any): AxiosPromise { + return localVarFp.getCreatedCoursesV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Allows a user to get all courses participated by a user. + * @summary Get user courses + * @param {string} authorization Authorization token + * @param {GetUserCoursesData} data Data needed to get user courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserCoursesV1(authorization: string, data: GetUserCoursesData, options?: any): AxiosPromise { + return localVarFp.getUserCoursesV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Allows a user to search for courses by their name. + * @summary Search for courses + * @param {string} authorization Authorization token + * @param {SearchCourseData} data Data needed to search for courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchCourseV1(authorization: string, data: SearchCourseData, options?: any): AxiosPromise { + return localVarFp.searchCourseV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * CourseApi - object-oriented interface + * @export + * @class CourseApi + * @extends {BaseAPI} + */ +export class CourseApi extends BaseAPI { + /** + * Allows a user to create a new course. + * @summary Create a new course + * @param {string} authorization Authorization token + * @param {CreateCourseData} data Data needed to create a new course + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CourseApi + */ + public createCourseV1(authorization: string, data: CreateCourseData, options?: RawAxiosRequestConfig) { + return CourseApiFp(this.configuration).createCourseV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows a user to get information about a course by its id. + * @summary Get course information + * @param {number} id Course ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CourseApi + */ + public getCourseInfoV1(id: number, authorization: string, options?: RawAxiosRequestConfig) { + return CourseApiFp(this.configuration).getCourseInfoV1(id, authorization, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows a user to get all participants of a course. + * @summary Get course participants + * @param {string} authorization Authorization token + * @param {GetCourseParticipantsData} data Data needed to get course participants + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CourseApi + */ + public getCourseParticipantsV1(authorization: string, data: GetCourseParticipantsData, options?: RawAxiosRequestConfig) { + return CourseApiFp(this.configuration).getCourseParticipantsV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows a user to get all courses created by a user. + * @summary Get created courses + * @param {string} authorization Authorization token + * @param {GetCreatedCoursesData} data Data needed to get created courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CourseApi + */ + public getCreatedCoursesV1(authorization: string, data: GetCreatedCoursesData, options?: RawAxiosRequestConfig) { + return CourseApiFp(this.configuration).getCreatedCoursesV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows a user to get all courses participated by a user. + * @summary Get user courses + * @param {string} authorization Authorization token + * @param {GetUserCoursesData} data Data needed to get user courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CourseApi + */ + public getUserCoursesV1(authorization: string, data: GetUserCoursesData, options?: RawAxiosRequestConfig) { + return CourseApiFp(this.configuration).getUserCoursesV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows a user to search for courses by their name. + * @summary Search for courses + * @param {string} authorization Authorization token + * @param {SearchCourseData} data Data needed to search for courses + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CourseApi + */ + public searchCourseV1(authorization: string, data: SearchCourseData, options?: RawAxiosRequestConfig) { + return CourseApiFp(this.configuration).searchCourseV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } +} + + + +/** + * ExamApi - axios parameter creator + * @export + */ +export const ExamApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Allows the user to answer a question of an exam. + * @summary Answer a question of an exam + * @param {string} authorization Authorization token + * @param {AnswerQuestionData} data Data needed to answer a question of an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + answerExamQuestionV1: async (authorization: string, data: AnswerQuestionData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('answerExamQuestionV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('answerExamQuestionV1', 'data', data) + const localVarPath = `/api/v1/exam/answer`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows the user to create a new exam. + * @summary Create a new exam + * @param {string} authorization Authorization token + * @param {CreateExamData} data Data needed to create a new exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createExamV1: async (authorization: string, data: CreateExamData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('createExamV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('createExamV1', 'data', data) + const localVarPath = `/api/v1/exam/create`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows the user to get information about an exam. + * @summary Get information about an exam + * @param {number} id Exam ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExamInfoV1: async (id: number, authorization: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('getExamInfoV1', 'id', id) + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getExamInfoV1', 'authorization', authorization) + const localVarPath = `/api/v1/exam/info`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (id !== undefined) { + localVarQueryParameter['id'] = id; + } + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows the user to get questions of an exam. + * @summary Get questions of an exam + * @param {string} authorization Authorization token + * @param {GetExamQuestionsData} data Data needed to get questions of an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExamQuestionsV1: async (authorization: string, data: GetExamQuestionsData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getExamQuestionsV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('getExamQuestionsV1', 'data', data) + const localVarPath = `/api/v1/exam/questions`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows the user to get information about an exam that a user has participated in. + * @summary Get information about an exam that a user has participated in + * @param {string} authorization Authorization token + * @param {GetGivenExamData} data Data needed to get information about an exam that a user has participated in + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGivenExamV1: async (authorization: string, data: GetGivenExamData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getGivenExamV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('getGivenExamV1', 'data', data) + const localVarPath = `/api/v1/exam/givenExam`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows the user to get history of exams of a user. + * @summary Get history of exams of a user + * @param {string} authorization Authorization token + * @param {GetUsersExamHistoryData} data Data needed to get history of exams of a user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserExamsHistoryV1: async (authorization: string, data: GetUsersExamHistoryData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getUserExamsHistoryV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('getUserExamsHistoryV1', 'data', data) + const localVarPath = `/api/v1/exam/userExamsHistory`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows the user to get ongoing exams of a user. + * @summary Get ongoing exams of a user + * @param {string} authorization Authorization token + * @param {string} [targetId] Target user id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserOngoingExamsV1: async (authorization: string, targetId?: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getUserOngoingExamsV1', 'authorization', authorization) + const localVarPath = `/api/v1/exam/userOngoingExams`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (targetId !== undefined) { + localVarQueryParameter['targetId'] = targetId; + } + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Allows the user to set score for a user in an exam. + * @summary Set score for a user in an exam + * @param {string} authorization Authorization token + * @param {SetScoreData} data Data needed to set score for a user in an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setScoreV1: async (authorization: string, data: SetScoreData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('setScoreV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('setScoreV1', 'data', data) + const localVarPath = `/api/v1/exam/setScore`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ExamApi - functional programming interface + * @export + */ +export const ExamApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ExamApiAxiosParamCreator(configuration) + return { + /** + * Allows the user to answer a question of an exam. + * @summary Answer a question of an exam + * @param {string} authorization Authorization token + * @param {AnswerQuestionData} data Data needed to answer a question of an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async answerExamQuestionV1(authorization: string, data: AnswerQuestionData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.answerExamQuestionV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ExamApi.answerExamQuestionV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows the user to create a new exam. + * @summary Create a new exam + * @param {string} authorization Authorization token + * @param {CreateExamData} data Data needed to create a new exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createExamV1(authorization: string, data: CreateExamData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createExamV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ExamApi.createExamV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows the user to get information about an exam. + * @summary Get information about an exam + * @param {number} id Exam ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getExamInfoV1(id: number, authorization: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getExamInfoV1(id, authorization, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ExamApi.getExamInfoV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows the user to get questions of an exam. + * @summary Get questions of an exam + * @param {string} authorization Authorization token + * @param {GetExamQuestionsData} data Data needed to get questions of an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getExamQuestionsV1(authorization: string, data: GetExamQuestionsData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getExamQuestionsV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ExamApi.getExamQuestionsV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows the user to get information about an exam that a user has participated in. + * @summary Get information about an exam that a user has participated in + * @param {string} authorization Authorization token + * @param {GetGivenExamData} data Data needed to get information about an exam that a user has participated in + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getGivenExamV1(authorization: string, data: GetGivenExamData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getGivenExamV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ExamApi.getGivenExamV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows the user to get history of exams of a user. + * @summary Get history of exams of a user + * @param {string} authorization Authorization token + * @param {GetUsersExamHistoryData} data Data needed to get history of exams of a user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUserExamsHistoryV1(authorization: string, data: GetUsersExamHistoryData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserExamsHistoryV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ExamApi.getUserExamsHistoryV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows the user to get ongoing exams of a user. + * @summary Get ongoing exams of a user + * @param {string} authorization Authorization token + * @param {string} [targetId] Target user id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUserOngoingExamsV1(authorization: string, targetId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserOngoingExamsV1(authorization, targetId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ExamApi.getUserOngoingExamsV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Allows the user to set score for a user in an exam. + * @summary Set score for a user in an exam + * @param {string} authorization Authorization token + * @param {SetScoreData} data Data needed to set score for a user in an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async setScoreV1(authorization: string, data: SetScoreData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.setScoreV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['ExamApi.setScoreV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * ExamApi - factory interface + * @export + */ +export const ExamApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ExamApiFp(configuration) + return { + /** + * Allows the user to answer a question of an exam. + * @summary Answer a question of an exam + * @param {string} authorization Authorization token + * @param {AnswerQuestionData} data Data needed to answer a question of an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + answerExamQuestionV1(authorization: string, data: AnswerQuestionData, options?: any): AxiosPromise { + return localVarFp.answerExamQuestionV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Allows the user to create a new exam. + * @summary Create a new exam + * @param {string} authorization Authorization token + * @param {CreateExamData} data Data needed to create a new exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createExamV1(authorization: string, data: CreateExamData, options?: any): AxiosPromise { + return localVarFp.createExamV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Allows the user to get information about an exam. + * @summary Get information about an exam + * @param {number} id Exam ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExamInfoV1(id: number, authorization: string, options?: any): AxiosPromise { + return localVarFp.getExamInfoV1(id, authorization, options).then((request) => request(axios, basePath)); + }, + /** + * Allows the user to get questions of an exam. + * @summary Get questions of an exam + * @param {string} authorization Authorization token + * @param {GetExamQuestionsData} data Data needed to get questions of an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExamQuestionsV1(authorization: string, data: GetExamQuestionsData, options?: any): AxiosPromise { + return localVarFp.getExamQuestionsV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Allows the user to get information about an exam that a user has participated in. + * @summary Get information about an exam that a user has participated in + * @param {string} authorization Authorization token + * @param {GetGivenExamData} data Data needed to get information about an exam that a user has participated in + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGivenExamV1(authorization: string, data: GetGivenExamData, options?: any): AxiosPromise { + return localVarFp.getGivenExamV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Allows the user to get history of exams of a user. + * @summary Get history of exams of a user + * @param {string} authorization Authorization token + * @param {GetUsersExamHistoryData} data Data needed to get history of exams of a user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserExamsHistoryV1(authorization: string, data: GetUsersExamHistoryData, options?: any): AxiosPromise { + return localVarFp.getUserExamsHistoryV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Allows the user to get ongoing exams of a user. + * @summary Get ongoing exams of a user + * @param {string} authorization Authorization token + * @param {string} [targetId] Target user id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserOngoingExamsV1(authorization: string, targetId?: string, options?: any): AxiosPromise { + return localVarFp.getUserOngoingExamsV1(authorization, targetId, options).then((request) => request(axios, basePath)); + }, + /** + * Allows the user to set score for a user in an exam. + * @summary Set score for a user in an exam + * @param {string} authorization Authorization token + * @param {SetScoreData} data Data needed to set score for a user in an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setScoreV1(authorization: string, data: SetScoreData, options?: any): AxiosPromise { + return localVarFp.setScoreV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ExamApi - object-oriented interface + * @export + * @class ExamApi + * @extends {BaseAPI} + */ +export class ExamApi extends BaseAPI { + /** + * Allows the user to answer a question of an exam. + * @summary Answer a question of an exam + * @param {string} authorization Authorization token + * @param {AnswerQuestionData} data Data needed to answer a question of an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExamApi + */ + public answerExamQuestionV1(authorization: string, data: AnswerQuestionData, options?: RawAxiosRequestConfig) { + return ExamApiFp(this.configuration).answerExamQuestionV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows the user to create a new exam. + * @summary Create a new exam + * @param {string} authorization Authorization token + * @param {CreateExamData} data Data needed to create a new exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExamApi + */ + public createExamV1(authorization: string, data: CreateExamData, options?: RawAxiosRequestConfig) { + return ExamApiFp(this.configuration).createExamV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows the user to get information about an exam. + * @summary Get information about an exam + * @param {number} id Exam ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExamApi + */ + public getExamInfoV1(id: number, authorization: string, options?: RawAxiosRequestConfig) { + return ExamApiFp(this.configuration).getExamInfoV1(id, authorization, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows the user to get questions of an exam. + * @summary Get questions of an exam + * @param {string} authorization Authorization token + * @param {GetExamQuestionsData} data Data needed to get questions of an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExamApi + */ + public getExamQuestionsV1(authorization: string, data: GetExamQuestionsData, options?: RawAxiosRequestConfig) { + return ExamApiFp(this.configuration).getExamQuestionsV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows the user to get information about an exam that a user has participated in. + * @summary Get information about an exam that a user has participated in + * @param {string} authorization Authorization token + * @param {GetGivenExamData} data Data needed to get information about an exam that a user has participated in + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExamApi + */ + public getGivenExamV1(authorization: string, data: GetGivenExamData, options?: RawAxiosRequestConfig) { + return ExamApiFp(this.configuration).getGivenExamV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows the user to get history of exams of a user. + * @summary Get history of exams of a user + * @param {string} authorization Authorization token + * @param {GetUsersExamHistoryData} data Data needed to get history of exams of a user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExamApi + */ + public getUserExamsHistoryV1(authorization: string, data: GetUsersExamHistoryData, options?: RawAxiosRequestConfig) { + return ExamApiFp(this.configuration).getUserExamsHistoryV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows the user to get ongoing exams of a user. + * @summary Get ongoing exams of a user + * @param {string} authorization Authorization token + * @param {string} [targetId] Target user id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExamApi + */ + public getUserOngoingExamsV1(authorization: string, targetId?: string, options?: RawAxiosRequestConfig) { + return ExamApiFp(this.configuration).getUserOngoingExamsV1(authorization, targetId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Allows the user to set score for a user in an exam. + * @summary Set score for a user in an exam + * @param {string} authorization Authorization token + * @param {SetScoreData} data Data needed to set score for a user in an exam + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExamApi + */ + public setScoreV1(authorization: string, data: SetScoreData, options?: RawAxiosRequestConfig) { + return ExamApiFp(this.configuration).setScoreV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } +} + + + +/** + * TopicApi - axios parameter creator + * @export + */ +export const TopicApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Create a new topic + * @summary Create a new topic + * @param {string} authorization Authorization token + * @param {CreateNewTopicData} data Data needed to create a new topic + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createTopicV1: async (authorization: string, data: CreateNewTopicData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('createTopicV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('createTopicV1', 'data', data) + const localVarPath = `/api/v1/topic/create`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Get all user topic stats + * @summary Get all user topic stats + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAllUserTopicStatsV1: async (authorization: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getAllUserTopicStatsV1', 'authorization', authorization) + const localVarPath = `/api/v1/topic/allUserTopicStats`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Get topic info + * @summary Get topic info + * @param {number} id Topic ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTopicInfoV1: async (id: number, authorization: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('getTopicInfoV1', 'id', id) + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getTopicInfoV1', 'authorization', authorization) + const localVarPath = `/api/v1/topic/info`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (id !== undefined) { + localVarQueryParameter['id'] = id; + } + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Get user topic stat + * @summary Get user topic stat + * @param {string} authorization Authorization token + * @param {GetUserTopicStatData} data Data needed to get user topic stat + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserTopicStatV1: async (authorization: string, data: GetUserTopicStatData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('getUserTopicStatV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('getUserTopicStatV1', 'data', data) + const localVarPath = `/api/v1/topic/userTopicStat`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Search for topics + * @summary Search for topics + * @param {string} authorization Authorization token + * @param {SearchTopicData} data Data needed to search for topics + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchTopicV1: async (authorization: string, data: SearchTopicData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'authorization' is not null or undefined + assertParamExists('searchTopicV1', 'authorization', authorization) + // verify required parameter 'data' is not null or undefined + assertParamExists('searchTopicV1', 'data', data) + const localVarPath = `/api/v1/topic/search`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (authorization != null) { + localVarHeaderParameter['Authorization'] = String(authorization); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(data, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * TopicApi - functional programming interface * @export - * @interface SearchUserResult */ -export interface SearchUserResult { - /** - * - * @type {Array} - * @memberof SearchUserResult - */ - 'users'?: Array; -} +export const TopicApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = TopicApiAxiosParamCreator(configuration) + return { + /** + * Create a new topic + * @summary Create a new topic + * @param {string} authorization Authorization token + * @param {CreateNewTopicData} data Data needed to create a new topic + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createTopicV1(authorization: string, data: CreateNewTopicData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createTopicV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TopicApi.createTopicV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Get all user topic stats + * @summary Get all user topic stats + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getAllUserTopicStatsV1(authorization: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getAllUserTopicStatsV1(authorization, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TopicApi.getAllUserTopicStatsV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Get topic info + * @summary Get topic info + * @param {number} id Topic ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getTopicInfoV1(id: number, authorization: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getTopicInfoV1(id, authorization, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TopicApi.getTopicInfoV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Get user topic stat + * @summary Get user topic stat + * @param {string} authorization Authorization token + * @param {GetUserTopicStatData} data Data needed to get user topic stat + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUserTopicStatV1(authorization: string, data: GetUserTopicStatData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserTopicStatV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TopicApi.getUserTopicStatV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Search for topics + * @summary Search for topics + * @param {string} authorization Authorization token + * @param {SearchTopicData} data Data needed to search for topics + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async searchTopicV1(authorization: string, data: SearchTopicData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.searchTopicV1(authorization, data, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TopicApi.searchTopicV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + /** - * + * TopicApi - factory interface * @export - * @interface SearchUserV1200Response */ -export interface SearchUserV1200Response { - /** - * - * @type {EndpointError} - * @memberof SearchUserV1200Response - */ - 'error'?: EndpointError; - /** - * - * @type {SearchUserResult} - * @memberof SearchUserV1200Response - */ - 'result'?: SearchUserResult; - /** - * - * @type {boolean} - * @memberof SearchUserV1200Response - */ - 'success'?: boolean; -} +export const TopicApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = TopicApiFp(configuration) + return { + /** + * Create a new topic + * @summary Create a new topic + * @param {string} authorization Authorization token + * @param {CreateNewTopicData} data Data needed to create a new topic + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createTopicV1(authorization: string, data: CreateNewTopicData, options?: any): AxiosPromise { + return localVarFp.createTopicV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Get all user topic stats + * @summary Get all user topic stats + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAllUserTopicStatsV1(authorization: string, options?: any): AxiosPromise { + return localVarFp.getAllUserTopicStatsV1(authorization, options).then((request) => request(axios, basePath)); + }, + /** + * Get topic info + * @summary Get topic info + * @param {number} id Topic ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTopicInfoV1(id: number, authorization: string, options?: any): AxiosPromise { + return localVarFp.getTopicInfoV1(id, authorization, options).then((request) => request(axios, basePath)); + }, + /** + * Get user topic stat + * @summary Get user topic stat + * @param {string} authorization Authorization token + * @param {GetUserTopicStatData} data Data needed to get user topic stat + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserTopicStatV1(authorization: string, data: GetUserTopicStatData, options?: any): AxiosPromise { + return localVarFp.getUserTopicStatV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + /** + * Search for topics + * @summary Search for topics + * @param {string} authorization Authorization token + * @param {SearchTopicData} data Data needed to search for topics + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchTopicV1(authorization: string, data: SearchTopicData, options?: any): AxiosPromise { + return localVarFp.searchTopicV1(authorization, data, options).then((request) => request(axios, basePath)); + }, + }; +}; + /** - * + * TopicApi - object-oriented interface * @export - * @interface SearchedUserInfo + * @class TopicApi + * @extends {BaseAPI} */ -export interface SearchedUserInfo { - /** - * - * @type {string} - * @memberof SearchedUserInfo - */ - 'ban_reason'?: string; - /** - * - * @type {string} - * @memberof SearchedUserInfo - */ - 'created_at'?: string; +export class TopicApi extends BaseAPI { /** - * - * @type {string} - * @memberof SearchedUserInfo + * Create a new topic + * @summary Create a new topic + * @param {string} authorization Authorization token + * @param {CreateNewTopicData} data Data needed to create a new topic + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TopicApi */ - 'email'?: string; + public createTopicV1(authorization: string, data: CreateNewTopicData, options?: RawAxiosRequestConfig) { + return TopicApiFp(this.configuration).createTopicV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + /** - * - * @type {string} - * @memberof SearchedUserInfo + * Get all user topic stats + * @summary Get all user topic stats + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TopicApi */ - 'full_name'?: string; + public getAllUserTopicStatsV1(authorization: string, options?: RawAxiosRequestConfig) { + return TopicApiFp(this.configuration).getAllUserTopicStatsV1(authorization, options).then((request) => request(this.axios, this.basePath)); + } + /** - * - * @type {boolean} - * @memberof SearchedUserInfo + * Get topic info + * @summary Get topic info + * @param {number} id Topic ID + * @param {string} authorization Authorization token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TopicApi */ - 'is_banned'?: boolean; + public getTopicInfoV1(id: number, authorization: string, options?: RawAxiosRequestConfig) { + return TopicApiFp(this.configuration).getTopicInfoV1(id, authorization, options).then((request) => request(this.axios, this.basePath)); + } + /** - * - * @type {UserRole} - * @memberof SearchedUserInfo + * Get user topic stat + * @summary Get user topic stat + * @param {string} authorization Authorization token + * @param {GetUserTopicStatData} data Data needed to get user topic stat + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TopicApi */ - 'role'?: UserRole; + public getUserTopicStatV1(authorization: string, data: GetUserTopicStatData, options?: RawAxiosRequestConfig) { + return TopicApiFp(this.configuration).getUserTopicStatV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } + /** - * - * @type {string} - * @memberof SearchedUserInfo + * Search for topics + * @summary Search for topics + * @param {string} authorization Authorization token + * @param {SearchTopicData} data Data needed to search for topics + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TopicApi */ - 'user_id'?: string; + public searchTopicV1(authorization: string, data: SearchTopicData, options?: RawAxiosRequestConfig) { + return TopicApiFp(this.configuration).searchTopicV1(authorization, data, options).then((request) => request(this.axios, this.basePath)); + } } -/** - * UserRole is the role of the user. - * @export - * @enum {string} - */ - -export const UserRole = { - UserRoleOwner: 'owner', - UserRoleAdmin: 'admin', - UserRoleStudent: 'student', - UserRoleTeacher: 'teacher', - UserRoleUnknown: '' -} as const; - -export type UserRole = typeof UserRole[keyof typeof UserRole]; - - /** * UserApi - axios parameter creator @@ -1115,6 +4364,42 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * Allows a user to confirm their account + * @summary Confirm account + * @param {ConfirmAccountData} confirmAccountData Confirm account data + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + confirmAccountV1: async (confirmAccountData: ConfirmAccountData, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'confirmAccountData' is not null or undefined + assertParamExists('confirmAccountV1', 'confirmAccountData', confirmAccountData) + const localVarPath = `/api/v1/user/confirmAccount`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(confirmAccountData, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * Allows a user to confirm changing their own\'s password (from redirected page) * @summary Confirm changing your own\'s password @@ -1509,6 +4794,19 @@ export const UserApiFp = function(configuration?: Configuration) { const localVarOperationServerBasePath = operationServerMap['UserApi.changePasswordV1']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, + /** + * Allows a user to confirm their account + * @summary Confirm account + * @param {ConfirmAccountData} confirmAccountData Confirm account data + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async confirmAccountV1(confirmAccountData: ConfirmAccountData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.confirmAccountV1(confirmAccountData, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['UserApi.confirmAccountV1']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, /** * Allows a user to confirm changing their own\'s password (from redirected page) * @summary Confirm changing your own\'s password @@ -1516,7 +4814,7 @@ export const UserApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async confirmChangePasswordV1(confirmChangePasswordData: ConfirmChangePasswordData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async confirmChangePasswordV1(confirmChangePasswordData: ConfirmChangePasswordData, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.confirmChangePasswordV1(confirmChangePasswordData, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['UserApi.confirmChangePasswordV1']?.[localVarOperationServerIndex]?.url; @@ -1662,6 +4960,16 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? changePasswordV1(authorization: string, changePasswordData: ChangePasswordData, options?: any): AxiosPromise { return localVarFp.changePasswordV1(authorization, changePasswordData, options).then((request) => request(axios, basePath)); }, + /** + * Allows a user to confirm their account + * @summary Confirm account + * @param {ConfirmAccountData} confirmAccountData Confirm account data + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + confirmAccountV1(confirmAccountData: ConfirmAccountData, options?: any): AxiosPromise { + return localVarFp.confirmAccountV1(confirmAccountData, options).then((request) => request(axios, basePath)); + }, /** * Allows a user to confirm changing their own\'s password (from redirected page) * @summary Confirm changing your own\'s password @@ -1669,7 +4977,7 @@ export const UserApiFactory = function (configuration?: Configuration, basePath? * @param {*} [options] Override http request option. * @throws {RequiredError} */ - confirmChangePasswordV1(confirmChangePasswordData: ConfirmChangePasswordData, options?: any): AxiosPromise { + confirmChangePasswordV1(confirmChangePasswordData: ConfirmChangePasswordData, options?: any): AxiosPromise { return localVarFp.confirmChangePasswordV1(confirmChangePasswordData, options).then((request) => request(axios, basePath)); }, /** @@ -1792,6 +5100,18 @@ export class UserApi extends BaseAPI { return UserApiFp(this.configuration).changePasswordV1(authorization, changePasswordData, options).then((request) => request(this.axios, this.basePath)); } + /** + * Allows a user to confirm their account + * @summary Confirm account + * @param {ConfirmAccountData} confirmAccountData Confirm account data + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public confirmAccountV1(confirmAccountData: ConfirmAccountData, options?: RawAxiosRequestConfig) { + return UserApiFp(this.configuration).confirmAccountV1(confirmAccountData, options).then((request) => request(this.axios, this.basePath)); + } + /** * Allows a user to confirm changing their own\'s password (from redirected page) * @summary Confirm changing your own\'s password diff --git a/src/apiClient.ts b/src/apiClient.ts index 86c8b3e..7522747 100644 --- a/src/apiClient.ts +++ b/src/apiClient.ts @@ -15,6 +15,11 @@ import { GetUserInfoResult, EditUserData, EditUserResult, + TopicApi, + CreateNewTopicData, + CreateNewTopicResult, + SearchTopicData, + SearchTopicResult, } from './api'; class ExamSphereAPIClient extends UserApi { @@ -35,11 +40,15 @@ class ExamSphereAPIClient extends UserApi { /** The currently logged-in user's role. */ public role?: UserRole; + private topicApi: TopicApi; + constructor() { super(); this.guessBasePath(); this.clientRId = this.generateClientRId(); this.readTokens(); + + this.topicApi = new TopicApi(this.configuration); } /** @@ -62,6 +71,7 @@ class ExamSphereAPIClient extends UserApi { public guessBasePath(): void { // try to find out the base path let correctBasePath = "https://aliwoto.is-a.dev:8080"; + // let correctBasePath = "http://localhost:8080"; const envBasePath = process.env.EXAM_SPHERE_API_URL; if (envBasePath) { correctBasePath = envBasePath; @@ -264,6 +274,36 @@ class ExamSphereAPIClient extends UserApi { return searchUserResult; } + public async createNewTopic(data: CreateNewTopicData): Promise { + if (!this.isLoggedIn()) { + throw new Error("Not logged in"); + } + + let createTopicResult = (await this.topicApi.createTopicV1(`Bearer ${this.accessToken}`, data))?.data.result; + if (!createTopicResult) { + // we shouldn't reach here, because if there is an error somewhere, + // it should have already been thrown by the API client + throw new Error("Failed to create topic"); + } + + return createTopicResult; + } + + public async searchTopic(data: SearchTopicData): Promise { + if (!this.isLoggedIn()) { + throw new Error("Not logged in"); + } + + let searchTopicResult = (await this.topicApi.searchTopicV1(`Bearer ${this.accessToken}`, data))?.data.result; + if (!searchTopicResult) { + // we shouldn't reach here, because if there is an error somewhere, + // it should have already been thrown by the API client + throw new Error("Failed to search topic"); + } + + return searchTopicResult; + } + /** * Returns true if we are considered as "logged in" by the API client, * This method only checks if the access token is present, it doesn't @@ -307,6 +347,14 @@ class ExamSphereAPIClient extends UserApi { return this.isOwner() || this.isAdmin(); } + public canCreateTopics(): boolean { + return this.isOwner() || this.isAdmin(); + } + + public canSearchTopics(): boolean { + return this.isLoggedIn(); + } + public canCreateTargetRole(targetRole: UserRole): boolean { if (targetRole === UserRole.UserRoleOwner || UserRole.UserRoleUnknown) { diff --git a/src/components/menus/sideMenu.tsx b/src/components/menus/sideMenu.tsx index 138fcf3..50c9338 100644 --- a/src/components/menus/sideMenu.tsx +++ b/src/components/menus/sideMenu.tsx @@ -21,150 +21,164 @@ const SideMenuContainer = styled.div<{ $isOpen: boolean }>` `; interface SideMenuProps { - isOpen: boolean; - toggleMenu: () => void; + isOpen: boolean; + toggleMenu: () => void; - children?: React.ReactNode; + children?: React.ReactNode; } -const SideMenu: React.FC = ({...props}) => { - if (apiClient.isOwner()) { - return ( - - - - - - - - - - - - - - - - - - - - { - apiClient.logout(); - window.location.href = '/'; - }} - > - - ); - } +const RenderProfileMenu = () => { + return ( + + + + + ) +}; + +const RenderManageUserMenu = () => { + return ( + + + + + + + + + ) +} + +const RenderManageTopicsMenu = () => { + return ( + + + + + + ) +}; - if (apiClient.isAdmin()) { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - { - apiClient.logout(); - window.location.href = '/'; - }} - > - - ); - } +const RenderManageCoursesMenu = () => { + return ( + + + + + + ) +}; - if (apiClient.isTeacher()) { - return ( - - - - - - - - - - - - - { - apiClient.logout(); - window.location.href = '/'; - }} - > - - ); - } - - if (apiClient.isStudent()) { - return ( - - - - - - - - - - - - - { - apiClient.logout(); - window.location.href = '/'; - }} - > - - ); - } +const RenderManageExamsMenu = () => { + return ( + + + + + ) +}; +const RenderCommonMenus = () => { + return ( + <> + + + { + apiClient.logout(); + window.location.href = '/'; + }} + > + + ); +}; + +const SideMenu: React.FC = ({ ...props }) => { + if (apiClient.isOwner()) { return ( - - - + + + {RenderProfileMenu()} + {RenderManageUserMenu()} + {RenderManageTopicsMenu()} + {RenderManageCoursesMenu()} + {RenderManageExamsMenu()} + {RenderCommonMenus()} + ); + } + + if (apiClient.isAdmin()) { + return ( + + + {RenderProfileMenu()} + {RenderManageUserMenu()} + {RenderManageTopicsMenu()} + {RenderManageCoursesMenu()} + {RenderManageExamsMenu()} + {RenderCommonMenus()} + + ); + } + + if (apiClient.isTeacher()) { + return ( + + + {RenderProfileMenu()} + {RenderManageUserMenu()} + {RenderManageCoursesMenu()} + {RenderManageExamsMenu()} + {RenderCommonMenus()} + + ); + } + + if (apiClient.isStudent()) { + return ( + + + {RenderProfileMenu()} + {RenderManageUserMenu()} + {RenderManageExamsMenu()} + {RenderCommonMenus()} + + ); + } + + return ( + + + + ); }; export default SideMenu; diff --git a/src/pages/createTopicPage.tsx b/src/pages/createTopicPage.tsx new file mode 100644 index 0000000..9b7aaf8 --- /dev/null +++ b/src/pages/createTopicPage.tsx @@ -0,0 +1,59 @@ +import React, { useState } from 'react'; +import SubmitButton from '../components/buttons/submitButton'; +import DashboardContainer from '../components/containers/dashboardContainer'; +import TitleLabel from '../components/labels/titleLabel'; +import CreateUserForm from '../components/forms/createUserForm'; +import CreateUserContainer from '../components/containers/createUserContainer'; +import apiClient from '../apiClient'; +import { CreateNewTopicData } from '../api'; +import { CurrentAppTranslation } from '../translations/appTranslation'; +import { TextField } from '@mui/material'; +import useAppSnackbar from '../components/snackbars/useAppSnackbars'; +import { extractErrorDetails } from '../utils/errorUtils'; + +const CreateTopicPage: React.FC = () => { + const [createTopicData, setUserInfo] = useState({ + topic_name: '', + }); + const snackbar = useAppSnackbar(); + + const handleInputChange = (e: React.ChangeEvent) => { + setUserInfo({ ...createTopicData, [e.target.name]: e.target.value }); + }; + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + + try { + await apiClient.createNewTopic(createTopicData); + snackbar.success(CurrentAppTranslation.TopicCreatedSuccessfullyText); + } catch (error: any) { + const [errCode, errMessage] = extractErrorDetails(error); + snackbar.error(`Failed (${errCode}): ${errMessage}`); + } + }; + + return ( + + + + {CurrentAppTranslation.CreateNewUserText} + { handleInputChange(e as any) }} + required /> + {CurrentAppTranslation.CreateUserButtonText} + + + + ); +}; + +export default CreateTopicPage; \ No newline at end of file diff --git a/src/pages/createUserPage.tsx b/src/pages/createUserPage.tsx index 6886044..731a956 100644 --- a/src/pages/createUserPage.tsx +++ b/src/pages/createUserPage.tsx @@ -113,9 +113,9 @@ const CreateUserPage: React.FC = () => { onChange={(e) => { handleInputChange(e as any) }} required={false} /> apiClient.canCreateTargetRole(role))} diff --git a/src/pages/searchTopicPage.tsx b/src/pages/searchTopicPage.tsx new file mode 100644 index 0000000..f8d025e --- /dev/null +++ b/src/pages/searchTopicPage.tsx @@ -0,0 +1,146 @@ +import { useEffect, useState } from 'react'; +import { + TextField, + List, + ListItem, + CircularProgress, + Paper, + Grid, + Typography, +} from '@mui/material'; +import { Box } from '@mui/material'; +import SearchIcon from '@mui/icons-material/Search'; +import IconButton from '@mui/material/IconButton'; +import { SearchedTopicInfo } from '../api'; +import apiClient from '../apiClient'; +import DashboardContainer from '../components/containers/dashboardContainer'; +import { CurrentAppTranslation } from '../translations/appTranslation'; + +const RenderTopicsList = (topics: SearchedTopicInfo[] | undefined, forEdit: boolean = false) => { + if (!topics || topics.length === 0) { + return ( + + {forEdit ? CurrentAppTranslation.EnterSearchForEdit : + CurrentAppTranslation.NoResultsFoundText} + + ); + } + + return ( + + {topics.map((topic) => ( + + { + // Redirect to user info page, make sure to query encode it + window.location.href = `/topicInfo?topicId=${encodeURIComponent(topic.topic_id!)}`; + } + }> + + + + {`${CurrentAppTranslation.topic_id}: ${topic.topic_id}`} + + + {`${CurrentAppTranslation.topic_name}: ${topic.topic_name}`} + + + + + + ))} + + ) +} + +const SearchTopicPage = () => { + const urlSearch = new URLSearchParams(window.location.search); + const providedQuery = urlSearch.get('query'); + const forEdit = (urlSearch.get('edit') ?? "false") === "true"; + + const [query, setQuery] = useState(providedQuery ?? ''); + const [topics, setTopics] = useState([]); + const [isLoading, setIsLoading] = useState(false); + + const handleSearch = async () => { + window.history.pushState( + `searchTopic_query_${query}`, + "Search Topic", + `/searchTopic?query=${encodeURIComponent(query)}`, + ); + + if (query === '') { + return; + } + + setIsLoading(true); + const results = await apiClient.searchTopic({ + topic_name: query, + }) + + if (!results || !results.topics) { + setIsLoading(false); + return; + } + + setTopics(results.topics); + setIsLoading(false); + }; + + useEffect(() => { + // if at first the query is not null (e.g. the providedQuery exists), + // do the search. + if (query) { + handleSearch(); + } + }, []); // eslint-disable-line react-hooks/exhaustive-deps + + return ( + + + + setQuery(e.target.value)} + label={CurrentAppTranslation.SearchTopicsText} + onKeyDown={(e) => e.key === 'Enter' && handleSearch()} + InputProps={{ + endAdornment: ( + handleSearch()} disabled={isLoading}> + + + ), + }} + /> + {isLoading ? ( + + + + ) : RenderTopicsList(topics, forEdit)} + + + + + + ); +}; + +export default SearchTopicPage; \ No newline at end of file diff --git a/src/translations/appTranslation.ts b/src/translations/appTranslation.ts index 214a67c..29e60b5 100644 --- a/src/translations/appTranslation.ts +++ b/src/translations/appTranslation.ts @@ -8,6 +8,7 @@ export class AppTranslationBase { LoginText: string = "Login"; LoadingText: string = "Loading..."; ProfileText: string = "Profile"; + DashboardText: string = "Dashboard"; EditProfileText: string = "Edit Profile"; ChangePasswordText: string = "Change Password"; ManageUsersText: string = "Manage Users"; @@ -15,6 +16,10 @@ export class AppTranslationBase { SearchUsersText: string = "Search Users"; EditUserInfoText: string = "Edit User Info"; ChangeUserPasswordText: string = "Change User Password"; + ManageTopicsText: string = "Manage Topics"; + AddTopicText: string = "Add Topic"; + SearchTopicsText: string = "Search Topics"; + EditTopicsText: string = "Edit Topic"; ManageCoursesText: string = "Manage Courses"; AddCourseText: string = "Add Course"; SearchCoursesText: string = "Search Courses"; @@ -26,12 +31,16 @@ export class AppTranslationBase { HelpText: string = "Help"; LogoutText: string = "Logout"; CreateUserButtonText: string = "Create User"; + CreateTopicButtonText: string = "Create Topic"; SaveText: string = "Save"; EditText: string = "Edit"; UserInformationText: string = "User Information"; + + // System messages UserNotFoundText: string = "This user doesn't seem to exist..."; CreateNewUserText: string = "Create New User"; UserCreatedSuccessfullyText: string = "User created successfully"; + TopicCreatedSuccessfullyText: string = "Topic created successfully"; NoResultsFoundText: string = "No results found, try changing your search query"; EnterSearchForEdit: string = "Enter search query to edit the user"; @@ -40,6 +49,8 @@ export class AppTranslationBase { //#region API response fields translations + topic_name: string = "Topic Name"; + topic_id: string = "Topic ID"; user_id: string = "User ID"; full_name: string = "Full Name"; email: string = "Email"; diff --git a/src/translations/faTranslation.ts b/src/translations/faTranslation.ts index 9c14519..86658c2 100644 --- a/src/translations/faTranslation.ts +++ b/src/translations/faTranslation.ts @@ -10,12 +10,17 @@ class FaTranslation extends AppTranslationBase { LoginText: string = "ورود"; LoadingText: string = "در حال بارگذاری..."; ProfileText: string = "پروفایل"; + DashboardText: string = "داشبورد"; EditProfileText: string = "ویرایش پروفایل"; ChangePasswordText: string = "تغییر رمز عبور"; ManageUsersText: string = "مدیریت کاربران"; AddUserText: string = "افزودن کاربر"; EditUserInfoText: string = "ویرایش اطلاعات کاربر"; ChangeUserPasswordText: string = "تغییر رمز عبور کاربر"; + ManageTopicsText: string = "مدیریت موضوعات"; + AddTopicText: string = "افزودن موضوع"; + SearchTopicsText: string = "جستجوی موضوعات"; + EditTopicsText: string = "ویرایش موضوع"; ManageCoursesText: string = "مدیریت دوره ها"; AddCourseText: string = "افزودن دوره"; SearchCoursesText: string = "جستجوی دوره ها"; @@ -27,12 +32,18 @@ class FaTranslation extends AppTranslationBase { HelpText: string = "راهنما"; LogoutText: string = "خروج از حساب کاربری"; CreateUserButtonText: string = "ایجاد کاربر"; + CreateTopicButtonText: string = "ایجاد موضوع"; SaveText: string = "ذخیره"; EditText: string = "ویرایش"; UserInformationText: string = "اطلاعات کاربر"; + + + // System messages + UserNotFoundText: string = "این کاربر وجود ندارد..."; CreateNewUserText: string = "ایجاد کاربر جدید"; UserCreatedSuccessfullyText: string = "کاربر با موفقیت ایجاد شد"; + TopicCreatedSuccessfullyText: string = "موضوع با موفقیت ایجاد شد"; NoResultsFoundText: string = "نتیجه ای یافت نشد، تلاش کنید تا جستجوی خود را تغییر دهید"; EnterSearchForEdit: string = "برای ویرایش کاربر جستجو کنید"; @@ -41,6 +52,8 @@ class FaTranslation extends AppTranslationBase { //#region API response fields translations + topic_name: string = "نام موضوع"; + topic_id: string = "شناسه موضوع"; user_id: string = "شناسه کاربری"; full_name: string = "نام کامل"; email: string = "ایمیل";