Skip to content

Commit 4998663

Browse files
committed
Releasing 2.0.1 version.
1 parent f5d202a commit 4998663

File tree

5 files changed

+261
-7
lines changed

5 files changed

+261
-7
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ dev ]
16+
branches: [ master ]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ dev ]
19+
branches: [ master ]
2020
schedule:
2121
- cron: '27 20 * * 1'
2222

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,22 @@ Paid:
2626
<dependency>
2727
<groupId>com.github.prominence</groupId>
2828
<artifactId>openweathermap-api</artifactId>
29-
<version>2.0.0-SNAPSHOT</version>
29+
<version>2.0.1</version>
3030
</dependency>
3131
```
3232

3333
### Gradle coordinates:
3434

3535
```groovy
36-
compile('com.github.prominence:openweathermap-api:2.0.0')
36+
compile('com.github.prominence:openweathermap-api:2.0.1')
3737
```
3838

3939
### Documentation
4040
* [OpenWeatherMap Java API - 1.0](docs/Release_1.0.md)
4141
* [OpenWeatherMap Java API - 1.1](docs/Release_1.1.md)
4242
* [OpenWeatherMap Java API - 1.2](docs/Release_1.2.md)
4343
* [OpenWeatherMap Java API - 2.0.0](docs/Release_2.0.0.md)
44+
* [OpenWeatherMap Java API - 2.0.1](docs/Release_2.0.1.md)
4445
* [OpenWeatherMap Java API - SNAPSHOT](docs/SNAPSHOT.md)
4546

4647
### License

docs/Release_2.0.1.md

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
### Implemented features:
2+
* Current weather data
3+
* 5 day / 3-hour forecast
4+
5+
### Maven coordinates:
6+
7+
```xml
8+
<dependency>
9+
<groupId>com.github.prominence</groupId>
10+
<artifactId>openweathermap-api</artifactId>
11+
<version>2.0.1</version>
12+
</dependency>
13+
```
14+
15+
### Gradle coordinates:
16+
17+
```groovy
18+
compile('com.github.prominence:openweathermap-api:2.0.1')
19+
```
20+
21+
### How to use:
22+
23+
Firstly, you need to create the instance of `OpenWeatherMapClient` class:
24+
```java
25+
OpenWeatherMapClient openWeatherClient = new OpenWeatherMapClient(API_TOKEN);
26+
```
27+
where `API_TOKEN` is your token([you can get it here](https://home.openweathermap.org/api_keys)) as `String`.
28+
29+
Currently, available APIs are:
30+
* `currentWeather()`
31+
* `forecast5Day3HourStep()`
32+
33+
Default(more or less) customization points:
34+
```java
35+
...
36+
// response language
37+
.language(Language.RUSSIAN)
38+
...
39+
// response units of measure
40+
.unitSystem(UnitSystem.IMPERIAL)
41+
...
42+
```
43+
44+
Available output forms:
45+
* `asJava()`
46+
* `asJSON()`
47+
48+
Additional output forms, available for several APIs:
49+
* `asXML()`
50+
* `asHTML()`
51+
52+
_All response forms can be in **sync** and **async** variants._
53+
54+
#### Current weather data
55+
Examples:
56+
```java
57+
final String weatherJson = openWeatherClient
58+
.currentWeather()
59+
.single()
60+
.byCityName("Minsk")
61+
.language(Language.RUSSIAN)
62+
.unitSystem(UnitSystem.IMPERIAL)
63+
.retrieve()
64+
.asJSON();
65+
```
66+
67+
```java
68+
final Weather weather = openWeatherClient
69+
.currentWeather()
70+
.single()
71+
.byCityName("Minsk")
72+
.language(Language.RUSSIAN)
73+
.unitSystem(UnitSystem.METRIC)
74+
.retrieve()
75+
.asJava();
76+
```
77+
78+
```java
79+
final List<Weather> weatherList = openWeatherClient
80+
.currentWeather()
81+
.multiple()
82+
.byCitiesInCycle(Coordinate.withValues(55.5, 37.5))
83+
.language(Language.GERMAN)
84+
.unitSystem(UnitSystem.IMPERIAL)
85+
.retrieve()
86+
.asJava();
87+
```
88+
89+
```java
90+
final CompletableFuture<String> weatherXmlFuture = openWeatherClient
91+
.currentWeather()
92+
.single()
93+
.byZipCodeAndCountry("220015", "by")
94+
.language(Language.RUSSIAN)
95+
.unitSystem(UnitSystem.METRIC)
96+
.retrieveAsync()
97+
.asXML();
98+
```
99+
100+
You are able to set preferable options(via chain methods) and execute appropriate request.
101+
102+
`com.github.prominence.openweathermap.api.model.weather.Weather`'s useful public methods(setters are not listed):
103+
104+
| Method | Description |
105+
|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
106+
| `getState()` | Returns short weather description. Example: `Clear`. |
107+
| `getDescription()` | Returns weather description. Example: `clear sky`. |
108+
| `getWeatherIconUrl()` | Returns a link to weather icon hosted on https://openweathermap.org website. |
109+
| `getCalculatedOn()` | Returns `LocalDateTime` object with data calculation time. |
110+
| `getTemperature()` | Returns `Temperature` instance that contains information about temperature. Available fields: `value`, `maxTemperature`, `minTemperature`, `feelsLike` and `unit`. |
111+
| `getAtmosphericPressure()`| Returns `AtmosphericPressure` instance that contains information about atmospheric pressure. Available fields: `value`, `seaLevelValue`, `groundLevelValue` and `unit`. |
112+
| `getHumidity()` | Returns `Humidity` instance that contains humidity percentage information. |
113+
| `getWind()` | Returns `Wind` instance that contains wind information: `speed`, `degrees`, `gust` and `unit`. |
114+
| `getRain()` | Returns `Rain` instance that contains information about rain volume for the last one hour and/or the last 3 hours. Can be absent in case of no data. |
115+
| `getSnow()` | Returns `Snow` instance that contains information about snow volume for the last one hour and/or the last 3 hours. Can be absent in case of no data. |
116+
| `getClouds()` | Returns `Clouds` instance that contains information about cloudiness percentage. |
117+
| `getLocation()` | Returns `Location` object. Available fields: `id`, `name`, `countryCode`, `sunrise` and `sunset` time, `zoneOffset` and `coordinate`. |
118+
| `toString()` | Returns informative string for the whole available weather information. |
119+
120+
`toString()` output example:
121+
```
122+
Location: Minsk(BY), Weather: clear sky, -4.22 ℃, 1020.0 hPa, Clouds: 0%
123+
```
124+
125+
#### 5 day / 3-hour forecast
126+
Examples:
127+
```java
128+
final Forecast forecast = openWeatherClient
129+
.forecast5Day3HourStep()
130+
.byCityName("Minsk")
131+
.language(Language.ENGLISH)
132+
.unitSystem(UnitSystem.METRIC)
133+
.count(15)
134+
.retrieve()
135+
.asJava();
136+
```
137+
138+
```java
139+
final String forecastJson = getClient()
140+
.forecast5Day3HourStep()
141+
.byCityName("New York", "NY", "US")
142+
.language(Language.SPANISH)
143+
.unitSystem(UnitSystem.IMPERIAL)
144+
.count(15)
145+
.retrieve()
146+
.asJSON();
147+
```
148+
149+
```java
150+
CompletableFuture<String> forecastFuture = getClient()
151+
.forecast5Day3HourStep()
152+
.byCityId(350001514)
153+
.language(Language.ENGLISH)
154+
.unitSystem(UnitSystem.METRIC)
155+
.count(15)
156+
.retrieveAsync()
157+
.asXML();
158+
```
159+
160+
```java
161+
final String forecastXml = getClient()
162+
.forecast5Day3HourStep()
163+
.byZipCodeInUSA("10005")
164+
.language(Language.ENGLISH)
165+
.unitSystem(UnitSystem.METRIC)
166+
.retrieve()
167+
.asXML();
168+
```
169+
170+
You are able to set preferable options(via chain methods) and execute appropriate request.
171+
172+
`com.github.prominence.openweathermap.api.request.forecast.free.Forecast`'s useful public methods(setters are not listed):
173+
174+
| Method | Description |
175+
|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
176+
| `getLocation()` | Returns `Location` object. Available fields: `id`, `name`, `countryCode`, `sunrise` and `sunset` time, `zoneOffset`, `coordinate` and `population`. |
177+
| `getWeatherForecasts()` | Returns list of `WeatherForecast` objects with forecast information. |
178+
| `toString()` | Returns informative string for the whole available forecast information. |
179+
180+
`toString()` output example:
181+
```
182+
A forecast for Minsk with 15 timestamps.
183+
```
184+
185+
`com.github.prominence.openweathermap.api.model.forecast.WeatherForecast`'s useful public methods(setters are not listed):
186+
187+
| Method | Description |
188+
|-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
189+
| `getState()` | Returns short weather description. Example: `Clear`. |
190+
| `getDescription()` | Returns weather description. Example: `clear sky`. |
191+
| `getWeatherIconUrl()` | Returns a link to weather icon hosted on https://openweathermap.org website. |
192+
| `getForecastTime()` | Returns `LocalDateTime` object with weather forecast time. |
193+
| `getTemperature()` | Returns `Temperature` instance that contains information about temperature. Available fields: `value`, `maxTemperature`, `minTemperature`, `feelsLike` and `unit`. |
194+
| `getAtmosphericPressure()` | Returns `AtmosphericPressure` instance that contains information about atmospheric pressure. Available fields: `value`, `seaLevelValue`, `groundLevelValue` and `unit`. |
195+
| `getHumidity()` | Returns `Humidity` instance that contains humidity percentage information. |
196+
| `getWind()` | Returns `Wind` instance that contains wind information: `speed`, `degrees` and `unit`. |
197+
| `getRain()` | Returns `Rain` instance that contains information about rain volume for the last 3 hours. Can be absent in case of no data. |
198+
| `getSnow()` | Returns `Snow` instance that contains information about snow volume for the last 3 hours. Can be absent in case of no data. |
199+
| `getClouds()` | Returns `Clouds` instance that contains information about cloudiness percentage. |
200+
| `getForecastTimeISO()` | Returns String with time of data forecasted, ISO, UTC. |
201+
| `getDayTime()` | Returns enumerations representing the part of day(day, night). |
202+
| `toString()` | Returns informative string for the forecast of particular timestamp. |
203+
204+
### Constants and options
205+
206+
#### Language
207+
| Constant | Description |
208+
|-----------------------------------|-------------------------------|
209+
| Language.ARABIC | Arabic language. |
210+
| Language.BULGARIAN | Bulgarian language. |
211+
| Language.CATALAN | Catalan language. |
212+
| Language.CZECH | Czech language. |
213+
| Language.GERMAN | German language. |
214+
| Language.GREEK | Greek language. |
215+
| Language.ENGLISH | English language. |
216+
| Language.PERSIAN | Persian (Farsi) language. |
217+
| Language.FINNISH | Finnish language. |
218+
| Language.FRENCH | French language. |
219+
| Language.GALICIAN | Galician language. |
220+
| Language.CROATIAN | Croatian language. |
221+
| Language.HUNGARIAN | Hungarian language. |
222+
| Language.ITALIAN | Italian language. |
223+
| Language.JAPANESE | Japanese language. |
224+
| Language.KOREAN | Korean language. |
225+
| Language.LATVIAN | Latvian language. |
226+
| Language.LITHUANIAN | Lithuanian language. |
227+
| Language.MACEDONIAN | Macedonian language. |
228+
| Language.DUTCH | Dutch language. |
229+
| Language.POLISH | Polish language. |
230+
| Language.PORTUGUESE | Portuguese language. |
231+
| Language.ROMANIAN | Romanian language. |
232+
| Language.RUSSIAN | Russian language. |
233+
| Language.SWEDISH | Swedish language. |
234+
| Language.SLOVAK | Slovak language. |
235+
| Language.SLOVENIAN | Slovenian language. |
236+
| Language.SPANISH | Spanish language. |
237+
| Language.TURKISH | Turkish language. |
238+
| Language.UKRANIAN | Ukrainian language. |
239+
| Language.VIETNAMESE | Vietnamese language. |
240+
| Language.CHINESE_SIMPLIFIED | Chinese Simplified language. |
241+
| Language.CHINESE_TRADITIONAL | Chinese Traditional language. |
242+
243+
#### Unit
244+
| Constant | Description |
245+
|----------------------|------------------------------------------------|
246+
| Unit.METRIC_SYSTEM | Celsius, meter/sec, hPa, mm(rain, snow). |
247+
| Unit.IMPERIAL_SYSTEM | Fahrenheit, miles/hour, hPa, mm(rain, snow). |
248+
| Unit.STANDARD_SYSTEM | Kelvin, meter/sec, hPa, mm(rain, snow). |
249+
250+
### Dependencies
251+
* com.fasterxml.jackson.core:jackson-databind:2.12.2
252+
* org.slf4j:slf4j-api:1.7.30 (*compile*)
253+
* junit:junit:4.13.1 (*test*)

docs/SNAPSHOT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
<dependency>
99
<groupId>com.github.prominence</groupId>
1010
<artifactId>openweathermap-api</artifactId>
11-
<version>2.0.0-SNAPSHOT</version>
11+
<version>2.0.1-SNAPSHOT</version>
1212
</dependency>
1313
```
1414

1515
### Gradle coordinates:
1616

1717
```groovy
18-
compile('com.github.prominence:openweathermap-api:2.0.0-SNAPSHOT')
18+
compile('com.github.prominence:openweathermap-api:2.0.1-SNAPSHOT')
1919
```
2020

2121
### How to use:

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.prominence</groupId>
88
<artifactId>openweathermap-api</artifactId>
9-
<version>2.0.0-SNAPSHOT</version>
9+
<version>2.0.1</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Java OpenWeatherMap API</name>

0 commit comments

Comments
 (0)