{
  "openapi": "3.1.0",
  "info": {
    "title": "Elo Plugin Runtime API",
    "version": "1.0.0",
    "description": "Use a five-minute plugin grant provided by the Elo host. This is not the private dashboard API."
  },
  "servers": [
    {
      "url": "https://elo-api-prod.quaggamock.com"
    }
  ],
  "security": [
    {
      "pluginGrant": []
    }
  ],
  "components": {
    "securitySchemes": {
      "pluginGrant": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "MeetingInvocation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation",
          "meetingId"
        ],
        "properties": {
          "operation": {
            "type": "string",
            "enum": [
              "meeting:read",
              "transcript:read",
              "tags:read",
              "notes:write"
            ]
          },
          "meetingId": {
            "type": "string",
            "minLength": 1
          },
          "cursor": {
            "type": "string",
            "maxLength": 4000
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          }
        }
      },
      "ConfigurationInvocation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operation"
        ],
        "properties": {
          "operation": {
            "type": "string",
            "enum": [
              "identity:read",
              "settings:read",
              "settings:write"
            ]
          },
          "value": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    }
  },
  "paths": {
    "/plugin-runtime/{installationId}": {
      "post": {
        "summary": "MeetingInvocation",
        "parameters": [
          {
            "in": "path",
            "name": "installationId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MeetingInvocation"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation-specific JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "meeting"
                      ],
                      "properties": {
                        "meeting": {
                          "type": "object",
                          "required": [
                            "id",
                            "title",
                            "provider",
                            "url",
                            "destination",
                            "status",
                            "createdAt",
                            "endedAt",
                            "scheduledDelete"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "title": {
                              "type": "string"
                            },
                            "provider": {
                              "type": "string"
                            },
                            "url": {
                              "type": "string"
                            },
                            "destination": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            },
                            "createdAt": {
                              "type": "integer",
                              "format": "int64"
                            },
                            "endedAt": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "format": "int64"
                            },
                            "scheduledDelete": {
                              "type": [
                                "integer",
                                "null"
                              ],
                              "format": "int64"
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "entries",
                        "nextCursor"
                      ],
                      "properties": {
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "id",
                              "kind",
                              "speaker",
                              "text",
                              "at"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "caption",
                                  "chat",
                                  "note"
                                ]
                              },
                              "speaker": {
                                "type": "string"
                              },
                              "text": {
                                "type": "string"
                              },
                              "at": {
                                "type": "integer",
                                "format": "int64"
                              },
                              "endedAt": {
                                "type": "integer",
                                "format": "int64"
                              }
                            }
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Opaque cursor for the next page; null when exhausted. Do not decode or modify."
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "tags"
                      ],
                      "properties": {
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "id",
                              "name"
                            ],
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "id"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "meeting:read": {
                    "summary": "Read meeting",
                    "value": {
                      "meeting": {
                        "id": "meeting-demo",
                        "title": "Product daily",
                        "provider": "meet",
                        "url": "https://meet.google.com/abc-defg-hij",
                        "destination": "r2",
                        "status": "completed",
                        "createdAt": 1793455200000,
                        "endedAt": 1793457000000,
                        "scheduledDelete": null
                      }
                    }
                  },
                  "transcript:read": {
                    "summary": "Read transcript",
                    "value": {
                      "entries": [
                        {
                          "id": "entry-demo",
                          "kind": "caption",
                          "speaker": "Alice",
                          "text": "We agreed to review the integration.",
                          "at": 1793455200000,
                          "endedAt": 1793455204000
                        }
                      ],
                      "nextCursor": null
                    }
                  },
                  "tags:read": {
                    "summary": "Read tags",
                    "value": {
                      "tags": [
                        {
                          "id": "tag-demo",
                          "name": "Product"
                        }
                      ]
                    }
                  },
                  "notes:write": {
                    "summary": "Append note",
                    "value": {
                      "id": "note-demo"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Revise os dados enviados.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "message",
                    "issues"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "issues": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "code": "invalid_input",
                  "message": "Revise os dados enviados.",
                  "issues": []
                }
              }
            }
          },
          "401": {
            "description": "A sessão do plugin expirou.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "code": "plugin_token",
                  "message": "A sessão do plugin expirou."
                }
              }
            }
          },
          "403": {
            "description": "O plugin não recebeu esta permissão.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "code": "plugin_scope",
                  "message": "O plugin não recebeu esta permissão."
                }
              }
            }
          },
          "404": {
            "description": "Plugin não encontrado ou desativado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "code": "plugin_missing",
                  "message": "Plugin não encontrado ou desativado."
                }
              }
            }
          }
        }
      }
    },
    "/plugin-runtime/{installationId}/config": {
      "post": {
        "summary": "ConfigurationInvocation",
        "parameters": [
          {
            "in": "path",
            "name": "installationId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfigurationInvocation"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operation-specific JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "user"
                      ],
                      "properties": {
                        "user": {
                          "type": "object",
                          "required": [
                            "id",
                            "name",
                            "email"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "settings"
                      ],
                      "properties": {
                        "settings": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    {
                      "type": "object",
                      "required": [
                        "saved"
                      ],
                      "properties": {
                        "saved": {
                          "type": "boolean"
                        }
                      }
                    }
                  ]
                },
                "examples": {
                  "identity:read": {
                    "summary": "Read identity",
                    "value": {
                      "user": {
                        "id": "user-demo",
                        "name": "Alice",
                        "email": "alice@example.test"
                      }
                    }
                  },
                  "settings:read": {
                    "summary": "Read settings",
                    "value": {
                      "settings": {
                        "title": "Minutes",
                        "includeEvidence": true
                      }
                    }
                  },
                  "settings:write": {
                    "summary": "Save settings",
                    "value": {
                      "saved": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Revise os dados enviados.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "message",
                    "issues"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "issues": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "code": "invalid_input",
                  "message": "Revise os dados enviados.",
                  "issues": []
                }
              }
            }
          },
          "401": {
            "description": "A sessão do plugin expirou.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "code": "plugin_token",
                  "message": "A sessão do plugin expirou."
                }
              }
            }
          },
          "403": {
            "description": "O plugin não recebeu esta permissão.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "code": "plugin_scope",
                  "message": "O plugin não recebeu esta permissão."
                }
              }
            }
          },
          "404": {
            "description": "Plugin não encontrado ou desativado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "code": "plugin_missing",
                  "message": "Plugin não encontrado ou desativado."
                }
              }
            }
          }
        }
      }
    }
  }
}
