diff --git a/catalog.json b/catalog.json index 55b7562..4e6ea05 100644 --- a/catalog.json +++ b/catalog.json @@ -22,10 +22,10 @@ "name": "google-calendar", "openapi": "https://raw.githubusercontent.com/localthought/openapi-directory/9c5cfb87b3f8b64e11069373a73e3fc85de0de5e/APIs/googleapis.com/google-calendar/v3/openapi.yaml", "overlays": [ - "https://raw.githubusercontent.com/localthought/overlays/168a9395a5ce290eee10a6a924c57717e7e0395a/googleapis.com/google-calendar/v3/auth-overlay.yaml", + "https://raw.githubusercontent.com/localthought/overlays/c844b237027e0297e40f5ff540ba041d760f862a/googleapis.com/google-calendar/v3/auth-overlay.yaml", "https://raw.githubusercontent.com/localthought/overlays/d603d5453e9dc5ec26a1d7a6b9cfaeec934d5f4a/googleapis.com/google-calendar/v3/pagination-overlay.yaml", - "https://raw.githubusercontent.com/localthought/overlays/d603d5453e9dc5ec26a1d7a6b9cfaeec934d5f4a/googleapis.com/google-calendar/v3/crud-causality-overlay.yaml", - "https://raw.githubusercontent.com/localthought/overlays/0621413709fc88d65e908ae3643ceaaa53872194/googleapis.com/google-calendar/v3/schema-overlay.yaml", + "https://raw.githubusercontent.com/localthought/overlays/c844b237027e0297e40f5ff540ba041d760f862a/googleapis.com/google-calendar/v3/crud-causality-overlay.yaml", + "https://raw.githubusercontent.com/localthought/overlays/c844b237027e0297e40f5ff540ba041d760f862a/googleapis.com/google-calendar/v3/schema-overlay.yaml", "https://raw.githubusercontent.com/localthought/overlays/ee929c625d3c63dea87bcccae932a98a33138a8f/googleapis.com/google-calendar/v3/identity-overlay.yaml" ], "selection": { diff --git a/googleapis.com/google-calendar/v3/auth-overlay.yaml b/googleapis.com/google-calendar/v3/auth-overlay.yaml index c5f3fd4..5ab37c9 100644 --- a/googleapis.com/google-calendar/v3/auth-overlay.yaml +++ b/googleapis.com/google-calendar/v3/auth-overlay.yaml @@ -108,3 +108,61 @@ actions: - https://www.googleapis.com/auth/calendar.calendarlist.readonly - googleOffline: - https://www.googleapis.com/auth/calendar.calendarlist.readonly + +# Introduces the one write operation this platform exposes: a partial update +# to an event, matching what Devonian's google-calendar lens can send +# (`planCalendarEdit`/`applyCalendarEdit` in localthought/devonian only ever +# patch summary, description, location, start and end). Runs first among the +# google-calendar overlays so crud-causality-overlay.yaml can add `x-crud` to +# it afterwards. Reuses the `calendar.events` scope already requested for the +# events GET operations below, so no new consent/reconnect is required. +- target: $.paths['/calendars/{calendarId}/events/{eventId}'] + update: + patch: + operationId: events-patch + summary: Update fields on an existing event + description: > + A partial update to an event. `If-Match` carries the event's + last-known ETag for optimistic-concurrency conflict detection; + Google returns 412 if the event changed remotely since it was read. + parameters: + - name: calendarId + in: path + required: true + schema: { type: string } + - name: eventId + in: path + required: true + schema: { type: string } + - name: sendUpdates + in: query + required: false + description: Whether to notify attendees of the change. + schema: + type: string + enum: [all, externalOnly, none] + - name: If-Match + in: header + required: false + description: The event's last-known ETag. + schema: { type: string } + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/event' + responses: + '200': + description: The updated event. + content: + application/json: + schema: + $ref: '#/components/schemas/event' + '412': + description: The If-Match precondition failed. + security: + - googleOnline: + - https://www.googleapis.com/auth/calendar.events + - googleOffline: + - https://www.googleapis.com/auth/calendar.events diff --git a/googleapis.com/google-calendar/v3/crud-causality-overlay.yaml b/googleapis.com/google-calendar/v3/crud-causality-overlay.yaml index 910ce7a..1929783 100644 --- a/googleapis.com/google-calendar/v3/crud-causality-overlay.yaml +++ b/googleapis.com/google-calendar/v3/crud-causality-overlay.yaml @@ -1,15 +1,15 @@ overlay: 1.0.0 info: title: Google Calendar API CRUD Causality - version: 1.0.0 -# Declares the CRUD-causality resources a read-only sync needs: which -# collections exist, how each item is addressed, and (since this platform -# only lists and reads — see the base document's description) nothing about -# writes. Mirrors the shape of the GitHub crud-causality overlay in this -# repo, with one Google-specific point: there is no "list all calendars" -# operation, so `event`'s `calendarId` context comes from enumerating -# `calendarListEntry` (via its own identity binding) rather than from a -# dedicated calendars collection. + version: 1.1.0 +# Declares the CRUD-causality resources this platform needs: which +# collections exist, how each item is addressed, and (since the base +# document is otherwise read-only — see its description) the one write path +# auth-overlay.yaml adds: a partial update to an event. Mirrors the shape of +# the GitHub crud-causality overlay in this repo, with one Google-specific +# point: there is no "list all calendars" operation, so `event`'s +# `calendarId` context comes from enumerating `calendarListEntry` (via its +# own identity binding) rather than from a dedicated calendars collection. actions: - target: $.components update: @@ -67,3 +67,8 @@ actions: x-crud: action: read resource: event + - target: $.paths['/calendars/{calendarId}/events/{eventId}'].patch + update: + x-crud: + action: update + resource: event diff --git a/googleapis.com/google-calendar/v3/schema-overlay.yaml b/googleapis.com/google-calendar/v3/schema-overlay.yaml index 147328a..e6f9477 100644 --- a/googleapis.com/google-calendar/v3/schema-overlay.yaml +++ b/googleapis.com/google-calendar/v3/schema-overlay.yaml @@ -22,3 +22,9 @@ actions: format: date-time timeZone: type: string + etag: + type: string + description: > + Opaque version identifier, present on every read. Send back as + `If-Match` on a PATCH for optimistic-concurrency conflict + detection. diff --git a/tests/test_identity_overlays.py b/tests/test_identity_overlays.py index 5968ce1..aeb26d9 100644 --- a/tests/test_identity_overlays.py +++ b/tests/test_identity_overlays.py @@ -19,6 +19,19 @@ def test_google_auth_and_identity_overlay(self): scopes = document["components"]["securitySchemes"][scheme]["flows"]["authorizationCode"]["scopes"] self.assertTrue({"openid", "email", "profile"} <= set(scopes)) + def test_google_calendar_event_patch_overlay(self): + document = self.composed("google-calendar") + operation = document["paths"]["/calendars/{calendarId}/events/{eventId}"]["patch"] + self.assertEqual(operation["operationId"], "events-patch") + self.assertEqual(operation["x-crud"], {"action": "update", "resource": "event"}) + for scheme in ("googleOnline", "googleOffline"): + self.assertIn( + {scheme: ["https://www.googleapis.com/auth/calendar.events"]}, + operation["security"], + ) + self.assertIn("application/json", operation["requestBody"]["content"]) + self.assertIn("etag", document["components"]["schemas"]["event"]["properties"]) + def test_github_auth_and_identity_overlay(self): document = self.composed("github-issues") operation = document["paths"]["/user"]["get"]