UNPKG

@tongji_api/sdk

Version:

同济大学开放平台SDK

1,463 lines (1,462 loc) 170 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.OAuthClient = void 0; // Auto-generated API methods const axios_1 = __importDefault(require("axios")); class OAuthClient { constructor(config = {}) { this.accessToken = null; this.tokenExpiresAt = null; this.config = config; this.axiosInstance = axios_1.default.create({ baseURL: 'https://api.tongji.edu.cn', timeout: 10000, }); } isTokenValid() { return this.accessToken !== null && this.tokenExpiresAt !== null && Date.now() < this.tokenExpiresAt; } async getClientCredentialsToken() { if (this.isTokenValid()) { return { error: true, message: 'isTokenValid' }; } if (!Object.keys(this.config).length) return { error: true, message: 'OAuth config is not set' }; const params = new URLSearchParams(); params.append('client_id', this.config.clientId); params.append('client_secret', this.config.clientSecret); params.append('grant_type', 'client_credentials'); try { const response = await axios_1.default.post(this.config.tokenUrl, params.toString(), { headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json' }, }); this.accessToken = response.data.access_token; this.tokenExpiresAt = Date.now() + (response.data.expires_in * 1000); return response.data; } catch (error) { return { error: true, message: error.response?.statusText || 'An error occurred', status: error.response?.status || 500 }; } } async refreshToken(refreshToken) { const response = await this.axiosInstance.post(this.config.tokenUrl, { grant_type: 'refresh_token', refresh_token: refreshToken, client_id: this.config.clientId, client_secret: this.config.clientSecret, }); return response.data; } static getInstance(config) { if (!OAuthClient.instance) { OAuthClient.instance = new OAuthClient(config); } return OAuthClient.instance; } static resetInstance() { OAuthClient.instance = null; } async v1_dc_sep_auth_update_contact_info(body, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.post(`/v1/dc/sep_auth/update_contact_info`, body, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_sep_auth_all_contact_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/sep_auth/all_contact_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_card_info_idcard_validateDate(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/card_info/idcard_validateDate`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_sep_auth_person_contact_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/sep_auth/person_contact_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_user_user_data_statistics(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/user/user_data_statistics`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_card_info_person_info_by_cardno(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/card_info/person_info_by_cardno`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_card_info_dm_card_no_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/card_info/dm_card_no_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_user_person_info_by_pid(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/user/person_info_by_pid`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_user_single_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/user/single_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_card_info_cardno_validate(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/card_info/cardno_validate`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_user_person_all_info_by_userid(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/user/person_all_info_by_userid`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_user_add_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/user/add_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_user_all_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/user/all_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_user_update_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/user/update_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_user_pm_member_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/user/pm_member_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_user_user_annual_bill(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/user/user_annual_bill`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_sep_auth_all_address_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/sep_auth/all_address_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_sep_auth_card_no_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/sep_auth/card_no_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_user_student_leave(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/user/student_leave`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_student_work_info_competition_winners(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/student_work_info/competition_winners`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_student_info_student_graduation(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/student_info/student_graduation`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_user_all_student(body, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.post(`/v1/rt/user/all_student`, body, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_student_work_info_class_info(headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/student_work_info/class_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_student_work_info_student_headteacher_counselor_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/student_work_info/student_headteacher_counselor_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_user_student_infos(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/user/student_infos`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_user_cec_student_infos(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/user/cec_student_infos`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_sep_auth_student_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/sep_auth/student_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_sep_auth_student_accommodation_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/sep_auth/student_accommodation_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_student_work_info_work_study(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/student_work_info/work_study`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_student_work_info_honorary_title(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/student_work_info/honorary_title`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_student_work_info_stipend(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/student_work_info/stipend`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_student_work_info_scholarship(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/student_work_info/scholarship`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_student_work_info_hardship_allowance(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/student_work_info/hardship_allowance`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_student_work_info_student_loan(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/student_work_info/student_loan`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_user_website_teacher_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/user/website_teacher_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_user_secretary_info(headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/user/secretary_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_user_teacher_infos(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/user/teacher_infos`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_sep_auth_teacher_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/sep_auth/teacher_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_sep_auth_teacher_title_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/sep_auth/teacher_title_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_sep_auth_senior_talents_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/sep_auth/senior_talents_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_user_postdoc_info(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/user/postdoc_info`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v2_dc_teaching_info_student_guidance(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v2/dc/teaching_info/student_guidance`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_onetongji_calendar(query, headers) { try { const response = await this.axiosInstance.get(`/v1/rt/onetongji/calendar`, { headers: { ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_teaching_info_postgraduate_gpa_and_ms(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/teaching_info/postgraduate_gpa_and_ms`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_teaching_info_postgraduate_degree_course_ms(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/teaching_info/postgraduate_degree_course_ms`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_teaching_info_undergraduate_summarized_grades(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/teaching_info/undergraduate_summarized_grades`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_teaching_info_postgraduate_degree_course_credit(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/teaching_info/postgraduate_degree_course_credit`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_teaching_info_postgraduate_completed_credit(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/teaching_info/postgraduate_completed_credit`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_teaching_info_postgraduate_required_credit(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/teaching_info/postgraduate_required_credit`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_onetongji_culture_plan_count(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/onetongji/culture_plan/count`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_onetongji_lecture_count_advanced_lecture(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/onetongji/lecture/count_advanced_lecture`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_teaching_info_sports_test_health(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/teaching_info/sports_test_health`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_teaching_info_stu_tencent_meeting_course(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/teaching_info/stu_tencent_meeting_course`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_onetongji_student_timetable(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/onetongji/student_timetable`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_dc_teaching_info_student_timetable(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/dc/teaching_info/student_timetable`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500 }; } } async v1_rt_onetongji_culture_plan_get(query, headers) { try { if (!this.isTokenValid()) { const resp = await this.getClientCredentialsToken(); if (!resp.access_token) { return resp; } } const response = await this.axiosInstance.get(`/v1/rt/onetongji/culture_plan/get`, { headers: { Authorization: `Bearer ${this.accessToken}`, ...headers }, params: query, }); return response.data; } catch (error) { return { data: null, message: error.response?.data || 'An error occurred', status: error.response?.status || 500