#!/usr/bin/env bash
set -euo pipefail
: "${SIGNAILIST_API_KEY:?Set SIGNAILIST_API_KEY}"
: "${SIGNAILIST_SOURCE_ID:?Set SIGNAILIST_SOURCE_ID}"
: "${SIGNAILIST_IDEMPOTENCY_KEY:?Use the same key when retrying this batch}"
curl --fail-with-body --request POST \
  "https://api.signailist.com/v1/external-sources/${SIGNAILIST_SOURCE_ID}/items" \
  --header "Authorization: Bearer ${SIGNAILIST_API_KEY}" \
  --header "Idempotency-Key: ${SIGNAILIST_IDEMPOTENCY_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{"items":[{"externalId":"example-1","version":"1","title":"Example","text":"A material from our system.","publishedAt":"2026-10-20T12:00:00Z"}]}'
