/
org_value.go
36 lines (31 loc) · 935 Bytes
/
org_value.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
package limacharlie
import (
"fmt"
"net/http"
)
type OrgValueInfo struct {
Name OrgValueName `json:"config"`
Value OrgValue `json:"value"`
}
type OrgValueName = string
type OrgValue = string
// Get an Org Value from a specific org.
func (org Organization) OrgValueGet(name string) (*OrgValueInfo, error) {
resp := OrgValueInfo{}
request := makeDefaultRequest(&resp)
if err := org.client.reliableRequest(http.MethodGet, fmt.Sprintf("configs/%s/%s", org.client.options.OID, name), request); err != nil {
return nil, err
}
return &resp, nil
}
// Set an Org Value for a specific org.
func (org Organization) OrgValueSet(name string, value string) error {
resp := Dict{}
request := makeDefaultRequest(&resp).withFormData(Dict{
"value": value,
})
if err := org.client.reliableRequest(http.MethodPost, fmt.Sprintf("configs/%s/%s", org.client.options.OID, name), request); err != nil {
return err
}
return nil
}