public class OWM
Starting point for this lib. If you're new to this API, start from this class.
Lets you access data from OpenWeatherMap.org using its Weather APIs.
Sample code in Java:
OWM owm = new OWM("your-api-key");
Sample code in Kotlin:
val owm: OWM = OWM("your-api-key")
Constructor and Description |
---|
OWM(String apiKey)
Constructor
|
Modifier and Type | Method and Description |
---|---|
CurrentWeather |
currentWeatherByCityId(int cityId) |
CurrentWeather |
currentWeatherByCityName(String cityName) |
CurrentWeather |
currentWeatherByCityName(String cityName,
OWM.Country countryCode) |
CurrentWeather |
currentWeatherByCoords(float latitude,
float longitude) |
CurrentWeather |
currentWeatherByZipCode(int zipCode) |
CurrentWeather |
currentWeatherByZipCode(int zipCode,
OWM.Country countryCode) |
DailyForecast |
dailyForecastByCityId(int cityId) |
DailyForecast |
dailyForecastByCityId(int cityId,
byte count) |
DailyForecast |
dailyForecastByCityName(String cityName) |
DailyForecast |
dailyForecastByCityName(String cityName,
byte count) |
DailyForecast |
dailyForecastByCityName(String cityName,
OWM.Country countryCode) |
DailyForecast |
dailyForecastByCityName(String cityName,
OWM.Country countryCode,
byte count) |
DailyForecast |
dailyForecastByCoords(float latitude,
float longitude) |
DailyForecast |
dailyForecastByCoords(float latitude,
float longitude,
byte count) |
DailyForecast |
dailyForecastByZipCode(int zipCode) |
DailyForecast |
dailyForecastByZipCode(int zipCode,
byte count) |
DailyForecast |
dailyForecastByZipCode(int zipCode,
OWM.Country countryCode) |
DailyForecast |
dailyForecastByZipCode(int zipCode,
OWM.Country countryCode,
byte count) |
HourlyForecast |
hourlyForecastByCityId(int cityId) |
HourlyForecast |
hourlyForecastByCityName(String cityName) |
HourlyForecast |
hourlyForecastByCityName(String cityName,
OWM.Country countryCode) |
HourlyForecast |
hourlyForecastByCoords(float latitude,
float longitude) |
HourlyForecast |
hourlyForecastByZipCode(int zipCode) |
HourlyForecast |
hourlyForecastByZipCode(int zipCode,
OWM.Country countryCode) |
void |
resetProxy()
Reset proxy to system's proxy for getting data from OpenWeatherMap.org
|
OWM |
setAccuracy(OWM.Accuracy accuracy)
Set search accuracy for getting data from OpenWeatherMap.org
|
OWM |
setLanguage(OWM.Language lang)
Set language for getting data from OpenWeatherMap.org
|
OWM |
setNoProxy()
Remove proxy (i.e., direct connection) for getting data from OpenWeatherMap.org
|
OWM |
setProxy(NonExistentClass proxy)
Set proxy for getting data from OpenWeatherMap.org
|
OWM |
setProxy(NonExistentClass proxy,
String user,
String pass)
Set authenticated proxy for getting data from OpenWeatherMap.org
|
OWM |
setProxy(String host,
int port)
Set HTTP proxy for getting data from OpenWeatherMap.org
|
OWM |
setProxy(String host,
int port,
NonExistentClass type)
Set proxy of any type for getting data from OpenWeatherMap.org
|
OWM |
setProxy(String host,
int port,
String user,
String pass)
Set authenticated HTTP proxy for getting data from OpenWeatherMap.org
|
OWM |
setProxy(String host,
int port,
String user,
String pass,
NonExistentClass type)
Set authenticated proxy of any type for getting data from OpenWeatherMap.org
|
OWM |
setUnit(OWM.Unit unit)
Set unit for getting data from OpenWeatherMap.org
|
public OWM(String apiKey)
Constructor
Defaults: Search accuracy is set to like Defaults: Unit is set to standard Defaults: Language is set to English Defaults: Proxy is set to system's proxy
apiKey
- API key from OpenWeatherMap.orgpublic OWM setAccuracy(OWM.Accuracy accuracy)
Set search accuracy for getting data from OpenWeatherMap.org
accuracy
- Search accuracypublic OWM setUnit(OWM.Unit unit)
Set unit for getting data from OpenWeatherMap.org
unit
- Unitpublic OWM setLanguage(OWM.Language lang)
Set language for getting data from OpenWeatherMap.org
lang
- Languagepublic OWM setProxy(NonExistentClass proxy)
Set proxy for getting data from OpenWeatherMap.org
proxy
- Proxypublic OWM setProxy(NonExistentClass proxy, String user, String pass)
Set authenticated proxy for getting data from OpenWeatherMap.org
proxy
- Proxyuser
- User name for the proxypass
- Password for the proxypublic OWM setProxy(String host, int port)
Set HTTP proxy for getting data from OpenWeatherMap.org
host
- Host address of the proxyport
- Port address of the proxypublic OWM setProxy(String host, int port, NonExistentClass type)
Set proxy of any type for getting data from OpenWeatherMap.org
host
- Host address of the proxyport
- Port address of the proxytype
- Type of the proxypublic OWM setProxy(String host, int port, String user, String pass)
Set authenticated HTTP proxy for getting data from OpenWeatherMap.org
host
- Host address of the proxyport
- Port address of the proxyuser
- User name for the proxy if requiredpass
- Password for the proxy if requiredpublic OWM setProxy(String host, int port, String user, String pass, NonExistentClass type)
Set authenticated proxy of any type for getting data from OpenWeatherMap.org
host
- Host address of the proxyport
- Port address of the proxyuser
- User name for the proxy if requiredpass
- Password for the proxy if requiredtype
- Type of the proxypublic OWM setNoProxy()
Remove proxy (i.e., direct connection) for getting data from OpenWeatherMap.org
public void resetProxy()
Reset proxy to system's proxy for getting data from OpenWeatherMap.org
public CurrentWeather currentWeatherByCityName(String cityName)
public CurrentWeather currentWeatherByCityName(String cityName, OWM.Country countryCode)
public CurrentWeather currentWeatherByCityId(int cityId)
public CurrentWeather currentWeatherByCoords(float latitude, float longitude)
public CurrentWeather currentWeatherByZipCode(int zipCode)
public CurrentWeather currentWeatherByZipCode(int zipCode, OWM.Country countryCode)
public HourlyForecast hourlyForecastByCityName(String cityName)
public HourlyForecast hourlyForecastByCityName(String cityName, OWM.Country countryCode)
public HourlyForecast hourlyForecastByCityId(int cityId)
public HourlyForecast hourlyForecastByCoords(float latitude, float longitude)
public HourlyForecast hourlyForecastByZipCode(int zipCode)
public HourlyForecast hourlyForecastByZipCode(int zipCode, OWM.Country countryCode)
public DailyForecast dailyForecastByCityName(String cityName)
public DailyForecast dailyForecastByCityName(String cityName, byte count)
public DailyForecast dailyForecastByCityName(String cityName, OWM.Country countryCode)
public DailyForecast dailyForecastByCityName(String cityName, OWM.Country countryCode, byte count)
public DailyForecast dailyForecastByCityId(int cityId)
public DailyForecast dailyForecastByCityId(int cityId, byte count)
public DailyForecast dailyForecastByCoords(float latitude, float longitude)
public DailyForecast dailyForecastByCoords(float latitude, float longitude, byte count)
public DailyForecast dailyForecastByZipCode(int zipCode)
public DailyForecast dailyForecastByZipCode(int zipCode, byte count)
public DailyForecast dailyForecastByZipCode(int zipCode, OWM.Country countryCode)
public DailyForecast dailyForecastByZipCode(int zipCode, OWM.Country countryCode, byte count)