Files
plexruby/docs/sdks/sessions/README.md

9.5 KiB
Raw Blame History

Sessions

Overview

API Calls that perform search operations with Plex Media Server Sessions

Available Operations

get_sessions

This will retrieve the "Now Playing" Information of the PMS.

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new(
      client_id: "gcgzw5rz2xovp84b4vha3a40",
      client_name: "Plex Web",
      client_version: "4.133.0",
      client_platform: "Chrome",
      device_name: "Linux",
    )
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.sessions.get_sessions()

if ! res.object.nil?
  # handle response
end

Response

T.nilable(::PlexRubySDK::Operations::GetSessionsResponse)

get_session_history

This will Retrieve a listing of all history views.

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new(
      client_id: "gcgzw5rz2xovp84b4vha3a40",
      client_name: "Plex Web",
      client_version: "4.133.0",
      client_platform: "Chrome",
      device_name: "Linux",
    )
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.sessions.get_session_history(sort="<value>", account_id=1, filter=::PlexRubySDK::Operations::QueryParamFilter.new(), library_section_id=12)

if ! res.object.nil?
  # handle response
end

Parameters

Parameter Type Required Description Example
sort ::String Sorts the results by the specified field followed by the direction (asc, desc)
account_id ::Integer Filter results by those that are related to a specific users id
1
filter ::PlexRubySDK::Operations::QueryParamFilter Filters content by field and direction/equality
(Unknown if viewedAt is the only supported column)
{
"viewed-at-greater-than": {
"value": "viewedAt\u003e"
},
"viewed-at-greater-than-or-equal-to": {
"value": "viewedAt\u003e=\u003e"
},
"viewed-at-less-than": {
"value": "viewedAt\u003c"
}
}
library_section_id ::Integer Filters the results based on the id of a valid library section
12

Response

T.nilable(::PlexRubySDK::Operations::GetSessionHistoryResponse)

get_transcode_sessions

Get Transcode Sessions

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new(
      client_id: "gcgzw5rz2xovp84b4vha3a40",
      client_name: "Plex Web",
      client_version: "4.133.0",
      client_platform: "Chrome",
      device_name: "Linux",
    )
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.sessions.get_transcode_sessions()

if ! res.object.nil?
  # handle response
end

Response

T.nilable(::PlexRubySDK::Operations::GetTranscodeSessionsResponse)

stop_transcode_session

Stop a Transcode Session

Example Usage

require 'plex_ruby_sdk'


s = ::PlexRubySDK::PlexAPI.new(
      client_id: "gcgzw5rz2xovp84b4vha3a40",
      client_name: "Plex Web",
      client_version: "4.133.0",
      client_platform: "Chrome",
      device_name: "Linux",
    )
s.config_security(
  ::PlexRubySDK::Shared::Security.new(
    access_token: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.sessions.stop_transcode_session(session_key="zz7llzqlx8w9vnrsbnwhbmep")

if res.status_code == 200
  # handle response
end

Parameters

Parameter Type Required Description Example
session_key ::String ✔️ the Key of the transcode session to stop zz7llzqlx8w9vnrsbnwhbmep

Response

T.nilable(::PlexRubySDK::Operations::StopTranscodeSessionResponse)