#!/usr/bin/env sh
# Wirelytics API — quickstart with curl.
#   export WIRELYTICS_API_KEY=wlx_live_…
#   sh quickstart.sh
# Docs: https://www.wirelytics.de/integration

BASE="${WIRELYTICS_BASE_URL:-https://api.wirelytics.de}"
AUTH="Authorization: Bearer ${WIRELYTICS_API_KEY:?set WIRELYTICS_API_KEY first}"

# 1) Newest brief of one ticker (last 30 days), full JSON
curl -sS -H "$AUTH" "$BASE/brief-api?ticker=CRML"

# 2) Light variant: verdict + quote only
curl -sS -H "$AUTH" "$BASE/brief-api?ticker=CRML&format=meta"

# 3) Archive: the brief of exactly this date
curl -sS -H "$AUTH" "$BASE/brief-api?ticker=CRML&date=2026-09-21"

# 4) Ready-to-embed block (self-contained HTML, or Markdown)
curl -sS -H "$AUTH" "$BASE/brief-api?ticker=CRML&format=markdown"

# 5) Batch: up to 50 tickers, sorted by score, plus the day's cover
curl -sS -H "$AUTH" "$BASE/brief-api?tickers=CRML,ALIT,UURAF&include=edition"

# 6) Show the quota headers of a call (X-RateLimit-*, X-API-Version)
curl -sS -o /dev/null -D - -H "$AUTH" "$BASE/brief-api?ticker=CRML&format=meta"
