// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package components import ( "encoding/json" "fmt" "github.com/LukeHagar/plexgo/internal/utils" "time" ) // PlexDeviceProtocol - The protocol used for the connection (http, https, etc) type PlexDeviceProtocol string const ( PlexDeviceProtocolHTTP PlexDeviceProtocol = "http" PlexDeviceProtocolHTTPS PlexDeviceProtocol = "https" ) func (e PlexDeviceProtocol) ToPointer() *PlexDeviceProtocol { return &e } func (e *PlexDeviceProtocol) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case "http": fallthrough case "https": *e = PlexDeviceProtocol(v) return nil default: return fmt.Errorf("invalid value for PlexDeviceProtocol: %v", v) } } type Connections struct { // The protocol used for the connection (http, https, etc) Protocol PlexDeviceProtocol `json:"protocol"` // The (ip) address or domain name used for the connection Address string `json:"address"` // The port used for the connection Port int `json:"port"` // The full URI of the connection URI string `json:"uri"` // If the connection is local address Local bool `json:"local"` // If the connection is relayed through plex.direct Relay bool `json:"relay"` // If the connection is using IPv6 IPv6 bool `json:"IPv6"` } func (c *Connections) GetProtocol() PlexDeviceProtocol { if c == nil { return PlexDeviceProtocol("") } return c.Protocol } func (c *Connections) GetAddress() string { if c == nil { return "" } return c.Address } func (c *Connections) GetPort() int { if c == nil { return 0 } return c.Port } func (c *Connections) GetURI() string { if c == nil { return "" } return c.URI } func (c *Connections) GetLocal() bool { if c == nil { return false } return c.Local } func (c *Connections) GetRelay() bool { if c == nil { return false } return c.Relay } func (c *Connections) GetIPv6() bool { if c == nil { return false } return c.IPv6 } type PlexDevice struct { Name string `json:"name"` Product string `json:"product"` ProductVersion string `json:"productVersion"` Platform *string `json:"platform"` PlatformVersion *string `json:"platformVersion"` Device *string `json:"device"` ClientIdentifier string `json:"clientIdentifier"` CreatedAt time.Time `json:"createdAt"` LastSeenAt time.Time `json:"lastSeenAt"` Provides string `json:"provides"` // ownerId is null when the device is owned by the token used to send the request OwnerID *int64 `json:"ownerId"` SourceTitle *string `json:"sourceTitle"` PublicAddress string `json:"publicAddress"` AccessToken string `json:"accessToken"` Owned bool `json:"owned"` Home bool `json:"home"` Synced bool `json:"synced"` Relay bool `json:"relay"` Presence bool `json:"presence"` HTTPSRequired bool `json:"httpsRequired"` PublicAddressMatches bool `json:"publicAddressMatches"` DNSRebindingProtection bool `json:"dnsRebindingProtection"` NatLoopbackSupported bool `json:"natLoopbackSupported"` Connections []Connections `json:"connections"` } func (p PlexDevice) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(p, "", false) } func (p *PlexDevice) UnmarshalJSON(data []byte) error { if err := utils.UnmarshalJSON(data, &p, "", false, []string{"name", "product", "productVersion", "clientIdentifier", "createdAt", "lastSeenAt", "provides", "publicAddress", "accessToken", "owned", "home", "synced", "relay", "presence", "httpsRequired", "publicAddressMatches", "dnsRebindingProtection", "natLoopbackSupported", "connections"}); err != nil { return err } return nil } func (p *PlexDevice) GetName() string { if p == nil { return "" } return p.Name } func (p *PlexDevice) GetProduct() string { if p == nil { return "" } return p.Product } func (p *PlexDevice) GetProductVersion() string { if p == nil { return "" } return p.ProductVersion } func (p *PlexDevice) GetPlatform() *string { if p == nil { return nil } return p.Platform } func (p *PlexDevice) GetPlatformVersion() *string { if p == nil { return nil } return p.PlatformVersion } func (p *PlexDevice) GetDevice() *string { if p == nil { return nil } return p.Device } func (p *PlexDevice) GetClientIdentifier() string { if p == nil { return "" } return p.ClientIdentifier } func (p *PlexDevice) GetCreatedAt() time.Time { if p == nil { return time.Time{} } return p.CreatedAt } func (p *PlexDevice) GetLastSeenAt() time.Time { if p == nil { return time.Time{} } return p.LastSeenAt } func (p *PlexDevice) GetProvides() string { if p == nil { return "" } return p.Provides } func (p *PlexDevice) GetOwnerID() *int64 { if p == nil { return nil } return p.OwnerID } func (p *PlexDevice) GetSourceTitle() *string { if p == nil { return nil } return p.SourceTitle } func (p *PlexDevice) GetPublicAddress() string { if p == nil { return "" } return p.PublicAddress } func (p *PlexDevice) GetAccessToken() string { if p == nil { return "" } return p.AccessToken } func (p *PlexDevice) GetOwned() bool { if p == nil { return false } return p.Owned } func (p *PlexDevice) GetHome() bool { if p == nil { return false } return p.Home } func (p *PlexDevice) GetSynced() bool { if p == nil { return false } return p.Synced } func (p *PlexDevice) GetRelay() bool { if p == nil { return false } return p.Relay } func (p *PlexDevice) GetPresence() bool { if p == nil { return false } return p.Presence } func (p *PlexDevice) GetHTTPSRequired() bool { if p == nil { return false } return p.HTTPSRequired } func (p *PlexDevice) GetPublicAddressMatches() bool { if p == nil { return false } return p.PublicAddressMatches } func (p *PlexDevice) GetDNSRebindingProtection() bool { if p == nil { return false } return p.DNSRebindingProtection } func (p *PlexDevice) GetNatLoopbackSupported() bool { if p == nil { return false } return p.NatLoopbackSupported } func (p *PlexDevice) GetConnections() []Connections { if p == nil { return []Connections{} } return p.Connections }