{
  "openapi": "3.0.1",
  "info": {
    "title": "Vatis Egress Service",
    "description": "Vatis Egress Service API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://egress-service.vatis.tech",
      "description": "Default server"
    }
  ],
  "paths": {
    "/egress-service/api/v1/egress/live": {
      "get": {
        "summary": "Egresses a live stream of data",
        "description": "Live egress",
        "operationId": "live-egress",
        "parameters": [
          {
            "name": "streams",
            "in": "query",
            "description": "List of stream ids for watching",
            "schema": {
              "type": "array"
            }
          },
          {
            "name": "streamsInclusion",
            "in": "query",
            "description": "Inclusion mode for the streams. When using 'EXCLUDE' the 'group' and 'count' must be specified",
            "schema": {
              "type": "string",
              "enum": [
                "INCLUDE",
                "EXCLUDE"
              ]
            }
          },
          {
            "name": "group",
            "in": "query",
            "description": "Group id of the streams",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "count",
            "in": "query",
            "description": "Number of streams to search. Used when the included streams are not specified",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "tags",
            "in": "query",
            "description": "List of tags to match",
            "schema": {
              "type": "array",
              "default": "main"
            }
          },
          {
            "name": "matchTags",
            "in": "query",
            "description": "Match mode for the tags. 'ALL' matches all tags, 'ANY' matches any tag.",
            "schema": {
              "type": "string",
              "enum": [
                "ALL",
                "ANY"
              ]
            }
          },
          {
            "name": "format",
            "in": "query",
            "description": "Output format of the events. Only raw output formats are supported with 'RAW' output format.",
            "schema": {
              "type": "string",
              "enum": [
                "EVENTS",
                "RAW"
              ]
            }
          },
          {
            "name": "acceptFrameType",
            "in": "query",
            "description": "Accept frame type for the stream. 'partial-final' accepts partial and final frames, 'final' accepts only final frames.",
            "schema": {
              "type": "string",
              "enum": [
                "partial-final",
                "final"
              ],
              "default": "partial-final"
            }
          },
          {
            "name": "timeout",
            "in": "query",
            "description": "Timeout for the stream creation in milliseconds. If not specified, the maximum timeout allowed by the server will be used.",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "omitPayload",
            "in": "query",
            "description": "Exclude the payload from the result. If true, the payload value will be set to 'null'. This is compatible only with 'EVENTS' format.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "excludeNoPayload",
            "in": "query",
            "description": "Filter out messages without payload.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "resume",
            "in": "query",
            "description": "Key-value pair where the key is the topic name and the value is the message id to resume from, exclusively. (e.g. topicName=messageId)",
            "schema": {
              "type": "array",
              "example": "sinkTopicName=messageId"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Stream egressed",
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "$ref": "#/components/schemas/StreamSinkMessageDto"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerToken": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "StreamSinkMessageDto": {
        "type": "object",
        "properties": {
          "streamId": {
            "type": "string",
            "format": "uuid"
          },
          "groupId": {
            "type": "string",
            "format": "uuid"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sinkTopicName": {
            "type": "string"
          },
          "messageId": {
            "type": "string"
          },
          "processorId": {
            "type": "string"
          },
          "sequenceId": {
            "type": "integer",
            "format": "int64"
          },
          "publishTimestamp": {
            "type": "string",
            "format": "date-time"
          },
          "frameType": {
            "type": "string"
          },
          "payloadSchema": {
            "type": "string"
          },
          "payload": {
            "type": "object"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer",
            "format": "int32"
          },
          "title": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "internalErrorName": {
            "type": "string"
          },
          "nestedErrors": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}
