# BananaPrompts SDK for Elixir
`bananaprompts_sdk` is the official Elixir SDK for the BananaPrompts API.
It gives Elixir developers a clean client for discovering trending prompts,
browsing category templates, and searching reusable prompt patterns.
The package is intentionally lightweight:
- typed public structs for clients, responses, and errors
- a thin request layer built on `Req`
- convenience helpers for prompt discovery endpoints
- package metadata prepared for Hex publishing
## Installation
Add the dependency to your `mix.exs`:
```elixir
def deps do
[
{:bananaprompts_sdk, "~> 0.1.0"}
]
end
```
Then fetch dependencies:
```bash
mix deps.get
```
## Quick Start
```elixir
client =
BananapromptsSDK.new(
api_key: System.fetch_env!("BANANAPROMPTS_API_KEY")
)
{:ok, response} =
BananapromptsSDK.list_trending_prompts(client, params: %{limit: 10})
response.status
response.body
```
## Built-In Helpers
Fetch trending prompts:
```elixir
BananapromptsSDK.list_trending_prompts(client, params: %{limit: 20, timeframe: "7d"})
```
Browse templates by category:
```elixir
BananapromptsSDK.list_category_templates(client, "marketing", params: %{limit: 25})
```
Search prompt templates:
```elixir
BananapromptsSDK.search_templates(client, "product launch email", params: %{limit: 10})
```
## Configuration
The client accepts these options:
- `:api_key` - API key used for authenticated requests
- `:base_url` - defaults to `https://bananaprompts.org`
- `:api_key_header` - defaults to `"authorization"`
- `:api_key_prefix` - defaults to `"Bearer"`
- `:headers` - additional request headers
- `:receive_timeout` - request timeout in milliseconds
- `:req_options` - raw `Req` options merged into each request
## Generic Requests
You can still call lower-level helpers for endpoints not yet wrapped:
```elixir
BananapromptsSDK.get(client, "/v1/collections/featured")
```
```elixir
BananapromptsSDK.request(client, :post, "/v1/prompts/bookmarks", body: %{prompt_id: "pr_123"})
```
## Publishing Notes
Before the next public release, update these items:
- replace the `@source_url_placeholder` in `mix.exs` with the public repository URL
- align helper function paths with the production BananaPrompts API contract
- expand tests around pagination, filtering, and authentication failures
## Official Links
- Homepage: [https://bananaprompts.org/](https://bananaprompts.org/)
- Official documentation and support: [https://bananaprompts.org/](https://bananaprompts.org/)
## License
MIT