An Elixir SDK for the Medium.com API.
If available in Hex, the package can be installed as:
- Add
medium
to your list of dependencies inmix.exs
:
```elixir
def deps do
[{:medium, "~> 0.2"}]
end
```
- Ensure
medium
is started before your application:
```elixir
def application do
[applications: [:medium]]
end
```
Since all Medium requests must be made with an integration token, you need to create a new client associated with that token in order to perform requests:
client = Medium.client("my-access-token")
With our client at hand, we can start making requests to the API! 💥
# We can perform all GET requests described on the API:
user = Medium.me(client)
user_publications = Medium.publications(client, user.id)
# And we can also publish:
post = %{
title: "Liverpool FC",
content_format: "html",
content: "<h1>Liverpool FC</h1><p>You’ll never walk alone.</p>",
canonical_url: "http://jamietalbot.com/posts/liverpool-fc",
tags: ["football", "sport", "Liverpool"],
publish_status: "public"
}
response = Medium.publish(client, user.id, post)
Don't forget to check the Medium API or the documentation to see all available methods.
- Improve the documentation
- Improve the test suite
- Remove the Tesla dependency
All the code contained in this repository, unless explicitly stated, is licensed under an MIT license.
A copy of the license can be found in the LICENSE file.