Repository navigation
Expand file tree
/
Copy pathmodel_error_code.go
More file actions
156 lines (134 loc) · 4.11 KB
/
Copy pathmodel_error_code.go
File metadata and controls
156 lines (134 loc) · 4.11 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
DocSpring API
Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or 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"
)
// ErrorCode A machine-readable error code. New codes can be added.
type ErrorCode string
// List of ErrorCode
const (
ERRORCODE_INVALID_REQUEST ErrorCode = "invalid_request"
ERRORCODE_UNAUTHORIZED ErrorCode = "unauthorized"
ERRORCODE_PAYMENT_REQUIRED ErrorCode = "payment_required"
ERRORCODE_INSUFFICIENT_CREDITS ErrorCode = "insufficient_credits"
ERRORCODE_FORBIDDEN ErrorCode = "forbidden"
ERRORCODE_UPGRADE_REQUIRED ErrorCode = "upgrade_required"
ERRORCODE_ACCOUNT_SUSPENDED ErrorCode = "account_suspended"
ERRORCODE_NOT_FOUND ErrorCode = "not_found"
ERRORCODE_METHOD_NOT_ALLOWED ErrorCode = "method_not_allowed"
ERRORCODE_CONFLICT ErrorCode = "conflict"
ERRORCODE_GONE ErrorCode = "gone"
ERRORCODE_REQUEST_TOO_LARGE ErrorCode = "request_too_large"
ERRORCODE_UNSUPPORTED_MEDIA_TYPE ErrorCode = "unsupported_media_type"
ERRORCODE_VALIDATION_FAILED ErrorCode = "validation_failed"
ERRORCODE_INVALID_DATA ErrorCode = "invalid_data"
ERRORCODE_RATE_LIMITED ErrorCode = "rate_limited"
ERRORCODE_INTERNAL_ERROR ErrorCode = "internal_error"
ERRORCODE_BAD_GATEWAY ErrorCode = "bad_gateway"
ERRORCODE_SERVICE_UNAVAILABLE ErrorCode = "service_unavailable"
ERRORCODE_UPSTREAM_TIMEOUT ErrorCode = "upstream_timeout"
ERRORCODE_POLLING_TIMEOUT ErrorCode = "polling_timeout"
ERRORCODE_IDEMPOTENCY_KEY_IN_USE ErrorCode = "idempotency_key_in_use"
ERRORCODE_IDEMPOTENCY_KEY_REUSED ErrorCode = "idempotency_key_reused"
)
// All allowed values of ErrorCode enum
var AllowedErrorCodeEnumValues = []ErrorCode{
"invalid_request",
"unauthorized",
"payment_required",
"insufficient_credits",
"forbidden",
"upgrade_required",
"account_suspended",
"not_found",
"method_not_allowed",
"conflict",
"gone",
"request_too_large",
"unsupported_media_type",
"validation_failed",
"invalid_data",
"rate_limited",
"internal_error",
"bad_gateway",
"service_unavailable",
"upstream_timeout",
"polling_timeout",
"idempotency_key_in_use",
"idempotency_key_reused",
}
func (v *ErrorCode) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := ErrorCode(value)
for _, existing := range AllowedErrorCodeEnumValues {
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
}
// NewErrorCodeFromValue returns a pointer to a valid ErrorCode
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewErrorCodeFromValue(v string) (*ErrorCode, error) {
ev := ErrorCode(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for ErrorCode: valid values are %v", v, AllowedErrorCodeEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v ErrorCode) IsValid() bool {
for _, existing := range AllowedErrorCodeEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to ErrorCode value
func (v ErrorCode) Ptr() *ErrorCode {
return &v
}
type NullableErrorCode struct {
value *ErrorCode
isSet bool
}
func (v NullableErrorCode) Get() *ErrorCode {
return v.value
}
func (v *NullableErrorCode) Set(val *ErrorCode) {
v.value = val
v.isSet = true
}
func (v NullableErrorCode) IsSet() bool {
return v.isSet
}
func (v *NullableErrorCode) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableErrorCode(val *ErrorCode) *NullableErrorCode {
return &NullableErrorCode{value: val, isSet: true}
}
func (v NullableErrorCode) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableErrorCode) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}