blisscs

blisscs

How would you start off writing a library for third party api

Hello,

I am in the process of learning to build a library for the third party api.
I am not so sure how to start it. If anybody has any recommended steps please put them here.

I am thinking of using HTTPoison, and Poison for HTTP client and for parsing Json respectively.

The current issue that I am finding here is How would one write configs for development and for testing and for the moment is included into another app.

If anybody has any past experience on this. I would be really appreciated for recommendations.

Thank you in advance.

Most Liked

svilen

svilen

Author of Concurrent Data Processing in Elixir

Very often the first thing I do, after creating the project with mix new, is to write a README.md and explain what the library is, common usage and configuration. I find it to be a good exercise before getting on with the actual implementation.

Looks like “Readme Driven Development” is already a term: :smile:

http://tom.preston-werner.com/2010/08/23/readme-driven-development.html

stefanchrobot

stefanchrobot

You’re on a good path. Have a look at ex_aws - it’s doing basically the same thing, i.e. wraps HTTP API.

The tough part might be to decide which config options go into config and which ones you want to pass around. One thing that makes many libraries useless for me is when I build a multi-tenant app and the library wants me to put the API key into the config, whereas I need to make an API call with different API keys.

axelson

axelson

Scenic Core Team

In regards to configuration for your library, I really like what @michalmuskala lays out in this article: http://michal.muskala.eu/2017/07/30/configuring-elixir-libraries.html

blisscs

blisscs

@stefanchrobot Thank you for recommending ex_aws I will definitely look there as my starting point. I also have faced similar problems in multi tenant app. Will have to think wisely about the configuration parts.

@svilen Thank you for recommending about “Readme Driven Development”. Will look there also. Cause I will opensource this library. I think it is good to do the README from day one

@axelson Thank you for recommending, the article about the configuration. Will be looking there also.

mertonium

mertonium

Another good resource is the Elixir Library Guidelines, specifically the section on avoiding application configuration.

Where Next?

Popular in Questions Top

gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New
wernerlaude
In AR this is so simple @articles = current_user.articles How to do in Ecto? def index(conn, _params) do current_user = conn.assig...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

Other popular topics Top

yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement