kra-types
v1.0.11
Published
마사회 API type 정보와 url등 정리
Downloads
10
Readme
한국마사회 API Helper
마사회 API type 정보와 url등 정리
typescript의 경우 지정된 type으로 코딩 실수를 미연에 방지
install
npm
$ npm install kra-types
yarn
$ yarn add kra-types
list
- DailyTraining
- EntryHorseWeightInfo
- JockeyInfo
- JockeyResult
- RaceHorseClinic
- RaceHorseInfo
- RaceHorseResult
- RacePlan
- RaceResult
- RidingTestResult
- SectionRecord
- StartingTraining
- SwimTraining
- Track
- TrainerInfo
uptadedAt 23.7.15
example
racePlan 작성법
import {
RacePlan,
RacePlanRequestParams,
racePlanInfo,
RsponseData,
Meet,
} from 'kra-types'
const getRacePlans = async (params: RacePlanRequestParams) => {
const r = await api.get<ResponseData<RacePlan[] | RacePlan>>(
racePlanInfo.url,
{ params },
) // api is axios, fetch, etc..
if (!r.data.response.body) return []
if (!r.data.response.body.items) return []
const itemsItem = r.data.response.body.items.item
return Array.isArray(itemsItem) ? itemsItem : [itemsItem] // because length 1 is not array
}
// use
getRacePlans({
serviceKey,
pageNo: 1,
numOfRows: 20,
meet: Meet['서울'].no,
rc_date: 20230714,
}).then((rs) => {
console.log(rs)
})