-
Notifications
You must be signed in to change notification settings - Fork 302
/
gateway_configuration_json.pb.go
81 lines (75 loc) · 2.24 KB
/
gateway_configuration_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
// 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/gateway_configuration.proto
package ttnpb
import (
jsonplugin "github.com/TheThingsIndustries/protoc-gen-go-json/jsonplugin"
)
// MarshalProtoJSON marshals the GetGatewayConfigurationRequest message to JSON.
func (x *GetGatewayConfigurationRequest) MarshalProtoJSON(s *jsonplugin.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.GatewayIds != nil || s.HasField("gateway_ids") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("gateway_ids")
x.GatewayIds.MarshalProtoJSON(s.WithField("gateway_ids"))
}
if x.Format != "" || s.HasField("format") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("format")
s.WriteString(x.Format)
}
if x.Type != "" || s.HasField("type") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("type")
s.WriteString(x.Type)
}
if x.Filename != "" || s.HasField("filename") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("filename")
s.WriteString(x.Filename)
}
s.WriteObjectEnd()
}
// MarshalJSON marshals the GetGatewayConfigurationRequest to JSON.
func (x *GetGatewayConfigurationRequest) MarshalJSON() ([]byte, error) {
return jsonplugin.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the GetGatewayConfigurationRequest message from JSON.
func (x *GetGatewayConfigurationRequest) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.ReadAny() // ignore unknown field
case "gateway_ids", "gatewayIds":
if s.ReadNil() {
x.GatewayIds = nil
return
}
x.GatewayIds = &GatewayIdentifiers{}
x.GatewayIds.UnmarshalProtoJSON(s.WithField("gateway_ids", true))
case "format":
s.AddField("format")
x.Format = s.ReadString()
case "type":
s.AddField("type")
x.Type = s.ReadString()
case "filename":
s.AddField("filename")
x.Filename = s.ReadString()
}
})
}
// UnmarshalJSON unmarshals the GetGatewayConfigurationRequest from JSON.
func (x *GetGatewayConfigurationRequest) UnmarshalJSON(b []byte) error {
return jsonplugin.DefaultUnmarshalerConfig.Unmarshal(b, x)
}