18 lines
692 B
Bash
Executable File
18 lines
692 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
API_URL="https://graphql.ordrestyring.dk/graphql"
|
|
KEY_FILE="$ROOT_DIR/apikey"
|
|
API_KEY=$(tr -d '\r\n' < "$KEY_FILE")
|
|
|
|
# events requires a 'between' parameter with Unix timestamps
|
|
# Using current month as example (timestamps in seconds)
|
|
START_TIMESTAMP=$(date -d "$(date +%Y-%m-01)" +%s)
|
|
END_TIMESTAMP=$(date +%s)
|
|
|
|
curl -sS -X POST "$API_URL" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
--data "{\"query\":\"query { events(between: {field: startTime, from: $START_TIMESTAMP, to: $END_TIMESTAMP}) { id header text startTime stopTime type } }\"}" \
|
|
| jq .
|