mirror of
https://github.com/gosticks/octoprint-open-api.git
synced 2025-10-16 11:45:38 +00:00
WIP: system api
This commit is contained in:
parent
f156793e1b
commit
ad84cf0120
14
TODO.md
14
TODO.md
@ -70,13 +70,13 @@
|
||||
- [x] Fetch template data
|
||||
- [ ] Model: Config
|
||||
- [ ] Slicing TBD [link](https://docs.octoprint.org/en/master/api/slicing.html)
|
||||
- [ ] System [link](https://docs.octoprint.org/en/master/api/system.html)
|
||||
- [ ] List all registered system commands
|
||||
- [ ] List all registered system commands for a source
|
||||
- [ ] Execute a registed system command
|
||||
- [ ] Model: List all response
|
||||
- [ ] Model: Client command definitions
|
||||
- [ ] Model: Command definition
|
||||
- [x] System [link](https://docs.octoprint.org/en/master/api/system.html)
|
||||
- [x] List all registered system commands
|
||||
- [x] List all registered system commands for a source
|
||||
- [x] Execute a registed system command
|
||||
- [x] Model: List all response
|
||||
- [x] Model: Client command definitions
|
||||
- [x] Model: Command definition
|
||||
- [ ] Timelapse [link](https://docs.octoprint.org/en/master/api/timelapse.html)
|
||||
- [ ] Retrieve a list of timelapses and the current config
|
||||
- [ ] Delete a timelapse
|
||||
|
||||
4
openapi/components/parameters/systemCmdSource.yaml
Normal file
4
openapi/components/parameters/systemCmdSource.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
in: path
|
||||
name: source
|
||||
description: >-
|
||||
The source for which to list commands, currently either core or custom
|
||||
25
openapi/components/schemas/system/ClientCmd.yaml
Normal file
25
openapi/components/schemas/system/ClientCmd.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
type: object
|
||||
description: >-
|
||||
System command
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: >-
|
||||
The name of the command to display in the System menu.
|
||||
action:
|
||||
type: string
|
||||
description: >-
|
||||
An identifier to refer to the command programmatically. The special action string divider signifies a divider in the menu.
|
||||
confirm:
|
||||
type: string
|
||||
description: >-
|
||||
If present and set, this text will be displayed to the user in a confirmation dialog they have to acknowledge in order to really execute the command.
|
||||
source:
|
||||
type: string
|
||||
description: >-
|
||||
Source of the command definition, currently either core (for system actions defined by OctoPrint itself) or custom (for custom system commands defined by the user through config.yaml).
|
||||
resource:
|
||||
type: string
|
||||
format: url
|
||||
description: >-
|
||||
The URL of the command to use for executing it.
|
||||
18
openapi/components/schemas/system/Cmd.yaml
Normal file
18
openapi/components/schemas/system/Cmd.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
allOf:
|
||||
- $ref: ./ClientCmd.yaml
|
||||
- type: object
|
||||
description: >-
|
||||
The full command definition is not available via the API.
|
||||
properties:
|
||||
command:
|
||||
type: string
|
||||
description: >-
|
||||
The full command line to execute for the command.
|
||||
async:
|
||||
type: boolean
|
||||
description: >-
|
||||
Whether to execute the command asynchronously or wait for its result before responding to the HTTP execution request.
|
||||
ignore:
|
||||
type: boolean
|
||||
description: >-
|
||||
Whether to ignore the return code of the command’s execution.
|
||||
@ -79,5 +79,14 @@ paths:
|
||||
$ref: paths/printerprofiles/{identifier}-post.yaml
|
||||
delete:
|
||||
$ref: paths/printerprofiles/{identifier}-delete.yaml
|
||||
|
||||
/system/commands:
|
||||
get:
|
||||
$ref: paths/system/commands/get.yaml
|
||||
/system/commands/{source}:
|
||||
get:
|
||||
$ref: paths/system/commands/{source}-get.yaml
|
||||
/system/commands/{source}/{action}:
|
||||
post:
|
||||
$ref: paths/system/commands/{source}-{action}-post.yaml
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
summary: Retrieve current settings
|
||||
operation: getSettings
|
||||
operationId: getSettings
|
||||
description: >-
|
||||
Retrieves the current configuration of OctoPrint.
|
||||
responses:
|
||||
|
||||
17
openapi/paths/system/commands/get.yaml
Normal file
17
openapi/paths/system/commands/get.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
summary: List all registered system commands
|
||||
operationId: getSystemCmds
|
||||
description: >-
|
||||
Retrieves all configured system commands.
|
||||
responses:
|
||||
"200":
|
||||
description: >-
|
||||
All available system commands.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
core:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../../../components/schemas/system/ClientCmd.yaml
|
||||
16
openapi/paths/system/commands/{source}-get.yaml
Normal file
16
openapi/paths/system/commands/{source}-get.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
summary: List all registered system commands for a source
|
||||
operationId: getSystemSourceCmds
|
||||
description: >-
|
||||
Retrieves the configured system commands for the specified source.
|
||||
parameters:
|
||||
- $ref: ../../../components/parameters/systemCmdSource.yaml
|
||||
responses:
|
||||
"200":
|
||||
description: >-
|
||||
All available system commands.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: ../../../components/schemas/system/ClientCmd.yaml
|
||||
23
openapi/paths/system/commands/{source}-{action}-post.yaml
Normal file
23
openapi/paths/system/commands/{source}-{action}-post.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
summary: Execute a registered system command
|
||||
operationId: executeSysCmd
|
||||
description: >-
|
||||
Execute the system command action defined in source.
|
||||
parameters:
|
||||
- $ref: ../../../components/parameters/systemCmdSource.yaml
|
||||
- in: path
|
||||
name: action
|
||||
description: >-
|
||||
The identifier of the command, action from its definition
|
||||
responses:
|
||||
"204":
|
||||
description: >-
|
||||
Command executed
|
||||
"400":
|
||||
description: >-
|
||||
If a divider is supposed to be executed or if the request is malformed otherwise
|
||||
"404":
|
||||
description: >-
|
||||
If the command could not be found for source and action
|
||||
"500":
|
||||
description: >-
|
||||
If the command didn’t define a command to execute, the command returned a non-zero return code and ignore was not true or some other internal server error occurred
|
||||
Loading…
Reference in New Issue
Block a user