Dark Sky API client library

Provides access to the Dark Sky API

Лицензия

Лицензия

Группа

Группа

ch.rasc
Идентификатор

Идентификатор

darksky
Последняя версия

Последняя версия

2.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Dark Sky API client library
Provides access to the Dark Sky API
Ссылка на сайт

Ссылка на сайт

https://github.com/ralscha/darksky/
Система контроля версий

Система контроля версий

https://github.com/ralscha/darksky.git

Скачать darksky

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/ch.rasc/darksky/ -->
<dependency>
    <groupId>ch.rasc</groupId>
    <artifactId>darksky</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/ch.rasc/darksky/
implementation 'ch.rasc:darksky:2.0.1'
// https://jarcasting.com/artifacts/ch.rasc/darksky/
implementation ("ch.rasc:darksky:2.0.1")
'ch.rasc:darksky:jar:2.0.1'
<dependency org="ch.rasc" name="darksky" rev="2.0.1">
  <artifact name="darksky" type="jar" />
</dependency>
@Grapes(
@Grab(group='ch.rasc', module='darksky', version='2.0.1')
)
libraryDependencies += "ch.rasc" % "darksky" % "2.0.1"
[ch.rasc/darksky "2.0.1"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
com.squareup.okhttp3 : okhttp jar 4.4.1
com.fasterxml.jackson.core : jackson-databind jar 2.10.3
com.google.code.findbugs : jsr305 jar 3.0.2
org.immutables : value Необязательный jar 2.8.3

test (3)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.6.0
org.junit.jupiter : junit-jupiter-engine jar 5.6.0
org.assertj : assertj-core jar 3.15.0

Модули Проекта

Данный проект не имеет модулей.

darksky

Test Status

Overview

darksky is a Java client library for the Dark Sky API API (former forecast.io).

For more details about the API and for creating an API key go to https://darksky.net/dev/ and sign up for a developer account. The free tier allows an application to send 1,000 API requests per day.

Example: Forecast Request

Create an instance of DsClient

DsClient client = new DsClient("...darksky.net.api.key...");

build a DsForecastRequest

DsForecastRequest request = DsForecastRequest.builder()
        .latitude("46.93011019")
		.longitude("7.5635394")
		.excludeBlock(DsBlock.ALERTS, DsBlock.MINUTELY, DsBlock.HOURLY)
		.unit(DsUnit.SI)
		.build();

call the API

DsResponse response = client.sendForecastRequest(request);

and process the response

for (DsDataPoint dataPoint : response.daily().data()) {
    ZoneId zoneId = ZoneId.of(response.timezone());
    Instant instant = Instant.ofEpochSecond(dataPoint.time());
    ZonedDateTime time = ZonedDateTime.ofInstant(instant, zoneId);

    System.out.print(time);
    System.out.print(": ");
    System.out.println(dataPoint.summary());
}

Example: Time Machine Request

Create an instance of DsClient

DsClient client = new DsClient("...darksky.net.api.key...");

build a DsTimeMachineRequest.

DsTimeMachineRequest request = DsTimeMachineRequest.builder()
        .latitude("46.93011019")
		.longitude("7.5635394")				
		.unit(DsUnit.SI)
		.time(ZonedDateTime.now().minusDays(10).toEpochSecond())
		.build();

call the API

DsResponse response = client.sendTimeMachineRequest(request);

and process the response

for (DsDataPoint dataPoint : response.hourly().data()) {			
    ZoneId zoneId = ZoneId.of(response.timezone());
    Instant instant = Instant.ofEpochSecond(dataPoint.time());
    ZonedDateTime time = ZonedDateTime.ofInstant(instant, zoneId);

    System.out.print(time);
    System.out.print(": ");
    System.out.println(dataPoint);            
}

Maven

	<dependency>
		<groupId>ch.rasc</groupId>
		<artifactId>darksky</artifactId>
		<version>2.0.1</version>
	</dependency>

Changelog

2.0.1 - March 21, 2020

  • Add missing properties to DsAlert and DsDataPoint according to the Dark Sky API documentation.

    • DsAlert.regions
    • DsAlert.severity
    • DsAlert.time
    • DsDataPoint.apparentTemperatureHigh
    • DsDataPoint.apparentTemperatureHighTime
    • DsDataPoint.apparentTemperatureLow
    • DsDataPoint.apparentTemperatureLowTime
    • DsDataPoint.precipIntensityError
    • DsDataPoint.temperatureHigh
    • DsDataPoint.temperatureHighTime
    • DsDataPoint.temperatureLow
    • DsDataPoint.temperatureLowTime
    • DsDataPoint.uvIndex
    • DsDataPoint.uvIndexTime
    • DsDataPoint.windGust
    • DsDataPoint.windGustTime

2.0.0 - October 20, 2016

  • Change package to ch.rasc.darksky (previously: ch.rasc.forecastio)
  • Change class name prefix from Fio* to Ds* (i.e. FioClient -> DsClient)
  • Fix include/exclude handling
  • Add time machine requests

1.0.1 - September 30, 2016

  • Change endpoint from api.forecast.io to api.darksky.net

1.0.0 - July 5, 2016

  • Initial release

License

Code released under the Apache license.

Powered by Dark Sky

Версии библиотеки

Версия
2.0.1
2.0.0