diff options
Diffstat (limited to 'octoprintApis/RestartRequest.go')
-rwxr-xr-x | octoprintApis/RestartRequest.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/octoprintApis/RestartRequest.go b/octoprintApis/RestartRequest.go new file mode 100755 index 0000000..df117ce --- /dev/null +++ b/octoprintApis/RestartRequest.go @@ -0,0 +1,28 @@ +package octoprintApis + +import ( + "bytes" + "encoding/json" + // "io" + + // "github.com/Z-Bolt/OctoScreen/octoprintApis/dataModels" +) + + +// RestartRequest restart the print of the currently selected file from the +// beginning. There must be an active print job for this to work and the print +// job must currently be paused +type RestartRequest struct{} + +// Do sends an API request and returns an error if any. +func (cmd *RestartRequest) Do(c *Client) error { + payload := map[string]string{"command": "restart"} + + buffer := bytes.NewBuffer(nil) + if err := json.NewEncoder(buffer).Encode(payload); err != nil { + return err + } + + _, err := c.doJsonRequest("POST", JobApiUri, buffer, JobToolErrors) + return err +} |