Skip to content

Commit

Permalink
refactor: clearer funciton name
Browse files Browse the repository at this point in the history
  • Loading branch information
star0202 committed May 4, 2023
1 parent a41ecc4 commit febfb11
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
28 changes: 24 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,83 +18,103 @@ export class Neis extends NeisRequest {
super({ type: 'json', pIndex: 1, pSize: 100, ...config })
}

/** schoolInfo */
async getSchool(params: SchoolInfoParam) {
return this.schoolInfoRaw(params)
}

/** schoolInfo */
async getSchoolOne(params: SchoolInfoParam) {
return firstOf(this.schoolInfoRaw(params))
}

/** mealServiceDietInfo */
async getMeal(params: MealServiceDietInfoParam) {
return this.mealServiceDietInfoRaw(params)
}

/** mealServiceDietInfo */
async getMealOne(params: MealServiceDietInfoParam) {
return firstOf(this.mealServiceDietInfoRaw(params))
}

/** SchoolSchedule */
async getSchedule(params: SchoolScheduleParam) {
return this.SchoolScheduleRaw(params)
}

/** SchoolSchedule */
async getScheduleOne(params: SchoolScheduleParam) {
return firstOf(this.SchoolScheduleRaw(params))
}

/** acaInsTiInfo */
async getAcademy(params: AcaInsTiInfoParam) {
return this.acaInsTiInfoRaw(params)
}

/** acaInsTiInfo */
async getAcademyOne(params: AcaInsTiInfoParam) {
return firstOf(this.acaInsTiInfoRaw(params))
}

/** elsTimetable */
async getElsTimetable(params: ElsTimetableParam) {
return this.elsTimetableRaw(params)
}

/** elsTimetable */
async getElsTimetableOne(params: ElsTimetableParam) {
return firstOf(this.elsTimetableRaw(params))
}

/** misTimetable */
async getMisTimetable(params: MisTimetableParam) {
return this.misTimetableRaw(params)
}

/** misTimetable */
async getMisTimetableOne(params: MisTimetableParam) {
return firstOf(this.misTimetableRaw(params))
}

/** hisTimetable */
async getHisTimetable(params: HisTimetableParam) {
return this.hisTimetableRaw(params)
}

/** hisTimetable */
async getHisTimetableOne(params: HisTimetableParam) {
return firstOf(this.hisTimetableRaw(params))
}

/** spsTimetable */
async getSpsTimetable(params: SpsTimetableParam) {
return this.spsTimetableRaw(params)
}

/** spsTimetable */
async getSpsTimetableOne(params: SpsTimetableParam) {
return firstOf(this.spsTimetableRaw(params))
}

async getClassInfo(params: ClassInfoParam) {
/** classInfo */
async getClass(params: ClassInfoParam) {
return this.classInfoRaw(params)
}

async getClassInfoOne(params: ClassInfoParam) {
/** classInfo */
async getClassOne(params: ClassInfoParam) {
return firstOf(this.classInfoRaw(params))
}

async getSchoolMajorInfo(params: SchoolMajorinfoParam) {
/** schoolMajorinfo */
async getMajor(params: SchoolMajorinfoParam) {
return this.schoolMajorinfoRaw(params)
}

async getSchoolMajorInfoOne(params: SchoolMajorinfoParam) {
/** schoolMajorinfo */
async getMajorOne(params: SchoolMajorinfoParam) {
return firstOf(this.schoolMajorinfoRaw(params))
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/ClassInfo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { neis } from './utils'

describe('ClassInfo', () => {
it('should return ClassInfoResponse[]', async () => {
const data = await neis.getClassInfo({
const data = await neis.getClass({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
})
Expand All @@ -13,7 +13,7 @@ describe('ClassInfo', () => {
})

it('should return ClassInfoResponse', async () => {
const data = await neis.getClassInfoOne({
const data = await neis.getClassOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
GRADE: '1',
Expand Down
4 changes: 2 additions & 2 deletions tests/SchoolMajorinfo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { neis } from './utils'

describe('SchoolMajorinfo', () => {
it('should return SchoolMajorinfoResponse[]', async () => {
const data = await neis.getSchoolMajorInfo({
const data = await neis.getMajor({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
})
Expand All @@ -13,7 +13,7 @@ describe('SchoolMajorinfo', () => {
})

it('should return SchoolMajorinfoResponse', async () => {
const data = await neis.getSchoolMajorInfoOne({
const data = await neis.getMajorOne({
ATPT_OFCDC_SC_CODE: AE,
SD_SCHUL_CODE: SE,
})
Expand Down

0 comments on commit febfb11

Please sign in to comment.