Files
triggerssmith/docs/swagger.json
2025-12-20 17:36:24 +02:00

930 lines
31 KiB
JSON

{
"swagger": "2.0",
"info": {
"contact": {}
},
"paths": {
"/api/acl/resources": {
"get": {
"produces": [
"application/json"
],
"tags": [
"resources"
],
"summary": "Get all resources",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"key": {
"type": "string",
"example": "html.view"
}
}
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"resources"
],
"summary": "Create resource",
"parameters": [
{
"description": "Resource",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_acladmin.createResourceRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api_acladmin.createResourceResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.createResourceErrorInvalidResourceKey"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.createResourceErrorResourceAlreadyExists"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
}
},
"/api/acl/resources/{resourceId}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"resources"
],
"summary": "Get resource by ID",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Resource ID",
"name": "resourceId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api_acladmin.getResourceResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.getResourceErrorInvalidResourceID"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.getResourceErrorResourceNotFound"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
},
"delete": {
"produces": [
"application/json"
],
"tags": [
"resources"
],
"summary": "Delete resource",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Resource ID",
"name": "resourceId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteResourceErrorInvalidResourceID"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteResourceErrorResourceNotFound"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteResourceErrorResourceInUse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
},
"patch": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"resources"
],
"summary": "Update resource",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Resource ID",
"name": "resourceId",
"in": "path",
"required": true
},
{
"description": "Resource",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceErrorInvalidResourceKey"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceErrorResourceNotFound"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.updateResourceErrorResourceKeyAlreadyExists"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
}
},
"/api/acl/roles": {
"get": {
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Get all roles",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "admin"
}
}
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Create role",
"parameters": [
{
"description": "Role",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_acladmin.createRoleRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api_acladmin.createRoleResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInvalidRequestBody"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api_acladmin.createRoleErrorInvalidRoleName"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.createRoleErrorRoleAlreadyExists"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
}
},
"/api/acl/roles/{roleId}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Get role by ID",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Role ID",
"name": "roleId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api_acladmin.getRoleResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.getRoleErrorInvalidRoleID"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.getRoleErrorRoleNotFound"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
},
"delete": {
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Delete role",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Role ID",
"name": "roleId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteRoleErrorInvalidRoleID"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteRoleErrorRoleNotFound"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.deleteRoleErrorRoleInUse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
},
"patch": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Update role",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Role ID",
"name": "roleId",
"in": "path",
"required": true
},
{
"description": "Role",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleErrorInvalidRoleName"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleErrorRoleNotFound"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/api_acladmin.updateRoleErrorRoleNameAlreadyExists"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api_acladmin.errorInternalServerError"
}
}
}
}
}
},
"definitions": {
"api_acladmin.createResourceErrorInvalidResourceKey": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid resource key"
},
"error": {
"type": "string",
"example": "FAILED_TO_CREATE_RESOURCE"
}
}
},
"api_acladmin.createResourceErrorResourceAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource with key 'html.view' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_CREATE_RESOURCE"
}
}
},
"api_acladmin.createResourceRequest": {
"type": "object",
"properties": {
"key": {
"type": "string",
"example": "html.view"
}
}
},
"api_acladmin.createResourceResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"key": {
"type": "string",
"example": "html.view"
}
}
},
"api_acladmin.createRoleErrorInvalidRoleName": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid role name"
},
"error": {
"type": "string",
"example": "FAILED_TO_CREATE_ROLE"
}
}
},
"api_acladmin.createRoleErrorRoleAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role with name 'admin' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_CREATE_ROLE"
}
}
},
"api_acladmin.createRoleRequest": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "admin"
}
}
},
"api_acladmin.createRoleResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "admin"
}
}
},
"api_acladmin.deleteResourceErrorInvalidResourceID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_RESOURCE_ID"
}
}
},
"api_acladmin.deleteResourceErrorResourceInUse": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource with ID 123 is used and cannot be deleted"
},
"error": {
"type": "string",
"example": "FAILED_TO_DELETE_RESOURCE"
}
}
},
"api_acladmin.deleteResourceErrorResourceNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No resource with ID 123"
},
"error": {
"type": "string",
"example": "RESOURCE_NOT_FOUND"
}
}
},
"api_acladmin.deleteRoleErrorInvalidRoleID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_ROLE_ID"
}
}
},
"api_acladmin.deleteRoleErrorRoleInUse": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role with ID 123 is assigned to users and cannot be deleted"
},
"error": {
"type": "string",
"example": "FAILED_TO_DELETE_ROLE"
}
}
},
"api_acladmin.deleteRoleErrorRoleNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No role with ID 123"
},
"error": {
"type": "string",
"example": "ROLE_NOT_FOUND"
}
}
},
"api_acladmin.errorInternalServerError": {
"type": "object",
"properties": {
"details": {
"type": "string"
},
"error": {
"type": "string"
}
}
},
"api_acladmin.errorInvalidRequestBody": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Request body is not valid JSON"
},
"error": {
"type": "string",
"example": "INVALID_REQUEST_BODY"
}
}
},
"api_acladmin.getResourceErrorInvalidResourceID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_RESOURCE_ID"
}
}
},
"api_acladmin.getResourceErrorResourceNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No resource with ID 123"
},
"error": {
"type": "string",
"example": "RESOURCE_NOT_FOUND"
}
}
},
"api_acladmin.getResourceResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"key": {
"type": "string",
"example": "html.view"
}
}
},
"api_acladmin.getRoleErrorInvalidRoleID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_ROLE_ID"
}
}
},
"api_acladmin.getRoleErrorRoleNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No role with ID 123"
},
"error": {
"type": "string",
"example": "ROLE_NOT_FOUND"
}
}
},
"api_acladmin.getRoleResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "admin"
}
}
},
"api_acladmin.updateResourceErrorInvalidResourceID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_RESOURCE_ID"
}
}
},
"api_acladmin.updateResourceErrorInvalidResourceKey": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid resource key"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_RESOURCE"
}
}
},
"api_acladmin.updateResourceErrorResourceKeyAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Resource with key 'html.view' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_RESOURCE"
}
}
},
"api_acladmin.updateResourceErrorResourceNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No resource with ID 123"
},
"error": {
"type": "string",
"example": "RESOURCE_NOT_FOUND"
}
}
},
"api_acladmin.updateResourceRequest": {
"type": "object",
"properties": {
"key": {
"type": "string",
"example": "html.view"
}
}
},
"api_acladmin.updateResourceResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"key": {
"type": "string",
"example": "html.view"
}
}
},
"api_acladmin.updateRoleErrorInvalidRoleID": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role ID must be positive integer"
},
"error": {
"type": "string",
"example": "INVALID_ROLE_ID"
}
}
},
"api_acladmin.updateRoleErrorInvalidRoleName": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Invalid role name"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_ROLE"
}
}
},
"api_acladmin.updateRoleErrorRoleNameAlreadyExists": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "Role with name 'admin' already exists"
},
"error": {
"type": "string",
"example": "FAILED_TO_UPDATE_ROLE"
}
}
},
"api_acladmin.updateRoleErrorRoleNotFound": {
"type": "object",
"properties": {
"details": {
"type": "string",
"example": "No role with ID 123"
},
"error": {
"type": "string",
"example": "ROLE_NOT_FOUND"
}
}
},
"api_acladmin.updateRoleRequest": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "admin"
}
}
},
"api_acladmin.updateRoleResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "admin"
}
}
}
}
}