-
Notifications
You must be signed in to change notification settings - Fork 12
/
system_status_tool.go
45 lines (37 loc) · 988 Bytes
/
system_status_tool.go
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package woocommerce
import (
"fmt"
"github.com/hiscaler/woocommerce-go/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
}