[460] | 1 | openapi: 3.1.0
|
---|
| 2 | info:
|
---|
| 3 | title: Command
|
---|
| 4 | version: '1'
|
---|
| 5 |
|
---|
| 6 | components:
|
---|
| 7 | schemas:
|
---|
| 8 | CommandElement:
|
---|
| 9 | type: object
|
---|
| 10 | properties:
|
---|
| 11 | overloads:
|
---|
| 12 | type: array
|
---|
| 13 | items:
|
---|
| 14 | type: string
|
---|
| 15 | examples:
|
---|
| 16 | - [listplayers, lp]
|
---|
| 17 | description: Overload names for the command, including the main command name
|
---|
| 18 | command:
|
---|
| 19 | type: string
|
---|
| 20 | examples:
|
---|
| 21 | - listplayers
|
---|
| 22 | description: Main command name
|
---|
| 23 | description:
|
---|
| 24 | type: string
|
---|
| 25 | examples:
|
---|
| 26 | - lists all players
|
---|
| 27 | description: Short description text for the command
|
---|
| 28 | help:
|
---|
| 29 | type:
|
---|
| 30 | - string
|
---|
| 31 | - 'null'
|
---|
| 32 | description: Help text for the command if defined, null otherwise
|
---|
| 33 | allowed:
|
---|
| 34 | type: boolean
|
---|
| 35 | description: Can the command be executed with the permission level active for this request?
|
---|
| 36 | required:
|
---|
| 37 | - overloads
|
---|
| 38 | - command
|
---|
| 39 | - description
|
---|
| 40 |
|
---|
| 41 | CommandsList:
|
---|
| 42 | type: array
|
---|
| 43 | items:
|
---|
| 44 | $ref: '#/components/schemas/CommandElement'
|
---|
| 45 |
|
---|
| 46 | CommandsResult:
|
---|
| 47 | type: object
|
---|
| 48 | properties:
|
---|
| 49 | commands:
|
---|
| 50 | $ref: '#/components/schemas/CommandsList'
|
---|
| 51 | required:
|
---|
| 52 | - commands
|
---|
| 53 |
|
---|
| 54 | CommandExecutedResultFull:
|
---|
| 55 | type: object
|
---|
| 56 | properties:
|
---|
| 57 | command:
|
---|
| 58 | type: string
|
---|
| 59 | examples:
|
---|
| 60 | - 'settime'
|
---|
| 61 | description: The command executed without arguments
|
---|
| 62 | parameters:
|
---|
| 63 | type: string
|
---|
| 64 | examples:
|
---|
| 65 | - '1 13 37'
|
---|
| 66 | description: The arguments of the executed command
|
---|
| 67 | result:
|
---|
| 68 | type: string
|
---|
| 69 | examples:
|
---|
| 70 | - 'Set time to 13616'
|
---|
| 71 | description: The output of the executed command
|
---|
| 72 | required:
|
---|
| 73 | - command
|
---|
| 74 | - parameters
|
---|
| 75 | - result
|
---|
| 76 | description: Full style command result
|
---|
| 77 |
|
---|
| 78 | CommandExecutedResultSimple:
|
---|
| 79 | type: object
|
---|
| 80 | properties:
|
---|
| 81 | resultRaw:
|
---|
| 82 | type: string
|
---|
| 83 | examples:
|
---|
| 84 | - 'Set time to 13616'
|
---|
| 85 | description: The output of the executed command
|
---|
| 86 | required:
|
---|
| 87 | - resultRaw
|
---|
| 88 | description: Simple style command result
|
---|
| 89 |
|
---|
[462] | 90 | CommandExecutedResponse:
|
---|
| 91 | type: object
|
---|
| 92 | properties:
|
---|
| 93 | data:
|
---|
| 94 | oneOf:
|
---|
| 95 | - $ref: '#/components/schemas/CommandExecutedResultFull'
|
---|
| 96 | - $ref: '#/components/schemas/CommandExecutedResultSimple'
|
---|
| 97 | meta:
|
---|
| 98 | $ref: './openapi.yaml#/components/schemas/ResultEnvelopeMeta'
|
---|
| 99 | required:
|
---|
| 100 | - data
|
---|
| 101 | - meta
|
---|
[460] | 102 |
|
---|
| 103 | requestBodies:
|
---|
| 104 | CommandBodyIn:
|
---|
| 105 | content:
|
---|
| 106 | application/json:
|
---|
| 107 | schema:
|
---|
| 108 | type: object
|
---|
| 109 | properties:
|
---|
| 110 | command:
|
---|
| 111 | type: string
|
---|
| 112 | examples:
|
---|
| 113 | - 'settime 1 13 37'
|
---|
| 114 | description: Command to be executed, including any arguments
|
---|
| 115 | format:
|
---|
| 116 | type: string
|
---|
| 117 | enum:
|
---|
| 118 | - Full
|
---|
| 119 | - Simple
|
---|
| 120 | - Raw
|
---|
| 121 | description: Expected format of the returned execution result. Full being a full JSON object with info on the executed command and result, simple only returning a JSON object with the execution result and raw returning the execution result as plain text.
|
---|
| 122 | required:
|
---|
| 123 | - command
|
---|
| 124 | required: true
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | responses:
|
---|
| 128 | CommandsBodyOut:
|
---|
| 129 | description: Found commands
|
---|
| 130 | content:
|
---|
| 131 | application/json:
|
---|
| 132 | schema:
|
---|
| 133 | type: object
|
---|
| 134 | properties:
|
---|
| 135 | data:
|
---|
| 136 | $ref: '#/components/schemas/CommandsResult'
|
---|
| 137 | meta:
|
---|
| 138 | $ref: './openapi.yaml#/components/schemas/ResultEnvelopeMeta'
|
---|
| 139 | required:
|
---|
| 140 | - data
|
---|
| 141 | - meta
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 | parameters:
|
---|
| 145 | CommandNameParameter:
|
---|
| 146 | name: name
|
---|
| 147 | in: path
|
---|
| 148 | required: true
|
---|
| 149 | schema:
|
---|
| 150 | type: string
|
---|
| 151 | description: Name of command to fetch
|
---|
| 152 |
|
---|
| 153 |
|
---|
| 154 | paths:
|
---|
| 155 | /api/command:
|
---|
| 156 | get:
|
---|
| 157 | tags:
|
---|
| 158 | - Commands
|
---|
| 159 | summary: Commands list
|
---|
| 160 | description: Fetch a list of all commands
|
---|
| 161 | operationId: command.get
|
---|
| 162 | responses:
|
---|
| 163 | 200:
|
---|
| 164 | description: List of commands
|
---|
| 165 | $ref: '#/components/responses/CommandsBodyOut'
|
---|
| 166 |
|
---|
| 167 | post:
|
---|
| 168 | tags:
|
---|
| 169 | - Commands
|
---|
| 170 | summary: Command execute
|
---|
| 171 | description: Execute a command
|
---|
| 172 | operationId: command.post
|
---|
| 173 | requestBody:
|
---|
| 174 | $ref: '#/components/requestBodies/CommandBodyIn'
|
---|
| 175 | responses:
|
---|
| 176 | 200:
|
---|
| 177 | description: Command executed successfully
|
---|
| 178 | content:
|
---|
| 179 | application/json:
|
---|
| 180 | schema:
|
---|
[462] | 181 | $ref: '#/components/schemas/CommandExecutedResponse'
|
---|
[460] | 182 | text/plain:
|
---|
| 183 | schema:
|
---|
| 184 | type: string
|
---|
| 185 | examples:
|
---|
| 186 | - 'Set time to 13616'
|
---|
| 187 | 400:
|
---|
| 188 | description: Invalid request body, errorCode will be 'NO_COMMAND'
|
---|
| 189 | $ref: './openapi.yaml#/components/responses/HttpEmptyEnvelopedResponse'
|
---|
| 190 | 404:
|
---|
| 191 | description: Command to be executed not found
|
---|
| 192 | $ref: './openapi.yaml#/components/responses/HttpEmptyEnvelopedResponse'
|
---|
| 193 | 403:
|
---|
| 194 | description: Not allowed to execute the given command
|
---|
| 195 | $ref: './openapi.yaml#/components/responses/Unauthorized'
|
---|
| 196 | security:
|
---|
| 197 | - apiTokenName: []
|
---|
| 198 | apiTokenSecret: []
|
---|
| 199 | - sessionCookie: []
|
---|
| 200 |
|
---|
| 201 | /api/command/{name}:
|
---|
| 202 | get:
|
---|
| 203 | tags:
|
---|
| 204 | - Commands
|
---|
| 205 | summary: Command show
|
---|
| 206 | description: Get info on a specific command
|
---|
| 207 | operationId: command.get.id
|
---|
| 208 | parameters:
|
---|
| 209 | - $ref: '#/components/parameters/CommandNameParameter'
|
---|
| 210 | responses:
|
---|
| 211 | 200:
|
---|
| 212 | description: Single command
|
---|
| 213 | $ref: '#/components/responses/CommandsBodyOut'
|
---|
| 214 | 404:
|
---|
| 215 | description: Command not found
|
---|
| 216 | $ref: './openapi.yaml#/components/responses/HttpEmptyEnvelopedResponse'
|
---|