-
Notifications
You must be signed in to change notification settings - Fork 310
/
configuration_services_json.pb.go
110 lines (104 loc) · 2.82 KB
/
configuration_services_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
108
109
110
// Code generated by protoc-gen-go-json. DO NOT EDIT.
// versions:
// - protoc-gen-go-json v1.1.0
// - protoc v3.9.1
// source: lorawan-stack/api/configuration_services.proto
package ttnpb
import (
jsonplugin "github.com/TheThingsIndustries/protoc-gen-go-json/jsonplugin"
)
// MarshalProtoJSON marshals the GetPhyVersionsResponse_VersionInfo message to JSON.
func (x *GetPhyVersionsResponse_VersionInfo) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.BandId != "" || s.HasField("band_id") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("band_id")
s.WriteString(x.BandId)
}
if len(x.PhyVersions) > 0 || s.HasField("phy_versions") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("phy_versions")
s.WriteArrayStart()
var wroteElement bool
for _, element := range x.PhyVersions {
s.WriteMoreIf(&wroteElement)
element.MarshalProtoJSON(s)
}
s.WriteArrayEnd()
}
s.WriteObjectEnd()
}
// UnmarshalProtoJSON unmarshals the GetPhyVersionsResponse_VersionInfo message from JSON.
func (x *GetPhyVersionsResponse_VersionInfo) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "band_id", "bandId":
s.AddField("band_id")
x.BandId = s.ReadString()
case "phy_versions", "phyVersions":
s.AddField("phy_versions")
s.ReadArray(func() {
var v PHYVersion
v.UnmarshalProtoJSON(s)
x.PhyVersions = append(x.PhyVersions, v)
})
}
})
}
// MarshalProtoJSON marshals the GetPhyVersionsResponse message to JSON.
func (x *GetPhyVersionsResponse) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if len(x.VersionInfo) > 0 || s.HasField("version_info") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("version_info")
s.WriteArrayStart()
var wroteElement bool
for _, element := range x.VersionInfo {
s.WriteMoreIf(&wroteElement)
element.MarshalProtoJSON(s.WithField("version_info"))
}
s.WriteArrayEnd()
}
s.WriteObjectEnd()
}
// UnmarshalProtoJSON unmarshals the GetPhyVersionsResponse message from JSON.
func (x *GetPhyVersionsResponse) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "version_info", "versionInfo":
s.AddField("version_info")
s.ReadArray(func() {
if s.ReadNil() {
x.VersionInfo = append(x.VersionInfo, nil)
return
}
v := &GetPhyVersionsResponse_VersionInfo{}
v.UnmarshalProtoJSON(s.WithField("version_info", false))
if s.Err() != nil {
return
}
x.VersionInfo = append(x.VersionInfo, v)
})
}
})
}