WIP: File API

This commit is contained in:
Wlad 2020-10-24 17:16:36 +02:00
parent 39eec7e2cd
commit 8c63cb8c21
5 changed files with 128 additions and 3 deletions

View File

@ -11,14 +11,14 @@
- [x] Current User
- [x] Version
- [x] Connection Handling
- [ ] File Operations [link](https://docs.octoprint.org/en/master/api/files.html)
- [x] File Operations [link](https://docs.octoprint.org/en/master/api/files.html)
- [x] Retrieve all files
- [x] Retrieve files from specific location
- [x] Upload file or create folder
- [x] Retrieve a specific files or folders information
- [ ] Issue a file command
- [x] Issue a file command
- [x] Delete file
- [ ] Model: Upload response
- [x] Model: Upload response
- [x] Model: Retrieve response
- [ ] Job operations [link](https://docs.octoprint.org/en/master/api/job.html)
- [ ] Issue a job command

View File

@ -0,0 +1,77 @@
content:
application/json:
schema:
oneOf:
- type: object
description: Selects a file for printing
properties:
command:
type: string
enum:
- select
print:
description: >-
Optional, if set to true the file will start printing directly after selection. If the printer is not operational when this parameter is present and set to true, the request will fail with a response of 409 Conflict.
type: boolean
- type: object
description: >-
Slices an STL file into GCODE. Note that this is an asynchronous operation that will take place in the background after the response has been sent back to the client.
properties:
command:
type: string
enum:
- slice
slice:
description: >-
The slicing engine to use, defaults to cura if not set, which is also the only supported slicer right now.
type: string
gcode:
description: >-
Name of the GCODE file to generated, in the same location as the STL file. Defaults to the STL file name with extension .gco if not set.
type: string
position:
description: >-
Position of the object-to-slices center on the print bed. A dictionary containing both x and y coordinate in mm is expected
$ref: ../schemas/Position.yaml
printerProfile:
description: >-
Name of the printer profile to use, if not set the default printer profile will be used.
type: string
profile:
oneOf:
- type: string
- type: object
select:
type: boolean
description: >-
Optional, if set to true the file be selected for printing right after the slicing has finished. If the printer is not operational or already printing when this parameter is present and set to true, the request will fail with a response of 409 Conflict
print:
type: boolean
description: >-
Optional, if set to true the file be selected and start printing right after the slicing has finished. If the printer is not operational or already printing when this parameter is present and set to true, the request will fail with a response of 409 Conflict. Note that if this parameter is set, the parameter select does not need to be set, it is automatically assumed to be true too, otherwise no printing would be possible.
- type: object
description: >-
Copies the file or folder to a new destination on the same location
properties:
command:
type: string
enum:
- copy
destination:
type: string
format: uri
description: >-
The path of the parent folder to which to copy the file or folder. It must already exist.
- type: object
description: >-
Moves the file or folder to a new destination on the same location
properties:
command:
type: string
enum:
- move
destination:
type: string
format: uri
description: >-
The path of the parent folder to which to copy the file or folder. It must already exist.

View File

@ -0,0 +1,28 @@
"200":
description: No error for a select command.
"201":
content:
application/json:
schema:
$ref: ../schemas/files/File.yaml
description: >-
No error for copy command.
"202":
content:
application/json:
schema:
$ref: ../schemas/files/File.yaml
description: >-
No error for a slice command.
"400":
description: >-
If the command is unknown or the request is otherwise invalid
"404":
description: >-
If location is neither local nor sdcard or the requested file was not found
"409":
description: >-
If a selected file is supposed to start printing directly but the printer is not operational or if a file is to be selected but the printer is already printing or if a file to be sliced is supposed to be selected or start printing directly but the printer is not operational or already printing.
"415":
description: >-
If a slice command was issued against something other than an STL file.

View File

@ -0,0 +1,6 @@
type: object
properties:
x:
type: number
y:
type: number

View File

@ -0,0 +1,14 @@
summary: Issue a file command
operationId: sendFileCommand
description: Issue a file command to an existing file.
parameters:
- $ref: ../../../components/parameters/fileLocation.yaml
- $ref: ../../../components/parameters/filePath.yaml
- $ref: ../../../components/parameters/fileRecursive.yaml
responses:
"200":
description: Returns a Retrieve Response
content:
application/json:
schema:
$ref: ../../../components/schemas/files/RetrieveResponse.yaml