forked from SmartThingsOSS/smartapp-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting_type.go
114 lines (82 loc) · 3.02 KB
/
setting_type.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Code generated by go-swagger; DO NOT EDIT.
package smartapp
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
// SettingType Denotes the type of setting.
// swagger:model SettingType
type SettingType string
const (
// SettingTypeDEVICE captures enum value "DEVICE"
SettingTypeDEVICE SettingType = "DEVICE"
// SettingTypeTEXT captures enum value "TEXT"
SettingTypeTEXT SettingType = "TEXT"
// SettingTypePASSWORD captures enum value "PASSWORD"
SettingTypePASSWORD SettingType = "PASSWORD"
// SettingTypeBOOLEAN captures enum value "BOOLEAN"
SettingTypeBOOLEAN SettingType = "BOOLEAN"
// SettingTypeENUM captures enum value "ENUM"
SettingTypeENUM SettingType = "ENUM"
// SettingTypeMODE captures enum value "MODE"
SettingTypeMODE SettingType = "MODE"
// SettingTypeSCENE captures enum value "SCENE"
SettingTypeSCENE SettingType = "SCENE"
// SettingTypeLINK captures enum value "LINK"
SettingTypeLINK SettingType = "LINK"
// SettingTypePAGE captures enum value "PAGE"
SettingTypePAGE SettingType = "PAGE"
// SettingTypeIMAGE captures enum value "IMAGE"
SettingTypeIMAGE SettingType = "IMAGE"
// SettingTypeIMAGES captures enum value "IMAGES"
SettingTypeIMAGES SettingType = "IMAGES"
// SettingTypeVIDEO captures enum value "VIDEO"
SettingTypeVIDEO SettingType = "VIDEO"
// SettingTypeTIME captures enum value "TIME"
SettingTypeTIME SettingType = "TIME"
// SettingTypePARAGRAPH captures enum value "PARAGRAPH"
SettingTypePARAGRAPH SettingType = "PARAGRAPH"
// SettingTypeEMAIL captures enum value "EMAIL"
SettingTypeEMAIL SettingType = "EMAIL"
// SettingTypeDECIMAL captures enum value "DECIMAL"
SettingTypeDECIMAL SettingType = "DECIMAL"
// SettingTypeNUMBER captures enum value "NUMBER"
SettingTypeNUMBER SettingType = "NUMBER"
// SettingTypePHONE captures enum value "PHONE"
SettingTypePHONE SettingType = "PHONE"
// SettingTypeOAUTH captures enum value "OAUTH"
SettingTypeOAUTH SettingType = "OAUTH"
)
// for schema
var settingTypeEnum []interface{}
func init() {
var res []SettingType
if err := json.Unmarshal([]byte(`["DEVICE","TEXT","PASSWORD","BOOLEAN","ENUM","MODE","SCENE","LINK","PAGE","IMAGE","IMAGES","VIDEO","TIME","PARAGRAPH","EMAIL","DECIMAL","NUMBER","PHONE","OAUTH"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
settingTypeEnum = append(settingTypeEnum, v)
}
}
func (m SettingType) validateSettingTypeEnum(path, location string, value SettingType) error {
if err := validate.Enum(path, location, value, settingTypeEnum); err != nil {
return err
}
return nil
}
// Validate validates this setting type
func (m SettingType) Validate(formats strfmt.Registry) error {
var res []error
// value enum
if err := m.validateSettingTypeEnum("", "body", m); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}