sample codegen
This commit is contained in:
@@ -6,6 +6,13 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func emptyBoolToTrue(b *bool) bool {
|
||||
if b == nil {
|
||||
return true
|
||||
}
|
||||
return *b
|
||||
}
|
||||
|
||||
// numberOrString handles strings that can also accept JSON numbers.
|
||||
// For example a field may contain a number or the string "auto".
|
||||
type numberOrString string
|
||||
|
||||
4
unifi/network.generated.go
generated
4
unifi/network.generated.go
generated
@@ -198,6 +198,8 @@ func (dst *Network) UnmarshalJSON(b []byte) error {
|
||||
IPSecIkeDhGroup emptyStringInt `json:"ipsec_ike_dh_group"`
|
||||
IPV6RaPreferredLifetime emptyStringInt `json:"ipv6_ra_preferred_lifetime"`
|
||||
IPV6RaValidLifetime emptyStringInt `json:"ipv6_ra_valid_lifetime"`
|
||||
InternetAccessEnabled *bool `json:"internet_access_enabled,omitempty"`
|
||||
IntraNetworkAccessEnabled *bool `json:"intra_network_access_enabled,omitempty"`
|
||||
OpenVPNLocalPort emptyStringInt `json:"openvpn_local_port"`
|
||||
OpenVPNRemotePort emptyStringInt `json:"openvpn_remote_port"`
|
||||
PptpcRouteDistance emptyStringInt `json:"pptpc_route_distance"`
|
||||
@@ -232,6 +234,8 @@ func (dst *Network) UnmarshalJSON(b []byte) error {
|
||||
dst.IPSecIkeDhGroup = int(aux.IPSecIkeDhGroup)
|
||||
dst.IPV6RaPreferredLifetime = int(aux.IPV6RaPreferredLifetime)
|
||||
dst.IPV6RaValidLifetime = int(aux.IPV6RaValidLifetime)
|
||||
dst.InternetAccessEnabled = emptyBoolToTrue(aux.InternetAccessEnabled)
|
||||
dst.IntraNetworkAccessEnabled = emptyBoolToTrue(aux.IntraNetworkAccessEnabled)
|
||||
dst.OpenVPNLocalPort = int(aux.OpenVPNLocalPort)
|
||||
dst.OpenVPNRemotePort = int(aux.OpenVPNRemotePort)
|
||||
dst.PptpcRouteDistance = int(aux.PptpcRouteDistance)
|
||||
|
||||
Reference in New Issue
Block a user