diff --git a/README.md b/README.md index b732a9c..09baa6a 100644 --- a/README.md +++ b/README.md @@ -57,36 +57,24 @@ Environment variables (highest priority): Default config file: `~/.config/notamify/config.json` -## Usage +## Qucik start +### Get active NOTAMs ```python -from notamify_sdk import NotamifyClient - -client = NotamifyClient(token="YOUR_TOKEN") - -# The API accepts at most 30 items per page. -active_notams = list(client.notams.active({ - "location": ["KJFK", "KLAX"], - "per_page": 30, -})) -print(len(active_notams)) - -first_page = next(iter(client.notams.active({ - "location": ["KJFK", "KLAX"], - "per_page": 30, -}).pages)) -print(first_page.total_count) - -job = client.create_async_briefing({ - "locations": [{ - "location": "KJFK", - "type": "origin", - "starts_at": "2026-02-25T10:00:00Z", - "ends_at": "2026-02-25T12:00:00Z", - }], -}) -print(job.uuid) +from datetime import datetime, timedelta +from notamify_sdk import NotamifyClient, ActiveNotamsQuery +client = NotamifyClient(token="YOUR_API_KEY") + +query = ActiveNotamsQuery( + location=["KJFK", "KLAX"], + starts_at=datetime.now(), + ends_at=datetime.now() + timedelta(days=1) +) +``` + +### Watcher flow +``` # Watcher sandbox flow listener = client.create_listener( "https://example.trycloudflare.com/webhooks/notamify", @@ -140,8 +128,6 @@ for page in pager.pages: print(page.page, page.total_count, len(page.notams)) ``` -The API allows at most `30` items per page. The SDK validates this with Pydantic and rejects larger `per_page` values. - ## Local Webhook Testing The example scripts live in the repository and source distribution under `examples/`.