-
Notifications
You must be signed in to change notification settings - Fork 42
/
casefield.go
43 lines (38 loc) · 1.39 KB
/
casefield.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 testrail
// CaseField represents a Case Field
type CaseField struct {
Configs []CaseFieldConfig `json:"configs"`
Description string `json:"description"`
DisplayOrder int `json:"display_order"`
ID int `json:"ID"`
IsActive bool `json:"is_active"`
Label string `json:"label"`
Name string `json:"name"`
SystemName string `json:"system_name"`
TypeID int `json:"type_id"`
}
// CaseFieldConfig represents the config a Case Field can have
type CaseFieldConfig struct {
Context Context `json:"context"`
ID string `json:"id"`
Options CaseFieldOption `json:"options"`
}
// Context represents the context a config can have
type Context struct {
IsGlobal bool `json:"is_global"`
ProjectIDs []int `json:"project_ids"`
}
// CaseFieldOption represents the options a config can have
type CaseFieldOption struct {
DefaultValue string `json:"default_value"`
Format string `json:"format"`
IsRequired bool `json:"is_required"`
Rows string `json:"rows"`
Items string `json:"items"`
}
// GetCaseFields returns a list of available case custom fields
func (c *Client) GetCaseFields() ([]CaseField, error) {
caseFields := []CaseField{}
err := c.sendRequest("GET", "get_case_fields", nil, &caseFields)
return caseFields, err
}