An elixir wrapper to reddit's API, not forcing genservers on you as a bonus
Usage
Configure your credentials in config/
as per usual, in the form
config :reddit, :oauth,
client_id: "my_id",
secret: "deadbeef",
username: "well_acktually",
password: "password123"
Credentials can be passed dynamically if you require, see the docs for details.
Now you can get to work
iex> {:ok, client} = Reddit.Client.login()
{:ok, %Tesla.Client{}}
iex> {:ok, response} = Reddit.Subreddit.top_posts(client, "evangelion")
{:ok, %Tesla.Env{status: 200, body: %{...}})
iex> Reddit.Listing.next_page(response, limit: 5)
{:ok, %Tesla.Env{status: 200, body: %{...}})
Installation
If available in Hex, the package can be installed
by adding reddit
to your list of dependencies in mix.exs
:
def deps do
[
{:reddit, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/reddit.