-
Notifications
You must be signed in to change notification settings - Fork 2
/
app_protection.go
43 lines (34 loc) · 936 Bytes
/
app_protection.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
package deploygate
import (
"fmt"
)
func (c *Client) EnableAppProtection(req *EnableAppProtectionRequest) (*EnableAppProtectionResponse, error) {
path := fmt.Sprintf("users/%s/platforms/%s/apps/%s/binaries/%d/protect", req.Owner, req.Platform, req.AppId, req.Revision)
resp, err := c.Post(&HttpRequest{
path: path,
})
if err != nil {
return nil, err
}
var r *EnableAppProtectionResponse
err = c.Decode(resp, &r)
if err != nil {
return nil, err
}
return r, nil
}
func (c *Client) DisableAppProtection(req *DisableAppProtectionRequest) (*DisableAppProtectionResponse, error) {
path := fmt.Sprintf("users/%s/platforms/%s/apps/%s/binaries/%d/protect", req.Owner, req.Platform, req.AppId, req.Revision)
resp, err := c.Delete(&HttpRequest{
path: path,
})
if err != nil {
return nil, err
}
var r *DisableAppProtectionResponse
err = c.Decode(resp, &r)
if err != nil {
return nil, err
}
return r, nil
}