Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Z-Bolt/OctoScreen.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'octoprintApis/RestartRequest.go')
-rwxr-xr-xoctoprintApis/RestartRequest.go28
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
+}