Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Created July 21, 2022 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mortenjust/8a7a907f0419358765db671edbbd7308 to your computer and use it in GitHub Desktop.
Save mortenjust/8a7a907f0419358765db671edbbd7308 to your computer and use it in GitHub Desktop.
WeatherKit Typescript types
export interface WeatherKit {
currentWeather: CurrentWeather;
forecastDaily: ForecastDaily;
forecastHourly: ForecastHourly;
}
export interface CurrentWeather {
name?: string;
metadata?: Metadata;
asOf?: Date;
cloudCover: number;
conditionCode: string;
daylight: boolean;
humidity: number;
precipitationIntensity: number;
pressure: number;
pressureTrend: string;
temperature: number;
temperatureApparent: number;
temperatureDewPoint: number;
uvIndex: number;
visibility: number;
windDirection: number;
windGust: number;
windSpeed: number;
forecastStart?: Date;
precipitationAmount?: number;
precipitationChance?: number;
precipitationType?: string;
snowfallIntensity?: number;
}
export interface Metadata {
attributionURL: string;
expireTime: Date;
latitude: number;
longitude: number;
readTime: Date;
reportedTime: Date;
units: string;
version: number;
}
export interface ForecastDaily {
name: string;
metadata: Metadata;
days: Day[];
}
export interface Day {
forecastStart: Date;
forecastEnd: Date;
conditionCode: string;
maxUvIndex: number;
moonPhase: string;
moonset: Date;
precipitationAmount: number;
precipitationChance: number;
precipitationType: string;
snowfallAmount: number;
solarMidnight: Date;
solarNoon: Date;
sunrise: Date;
sunriseCivil: Date;
sunriseNautical: Date;
sunriseAstronomical: Date;
sunset: Date;
sunsetCivil: Date;
sunsetNautical: Date;
sunsetAstronomical: Date;
temperatureMax: number;
temperatureMin: number;
daytimeForecast: Forecast;
overnightForecast: Forecast;
restOfDayForecast?: Forecast;
moonrise?: Date;
}
export interface Forecast {
forecastStart: Date;
forecastEnd: Date;
cloudCover: number;
conditionCode: string;
humidity: number;
precipitationAmount: number;
precipitationChance: number;
precipitationType: string;
snowfallAmount: number;
windDirection: number;
windSpeed: number;
}
export interface ForecastHourly {
name: string;
metadata: Metadata;
hours: CurrentWeather[];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment