Method: MatrixSdk::Protocols::CS#keys_query

Defined in:
lib/matrix_sdk/protocols/cs.rb

#keys_query(device_keys:, timeout: nil, token: nil, **params) ⇒ Object

Run a query for device keys

Examples:

Looking up all the device keys for a user

api.keys_query(device_keys: { '@alice:example.com': [] })
# => { :device_keys => { :'@alice:example.com' => { :JLAFKJWSCS => { ...

Looking up a specific device for a user

api.keys_query(device_keys: { '@alice:example.com': ['ABCDEFGHIJ'] })
# => { :device_keys => { :'@alice:example.com' => { :ABCDEFGHIJ => { ...

Parameters:

  • timeout (Numeric) (defaults to: nil)

    The timeout - in seconds - for the query

  • device_keys (Array)

    The list of devices to query

  • token (String) (defaults to: nil)

    The sync token that led to this query - if any

  • params (Hash)

    Additional parameters

Options Hash (**params):

  • timeout_ms (Integer)

    The timeout in milliseconds for the query, overrides timeout

See Also:



1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
# File 'lib/matrix_sdk/protocols/cs.rb', line 1773

def keys_query(device_keys:, timeout: nil, token: nil, **params)
  body = {
    timeout: (timeout || 10) * 1000,
    device_keys: device_keys
  }
  body[:timeout] = params[:timeout_ms] if params.key? :timeout_ms
  body[:token] = token if token

  request(:post, client_api_latest, '/keys/query', body: body)
end