Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jereinhardt/snowcone
Elixir wrapper for the Frost API
https://github.com/jereinhardt/snowcone
blockchain
Last synced: 4 months ago
JSON representation
Elixir wrapper for the Frost API
- Host: GitHub
- URL: https://github.com/jereinhardt/snowcone
- Owner: jereinhardt
- Created: 2018-04-07T17:54:24.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-24T21:22:35.000Z (over 5 years ago)
- Last Synced: 2024-09-17T03:53:36.657Z (4 months ago)
- Topics: blockchain
- Language: Elixir
- Size: 8.79 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Snowcone
Elixir API wrapper for the Frost API.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `snowcone` to your list of dependencies in `mix.exs`:```elixir
def deps do
[
{:snowcone, "~> 0.1.2"}
]
end
```## Configuration
You'll need to configure your api token and the service url you would like to use.
```elixir
# config/config.exsuse Mix.Config
config :snowcone,
service_url: "https://api.poetnetwork.net",
api_token: "your api token"
```## Usage
The `Snowcone` modules allows you to interact Frost enpoints related to works.
- `get_works/0` - retrieves all works related to an account
- `get_work/1` - retrieves a single work related to an account
- `create_work/1` - create a work for an account```elixir
# Retrieve a list of all available works.
Snowcone.get_works
# ** {:ok, [%Frost.Work{...}]}# Retrieve a work based on its id.
Snowcone.get_work("work_id")
# ** {:ok, %Frost.Work{...}}# Create a work. Returns a map with the work id.
Snowcone.create_work(work_params)
# ** {:ok, %{work_id: "work_id"}}# Any API request that fails will return a tuple with the error message.
Snowcone.get_work("invalid_work_id")
# ** {:error, "Work not found."}
```