-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement MET Norway weather provider
- Loading branch information
Showing
31 changed files
with
1,104 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
app/src/main/java/wangdaye/com/geometricweather/weather/apis/MetNoApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package wangdaye.com.geometricweather.weather.apis; | ||
|
||
import java.util.Date; | ||
|
||
import io.reactivex.Observable; | ||
import retrofit2.http.GET; | ||
import retrofit2.http.Header; | ||
import retrofit2.http.Query; | ||
import wangdaye.com.geometricweather.weather.json.metno.MetNoLocationForecastResult; | ||
import wangdaye.com.geometricweather.weather.json.metno.MetNoSunsetResult; | ||
|
||
/** | ||
* MET Weather API. | ||
*/ | ||
|
||
public interface MetNoApi { | ||
|
||
@GET("locationforecast/2.0/compact.json") | ||
Observable<MetNoLocationForecastResult> getLocationForecast(@Header("User-Agent") String userAgent, | ||
@Query("lat") Float lat, | ||
@Query("lon") Float lon); | ||
|
||
@GET("sunrise/2.0/.json") | ||
Observable<MetNoSunsetResult> getSunset(@Header("User-Agent") String userAgent, | ||
@Query("date") String date, | ||
@Query("days") int days, | ||
@Query("lat") Float lat, | ||
@Query("lon") Float lon, | ||
@Query("offset") String offset); | ||
|
||
// Only available in Nordic area | ||
/*@GET("nowcast/2.0/complete.json") | ||
Observable<MetNoLocationForecastResult> getMinutely(@Header("User-Agent") String userAgent, | ||
@Query("lat") Float lat, | ||
@Query("lon") Float lon);*/ | ||
|
||
/*@GET("airqualityforecast/0.1/") | ||
Observable<MetNoAqiResult> getAirQuality(@Header("User-Agent") String userAgent, | ||
@Query("lat") Float lat, | ||
@Query("lon") Float lon);*/ | ||
|
||
/*@GET("metalerts/1.1/") | ||
Observable<List<MetNoAlertResult>> getAlerts(@Header("User-Agent") String userAgent, | ||
@Query("lat") Float lat, | ||
@Query("lon") Float lon);*/ | ||
} |
43 changes: 43 additions & 0 deletions
43
app/src/main/java/wangdaye/com/geometricweather/weather/apis/NominatimApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package wangdaye.com.geometricweather.weather.apis; | ||
|
||
import java.util.List; | ||
|
||
import io.reactivex.Observable; | ||
import retrofit2.Call; | ||
import retrofit2.http.GET; | ||
import retrofit2.http.Header; | ||
import retrofit2.http.Query; | ||
import wangdaye.com.geometricweather.weather.json.nominatim.NominatimLocationResult; | ||
|
||
/** | ||
* Nominatim API. | ||
*/ | ||
|
||
public interface NominatimApi { | ||
|
||
@GET("search") | ||
Call<List<NominatimLocationResult>> callWeatherLocation(@Header("User-Agent") String userAgent, | ||
@Query("q") String q, | ||
@Query("featuretype") String featureType, | ||
@Query("addressdetails") Boolean addressDetails, | ||
@Query("accept-language") String acceptLanguage, | ||
@Query("format") String format); | ||
|
||
@GET("search") | ||
Observable<List<NominatimLocationResult>> getWeatherLocation(@Header("User-Agent") String userAgent, | ||
@Query("q") String q, | ||
@Query("featuretype") String featureType, | ||
@Query("addressdetails") Boolean addressDetails, | ||
@Query("accept-language") String acceptLanguage, | ||
@Query("format") String format); | ||
|
||
@GET("search") | ||
Observable<NominatimLocationResult> getWeatherLocationByGeoPosition(@Header("User-Agent") String userAgent, | ||
@Query("lat") Float lat, | ||
@Query("lon") Float lon, | ||
@Query("featuretype") String featureType, | ||
@Query("addressdetails") Boolean addressDetails, | ||
@Query("accept-language") String acceptLanguage, | ||
@Query("format") String format); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.