Module: X::Resources::PostSearch
- Included in:
- Post
- Defined in:
- x-resources/lib/x/resources/post_search.rb
Overview
The searches of posts, and the posts of the authenticated user that others reposted
Internal to x-resources: the methods it gives Post, such as X::Post.search, are public API, but the module is only how they are shared, and which classes extend or include it can change within 1.x.
Instance Method Summary collapse
-
#reposts_of_me(client:, **params) ⇒ Cursor
(also: #retweets_of_me)
The posts of the authenticated user that other users have reposted.
-
#search(query, client:, **params) ⇒ Cursor
Search recent posts.
-
#search_all(query, client:, **params) ⇒ Cursor
Search the full archive of posts.
Instance Method Details
#reposts_of_me(client:, **params) ⇒ Cursor Also known as: retweets_of_me
The posts of the authenticated user that other users have reposted
The endpoint names no user, so these are always the posts of the user the client authenticates as.
66 67 68 69 |
# File 'x-resources/lib/x/resources/post_search.rb', line 66 def reposts_of_me(client:, **params) # @type self: singleton(Post) Cursor.__send__(:build, self, "users/reposts_of_me", client:, params: {max_results: MAX_RESULTS}.merge(params)) end |
#search(query, client:, **params) ⇒ Cursor
Search recent posts
32 33 34 35 |
# File 'x-resources/lib/x/resources/post_search.rb', line 32 def search(query, client:, **params) # @type self: singleton(Post) Cursor.__send__(:build, self, "tweets/search/recent", client:, params: {query:, max_results: MAX_RESULTS}.merge(params), min_results: 10) end |
#search_all(query, client:, **params) ⇒ Cursor
Search the full archive of posts
A page holds up to 500 posts, or 100 when the request asks for context annotations, as the default fields do.
50 51 52 53 54 |
# File 'x-resources/lib/x/resources/post_search.rb', line 50 def search_all(query, client:, **params) # @type self: singleton(Post) max_results = context_annotations?(params) ? MAX_RESULTS : MAX_ARCHIVE_RESULTS Cursor.__send__(:build, self, "tweets/search/all", client:, params: {query:, max_results:}.merge(params), min_results: 10) end |