Hairfilter SDK for Elixir
hairfilter_sdk is the official Elixir SDK skeleton for the HairFilter API.
It provides a clean, publish-ready foundation for the official client while
the platform is still in MVP.
The package is intentionally small and opinionated:
- typed public structs for clients, responses, and errors
-
a thin request layer built on
Req -
JSON request and response handling via
Jason - package metadata prepared for Hex publishing
- docs and examples that can evolve alongside the API
Installation
Add the dependency to your mix.exs:
def deps do
[
{:hairfilter_sdk, "~> 0.1.0"}
]
endThen fetch dependencies:
mix deps.getQuick Start
client =
HairfilterSDK.new(
api_key: System.fetch_env!("HAIRFILTER_API_KEY")
)
{:ok, response} =
HairfilterSDK.get(client, "/v1/health")
response.status
response.bodyConfiguration
The client accepts these options:
:api_key- API key used for authenticated requests:base_url- defaults tohttps://hairfilter.net:api_key_header- defaults to"authorization":api_key_prefix- defaults to"Bearer":headers- additional request headers:receive_timeout- request timeout in milliseconds:req_options- rawReqoptions merged into each request
Example:
client =
HairfilterSDK.new(
api_key: System.fetch_env!("HAIRFILTER_API_KEY"),
base_url: "https://hairfilter.net",
headers: [{"x-sdk-name", "hairfilter-elixir"}],
receive_timeout: 15_000
)Request Examples
GET request:
HairfilterSDK.get(client, "/v1/images", params: %{limit: 10})POST request:
HairfilterSDK.post(client, "/v1/jobs", body: %{image_url: "https://example.com/me.png"})Generic request:
HairfilterSDK.request(client, :patch, "/v1/profile", body: %{display_name: "Taylor"})Publishing Notes
Before the first public release, update these items:
-
replace the
@source_url_placeholderinmix.exswith the public repository URL - add real endpoint examples once the API is finalized
- expand tests around authentication, pagination, and domain objects
-
publish generated docs with
mix docs
Official Links
- Homepage: https://hairfilter.net/
- Official documentation and support: https://hairfilter.net/
License
MIT