Repository navigation
Expand file tree
/
Copy pathmodel_shape_type.go
More file actions
122 lines (100 loc) · 2.69 KB
/
Copy pathmodel_shape_type.go
File metadata and controls
122 lines (100 loc) · 2.69 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
/*
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"
)
// ShapeType A shape a field can draw.
type ShapeType string
// List of ShapeType
const (
SHAPETYPE_SQUARE ShapeType = "square"
SHAPETYPE_RECTANGLE ShapeType = "rectangle"
SHAPETYPE_CIRCLE ShapeType = "circle"
SHAPETYPE_ELLIPSE ShapeType = "ellipse"
SHAPETYPE_TRIANGLE ShapeType = "triangle"
SHAPETYPE_POLYGON ShapeType = "polygon"
)
// All allowed values of ShapeType enum
var AllowedShapeTypeEnumValues = []ShapeType{
"square",
"rectangle",
"circle",
"ellipse",
"triangle",
"polygon",
}
func (v *ShapeType) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := ShapeType(value)
for _, existing := range AllowedShapeTypeEnumValues {
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
}
// NewShapeTypeFromValue returns a pointer to a valid ShapeType
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewShapeTypeFromValue(v string) (*ShapeType, error) {
ev := ShapeType(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for ShapeType: valid values are %v", v, AllowedShapeTypeEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v ShapeType) IsValid() bool {
for _, existing := range AllowedShapeTypeEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to ShapeType value
func (v ShapeType) Ptr() *ShapeType {
return &v
}
type NullableShapeType struct {
value *ShapeType
isSet bool
}
func (v NullableShapeType) Get() *ShapeType {
return v.value
}
func (v *NullableShapeType) Set(val *ShapeType) {
v.value = val
v.isSet = true
}
func (v NullableShapeType) IsSet() bool {
return v.isSet
}
func (v *NullableShapeType) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableShapeType(val *ShapeType) *NullableShapeType {
return &NullableShapeType{value: val, isSet: true}
}
func (v NullableShapeType) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableShapeType) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}