Conformance test
When a calendar is connected, Opami calls every required endpoint with sample data and checks each answer against the event format. The calendar is usable for reading once every read operation passes, and for writing once every write passes too. Run the same test yourself before connecting: it is the code Opami runs.
- Download opami-calendar-conformance.mjs (Node 20 or later, no dependencies).
- Write
config.json:
{
"endpoints": [
{ "operation": "calendars.list", "method": "GET", "url_template": "https://cal.example.com/calendars" },
{ "operation": "freebusy.query", "method": "POST", "url_template": "https://cal.example.com/freebusy" },
{ "operation": "events.list", "method": "GET", "url_template": "https://cal.example.com/calendars/{calendar_id}/events?from={from}&to={to}" },
{ "operation": "events.get", "method": "GET", "url_template": "https://cal.example.com/calendars/{calendar_id}/events/{event_id}" }
],
"auth": { "type": "bearer", "token": "your test token" }
}
auth is { "type": "bearer", "token" }, { "type": "api_key", "key", "header" } (header defaults to X-API-Key) or { "type": "basic", "username", "password" }.
- Run
node opami-calendar-conformance.mjs config.json.
What it checks, in order:
- calendars.list answers calendars in the format (it picks the primary calendar you own).
- freebusy.query answers busy intervals whose end is not before their start.
- events.list answers events of the asked calendar only.
- events.get reads one listed event back, or answers
404for an unknown one on an empty calendar. - With all three write endpoints entered: events.create makes an event 30 days ahead that reads back as sent, events.update changes its title, events.cancel cancels it (it then reads as cancelled, or
404/410). - events.respond is optional and needs a real invitation, so it is not called.
The test writes to the calendar it picks when you enter the write endpoints: point it at a test calendar.