// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations import ( "encoding/json" "fmt" "github.com/LukeHagar/plexgo/internal/utils" "net/http" "time" ) var GetServerResourcesServerList = []string{ "https://plex.tv/api/v2", } // IncludeHTTPS - Include Https entries in the results type IncludeHTTPS int const ( IncludeHTTPSDisable IncludeHTTPS = 0 IncludeHTTPSEnable IncludeHTTPS = 1 ) func (e IncludeHTTPS) ToPointer() *IncludeHTTPS { return &e } func (e *IncludeHTTPS) UnmarshalJSON(data []byte) error { var v int if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case 0: fallthrough case 1: *e = IncludeHTTPS(v) return nil default: return fmt.Errorf("invalid value for IncludeHTTPS: %v", v) } } // IncludeRelay - Include Relay addresses in the results // E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400 type IncludeRelay int const ( IncludeRelayDisable IncludeRelay = 0 IncludeRelayEnable IncludeRelay = 1 ) func (e IncludeRelay) ToPointer() *IncludeRelay { return &e } func (e *IncludeRelay) UnmarshalJSON(data []byte) error { var v int if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case 0: fallthrough case 1: *e = IncludeRelay(v) return nil default: return fmt.Errorf("invalid value for IncludeRelay: %v", v) } } // IncludeIPv6 - Include IPv6 entries in the results type IncludeIPv6 int const ( IncludeIPv6Disable IncludeIPv6 = 0 IncludeIPv6Enable IncludeIPv6 = 1 ) func (e IncludeIPv6) ToPointer() *IncludeIPv6 { return &e } func (e *IncludeIPv6) UnmarshalJSON(data []byte) error { var v int if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case 0: fallthrough case 1: *e = IncludeIPv6(v) return nil default: return fmt.Errorf("invalid value for IncludeIPv6: %v", v) } } type GetServerResourcesRequest struct { // Include Https entries in the results IncludeHTTPS *IncludeHTTPS `default:"0" queryParam:"style=form,explode=true,name=includeHttps"` // Include Relay addresses in the results // E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400 // IncludeRelay *IncludeRelay `default:"0" queryParam:"style=form,explode=true,name=includeRelay"` // Include IPv6 entries in the results IncludeIPv6 *IncludeIPv6 `default:"0" queryParam:"style=form,explode=true,name=includeIPv6"` // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) ClientID string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` } func (g GetServerResourcesRequest) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(g, "", false) } func (g *GetServerResourcesRequest) UnmarshalJSON(data []byte) error { if err := utils.UnmarshalJSON(data, &g, "", false, []string{"X-Plex-Client-Identifier"}); err != nil { return err } return nil } func (o *GetServerResourcesRequest) GetIncludeHTTPS() *IncludeHTTPS { if o == nil { return nil } return o.IncludeHTTPS } func (o *GetServerResourcesRequest) GetIncludeRelay() *IncludeRelay { if o == nil { return nil } return o.IncludeRelay } func (o *GetServerResourcesRequest) GetIncludeIPv6() *IncludeIPv6 { if o == nil { return nil } return o.IncludeIPv6 } func (o *GetServerResourcesRequest) GetClientID() string { if o == nil { return "" } return o.ClientID } // Protocol - The protocol used for the connection (http, https, etc) type Protocol string const ( ProtocolHTTP Protocol = "http" ProtocolHTTPS Protocol = "https" ) func (e Protocol) ToPointer() *Protocol { return &e } func (e *Protocol) 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 = Protocol(v) return nil default: return fmt.Errorf("invalid value for Protocol: %v", v) } } type Connections struct { // The protocol used for the connection (http, https, etc) Protocol Protocol `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 (o *Connections) GetProtocol() Protocol { if o == nil { return Protocol("") } return o.Protocol } func (o *Connections) GetAddress() string { if o == nil { return "" } return o.Address } func (o *Connections) GetPort() int { if o == nil { return 0 } return o.Port } func (o *Connections) GetURI() string { if o == nil { return "" } return o.URI } func (o *Connections) GetLocal() bool { if o == nil { return false } return o.Local } func (o *Connections) GetRelay() bool { if o == nil { return false } return o.Relay } func (o *Connections) GetIPv6() bool { if o == nil { return false } return o.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", "platform", "platformVersion", "device", "clientIdentifier", "createdAt", "lastSeenAt", "provides", "ownerId", "sourceTitle", "publicAddress", "accessToken", "owned", "home", "synced", "relay", "presence", "httpsRequired", "publicAddressMatches", "dnsRebindingProtection", "natLoopbackSupported", "connections"}); err != nil { return err } return nil } func (o *PlexDevice) GetName() string { if o == nil { return "" } return o.Name } func (o *PlexDevice) GetProduct() string { if o == nil { return "" } return o.Product } func (o *PlexDevice) GetProductVersion() string { if o == nil { return "" } return o.ProductVersion } func (o *PlexDevice) GetPlatform() *string { if o == nil { return nil } return o.Platform } func (o *PlexDevice) GetPlatformVersion() *string { if o == nil { return nil } return o.PlatformVersion } func (o *PlexDevice) GetDevice() *string { if o == nil { return nil } return o.Device } func (o *PlexDevice) GetClientIdentifier() string { if o == nil { return "" } return o.ClientIdentifier } func (o *PlexDevice) GetCreatedAt() time.Time { if o == nil { return time.Time{} } return o.CreatedAt } func (o *PlexDevice) GetLastSeenAt() time.Time { if o == nil { return time.Time{} } return o.LastSeenAt } func (o *PlexDevice) GetProvides() string { if o == nil { return "" } return o.Provides } func (o *PlexDevice) GetOwnerID() *int64 { if o == nil { return nil } return o.OwnerID } func (o *PlexDevice) GetSourceTitle() *string { if o == nil { return nil } return o.SourceTitle } func (o *PlexDevice) GetPublicAddress() string { if o == nil { return "" } return o.PublicAddress } func (o *PlexDevice) GetAccessToken() string { if o == nil { return "" } return o.AccessToken } func (o *PlexDevice) GetOwned() bool { if o == nil { return false } return o.Owned } func (o *PlexDevice) GetHome() bool { if o == nil { return false } return o.Home } func (o *PlexDevice) GetSynced() bool { if o == nil { return false } return o.Synced } func (o *PlexDevice) GetRelay() bool { if o == nil { return false } return o.Relay } func (o *PlexDevice) GetPresence() bool { if o == nil { return false } return o.Presence } func (o *PlexDevice) GetHTTPSRequired() bool { if o == nil { return false } return o.HTTPSRequired } func (o *PlexDevice) GetPublicAddressMatches() bool { if o == nil { return false } return o.PublicAddressMatches } func (o *PlexDevice) GetDNSRebindingProtection() bool { if o == nil { return false } return o.DNSRebindingProtection } func (o *PlexDevice) GetNatLoopbackSupported() bool { if o == nil { return false } return o.NatLoopbackSupported } func (o *PlexDevice) GetConnections() []Connections { if o == nil { return []Connections{} } return o.Connections } type GetServerResourcesResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // List of Plex Devices. This includes Plex hosted servers and clients PlexDevices []PlexDevice } func (o *GetServerResourcesResponse) GetContentType() string { if o == nil { return "" } return o.ContentType } func (o *GetServerResourcesResponse) GetStatusCode() int { if o == nil { return 0 } return o.StatusCode } func (o *GetServerResourcesResponse) GetRawResponse() *http.Response { if o == nil { return nil } return o.RawResponse } func (o *GetServerResourcesResponse) GetPlexDevices() []PlexDevice { if o == nil { return nil } return o.PlexDevices }