diff options
Diffstat (limited to 'octoprintApis/JobRequest.go')
-rwxr-xr-x | octoprintApis/JobRequest.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/octoprintApis/JobRequest.go b/octoprintApis/JobRequest.go new file mode 100755 index 0000000..c8a6808 --- /dev/null +++ b/octoprintApis/JobRequest.go @@ -0,0 +1,29 @@ +package octoprintApis + +import ( + // "bytes" + "encoding/json" + // "io" + + "github.com/Z-Bolt/OctoScreen/octoprintApis/dataModels" +) + + +// JobRequest retrieve information about the current job (if there is one). +type JobRequest struct{} + + +// Do sends an API request and returns the API response. +func (cmd *JobRequest) Do(client *Client) (*dataModels.JobResponse, error) { + bytes, err := client.doJsonRequest("GET", JobApiUri, nil, nil) + if err != nil { + return nil, err + } + + response := &dataModels.JobResponse{} + if err := json.Unmarshal(bytes, response); err != nil { + return nil, err + } + + return response, err +} |