verida / data-connector-server

1 stars 2 forks source link

Google Calendar Handler #97

Closed chime3 closed 2 months ago

chime3 commented 2 months ago

Closes #94

chime3 commented 2 months ago

Calendar

{
  "kind": "calendar#calendar",
  "etag": etag,
  "id": string,
  "summary": string,
  "description": string,
  "location": string,
  "timeZone": string,
  "conferenceProperties": {
    "allowedConferenceSolutionTypes": [
      string
    ]
  }
}

This is google calendar response format. I suggest to add lcoation and timezone into calendar schema so that it can be populated in other providers

Event

{
  "kind": "calendar#event",
  "etag": etag,
  "id": string,
  "status": string,
  "htmlLink": string,
  "created": datetime,
  "updated": datetime,
  "summary": string,
  "description": string,
  "location": string,
  "colorId": string,
  "creator": {
    "id": string,
    "email": string,
    "displayName": string,
    "self": boolean
  },
  "organizer": {
    "id": string,
    "email": string,
    "displayName": string,
    "self": boolean
  },
  "start": {
    "date": date,
    "dateTime": datetime,
    "timeZone": string
  },
  "end": {
    "date": date,
    "dateTime": datetime,
    "timeZone": string
  },
  "endTimeUnspecified": boolean,
  "recurrence": [
    string
  ],
  "recurringEventId": string,
  "originalStartTime": {
    "date": date,
    "dateTime": datetime,
    "timeZone": string
  },
  "transparency": string,
  "visibility": string,
  "iCalUID": string,
  "sequence": integer,
  "attendees": [
    {
      "id": string,
      "email": string,
      "displayName": string,
      "organizer": boolean,
      "self": boolean,
      "resource": boolean,
      "optional": boolean,
      "responseStatus": string,
      "comment": string,
      "additionalGuests": integer
    }
  ],
  "attendeesOmitted": boolean,
  "extendedProperties": {
    "private": {
      (key): string
    },
    "shared": {
      (key): string
    }
  },
  "hangoutLink": string,
  "conferenceData": {
    "createRequest": {
      "requestId": string,
      "conferenceSolutionKey": {
        "type": string
      },
      "status": {
        "statusCode": string
      }
    },
    "entryPoints": [
      {
        "entryPointType": string,
        "uri": string,
        "label": string,
        "pin": string,
        "accessCode": string,
        "meetingCode": string,
        "passcode": string,
        "password": string
      }
    ],
    "conferenceSolution": {
      "key": {
        "type": string
      },
      "name": string,
      "iconUri": string
    },
    "conferenceId": string,
    "signature": string,
    "notes": string,
  },
  "gadget": {
    "type": string,
    "title": string,
    "link": string,
    "iconLink": string,
    "width": integer,
    "height": integer,
    "display": string,
    "preferences": {
      (key): string
    }
  },
  "anyoneCanAddSelf": boolean,
  "guestsCanInviteOthers": boolean,
  "guestsCanModify": boolean,
  "guestsCanSeeOtherGuests": boolean,
  "privateCopy": boolean,
  "locked": boolean,
  "reminders": {
    "useDefault": boolean,
    "overrides": [
      {
        "method": string,
        "minutes": integer
      }
    ]
  },
  "source": {
    "url": string,
    "title": string
  },
  "workingLocationProperties": {
    "type": string,
    "homeOffice": (value),
    "customLocation": {
      "label": string
    },
    "officeLocation": {
      "buildingId": string,
      "floorId": string,
      "floorSectionId": string,
      "deskId": string,
      "label": string
    }
  },
  "outOfOfficeProperties": {
    "autoDeclineMode": string,
    "declineMessage": string
  },
  "focusTimeProperties": {
    "autoDeclineMode": string,
    "declineMessage": string,
    "chatStatus": string
  },
  "attachments": [
    {
      "fileUrl": string,
      "title": string,
      "mimeType": string,
      "iconLink": string,
      "fileId": string
    }
  ],
  "eventType": string
}

