1.0.11 • Published 2 years ago

kra-types v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

한국마사회 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)
})
1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago