Repository navigation
Expand file tree
/
Copy pathmodel_field_type.go
More file actions
140 lines (118 loc) · 3.12 KB
/
Copy pathmodel_field_type.go
File metadata and controls
140 lines (118 loc) · 3.12 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
DocSpring API
Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
API version: v2
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package docspring
import (
"encoding/json"
"fmt"
)
// FieldType The data type of a field's value.
type FieldType string
// List of FieldType
const (
FIELDTYPE_STRING FieldType = "string"
FIELDTYPE_NUMBER FieldType = "number"
FIELDTYPE_BOOLEAN FieldType = "boolean"
FIELDTYPE_DATE FieldType = "date"
FIELDTYPE_ADDRESS FieldType = "address"
FIELDTYPE_COUNTRY FieldType = "country"
FIELDTYPE_EMAIL FieldType = "email"
FIELDTYPE_URL FieldType = "url"
FIELDTYPE_IMAGE FieldType = "image"
FIELDTYPE_SIGNATURE FieldType = "signature"
FIELDTYPE_INITIALS FieldType = "initials"
FIELDTYPE_BARCODE FieldType = "barcode"
FIELDTYPE_COMBINED FieldType = "combined"
FIELDTYPE_OBJECT FieldType = "object"
FIELDTYPE_ARRAY FieldType = "array"
)
// All allowed values of FieldType enum
var AllowedFieldTypeEnumValues = []FieldType{
"string",
"number",
"boolean",
"date",
"address",
"country",
"email",
"url",
"image",
"signature",
"initials",
"barcode",
"combined",
"object",
"array",
}
func (v *FieldType) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := FieldType(value)
for _, existing := range AllowedFieldTypeEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
// A value added to the API after this client was released, as in a response, is kept as it is. IsValid says
// whether it's one of the values this client knows.
*v = enumTypeValue
return nil
}
// NewFieldTypeFromValue returns a pointer to a valid FieldType
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewFieldTypeFromValue(v string) (*FieldType, error) {
ev := FieldType(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for FieldType: valid values are %v", v, AllowedFieldTypeEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v FieldType) IsValid() bool {
for _, existing := range AllowedFieldTypeEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to FieldType value
func (v FieldType) Ptr() *FieldType {
return &v
}
type NullableFieldType struct {
value *FieldType
isSet bool
}
func (v NullableFieldType) Get() *FieldType {
return v.value
}
func (v *NullableFieldType) Set(val *FieldType) {
v.value = val
v.isSet = true
}
func (v NullableFieldType) IsSet() bool {
return v.isSet
}
func (v *NullableFieldType) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFieldType(val *FieldType) *NullableFieldType {
return &NullableFieldType{value: val, isSet: true}
}
func (v NullableFieldType) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFieldType) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}