Files
woogo/system_status_tool.go

47 lines
973 B
Go
Raw Permalink Normal View History

2025-04-08 19:24:11 +02:00
package woogo
import (
"fmt"
"git.cloudyne.io/go/woogo/entity"
jsoniter "github.com/json-iterator/go"
)
type systemStatusToolService service
func (s systemStatusToolService) All() (item entity.SystemStatusTool, err error) {
resp, err := s.httpClient.R().Get("/system_status/tools")
if err != nil {
return
}
if resp.IsSuccess() {
err = jsoniter.Unmarshal(resp.Body(), &item)
}
return
}
func (s systemStatusToolService) One(id string) (item entity.SystemStatusTool, err error) {
resp, err := s.httpClient.R().Get(fmt.Sprintf("/system_status/tools/%s", id))
if err != nil {
return
}
if resp.IsSuccess() {
err = jsoniter.Unmarshal(resp.Body(), &item)
}
return
}
func (s systemStatusToolService) Run(id string) (item entity.SystemStatusTool, err error) {
resp, err := s.httpClient.R().Put(fmt.Sprintf("/system_status/tools/%s", id))
if err != nil {
return
}
if resp.IsSuccess() {
err = jsoniter.Unmarshal(resp.Body(), &item)
}
return
}