ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - techgaun/darkskyx: A Darksky.net (formerly forecast.io) weather API client for Elixir
A Darksky.net (formerly forecast.io) weather API client for Elixir - techgaun/darkskyx
Visit Site

GitHub - techgaun/darkskyx: A Darksky.net (formerly forecast.io) weather API client for Elixir

GitHub - techgaun/darkskyx: A Darksky.net (formerly forecast.io) weather API client for Elixir

Darkskyx

Build Status Hex version Hex downloads

A Darksky.net weather api client for Elixir

As of March 31, 2020, Darksky has been acquired by Apple and the API will continue to function through the end of 2021.

Installation

The package can be installed as:

Add darkskyx to your list of dependencies in mix.exs:

def deps do
  [{:darkskyx, "~> 1.0"}]
end

Ensure darkskyx is started before your application:

def application do
  [applications: [:darkskyx]]
end

Usage

You can use darkskyx to perform forecast as well as time machine request. You will need to configure the darksky api key properly.

configuration

The simplest would be to set darksky api key as below:

export DARKSKY_API_KEY=<api_key>

Now, in your config.exs (or environment specific configuration), add the config block to configure Darkskyx. You can pass keyword list of units, lang, excludes and extends for the defaults config block which will be used to override the global default configuration. The default configuration is to use units: auto and lang: en. On top of the default configuration, you can also override the default configuration per request by passing the %Darkskyx{} struct configured to your liking.

config :darkskyx, api_key: System.get_env("DARKSKY_API_KEY"),
  defaults: [
    units: "us",
    lang: "en"
  ]

Examples

Darkskyx.forecast(41.032, -94.234)

Darkskyx.forecast(41.043, -93.23432, %Darkskyx{lang: "ar"})

Darkskyx.forecast(41.032, -94.234, %Darkskyx{exclude: "daily,hourly"})

Darkskyx.time_machine(41.043, -93.23432, 13432423)

Darkskyx.time_machine(41.043, -93.23432, 13432423, %Darkskyx{lang: "ar", units: "si"})

Darkskyx.current(37, -94)

Darkskyx.current(37, -94, %Darkskyx{lang: "ar"})

This package only performs API call and asks consumer of this package to perform things such as handling rate-limiting.

Change on v1.0

All the raw api calls except Darkskyx.current and Darkskyx.forecast now return headers for success calls like: {:ok, body, headers} This gives flexibility for API consumer to handle things such as rate limiting based on the headers.

Author

License

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory