{
    "openapi": "3.0.3",
    "info": {
        "title": "weather_status",
        "version": "0.0.1",
        "description": "Weather status in your dashboard",
        "license": {
            "name": "agpl"
        }
    },
    "components": {
        "securitySchemes": {
            "basic_auth": {
                "type": "http",
                "scheme": "basic"
            },
            "bearer_auth": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "Capabilities": {
                "type": "object",
                "required": [
                    "weather_status"
                ],
                "properties": {
                    "weather_status": {
                        "type": "object",
                        "required": [
                            "enabled"
                        ],
                        "properties": {
                            "enabled": {
                                "type": "boolean"
                            }
                        }
                    }
                }
            },
            "Forecast": {
                "type": "object",
                "required": [
                    "time",
                    "data"
                ],
                "properties": {
                    "time": {
                        "type": "string"
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "instant",
                            "next_12_hours",
                            "next_1_hours",
                            "next_6_hours"
                        ],
                        "properties": {
                            "instant": {
                                "type": "object",
                                "required": [
                                    "details"
                                ],
                                "properties": {
                                    "details": {
                                        "type": "object",
                                        "required": [
                                            "air_pressure_at_sea_level",
                                            "air_temperature",
                                            "cloud_area_fraction",
                                            "relative_humidity",
                                            "wind_from_direction",
                                            "wind_speed"
                                        ],
                                        "properties": {
                                            "air_pressure_at_sea_level": {
                                                "type": "number"
                                            },
                                            "air_temperature": {
                                                "type": "number"
                                            },
                                            "cloud_area_fraction": {
                                                "type": "number"
                                            },
                                            "relative_humidity": {
                                                "type": "number"
                                            },
                                            "wind_from_direction": {
                                                "type": "number"
                                            },
                                            "wind_speed": {
                                                "type": "number"
                                            }
                                        }
                                    }
                                }
                            },
                            "next_12_hours": {
                                "type": "object",
                                "required": [
                                    "summary",
                                    "details"
                                ],
                                "properties": {
                                    "summary": {
                                        "type": "object",
                                        "required": [
                                            "symbol_code"
                                        ],
                                        "properties": {
                                            "symbol_code": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "details": {
                                        "type": "object",
                                        "properties": {
                                            "precipitation_amount": {
                                                "type": "number"
                                            }
                                        }
                                    }
                                }
                            },
                            "next_1_hours": {
                                "type": "object",
                                "required": [
                                    "summary",
                                    "details"
                                ],
                                "properties": {
                                    "summary": {
                                        "type": "object",
                                        "required": [
                                            "symbol_code"
                                        ],
                                        "properties": {
                                            "symbol_code": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "details": {
                                        "type": "object",
                                        "properties": {
                                            "precipitation_amount": {
                                                "type": "number"
                                            }
                                        }
                                    }
                                }
                            },
                            "next_6_hours": {
                                "type": "object",
                                "required": [
                                    "summary",
                                    "details"
                                ],
                                "properties": {
                                    "summary": {
                                        "type": "object",
                                        "required": [
                                            "symbol_code"
                                        ],
                                        "properties": {
                                            "symbol_code": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "details": {
                                        "type": "object",
                                        "properties": {
                                            "precipitation_amount": {
                                                "type": "number"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "Location": {
                "type": "object",
                "properties": {
                    "lat": {
                        "type": "string"
                    },
                    "lon": {
                        "type": "string"
                    },
                    "address": {
                        "type": "string",
                        "nullable": true
                    }
                }
            },
            "LocationWithMode": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Location"
                    },
                    {
                        "$ref": "#/components/schemas/Mode"
                    }
                ]
            },
            "LocationWithSuccess": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Location"
                    },
                    {
                        "$ref": "#/components/schemas/Success"
                    }
                ]
            },
            "Mode": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "type": "integer",
                        "format": "int64"
                    }
                }
            },
            "OCSMeta": {
                "type": "object",
                "required": [
                    "status",
                    "statuscode"
                ],
                "properties": {
                    "status": {
                        "type": "string"
                    },
                    "statuscode": {
                        "type": "integer"
                    },
                    "message": {
                        "type": "string"
                    },
                    "totalitems": {
                        "type": "string"
                    },
                    "itemsperpage": {
                        "type": "string"
                    }
                }
            },
            "Success": {
                "type": "object",
                "required": [
                    "success"
                ],
                "properties": {
                    "success": {
                        "type": "boolean"
                    }
                }
            }
        }
    },
    "paths": {
        "/ocs/v2.php/apps/weather_status/api/v1/mode": {
            "put": {
                "operationId": "weather_status-set-mode",
                "summary": "Change the weather status mode. There are currently 2 modes: - ask the browser - use the user defined address",
                "tags": [
                    "weather_status"
                ],
                "security": [
                    {
                        "bearer_auth": []
                    },
                    {
                        "basic_auth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "mode",
                        "in": "query",
                        "description": "New mode",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "format": "int64"
                        }
                    },
                    {
                        "name": "OCS-APIRequest",
                        "in": "header",
                        "description": "Required to be true for the API request to pass",
                        "required": true,
                        "schema": {
                            "type": "boolean",
                            "default": true
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Weather status mode updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {
                                                    "$ref": "#/components/schemas/Success"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ocs/v2.php/apps/weather_status/api/v1/use-personal": {
            "put": {
                "operationId": "weather_status-use-personal-address",
                "summary": "Try to use the address set in user personal settings as weather location",
                "tags": [
                    "weather_status"
                ],
                "security": [
                    {
                        "bearer_auth": []
                    },
                    {
                        "basic_auth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "OCS-APIRequest",
                        "in": "header",
                        "description": "Required to be true for the API request to pass",
                        "required": true,
                        "schema": {
                            "type": "boolean",
                            "default": true
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Address updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {
                                                    "$ref": "#/components/schemas/LocationWithSuccess"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ocs/v2.php/apps/weather_status/api/v1/location": {
            "get": {
                "operationId": "weather_status-get-location",
                "summary": "Get stored user location",
                "tags": [
                    "weather_status"
                ],
                "security": [
                    {
                        "bearer_auth": []
                    },
                    {
                        "basic_auth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "OCS-APIRequest",
                        "in": "header",
                        "description": "Required to be true for the API request to pass",
                        "required": true,
                        "schema": {
                            "type": "boolean",
                            "default": true
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Location returned",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {
                                                    "$ref": "#/components/schemas/LocationWithMode"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "weather_status-set-location",
                "summary": "Set address and resolve it to get coordinates or directly set coordinates and get address with reverse geocoding",
                "tags": [
                    "weather_status"
                ],
                "security": [
                    {
                        "bearer_auth": []
                    },
                    {
                        "basic_auth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "address",
                        "in": "query",
                        "description": "Any approximative or exact address",
                        "schema": {
                            "type": "string",
                            "nullable": true
                        }
                    },
                    {
                        "name": "lat",
                        "in": "query",
                        "description": "Latitude in decimal degree format",
                        "schema": {
                            "type": "number",
                            "format": "double",
                            "nullable": true
                        }
                    },
                    {
                        "name": "lon",
                        "in": "query",
                        "description": "Longitude in decimal degree format",
                        "schema": {
                            "type": "number",
                            "format": "double",
                            "nullable": true
                        }
                    },
                    {
                        "name": "OCS-APIRequest",
                        "in": "header",
                        "description": "Required to be true for the API request to pass",
                        "required": true,
                        "schema": {
                            "type": "boolean",
                            "default": true
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Location updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {
                                                    "$ref": "#/components/schemas/LocationWithSuccess"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ocs/v2.php/apps/weather_status/api/v1/forecast": {
            "get": {
                "operationId": "weather_status-get-forecast",
                "summary": "Get forecast for current location",
                "tags": [
                    "weather_status"
                ],
                "security": [
                    {
                        "bearer_auth": []
                    },
                    {
                        "basic_auth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "OCS-APIRequest",
                        "in": "header",
                        "description": "Required to be true for the API request to pass",
                        "required": true,
                        "schema": {
                            "type": "boolean",
                            "default": true
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Forecast returned",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {
                                                    "oneOf": [
                                                        {
                                                            "type": "array",
                                                            "items": {
                                                                "$ref": "#/components/schemas/Forecast"
                                                            }
                                                        },
                                                        {
                                                            "type": "object",
                                                            "required": [
                                                                "error"
                                                            ],
                                                            "properties": {
                                                                "error": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Forecast not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {
                                                    "$ref": "#/components/schemas/Success"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ocs/v2.php/apps/weather_status/api/v1/favorites": {
            "get": {
                "operationId": "weather_status-get-favorites",
                "summary": "Get favorites list",
                "tags": [
                    "weather_status"
                ],
                "security": [
                    {
                        "bearer_auth": []
                    },
                    {
                        "basic_auth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "OCS-APIRequest",
                        "in": "header",
                        "description": "Required to be true for the API request to pass",
                        "required": true,
                        "schema": {
                            "type": "boolean",
                            "default": true
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Favorites returned",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "weather_status-set-favorites",
                "summary": "Set favorites list",
                "tags": [
                    "weather_status"
                ],
                "security": [
                    {
                        "bearer_auth": []
                    },
                    {
                        "basic_auth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "favorites[]",
                        "in": "query",
                        "description": "Favorite addresses",
                        "required": true,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    },
                    {
                        "name": "OCS-APIRequest",
                        "in": "header",
                        "description": "Required to be true for the API request to pass",
                        "required": true,
                        "schema": {
                            "type": "boolean",
                            "default": true
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Favorites updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {
                                                    "$ref": "#/components/schemas/Success"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "tags": []
}