Class: XTwitterScraper::Resources::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/x_twitter_scraper/resources/events.rb,
sig/x_twitter_scraper/resources/events.rbs

Overview

Activity events from monitored accounts

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Events

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Events.

Parameters:



62
63
64
# File 'lib/x_twitter_scraper/resources/events.rb', line 62

def initialize(client:)
  @client = client
end

Instance Method Details

#list(cursor: nil, event_type: nil, limit: nil, monitor_id: nil, request_options: {}) ⇒ XTwitterScraper::Models::EventListResponse

Some parameter documentations has been truncated, see Models::EventListParams for more details.

List events

Parameters:

  • cursor (String)

    Cursor for keyset pagination from prior response next_cursor

  • event_type (Symbol, XTwitterScraper::Models::EventType)

    Filter events by type

  • limit (Integer)

    Maximum number of items to return (1-100, default 50). For paid per-result endpo

  • monitor_id (String)

    Filter events by monitor ID

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/x_twitter_scraper/resources/events.rb', line 47

def list(params = {})
  parsed, options = XTwitterScraper::EventListParams.dump_request(params)
  query = XTwitterScraper::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "events",
    query: query.transform_keys(event_type: "eventType", monitor_id: "monitorId"),
    model: XTwitterScraper::Models::EventListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::EventDetail

Get event

Parameters:

  • id (String)

    Resource ID returned by the matching create or list endpoint.

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



18
19
20
21
22
23
24
25
# File 'lib/x_twitter_scraper/resources/events.rb', line 18

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["events/%1$s", id],
    model: XTwitterScraper::EventDetail,
    options: params[:request_options]
  )
end