Skip to content

Instantly share code, notes, and snippets.

@Gerrit0
Created January 1, 2018 19:47
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 Gerrit0/48ff666b4322a1a1df92d568101fb8ed to your computer and use it in GitHub Desktop.
Save Gerrit0/48ff666b4322a1a1df92d568101fb8ed to your computer and use it in GitHub Desktop.
interface ApiErrorResponse {
cod: number;
message: string;
}
interface ApiDayResponse {
dt: number;
main: {
temp: number;
temp_min: number;
temp_max: number;
pressure: number;
sea_level: number
grnd_level: number;
humidity: number;
temp_kf: number;
};
weather: {
id: number;
main: string;
description: string;
icon: string;
}[];
clouds: {
all: string;
};
wind: {
speed: number;
deg: number;
}
snow: {
'3h'?: number
};
rain: {
'3h'?: number
};
sys: {
pod: string;
};
dt_txt: string;
}
interface ApiOkResponse {
cod: string; // Unfortunately...
message: number;
cnt: number;
list: ApiDayResponse[];
city: {
id: number;
name: string;
coord: {
lat: number;
long: number;
}
country: string;
population: number;
}
}
type ApiResponse = ApiErrorResponse | ApiOkResponse;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment