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

StartRequest.go « octoprintApis - github.com/Z-Bolt/OctoScreen.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b1a7638fb29a3dcf6d574f440e9e29f96dbbce7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package octoprintApis

import (
	"bytes"
	"encoding/json"
	// "io"

	// "github.com/Z-Bolt/OctoScreen/octoprintApis/dataModels"
)


// StartRequest starts the print of the currently selected file.
type StartRequest struct{}

// Do sends an API request and returns an error if any.
func (cmd *StartRequest) Do(c *Client) error {
	payload := map[string]string{"command": "start"}

	buffer := bytes.NewBuffer(nil)
	if err := json.NewEncoder(buffer).Encode(payload); err != nil {
		return err
	}

	_, err := c.doJsonRequest("POST", JobApiUri, buffer, JobToolErrors)
	return err
}