Module: X::Objects::Lookups::Posts
- Included in:
- API
- Defined in:
- x-objects/lib/x/objects/lookups/posts.rb
Overview
Look up, search, and count posts, and report how many posts the app has read, mixed into a client through API
Internal to x-objects: X::Objects::API includes it, and its methods are public API of the client that includes API, but the module is only how they are grouped, and some of them need the methods of another, so include API rather than this module alone.
Instance Method Summary collapse
-
#count_all_posts(query, **params) ⇒ Integer
(also: #count_all_tweets)
Count the posts from the full archive that match a query, without reading them.
-
#count_all_posts_by_period(query, **params) ⇒ Hash{Range<Time> => Integer}
(also: #count_all_tweets_by_period)
Count the posts from the full archive that match a query, by period.
-
#count_posts(query, **params) ⇒ Integer
(also: #count_tweets)
Count the recent posts that match a query, without reading them.
-
#count_posts_by_period(query, **params) ⇒ Hash{Range<Time> => Integer}
(also: #count_tweets_by_period)
Count the posts from the last seven days that match a query, by period.
-
#find_all_posts(ids, concurrency: BatchFinders::DEFAULT_CONCURRENCY, **params) {|problem| ... } ⇒ Array<Post>
(also: #find_all_tweets)
Look up many posts by identifier, in parallel batches.
-
#find_post(id, **params) {|problem| ... } ⇒ Post?
(also: #find_tweet)
Look up a post by identifier.
-
#find_post!(id, **params) ⇒ Post
(also: #find_tweet!)
Look up a post by identifier, which must exist.
-
#post_usage(**params) {|problem| ... } ⇒ PostUsage?
Look up how many posts the app's project has read.
-
#post_usage!(**params) ⇒ PostUsage
Look up how many posts the app's project has read, which must be returned.
-
#reposts_of_me(**params) ⇒ Cursor
(also: #retweets_of_me)
The posts of the authenticated user that other users have reposted.
-
#search_all_posts(query, **params) ⇒ Cursor
(also: #search_all_tweets)
Search the full archive of posts.
-
#search_posts(query, **params) ⇒ Cursor
(also: #search_tweets)
Search recent posts.
Instance Method Details
#count_all_posts(query, **params) ⇒ Integer Also known as: count_all_tweets
Count the posts from the full archive that match a query, without reading them
The API bills a count by the request, not by the post, and refuses OAuth 1.0a for it, so a client that signs with OAuth 1.0a counts with a copy that authenticates as the app. A client signed in with OAuth 2.0 as a user that holds no credentials of the app counts as the user, which the full archive refuses with X::Forbidden.
123 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 123 def count_all_posts(query, **params) = Post.count_all(query, client: self, **params) # steep:ignore DifferentMethodParameterKind |
#count_all_posts_by_period(query, **params) ⇒ Hash{Range<Time> => Integer} Also known as: count_all_tweets_by_period
Count the posts from the full archive that match a query, by period
The API bills a count by the request, not by the post, and refuses OAuth 1.0a for it, so a client that signs with OAuth 1.0a counts with a copy that authenticates as the app. A client signed in with OAuth 2.0 as a user that holds no credentials of the app counts as the user, which the full archive refuses with X::Forbidden.
154 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 154 def count_all_posts_by_period(query, **params) = Post.count_all_by_period(query, client: self, **params) # steep:ignore DifferentMethodParameterKind |
#count_posts(query, **params) ⇒ Integer Also known as: count_tweets
Count the recent posts that match a query, without reading them
The API bills a count by the request, not by the post, and refuses OAuth 1.0a for it, so a client that signs with OAuth 1.0a counts with a copy that authenticates as the app.
108 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 108 def count_posts(query, **params) = Post.count(query, client: self, **params) # steep:ignore DifferentMethodParameterKind |
#count_posts_by_period(query, **params) ⇒ Hash{Range<Time> => Integer} Also known as: count_tweets_by_period
Count the posts from the last seven days that match a query, by period
The API bills a count by the request, not by the post, and refuses OAuth 1.0a for it, so a client that signs with OAuth 1.0a counts with a copy that authenticates as the app.
138 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 138 def count_posts_by_period(query, **params) = Post.count_by_period(query, client: self, **params) # steep:ignore DifferentMethodParameterKind |
#find_all_posts(ids, concurrency: BatchFinders::DEFAULT_CONCURRENCY, **params) {|problem| ... } ⇒ Array<Post> Also known as: find_all_tweets
Look up many posts by identifier, in parallel batches
57 58 59 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 57 def find_all_posts(ids, concurrency: BatchFinders::DEFAULT_CONCURRENCY, **params, &) Post.find_all(ids, client: self, concurrency:, **params, &) end |
#find_post(id, **params) {|problem| ... } ⇒ Post? Also known as: find_tweet
Look up a post by identifier
26 27 28 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 26 def find_post(id, **params, &) Post.find(id, client: self, **params, &) end |
#find_post!(id, **params) ⇒ Post Also known as: find_tweet!
Look up a post by identifier, which must exist
39 40 41 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 39 def find_post!(id, **params) Post.find!(id, client: self, **params) end |
#post_usage(**params) {|problem| ... } ⇒ PostUsage?
Look up how many posts the app's project has read
The usage endpoint takes app-only authentication alone, so a client that signs with OAuth 1.0a looks it up with a copy that authenticates as the app, and one signed in with OAuth 2.0 as a user that holds no credentials of the app is refused with X::Forbidden.
A response that holds no usage returns nil, as current_user does for a users/me that holds no user, and passes the problems it reported to the block, if there is one.
172 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 172 def post_usage(**params, &) = PostUsage.current(client: self, **params, &) |
#post_usage!(**params) ⇒ PostUsage
Look up how many posts the app's project has read, which must be returned
183 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 183 def post_usage!(**params) = PostUsage.current!(client: self, **params) |
#reposts_of_me(**params) ⇒ Cursor Also known as: retweets_of_me
The posts of the authenticated user that other users have reposted
80 81 82 |
# File 'x-objects/lib/x/objects/lookups/posts.rb', line 80 def reposts_of_me(**params) Post.reposts_of_me(client: self, **params) end |