-
Notifications
You must be signed in to change notification settings - Fork 302
/
enums_json.pb.go
107 lines (91 loc) · 3.28 KB
/
enums_json.pb.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
// Code generated by protoc-gen-go-json. DO NOT EDIT.
// versions:
// - protoc-gen-go-json v1.5.1
// - protoc v4.22.2
// source: lorawan-stack/api/enums.proto
package ttnpb
import (
jsonplugin "github.com/TheThingsIndustries/protoc-gen-go-json/jsonplugin"
)
// MarshalProtoJSON marshals the DownlinkPathConstraint to JSON.
func (x DownlinkPathConstraint) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), DownlinkPathConstraint_name)
}
// MarshalText marshals the DownlinkPathConstraint to text.
func (x DownlinkPathConstraint) MarshalText() ([]byte, error) {
return []byte(jsonplugin.GetEnumString(int32(x), DownlinkPathConstraint_name)), nil
}
// MarshalJSON marshals the DownlinkPathConstraint to JSON.
func (x DownlinkPathConstraint) MarshalJSON() ([]byte, error) {
return jsonplugin.DefaultMarshalerConfig.Marshal(x)
}
// DownlinkPathConstraint_customvalue contains custom string values that extend DownlinkPathConstraint_value.
var DownlinkPathConstraint_customvalue = map[string]int32{
"NONE": 0,
"PREFER_OTHER": 1,
"NEVER": 2,
}
// UnmarshalProtoJSON unmarshals the DownlinkPathConstraint from JSON.
func (x *DownlinkPathConstraint) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(DownlinkPathConstraint_value, DownlinkPathConstraint_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read DownlinkPathConstraint enum: %v", err)
return
}
*x = DownlinkPathConstraint(v)
}
// UnmarshalText unmarshals the DownlinkPathConstraint from text.
func (x *DownlinkPathConstraint) UnmarshalText(b []byte) error {
i, err := jsonplugin.ParseEnumString(string(b), DownlinkPathConstraint_customvalue, DownlinkPathConstraint_value)
if err != nil {
return err
}
*x = DownlinkPathConstraint(i)
return nil
}
// UnmarshalJSON unmarshals the DownlinkPathConstraint from JSON.
func (x *DownlinkPathConstraint) UnmarshalJSON(b []byte) error {
return jsonplugin.DefaultUnmarshalerConfig.Unmarshal(b, x)
}
// MarshalProtoJSON marshals the State to JSON.
func (x State) MarshalProtoJSON(s *jsonplugin.MarshalState) {
s.WriteEnumString(int32(x), State_name)
}
// MarshalText marshals the State to text.
func (x State) MarshalText() ([]byte, error) {
return []byte(jsonplugin.GetEnumString(int32(x), State_name)), nil
}
// MarshalJSON marshals the State to JSON.
func (x State) MarshalJSON() ([]byte, error) {
return jsonplugin.DefaultMarshalerConfig.Marshal(x)
}
// State_customvalue contains custom string values that extend State_value.
var State_customvalue = map[string]int32{
"REQUESTED": 0,
"APPROVED": 1,
"REJECTED": 2,
"FLAGGED": 3,
"SUSPENDED": 4,
}
// UnmarshalProtoJSON unmarshals the State from JSON.
func (x *State) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
v := s.ReadEnum(State_value, State_customvalue)
if err := s.Err(); err != nil {
s.SetErrorf("could not read State enum: %v", err)
return
}
*x = State(v)
}
// UnmarshalText unmarshals the State from text.
func (x *State) UnmarshalText(b []byte) error {
i, err := jsonplugin.ParseEnumString(string(b), State_customvalue, State_value)
if err != nil {
return err
}
*x = State(i)
return nil
}
// UnmarshalJSON unmarshals the State from JSON.
func (x *State) UnmarshalJSON(b []byte) error {
return jsonplugin.DefaultUnmarshalerConfig.Unmarshal(b, x)
}