diff --git a/README.md b/README.md index 6c0d487..045fe19 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - -### API +### 기상청 API 많은 API가 제공되나, 기상 예보를 위해서는 2개만 보면 된다. @@ -72,3 +72,30 @@ ### 평가 다소 구식 인터페이스이지만, 한국에서 사실상 유일한 공공 기상 데이터 출처이므로 필수적으로 활용해야 한다. + +## OpenWeather + +- + +### 사용법 및 제한 + + 여기에 접속해서 일단 가입해야 한다. +가입 후 몇 시간 정도는 지나야 API 사용할 수 있다. + + 여기에서 Free 티어가 사용가능한 API가 명확히 나온다. + +- 3-hour Forecast 5 days 이거 하나만 쓰면 된다. +- 2시간 마다 데이터가 업데이트 된다. + - 즉, 하루 12번만 호출하면 된다. +- 1분에 최대 60회 가능하며, 한 달에 1,000,000회 호출이 가능하다. + - (1,000,000 / 30) + +### OpenWeather API + +#### Call 5 day / 3 hour forecast data + + + +형식: api.openweathermap.org/data/2.5/forecast?units=metric&lat={lat}&lon={lon}&appid={API key} + + diff --git a/api/main.tsp b/api/main.tsp index 4519a27..9bda230 100644 --- a/api/main.tsp +++ b/api/main.tsp @@ -48,6 +48,22 @@ model HourlyForecastList { items: HourlyForecast[]; } +model CreateForecastRequest { + time: offsetDateTime; + + @doc("하루 동안의 예상 최고 기온(℃)") + high?: Celsius; + + @doc("하루 동안의 예상 최저 기온(℃)") + low?: Celsius; + + @doc("예상 기온(℃)") + temperature?: Celsius; + + @doc("예상 날씨 상태") + condition: WeatherCondition; +} + @error model Error { @doc("에러 코드") @@ -60,6 +76,15 @@ model Error { @route("/forecasts") @tag("Forecasts") interface Forecasts { + @post + @doc("internal API to create a forecast") + createForecast(@body body: CreateForecastRequest): { + @statusCode statusCode: 204; + } | { + @statusCode statusCode: 500; + @body body: Error; + }; + @get @route("/daily") listDaily(): {