Skip to content

Commit bb6536c

Browse files
committed
docs: add AGENTS.md with build/test commands and code style guide
1 parent 4a054d6 commit bb6536c

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# AGENTS.md
2+
3+
## Build & Test
4+
- `cargo check --all` — type-check both crates
5+
- `cargo test --all` — run all 18 unit tests + doc-tests
6+
- `cargo test -p usesend-api -- <test_name>` — run a single test in usesend-api
7+
- `cargo clippy --all --all-targets -- -D warnings` — lint (must pass with zero warnings)
8+
- `cargo fmt --all -- --check` — format check
9+
10+
## Architecture
11+
Cargo workspace with two crates:
12+
- **`usesend-api`** — Low-level typed HTTP client. `Config` (with `Arc`-shared state, governor rate limiter) → `SharedConfig` → service structs (`EmailsSvc`, `DomainsSvc`, etc.). Types live in `usesend-api/src/types/`.
13+
- **`usesend`** — High-level wrapper re-exporting `usesend_api::types` and wrapping each `*Svc` in thin service structs (`Emails`, `Domains`, etc.).
14+
15+
## Code Style
16+
- Rust edition 2024, MSRV 1.88. Default TLS: `rustls-tls`.
17+
- All request/params structs derive `bon::Builder` + `Serialize`/`Deserialize`. Use `#[builder(into)]` on String/StringOrVec fields.
18+
- Optional fields: `Option<T>` with `#[serde(skip_serializing_if = "Option::is_none")]`.
19+
- Typed IDs via `define_id_type!` macro (`DomainId`, `EmailId`, etc.) in `types/mod.rs`.
20+
- `serde(rename_all = "camelCase")` on API-facing structs. Enums use `SCREAMING_SNAKE_CASE`.
21+
- Imports: `use crate::...` internally; group by crate, alphabetical. No `use serde_json;` bare imports.
22+
- Error handling: `ApiError` enum with `thiserror`, return `ApiResult<T>`. No `.unwrap()` in library code.
23+
- License: `MIT OR Apache-2.0`. No comments unless code is complex.

0 commit comments

Comments
 (0)