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

SdStateRequest.go « octoprintApis - github.com/Z-Bolt/OctoScreen.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 87c871794466025c65fa4c7557cf8a1541b2a771 (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
27
28
29
30
31
package octoprintApis

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

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


// SdStateRequest retrieves the current state of the printer’s SD card. For this
// request no authentication is needed.
type SdStateRequest struct{}

// Do sends an API request and returns the API response.
func (cmd *SdStateRequest) Do(c *Client) (*dataModels.SdState, error) {
	b, err := c.doJsonRequest("GET", PrinterSdApiUri, nil, PrintSdErrors)
	if err != nil {
		return nil, err
	}

	r := &dataModels.SdState{}
	if err := json.Unmarshal(b, r); err != nil {
		return nil, err
	}

	return r, err
}