Google calendar event response is much complex.

Here is my suggested schema:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://common.schemas.verida.io/social/event/v0.1.0/schema.json",
    "title": "Event",
    "description": "Schema for a calendar event",
    "type": "object",
    "appearance": {
      "style": {
        "color": "#4285F4",
        "icon": "./icon.svg"
      }
    },
    "database": {
      "name": "social_event",
      "indexes": {
        "startTime": ["start.dateTime", "start.date"],
        "endTime": ["end.dateTime", "end.date"],
        "organizer": ["organizer.email"],
        "attendees": ["attendees.email"]
      }
    },
    "layouts": {
      "create": [
        "summary",
        "start",
        "end",
        "location"
      ],
      "view": [
        "summary",
        "description",
        "start",
        "end",
        "location",
        "organizer",
        "attendees",
        "status"
      ]
    },
    "properties": {
      "id": {
        "title": "ID",
        "description": "Unique identifier for the event",
        "type": "string"
      },
      "status": {
        "title": "Status",
        "description": "Status of the event",
        "type": "string",
        "enum": ["confirmed", "tentative", "cancelled"]
      },
      "created": {
        "title": "Created",
        "description": "Creation time of the event",
        "type": "string",
        "format": "date-time"
      },
      "updated": {
        "title": "Updated",
        "description": "Last modification time of the event",
        "type": "string",
        "format": "date-time"
      },
      "summary": {
        "title": "Summary",
        "description": "Title of the event",
        "type": "string"
      },
      "description": {
        "title": "Description",
        "description": "Detailed description of the event",
        "type": "string"
      },
      "location": {
        "title": "Location",
        "description": "Location of the event",
        "type": "string"
      },
      "creator": {
        "title": "Creator",
        "description": "Details of the event creator",
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "email": { "type": "string", "format": "email" },
          "displayName": { "type": "string" },
          "self": { "type": "boolean" }
        }
      },
      "organizer": {
        "title": "Organizer",
        "description": "Details of the event organizer",
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "email": { "type": "string", "format": "email" },
          "displayName": { "type": "string" },
          "self": { "type": "boolean" }
        }
      },
      "start": {
        "title": "Start",
        "description": "Start time of the event",
        "type": "object",
        "properties": {
          "dateTime": { "type": "string", "format": "date-time" },
          "date": { "type": "string", "format": "date" },
          "timeZone": { "type": "string" }
        }
      },
      "end": {
        "title": "End",
        "description": "End time of the event",
        "type": "object",
        "properties": {
          "dateTime": { "type": "string", "format": "date-time" },
          "date": { "type": "string", "format": "date" },
          "timeZone": { "type": "string" }
        }
      },
      "attendees": {
        "title": "Attendees",
        "description": "List of attendees for the event",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": { "type": "string" },
            "email": { "type": "string", "format": "email" },
            "displayName": { "type": "string" }
          }
        }
      },
      "conferenceData": {
        "title": "Conference Data",
        "description": "Details about the conference associated with the event"
      },
      "attachments": {
        "title": "Attachments",
        "description": "Attachments for the event",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "fileUrl": { "type": "string", "format": "uri" },
            "title": { "type": "string" },
            "mimeType": { "type": "string" },
            "iconLink": { "type": "string", "format": "uri" },
            "fileId": { "type": "string" }
          }
        }
      }
    },
    "required": ["id", "status", "summary", "start", "end"]
  }

Please check the above comments and reply @tahpot

tahpot commented 2 months ago

@chime3 This looks like a great start.

Can you create a branch and PR with your proposed schema in https://github.com/verida/schemas-common

Also create a proposed schema for calendar.

I can then add comments and feedback on the schema in that PR.

chime3 commented 2 months ago

@chime3 This looks like a great start.

Can you create a branch and PR with your proposed schema in https://github.com/verida/schemas-common

Also create a proposed schema for calendar.

I can then add comments and feedback on the schema in that PR.

Okay