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

settings.go « octoprintApis - github.com/Z-Bolt/OctoScreen.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c59b5840f6b7ad8fa8ac501e69e1b8b9c7c7308f (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
package octoprintApis

import (
	"encoding/json"

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


const SettingsApiUri = "/api/settings"


// SettingsRequest retrieves the current configuration of OctoPrint.
type SettingsRequest struct{}

// Do sends an API request and returns the API response.
func (cmd *SettingsRequest) Do(c *Client) (*dataModels.SettingsResponse, error) {
	bytes, err := c.doJsonRequest("GET", SettingsApiUri, nil, nil)
	if err != nil {
		return nil, err
	}

	response := &dataModels.SettingsResponse{}
	if err := json.Unmarshal(bytes, response); err != nil {
		return nil, err
	}

	return response, err
}