{
    "openapi": "3.0.3",
    "info": {
        "title": "terms_of_service-administration",
        "version": "0.0.1",
        "description": "Requires users to accept the terms of service before accessing data.",
        "license": {
            "name": "agpl"
        }
    },
    "components": {
        "securitySchemes": {
            "basic_auth": {
                "type": "http",
                "scheme": "basic"
            },
            "bearer_auth": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "AdminFormData": {
                "type": "object",
                "required": [
                    "terms",
                    "countries",
                    "languages",
                    "tos_on_public_shares",
                    "tos_for_users"
                ],
                "properties": {
                    "terms": {
                        "type": "object",
                        "additionalProperties": {
                            "$ref": "#/components/schemas/Terms"
                        }
                    },
                    "countries": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "languages": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "tos_on_public_shares": {
                        "type": "string",
                        "enum": [
                            "0",
                            "1"
                        ]
                    },
                    "tos_for_users": {
                        "type": "string",
                        "enum": [
                            "0",
                            "1"
                        ]
                    }
                }
            },
            "OCSMeta": {
                "type": "object",
                "required": [
                    "status",
                    "statuscode"
                ],
                "properties": {
                    "status": {
                        "type": "string"
                    },
                    "statuscode": {
                        "type": "integer"
                    },
                    "message": {
                        "type": "string"
                    },
                    "totalitems": {
                        "type": "string"
                    },
                    "itemsperpage": {
                        "type": "string"
                    }
                }
            },
            "PublicCapabilities": {
                "type": "object",
                "required": [
                    "terms_of_service"
                ],
                "properties": {
                    "terms_of_service": {
                        "type": "object",
                        "required": [
                            "enabled",
                            "term_uuid"
                        ],
                        "properties": {
                            "enabled": {
                                "type": "boolean",
                                "enum": [
                                    true
                                ]
                            },
                            "term_uuid": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "Terms": {
                "type": "object",
                "required": [
                    "id",
                    "countryCode",
                    "languageCode",
                    "body",
                    "renderedBody"
                ],
                "properties": {
                    "id": {
                        "type": "integer",
                        "format": "int64",
                        "minimum": 1
                    },
                    "countryCode": {
                        "type": "string"
                    },
                    "languageCode": {
                        "type": "string"
                    },
                    "body": {
                        "type": "string",
                        "minLength": 1
                    },
                    "renderedBody": {
                        "type": "string",
                        "minLength": 1
                    }
                }
            }
        }
    },
    "paths": {
        "/ocs/v2.php/apps/terms_of_service/terms": {
            "post": {
                "operationId": "terms-create",
                "summary": "Create new terms",
                "description": "This endpoint requires admin access",
                "tags": [
                    "terms"
                ],
                "security": [
                    {
                        "bearer_auth": []
                    },
                    {
                        "basic_auth": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "countryCode",
                                    "languageCode",
                                    "body"
                                ],
                                "properties": {
                                    "countryCode": {
                                        "type": "string",
                                        "description": "One of the 2-letter region codes or `--` for \"global\""
                                    },
                                    "languageCode": {
                                        "type": "string",
                                        "description": "One of the 2-letter language codes"
                                    },
                                    "body": {
                                        "type": "string",
                                        "description": "The actual terms and conditions text (can be markdown, using headers, basic text formating, lists and links)"
                                    }
                                }
                            }
                        }
                    }
                },
                "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": "Created successfully",
                        "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/Terms"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "417": {
                        "description": "Country or language code was not a valid option",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {}
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ocs/v2.php/apps/terms_of_service/terms/{id}": {
            "delete": {
                "operationId": "terms-destroy",
                "summary": "Delete a given Term by id",
                "description": "This endpoint requires admin access",
                "tags": [
                    "terms"
                ],
                "security": [
                    {
                        "bearer_auth": []
                    },
                    {
                        "basic_auth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "The terms which should be deleted",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "format": "int64",
                            "minimum": 1
                        }
                    },
                    {
                        "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": "Deleted successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {}
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ocs/v2.php/apps/terms_of_service/terms/admin": {
            "get": {
                "operationId": "terms-get-admin-form-data",
                "summary": "Get the form data for the admin interface",
                "description": "This endpoint requires admin access",
                "tags": [
                    "terms"
                ],
                "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": "Get form data successfully",
                        "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/AdminFormData"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ocs/v2.php/apps/terms_of_service/sign": {
            "delete": {
                "operationId": "signing-reset-all-signatories",
                "summary": "Reset the signatories of all accounts",
                "description": "This endpoint requires admin access",
                "tags": [
                    "signing"
                ],
                "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": "Reset successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "ocs"
                                    ],
                                    "properties": {
                                        "ocs": {
                                            "type": "object",
                                            "required": [
                                                "meta",
                                                "data"
                                            ],
                                            "properties": {
                                                "meta": {
                                                    "$ref": "#/components/schemas/OCSMeta"
                                                },
                                                "data": {}
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "tags": []
}
