Elixir wrapper for the Frost API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
test
.formatter.exs
.gitignore
README.md
mix.exs
mix.lock

README.md

Snowcone

Elixir API wrapper for the Frost API.

Installation

If available in Hex, the package can be installed by adding snowcone to your list of dependencies in mix.exs:

def deps do
  [
    {:snowcone, "~> 0.1.1"}
  ]
end

Usage

To best utilize snowcone, you will want to create a module in your application to handle api requests. Use Snowcone when defining the module, and include your Frost API key.

defmodule MyApp.FrostAPI do
  use Snowcone, frost_key: "secret frost api key"
end

You can use this module as your primary wrapper for interacting with the Frost API. This makes the following methods available:

# Retrieve a list of all available works.

MyApp.FrostAPI.get_works
# ** {:ok, [%Frost.Work{...}]}


# Retrieve a work based on its id.

MyApp.FrostAPI.get_work("work_id")
# ** {:ok, %Frost.Work{...}}


# Create a work.  Returns a map with the work id.

MyApp.FrostAPI.create_work(work_params)
# ** {:ok, %{work_id: "work_id"}}


# Any API request that fails will return a tuple with the error message.

MyApp.FrostAPI.get_work("invalid_work_id")
# ** {:error, "Work not found."}