{
    "swagger": "2.0",
    "info": {
        "description": "Yet Another Time Serie",
        "title": "Yats Server",
        "termsOfService": "https://kevwe.com/ TODO",
        "contact": {
            "name": "API Support",
            "url": "https:// TODO",
            "email": "TODO"
        },
        "license": {
            "name": "Affero GPL",
            "url": "https://www.gnu.org/licenses/agpl-3.0.en.html#license-text"
        },
        "version": "1.0"
    },
    "basePath": "/",
    "paths": {
        "/event": {
            "post": {
                "description": "store events",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Events"
                ],
                "summary": "write event to db",
                "parameters": [
                    {
                        "type": "string",
                        "description": "clientCN",
                        "name": "X-SSL-Client-CN",
                        "in": "header",
                        "required": true
                    },
                    {
                        "description": "Event body data",
                        "name": "event1",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/model.EventModel"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "schema": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "/event/search": {
            "post": {
                "description": "retrieve events in the specified time window",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Events"
                ],
                "summary": "Get the events From ... and To when present",
                "parameters": [
                    {
                        "type": "string",
                        "description": "clientCN",
                        "name": "X-SSL-Client-CN",
                        "in": "header",
                        "required": true
                    },
                    {
                        "description": "Event query filters",
                        "name": "event2",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/model.EventSearchRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "/event/{from}": {
            "get": {
                "description": "retrieve events  from timestamp {from}",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Events"
                ],
                "summary": "Get the events from timestamp {from}",
                "parameters": [
                    {
                        "type": "string",
                        "description": "clientCN",
                        "name": "X-SSL-Client-CN",
                        "in": "header",
                        "required": true
                    },
                    {
                        "description": "Event query filters",
                        "name": "event2",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/model.EventSearchRequest"
                        }
                    },
                    {
                        "type": "string",
                        "description": "Starting from timestamp :from",
                        "name": "from",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "/metric": {
            "post": {
                "description": "store metric",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Metrics"
                ],
                "summary": "write metric to db",
                "parameters": [
                    {
                        "type": "string",
                        "description": "clientCN",
                        "name": "X-SSL-Client-CN",
                        "in": "header",
                        "required": true
                    },
                    {
                        "description": "Metric request body",
                        "name": "metric2",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/model.MetricModel"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "schema": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "/metric/search": {
            "post": {
                "description": "search metrics in the specified timeframe",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Metrics"
                ],
                "summary": "Get the metrics From ... and To when present",
                "parameters": [
                    {
                        "type": "string",
                        "description": "clientCN",
                        "name": "X-SSL-Client-CN",
                        "in": "header",
                        "required": true
                    },
                    {
                        "description": "Metric query filters",
                        "name": "metric1",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/model.MetricSearchRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "/metric/{name}/{from}": {
            "get": {
                "description": "search metrics after the specified timestamp",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Metrics"
                ],
                "summary": "Get the specific metric {name} starting from the epoch {from}",
                "parameters": [
                    {
                        "type": "string",
                        "description": "clientCN",
                        "name": "X-SSL-Client-CN",
                        "in": "header",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Metric Name :name",
                        "name": "name",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Starting from epoch :from",
                        "name": "from",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "/position": {
            "post": {
                "description": "store position",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "Positions"
                ],
                "summary": "write position to db",
                "parameters": [
                    {
                        "type": "string",
                        "description": "clientCN",
                        "name": "X-SSL-Client-CN",
                        "in": "header",
                        "required": true
                    },
                    {
                        "description": "Position body data",
                        "name": "position",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/model.PositionModel"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "schema": {
                            "type": "string"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "model.EventModel": {
            "type": "object",
            "properties": {
                "etime": {
                    "type": "integer"
                },
                "id_client": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "model.EventSearchRequest": {
            "type": "object",
            "properties": {
                "from": {
                    "type": "integer"
                },
                "id_client": {
                    "type": "string"
                },
                "to": {
                    "type": "integer"
                }
            }
        },
        "model.MetricModel": {
            "type": "object",
            "properties": {
                "id_client": {
                    "type": "string"
                },
                "mtime": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "value": {
                    "type": "string"
                }
            }
        },
        "model.MetricSearchRequest": {
            "type": "object",
            "properties": {
                "from": {
                    "type": "integer"
                },
                "id_client": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "to": {
                    "type": "integer"
                }
            }
        },
        "model.PositionModel": {
            "type": "object",
            "properties": {
                "id_client": {
                    "type": "string"
                },
                "lat": {
                    "description": "TODO Check parquet types",
                    "type": "number"
                },
                "lon": {
                    "description": "TODO Check parquet types",
                    "type": "number"
                },
                "name": {
                    "type": "string"
                },
                "ptime": {
                    "type": "integer"
                }
            }
        }
    },
    "externalDocs": {
        "description": "OpenAPI",
        "url": "https://swagger.io/resources/open-api/"
    }
}