x-resources 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +9 -0
  3. data/CHANGELOG.md +254 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +148 -0
  6. data/lib/x/resources/abstract_class.rb +29 -0
  7. data/lib/x/resources/actions/direct_messages.rb +99 -0
  8. data/lib/x/resources/actions/engagement.rb +95 -0
  9. data/lib/x/resources/actions/lists.rb +126 -0
  10. data/lib/x/resources/actions/posts.rb +77 -0
  11. data/lib/x/resources/actions/relationships.rb +91 -0
  12. data/lib/x/resources/actions.rb +22 -0
  13. data/lib/x/resources/api.rb +40 -0
  14. data/lib/x/resources/attributes.rb +203 -0
  15. data/lib/x/resources/batch.rb +43 -0
  16. data/lib/x/resources/batch_finders.rb +185 -0
  17. data/lib/x/resources/bookmark_folder.rb +23 -0
  18. data/lib/x/resources/community.rb +137 -0
  19. data/lib/x/resources/cursor.rb +493 -0
  20. data/lib/x/resources/direct_message.rb +325 -0
  21. data/lib/x/resources/direct_message_conversations.rb +147 -0
  22. data/lib/x/resources/errors.rb +104 -0
  23. data/lib/x/resources/finders.rb +255 -0
  24. data/lib/x/resources/identity.rb +65 -0
  25. data/lib/x/resources/includes.rb +216 -0
  26. data/lib/x/resources/list.rb +336 -0
  27. data/lib/x/resources/lookups/communities.rb +56 -0
  28. data/lib/x/resources/lookups/direct_messages.rb +86 -0
  29. data/lib/x/resources/lookups/lists.rb +44 -0
  30. data/lib/x/resources/lookups/media.rb +72 -0
  31. data/lib/x/resources/lookups/posts.rb +198 -0
  32. data/lib/x/resources/lookups/spaces.rb +87 -0
  33. data/lib/x/resources/lookups/trends.rb +38 -0
  34. data/lib/x/resources/lookups/users.rb +221 -0
  35. data/lib/x/resources/lookups.rb +25 -0
  36. data/lib/x/resources/marshalling.rb +93 -0
  37. data/lib/x/resources/matching_rule.rb +107 -0
  38. data/lib/x/resources/media.rb +278 -0
  39. data/lib/x/resources/media_ids.rb +74 -0
  40. data/lib/x/resources/memo.rb +54 -0
  41. data/lib/x/resources/page.rb +394 -0
  42. data/lib/x/resources/page_limit.rb +80 -0
  43. data/lib/x/resources/pages.rb +270 -0
  44. data/lib/x/resources/parallel.rb +82 -0
  45. data/lib/x/resources/personalized_trend.rb +124 -0
  46. data/lib/x/resources/place.rb +107 -0
  47. data/lib/x/resources/poll.rb +75 -0
  48. data/lib/x/resources/post.rb +615 -0
  49. data/lib/x/resources/post_collections.rb +67 -0
  50. data/lib/x/resources/post_counts.rb +215 -0
  51. data/lib/x/resources/post_search.rb +86 -0
  52. data/lib/x/resources/post_usage.rb +203 -0
  53. data/lib/x/resources/post_writes.rb +140 -0
  54. data/lib/x/resources/published_count.rb +31 -0
  55. data/lib/x/resources/references.rb +121 -0
  56. data/lib/x/resources/relation_writes.rb +54 -0
  57. data/lib/x/resources/relationships.rb +77 -0
  58. data/lib/x/resources/resource.rb +535 -0
  59. data/lib/x/resources/serialization.rb +58 -0
  60. data/lib/x/resources/shape.rb +167 -0
  61. data/lib/x/resources/space.rb +332 -0
  62. data/lib/x/resources/topic.rb +59 -0
  63. data/lib/x/resources/trend.rb +130 -0
  64. data/lib/x/resources/user.rb +502 -0
  65. data/lib/x/resources/user_collections.rb +213 -0
  66. data/lib/x/resources/user_finders.rb +282 -0
  67. data/lib/x/resources/utils.rb +358 -0
  68. data/lib/x/resources/value_equality.rb +38 -0
  69. data/lib/x/resources/value_marshalling.rb +89 -0
  70. data/lib/x/resources/version.rb +25 -0
  71. data/lib/x/resources.rb +22 -0
  72. data/sig/manifest.yaml +7 -0
  73. data/sig/x-resources.rbs +813 -0
  74. metadata +140 -0
@@ -0,0 +1,813 @@
1
+ # The public interface of x-resources, as its @api public documentation states it. The modules the resource classes
2
+ # and X::Resources::API are built of, such as Finders, Relationships, and Lookups::Users, the helpers of the
3
+ # object layer, such as Utils, Pages, and Includes, and the constants, methods, and instance variables the code keeps
4
+ # private are declared in sig/internal/x-resources.rbs, which reopens the same modules and classes, so that Steep type
5
+ # checks the gem against them, but which the gem does not ship. The public methods those modules give a resource
6
+ # class, or a client that includes API, are declared here on the class, and on API.
7
+ module X
8
+ module Resources
9
+ class Error < ::X::Error
10
+ end
11
+ end
12
+
13
+ class MissingResource < Resources::Error
14
+ attr_reader problems: Array[Problem]
15
+
16
+ def initialize: (?String? message, ?problems: Array[Problem]) -> void
17
+ end
18
+
19
+ class UnreadableResponse < Resources::Error
20
+ end
21
+
22
+ class InvalidAttribute < UnreadableResponse
23
+ end
24
+
25
+ class MissingClient < Resources::Error
26
+ end
27
+
28
+ class PageLimitReached < Resources::Error
29
+ end
30
+
31
+ class Trend
32
+ FIELDS: Array[String]
33
+
34
+ attr_reader attrs: Hash[String, untyped]
35
+
36
+ def self.at: (Integer | String woeid, client: Resources::_Client, **untyped params) -> Array[Trend]
37
+ def initialize: (Hash[untyped, untyped] attrs) -> void
38
+ def to_h: () -> Hash[String, untyped]
39
+ | [K, V] () { (String key, untyped value) -> [K, V] } -> Hash[K, V]
40
+ def name: () -> String?
41
+ def post_count: () -> Integer?
42
+ def tweet_count: () -> Integer?
43
+ def ==: (untyped other) -> bool
44
+ def eql?: (untyped other) -> bool
45
+ def hash: () -> Integer
46
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
47
+ def as_json: (*untyped) -> Hash[String, untyped]
48
+ def to_json: (?JSON::State? state) -> String
49
+ def marshal_dump: () -> untyped
50
+ def marshal_load: (untyped state) -> void
51
+ def encode_with: (untyped coder) -> void
52
+ def init_with: (untyped coder) -> void
53
+ end
54
+
55
+ class PersonalizedTrend
56
+ FIELDS: Array[String]
57
+
58
+ attr_reader attrs: Hash[String, untyped]
59
+
60
+ def self.all: (client: Resources::_Client, **untyped params) -> Array[PersonalizedTrend]
61
+ def initialize: (Hash[untyped, untyped] attrs) -> void
62
+ def to_h: () -> Hash[String, untyped]
63
+ | [K, V] () { (String key, untyped value) -> [K, V] } -> Hash[K, V]
64
+ def name: () -> String?
65
+ def category: () -> String?
66
+ def post_count_text: () -> String?
67
+ def trending_since_text: () -> String?
68
+ def ==: (untyped other) -> bool
69
+ def eql?: (untyped other) -> bool
70
+ def hash: () -> Integer
71
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
72
+ def as_json: (*untyped) -> Hash[String, untyped]
73
+ def to_json: (?JSON::State? state) -> String
74
+ def marshal_dump: () -> untyped
75
+ def marshal_load: (untyped state) -> void
76
+ def encode_with: (untyped coder) -> void
77
+ def init_with: (untyped coder) -> void
78
+ end
79
+
80
+ class PostUsage
81
+ FIELDS: Array[String]
82
+
83
+ attr_reader attrs: Hash[String, untyped]
84
+
85
+ def self.current: (client: Resources::_Client, **untyped params) ?{ (Problem problem) -> void } -> PostUsage?
86
+ def self.current!: (client: Resources::_Client, **untyped params) -> PostUsage
87
+ def initialize: (Hash[untyped, untyped] attrs) -> void
88
+ def to_h: () -> Hash[String, untyped]
89
+ | [K, V] () { (String key, untyped value) -> [K, V] } -> Hash[K, V]
90
+ def project_id: () -> Integer?
91
+ def project_usage: () -> Integer?
92
+ def project_cap: () -> Integer?
93
+ def cap_reset_day: () -> Integer?
94
+ def daily: () -> Hash[Time, Integer]
95
+ def daily_by_app: () -> Hash[Integer?, Hash[Time, Integer]]
96
+ def ==: (untyped other) -> bool
97
+ def eql?: (untyped other) -> bool
98
+ def hash: () -> Integer
99
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
100
+ def as_json: (*untyped) -> Hash[String, untyped]
101
+ def to_json: (?JSON::State? state) -> String
102
+ def marshal_dump: () -> untyped
103
+ def marshal_load: (untyped state) -> void
104
+ def encode_with: (untyped coder) -> void
105
+ def init_with: (untyped coder) -> void
106
+ end
107
+
108
+ module Resources
109
+ VERSION: String
110
+
111
+ def self.gem_version: () -> Gem::Version
112
+
113
+ type attrs = Hash[String, untyped]
114
+ type params = Hash[String | Symbol, untyped]
115
+ type query = Hash[String, untyped]
116
+ type body = Hash[String, untyped]?
117
+ type id = String | Integer | Resource
118
+
119
+ # What an upload returned, holding the identifier of the media: a Hash, or the uploaded media of x-uploads
120
+ interface _UploadedMedia
121
+ def fetch: (String key) -> untyped
122
+ end
123
+
124
+ # Media that holds a media key, such as the uploaded media of x-uploads, which media is looked up by
125
+ interface _MediaKeyHolder
126
+ def media_key: () -> String?
127
+ end
128
+
129
+ # One medium a new post or direct message attaches: what an upload returned, media such as X::Media, a media key,
130
+ # or a media identifier
131
+ type medium = _UploadedMedia | _MediaKeyHolder | String | Integer
132
+
133
+ # The media a new post or direct message attaches: one medium, a list of them, or nil for none
134
+ type media_ids = (medium | Array[medium])?
135
+
136
+ # What the object layer asks to make its requests: X::Client, or any other client that answers these four
137
+ # methods, since x-resources makes no request of its own. The endpoint carries the query, which the object layer
138
+ # builds, and array_class and object_class say what the response is parsed into, which is plain hashes and
139
+ # arrays wherever the object layer reads a response itself. A client that also answers app_only, authenticator,
140
+ # or current_user_id is asked for them where they save a request: without app_only, an endpoint that refuses
141
+ # the OAuth 1.0a of a user is requested with the client itself; without authenticator, the authenticated user
142
+ # is looked up rather than read from the access token that names them; and without current_user_id, a check of
143
+ # whether one user follows another scans rather than reads connection_status. A release within 1.x may pass any
144
+ # other keyword X::Client takes for the same method, such as params: or headers:, so each takes the rest of its
145
+ # keywords untyped.
146
+ interface _Client
147
+ def get: (String endpoint, ?array_class: Class, ?object_class: untyped, **untyped) -> untyped
148
+ def post: (String endpoint, ?(String | Hash[untyped, untyped])? body, ?array_class: Class, ?object_class: untyped, **untyped) -> untyped
149
+ def put: (String endpoint, ?(String | Hash[untyped, untyped])? body, ?array_class: Class, ?object_class: untyped, **untyped) -> untyped
150
+ def delete: (String endpoint, ?array_class: Class, ?object_class: untyped, **untyped) -> untyped
151
+ end
152
+
153
+ # The class side of every concrete resource class, typed with that class
154
+ interface _ResourceClass[R < Resource]
155
+ def new: (Hash[untyped, untyped] attrs, ?client: _Client?, ?hydrated: bool) -> R
156
+ def from_id: (id id, ?client: _Client?) -> R
157
+ def from_response: (body body, client: _Client?, ?hydrated: bool, **untyped) -> (R | Page[R])?
158
+ end
159
+
160
+ # The class-side lookups of a concrete resource class the API looks up by identifier, typed with that class
161
+ interface _Lookup[R]
162
+ def find: (id id, client: _Client, **untyped params) ?{ (Problem problem) -> void } -> R?
163
+ def find!: (id id, client: _Client, **untyped params) -> R
164
+ end
165
+
166
+ # The class-side lookups of a concrete resource class the API looks up many at a time, typed with that class
167
+ interface _BatchLookup[R]
168
+ def find_all: (Array[id] ids, client: _Client, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[R]
169
+ def hydrate_all: (Array[R?] resources, client: _Client, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[R]
170
+ end
171
+
172
+ # The instance-side hydration of a concrete resource class, typed with that class
173
+ interface _Hydration[R]
174
+ def hydrate: () -> R?
175
+ def refresh: () -> R?
176
+ end
177
+
178
+ module API : _Client
179
+ def find_user: (id | String id_or_username, **untyped params) ?{ (Problem problem) -> void } -> User?
180
+ def find_user!: (id | String id_or_username, **untyped params) -> User
181
+ def find_user_by_username: (String username, **untyped params) ?{ (Problem problem) -> void } -> User?
182
+ def find_user_by_username!: (String username, **untyped params) -> User
183
+ def find_all_users: (Array[id | String] ids_or_usernames, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[User]
184
+ def find_all_users_by_username: (Array[String] usernames, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[User]
185
+ def find_user_by_id: (id id, **untyped params) ?{ (Problem problem) -> void } -> User?
186
+ def find_user_by_id!: (id id, **untyped params) -> User
187
+ def find_all_users_by_id: (Array[id] ids, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[User]
188
+ def current_user: (**untyped params) ?{ (Problem problem) -> void } -> User?
189
+ def current_user!: (**untyped params) -> User
190
+ def current_user_id: () -> Integer
191
+ def search_users: (String query, **untyped params) -> Cursor[User]
192
+ def find_post: (id id, **untyped params) ?{ (Problem problem) -> void } -> Post?
193
+ def find_tweet: (id id, **untyped params) ?{ (Problem problem) -> void } -> Post?
194
+ def find_post!: (id id, **untyped params) -> Post
195
+ def find_tweet!: (id id, **untyped params) -> Post
196
+ def find_all_posts: (Array[id] ids, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[Post]
197
+ def find_all_tweets: (Array[id] ids, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[Post]
198
+ def search_posts: (String query, **untyped params) -> Cursor[Post]
199
+ def search_tweets: (String query, **untyped params) -> Cursor[Post]
200
+ def search_all_posts: (String query, **untyped params) -> Cursor[Post]
201
+ def reposts_of_me: (**untyped params) -> Cursor[Post]
202
+ def retweets_of_me: (**untyped params) -> Cursor[Post]
203
+ def search_all_tweets: (String query, **untyped params) -> Cursor[Post]
204
+ def post_usage: (**untyped params) ?{ (Problem problem) -> void } -> PostUsage?
205
+ def post_usage!: (**untyped params) -> PostUsage
206
+ def count_posts: (String query, ?max_pages: Integer?, **untyped params) -> Integer
207
+ def count_tweets: (String query, ?max_pages: Integer?, **untyped params) -> Integer
208
+ def count_all_posts: (String query, ?max_pages: Integer?, **untyped params) -> Integer
209
+ def count_all_tweets: (String query, ?max_pages: Integer?, **untyped params) -> Integer
210
+ def count_posts_by_period: (String query, ?max_pages: Integer?, **untyped params) -> Hash[Range[Time], Integer]
211
+ def count_tweets_by_period: (String query, ?max_pages: Integer?, **untyped params) -> Hash[Range[Time], Integer]
212
+ def count_all_posts_by_period: (String query, ?max_pages: Integer?, **untyped params) -> Hash[Range[Time], Integer]
213
+ def count_all_tweets_by_period: (String query, ?max_pages: Integer?, **untyped params) -> Hash[Range[Time], Integer]
214
+ def find_list: (id id, **untyped params) ?{ (Problem problem) -> void } -> List?
215
+ def find_list!: (id id, **untyped params) -> List
216
+ def find_space: (id id, **untyped params) ?{ (Problem problem) -> void } -> Space?
217
+ def find_space!: (id id, **untyped params) -> Space
218
+ def find_all_spaces: (Array[id] ids, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[Space]
219
+ def search_spaces: (String query, **untyped params) -> Cursor[Space]
220
+ def find_all_spaces_by_creator: (Array[id] users, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[Space]
221
+ def find_media: (String | _MediaKeyHolder media_key, **untyped params) ?{ (Problem problem) -> void } -> X::Media?
222
+ def find_all_media: (Array[String | _MediaKeyHolder] media, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[X::Media]
223
+ def find_media!: (String | _MediaKeyHolder media_key, **untyped params) -> X::Media
224
+ def find_community: (id id, **untyped params) ?{ (Problem problem) -> void } -> Community?
225
+ def find_community!: (id id, **untyped params) -> Community
226
+ def search_communities: (String query, **untyped params) -> Cursor[Community]
227
+ def trends: (Integer | String woeid, **untyped params) -> Array[Trend]
228
+ def personalized_trends: (**untyped params) -> Array[PersonalizedTrend]
229
+ def find_direct_message: (id id, **untyped params) ?{ (Problem problem) -> void } -> DirectMessage?
230
+ def find_dm: (id id, **untyped params) ?{ (Problem problem) -> void } -> DirectMessage?
231
+ def find_direct_message!: (id id, **untyped params) -> DirectMessage
232
+ def find_dm!: (id id, **untyped params) -> DirectMessage
233
+ def direct_messages: (**untyped params) -> Cursor[DirectMessage]
234
+ def dms: (**untyped params) -> Cursor[DirectMessage]
235
+ def direct_messages_with: (id user, **untyped params) -> Cursor[DirectMessage]
236
+ def dms_with: (id user, **untyped params) -> Cursor[DirectMessage]
237
+ def direct_messages_in: (DirectMessage | String | Integer conversation, **untyped params) -> Cursor[DirectMessage]
238
+ def dms_in: (DirectMessage | String | Integer conversation, **untyped params) -> Cursor[DirectMessage]
239
+ def create_post: (?String? text, ?reply_to: Resources::id?, ?quote: Resources::id?, ?media_ids: Resources::media_ids, ?community: Resources::id?, **untyped params) -> Post
240
+ def create_tweet: (?String? text, ?reply_to: Resources::id?, ?quote: Resources::id?, ?media_ids: Resources::media_ids, ?community: Resources::id?, **untyped params) -> Post
241
+ def delete_post: (id post) -> bool
242
+ def delete_tweet: (id post) -> bool
243
+ def hide_reply: (id post) -> bool
244
+ def unhide_reply: (id post) -> bool
245
+ def create_list: (String name, **untyped params) -> List
246
+ def update_list: (id list, **untyped params) -> bool
247
+ def delete_list: (id list) -> bool
248
+ def add_list_member: (id list, id user) -> bool
249
+ def remove_list_member: (id list, id user) -> bool
250
+ def follow_list: (id list) -> bool
251
+ def unfollow_list: (id list) -> bool
252
+ def pin_list: (id list) -> bool
253
+ def unpin_list: (id list) -> bool
254
+ def create_direct_message: (id user, ?String? text, ?media_ids: Resources::media_ids, **untyped params) -> DirectMessage
255
+ def create_dm: (id user, ?String? text, ?media_ids: Resources::media_ids, **untyped params) -> DirectMessage
256
+ def create_group_direct_message: (Array[id] users, ?String? text, ?media_ids: Resources::media_ids, **untyped params) -> DirectMessage
257
+ def create_group_dm: (Array[id] users, ?String? text, ?media_ids: Resources::media_ids, **untyped params) -> DirectMessage
258
+ def create_direct_message_in: (DirectMessage | String | Integer conversation, ?String? text, ?media_ids: Resources::media_ids, **untyped params) -> DirectMessage
259
+ def create_dm_in: (DirectMessage | String | Integer conversation, ?String? text, ?media_ids: Resources::media_ids, **untyped params) -> DirectMessage
260
+ def delete_direct_message: (id message) -> bool
261
+ def delete_dm: (id message) -> bool
262
+ def follow: (id user) -> bool
263
+ def unfollow: (id user) -> bool
264
+ def block: (id user) -> bool
265
+ def unblock: (id user) -> bool
266
+ def mute: (id user) -> bool
267
+ def unmute: (id user) -> bool
268
+ def like: (id post) -> bool
269
+ def unlike: (id post) -> bool
270
+ def repost: (id post) -> bool
271
+ def retweet: (id post) -> bool
272
+ def unrepost: (id post) -> bool
273
+ def unretweet: (id post) -> bool
274
+ def bookmark: (id post) -> bool
275
+ def unbookmark: (id post) -> bool
276
+ end
277
+ end
278
+
279
+ class Resource
280
+ attr_reader attrs: Resources::attrs
281
+ attr_reader client: Resources::_Client?
282
+
283
+ def self.default_params: () -> Hash[String, Array[String]]
284
+ private def self.new: (Hash[untyped, untyped] attrs, ?client: Resources::_Client?, ?hydrated: bool) -> instance
285
+ private def self.from_id: (Resources::id id, ?client: Resources::_Client?) -> Resource
286
+ private def self.from_response: (Resources::body body, client: Resources::_Client?, ?hydrated: bool, **untyped) -> (Resource | Page[Resource])?
287
+
288
+ def initialize: (Hash[untyped, untyped] attrs, ?client: Resources::_Client?, ?hydrated: bool) -> void
289
+ def id: () -> (Integer | String)
290
+ def to_h: () -> Resources::attrs
291
+ | [K, V] () { (String key, untyped value) -> [K, V] } -> Hash[K, V]
292
+ def problems: () -> Array[Problem]
293
+ def hydrated?: () -> bool
294
+ def stub?: () -> bool
295
+ def hydrate: () -> Resource?
296
+ def refresh: () -> Resource?
297
+ def ==: (untyped other) -> bool
298
+ def eql?: (untyped other) -> bool
299
+ def hash: () -> Integer
300
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
301
+ def as_json: (*untyped) -> Hash[String, untyped]
302
+ def to_json: (?JSON::State? state) -> String
303
+ def marshal_dump: () -> untyped
304
+ def marshal_load: (untyped state) -> void
305
+ def encode_with: (untyped coder) -> void
306
+ def init_with: (untyped coder) -> void
307
+ def inspect: () -> String
308
+ end
309
+
310
+ class Page[R < Resource = Resource]
311
+ include Enumerable[R]
312
+
313
+ attr_reader items: Array[R]
314
+ attr_reader meta: Hash[String, untyped]
315
+ attr_reader problems: Array[Problem]
316
+
317
+ def initialize: (Array[R] items, ?meta: Hash[untyped, untyped], ?problems: Array[Problem]) -> void
318
+ def each: () { (R) -> void } -> self
319
+ | () -> Enumerator[R, self]
320
+ def to_a: () -> Array[R]
321
+ def entries: () -> Array[R]
322
+ def size: () -> Integer
323
+ def length: () -> Integer
324
+ def empty?: () -> bool
325
+ def []: (Integer index) -> R?
326
+ | (Integer start, Integer length) -> Array[R]?
327
+ | (Range[Integer?] range) -> Array[R]?
328
+ def last: () -> R?
329
+ | (Integer count) -> Array[R]
330
+ def next_token: () -> String?
331
+ def previous_token: () -> String?
332
+ def result_count: () -> Integer?
333
+ def ==: (untyped other) -> bool
334
+ def eql?: (untyped other) -> bool
335
+ def hash: () -> Integer
336
+ def as_json: (*untyped) -> Hash[String, untyped]
337
+ def to_h: () -> Hash[String, untyped]
338
+ | [K, V] () { (R resource) -> [K, V] } -> Hash[K, V]
339
+ def to_json: (?JSON::State? state) -> String
340
+ def marshal_dump: () -> untyped
341
+ def marshal_load: (untyped state) -> void
342
+ def encode_with: (untyped coder) -> void
343
+ def init_with: (untyped coder) -> void
344
+ end
345
+
346
+ class Cursor[R < Resource = Resource]
347
+ include Enumerable[R]
348
+
349
+ private def self.new: () -> instance
350
+
351
+ attr_reader resource_class: singleton(Resource)
352
+ attr_reader client: Resources::_Client
353
+
354
+ def prefetch?: () -> bool
355
+ def each: () { (R) -> void } -> self
356
+ | () -> Enumerator[R, self]
357
+ def each_page: () { (Page[R]) -> void } -> self
358
+ | () -> Enumerator[Page[R], self]
359
+ def page: (Integer index) -> Page[R]?
360
+ def refresh: () -> Cursor[R]
361
+ def prefetch: () -> Cursor[R]
362
+ def stubs: () -> Cursor[R]
363
+ def first: () -> R?
364
+ | (Integer count) -> Array[R]
365
+ def take: (Integer count) -> Array[R]
366
+ def to_a: () -> Array[R]
367
+ def entries: () -> Array[R]
368
+ def ids: () -> Array[Integer | String]
369
+ def any?: (*untyped pattern) ?{ (R) -> boolish } -> bool
370
+ def none?: (*untyped pattern) ?{ (R) -> boolish } -> bool
371
+ def empty?: () -> bool
372
+ def one?: (*untyped pattern) ?{ (R) -> boolish } -> bool
373
+ def published_count: () -> Integer?
374
+ def as_json: (*untyped) -> bot
375
+ def to_h: () -> bot
376
+ | [K, V] () { (R resource) -> [K, V] } -> Hash[K, V]
377
+ def to_json: (?JSON::State? state) -> bot
378
+ def marshal_dump: () -> bot
379
+ def encode_with: (untyped coder) -> bot
380
+ def inspect: () -> String
381
+ end
382
+
383
+ # Media is looked up by its media key, or by what holds one, and not by the numeric identifier an upload returns, so
384
+ # it declares its lookups rather than take those of the resources looked up by any identifier
385
+ class Media < Resource
386
+ include Resources::_Hydration[Media]
387
+ FIELDS: Array[String]
388
+
389
+ def id: () -> String
390
+
391
+ def self.find: (String | Resources::_MediaKeyHolder media, client: Resources::_Client, **untyped params) ?{ (Problem problem) -> void } -> Media?
392
+ def self.find_all: (Array[String | Resources::_MediaKeyHolder] media, client: Resources::_Client, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[Media]
393
+ def self.find!: (String | Resources::_MediaKeyHolder media, client: Resources::_Client, **untyped params) -> Media
394
+ def self.new: (Hash[untyped, untyped] attrs, ?client: Resources::_Client?, ?hydrated: bool) -> Media
395
+ def self.from_id: (String | Resources::_MediaKeyHolder media, ?client: Resources::_Client?) -> Media
396
+ def self.from_response: (Resources::body body, client: Resources::_Client?, ?hydrated: bool, **untyped) -> (Media | Page[Media])?
397
+ def self.hydrate_all: (Array[Media?] resources, client: Resources::_Client, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[Media]
398
+ def self.default_params: () -> Hash[String, Array[String]]
399
+ def media_key: () -> String
400
+ def media_id: () -> Integer
401
+ def type: () -> String?
402
+ def url: () -> String?
403
+ def preview_image_url: () -> String?
404
+ def alt_text: () -> String?
405
+ def duration_ms: () -> Integer?
406
+ def height: () -> Integer?
407
+ def width: () -> Integer?
408
+ def variants: () -> Array[Hash[String, untyped]]
409
+ def public_metrics: () -> Hash[String, untyped]?
410
+ def view_count: () -> Integer?
411
+ end
412
+
413
+ class BookmarkFolder < Resource
414
+ extend Resources::_ResourceClass[BookmarkFolder]
415
+ include Resources::_Hydration[BookmarkFolder]
416
+
417
+ def id: () -> Integer
418
+
419
+ def name: () -> String?
420
+ end
421
+
422
+ class Poll < Resource
423
+ extend Resources::_ResourceClass[Poll]
424
+ include Resources::_Hydration[Poll]
425
+ FIELDS: Array[String]
426
+
427
+ def self.default_params: () -> Hash[String, Array[String]]
428
+
429
+ def id: () -> Integer
430
+
431
+ def options: () -> Array[Hash[String, untyped]]
432
+ def duration_minutes: () -> Integer?
433
+ def end_datetime: () -> Time?
434
+ def voting_status: () -> String?
435
+ end
436
+
437
+ class Topic < Resource
438
+ extend Resources::_ResourceClass[Topic]
439
+ include Resources::_Hydration[Topic]
440
+ FIELDS: Array[String]
441
+
442
+ def self.default_params: () -> Hash[String, Array[String]]
443
+
444
+ def id: () -> Integer
445
+
446
+ def name: () -> String?
447
+ def description: () -> String?
448
+ end
449
+
450
+ class Place < Resource
451
+ extend Resources::_ResourceClass[Place]
452
+ include Resources::_Hydration[Place]
453
+ FIELDS: Array[String]
454
+
455
+ def self.default_params: () -> Hash[String, Array[String]]
456
+
457
+ def id: () -> String
458
+
459
+ def name: () -> String?
460
+ def full_name: () -> String?
461
+ def country: () -> String?
462
+ def country_code: () -> String?
463
+ def place_type: () -> String?
464
+ def contained_within: () -> Array[String]
465
+ def geo: () -> Hash[String, untyped]?
466
+ end
467
+
468
+ class User < Resource
469
+ extend Resources::_ResourceClass[User]
470
+ extend Resources::_Lookup[User]
471
+ extend Resources::_BatchLookup[User]
472
+ include Resources::_Hydration[User]
473
+ def id: () -> Integer
474
+
475
+ FIELDS: Array[String]
476
+ EXPANSIONS: Array[String]
477
+
478
+ def self.default_params: () -> Hash[String, Array[String]]
479
+ def self.find_by_id: (Resources::id id, client: Resources::_Client, **untyped params) ?{ (Problem problem) -> void } -> User?
480
+ def self.find_by_id!: (Resources::id id, client: Resources::_Client, **untyped params) -> User
481
+ def self.find_all_by_id: (Array[Resources::id] ids, client: Resources::_Client, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[User]
482
+ def self.find_by_username: (String username, client: Resources::_Client, **untyped params) ?{ (Problem problem) -> void } -> User?
483
+ def self.find_by_username!: (String username, client: Resources::_Client, **untyped params) -> User
484
+ def self.find_all_by_username: (Array[String] usernames, client: Resources::_Client, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[User]
485
+ def self.current: (client: Resources::_Client, **untyped params) ?{ (Problem problem) -> void } -> User?
486
+ def self.current!: (client: Resources::_Client, **untyped params) -> User
487
+ def self.search: (String query, client: Resources::_Client, **untyped params) -> Cursor[User]
488
+
489
+ def name: () -> String?
490
+ def username: () -> String?
491
+ def description: () -> String?
492
+ def location: () -> String?
493
+ def url: () -> String?
494
+ def profile_image_url: () -> String?
495
+ def profile_banner_url: () -> String?
496
+ def created_at: () -> Time?
497
+ def protected: () -> bool?
498
+ def protected?: () -> bool
499
+ def verified: () -> bool?
500
+ def verified?: () -> bool
501
+ def verified_type: () -> String?
502
+ def parody: () -> bool?
503
+ def parody?: () -> bool
504
+ def identity_verified: () -> bool?
505
+ def identity_verified?: () -> bool
506
+ def subscription_type: () -> String?
507
+ def affiliation: () -> Hash[String, untyped]?
508
+ def affiliated_with_ids: () -> Array[Integer]
509
+ def verified_followers_count: () -> Integer?
510
+ def subscriber_count: () -> Integer?
511
+ def connection_status: () -> Array[String]?
512
+ def receives_your_dm: () -> bool?
513
+ def receives_your_dm?: () -> bool
514
+ def subscribes_to_you: () -> bool?
515
+ def subscribes_to_you?: () -> bool
516
+ def subscription: () -> Hash[String, untyped]?
517
+ def pinned_post_id: () -> Integer?
518
+ def pinned_tweet_id: () -> Integer?
519
+ def most_recent_post_id: () -> Integer?
520
+ def most_recent_tweet_id: () -> Integer?
521
+ def entities: () -> Hash[String, untyped]?
522
+ def withheld: () -> Hash[String, untyped]?
523
+ def public_metrics: () -> Hash[String, untyped]?
524
+ def followers_count: () -> Integer?
525
+ def following_count: () -> Integer?
526
+ def tweet_count: () -> Integer?
527
+ def post_count: () -> Integer?
528
+ def listed_count: () -> Integer?
529
+ def like_count: () -> Integer?
530
+ def media_count: () -> Integer?
531
+ def pinned_post: () -> Post?
532
+ def pinned_tweet: () -> Post?
533
+ def most_recent_post: () -> Post?
534
+ def most_recent_tweet: () -> Post?
535
+ def affiliated_with: () -> Array[User]
536
+ def permalink: () -> String
537
+ def uri: () -> URI::Generic
538
+ def followers: (**untyped params) -> Cursor[User]
539
+ def following: (**untyped params) -> Cursor[User]
540
+ def blocking: (**untyped params) -> Cursor[User]
541
+ def muting: (**untyped params) -> Cursor[User]
542
+ def affiliates: (**untyped params) -> Cursor[User]
543
+ def posts: (**untyped params) -> Cursor[Post]
544
+ def tweets: (**untyped params) -> Cursor[Post]
545
+ def home_timeline: (**untyped params) -> Cursor[Post]
546
+ def mentions: (**untyped params) -> Cursor[Post]
547
+ def liked_posts: (**untyped params) -> Cursor[Post]
548
+ def liked_tweets: (**untyped params) -> Cursor[Post]
549
+ def bookmarks: (?folder: Resources::id?, **untyped params) -> Cursor[Post]
550
+ def bookmark_folders: (**untyped params) -> Cursor[BookmarkFolder]
551
+ def owned_lists: (**untyped params) -> Cursor[List]
552
+ def list_memberships: (**untyped params) -> Cursor[List]
553
+ def followed_lists: (**untyped params) -> Cursor[List]
554
+ def pinned_lists: (**untyped params) -> Cursor[List]
555
+ def follows?: (Resources::id user, ?max_pages: Integer?) -> bool
556
+ end
557
+
558
+ class Post < Resource
559
+ extend Resources::_ResourceClass[Post]
560
+ extend Resources::_Lookup[Post]
561
+ extend Resources::_BatchLookup[Post]
562
+ include Resources::_Hydration[Post]
563
+ def id: () -> Integer
564
+
565
+ FIELDS: Array[String]
566
+ EXPANSIONS: Array[String]
567
+
568
+ def self.default_params: () -> Hash[String, Array[String]]
569
+ def self.search: (String query, client: Resources::_Client, **untyped params) -> Cursor[Post]
570
+ def self.search_all: (String query, client: Resources::_Client, **untyped params) -> Cursor[Post]
571
+ def self.reposts_of_me: (client: Resources::_Client, **untyped params) -> Cursor[Post]
572
+ def self.retweets_of_me: (client: Resources::_Client, **untyped params) -> Cursor[Post]
573
+ def self.count: (String query, client: Resources::_Client, ?max_pages: Integer?, **untyped params) -> Integer
574
+ def self.count_all: (String query, client: Resources::_Client, ?max_pages: Integer?, **untyped params) -> Integer
575
+ def self.count_by_period: (String query, client: Resources::_Client, ?max_pages: Integer?, **untyped params) -> Hash[Range[Time], Integer]
576
+ def self.count_all_by_period: (String query, client: Resources::_Client, ?max_pages: Integer?, **untyped params) -> Hash[Range[Time], Integer]
577
+ def self.create: (?String? text, client: Resources::_Client, ?reply_to: Resources::id?, ?quote: Resources::id?, ?media_ids: Resources::media_ids, ?community: Resources::id?, **untyped params) -> Post
578
+ def self.delete: (Resources::id post, client: Resources::_Client) -> bool
579
+ def self.hide_reply: (Resources::id post, client: Resources::_Client) -> bool
580
+ def self.unhide_reply: (Resources::id post, client: Resources::_Client) -> bool
581
+
582
+ def text: () -> String?
583
+ def lang: () -> String?
584
+ def created_at: () -> Time?
585
+ def author_id: () -> Integer?
586
+ def conversation_id: () -> Integer?
587
+ def community_id: () -> Integer?
588
+ def in_reply_to_user_id: () -> Integer?
589
+ def possibly_sensitive: () -> bool?
590
+ def possibly_sensitive?: () -> bool
591
+ def reply_settings: () -> String?
592
+ def edit_history_post_ids: () -> Array[Integer]
593
+ def edit_history_tweet_ids: () -> Array[Integer]
594
+ def edit_controls: () -> Hash[String, untyped]?
595
+ def display_text_range: () -> Range[Integer]?
596
+ def scopes: () -> Hash[String, untyped]?
597
+ def card_uri: () -> String?
598
+ def article: () -> Hash[String, untyped]?
599
+ def article_title: () -> Hash[String, untyped]?
600
+ def media_metadata: () -> Array[Hash[String, untyped]]
601
+ def paid_partnership: () -> bool?
602
+ def paid_partnership?: () -> bool
603
+ def entities: () -> Hash[String, untyped]?
604
+ def urls: () -> Array[Hash[String, untyped]]
605
+ def context_annotations: () -> Array[Hash[String, untyped]]
606
+ def referenced_posts: () -> Array[Hash[String, String]]
607
+ def referenced_tweets: () -> Array[Hash[String, String]]
608
+ def attachments: () -> Hash[String, untyped]?
609
+ def coordinates: () -> Array[Numeric]?
610
+ def geo: () -> Hash[String, untyped]?
611
+ def withheld: () -> Hash[String, untyped]?
612
+ def note_post: () -> Hash[String, untyped]?
613
+ def note_tweet: () -> Hash[String, untyped]?
614
+ def public_metrics: () -> Hash[String, untyped]?
615
+ def retweet_count: () -> Integer?
616
+ def repost_count: () -> Integer?
617
+ def reply_count: () -> Integer?
618
+ def like_count: () -> Integer?
619
+ def quote_count: () -> Integer?
620
+ def bookmark_count: () -> Integer?
621
+ def impression_count: () -> Integer?
622
+ def matching_rules: () -> Array[MatchingRule]
623
+ def author: () -> User?
624
+ def in_reply_to_user: () -> User?
625
+ def community: () -> Community?
626
+ def place: () -> Place?
627
+ def media: () -> Array[Media]
628
+ def polls: () -> Array[Poll]
629
+ def media_source_posts: () -> Array[Post]
630
+ def media_source_tweets: () -> Array[Post]
631
+ def references: () -> Array[Post]
632
+ def replied_to: () -> Post?
633
+ def quoted: () -> Post?
634
+ def reposted: () -> Post?
635
+ def retweeted: () -> Post?
636
+ def reply?: () -> bool
637
+ def quote?: () -> bool
638
+ def repost?: () -> bool
639
+ def retweet?: () -> bool
640
+ def liked_by: (**untyped params) -> Cursor[User]
641
+ def reposted_by: (**untyped params) -> Cursor[User]
642
+ def retweeted_by: (**untyped params) -> Cursor[User]
643
+ def reposts: (**untyped params) -> Cursor[Post]
644
+ def retweets: (**untyped params) -> Cursor[Post]
645
+ def quotes: (**untyped params) -> Cursor[Post]
646
+ def quote_tweets: (**untyped params) -> Cursor[Post]
647
+ def permalink: () -> String
648
+ def uri: () -> URI::Generic
649
+ def expanded_text: () -> String?
650
+ def delete: () -> bool
651
+ def hide_reply: () -> bool
652
+ def unhide_reply: () -> bool
653
+ end
654
+
655
+ class Tweet = Post
656
+
657
+ class MatchingRule
658
+ attr_reader attrs: Hash[String, untyped]
659
+
660
+ def initialize: (Hash[untyped, untyped] attrs) -> void
661
+ def id: () -> Integer
662
+ def tag: () -> String?
663
+ def to_h: () -> Hash[String, untyped]
664
+ | [K, V] () { (String key, untyped value) -> [K, V] } -> Hash[K, V]
665
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, Integer | String | nil]
666
+ def ==: (untyped other) -> bool
667
+ def eql?: (untyped other) -> bool
668
+ def hash: () -> Integer
669
+ def as_json: (*untyped) -> Hash[String, untyped]
670
+ def to_json: (?JSON::State? state) -> String
671
+ def marshal_dump: () -> untyped
672
+ def marshal_load: (untyped state) -> void
673
+ def encode_with: (untyped coder) -> void
674
+ def init_with: (untyped coder) -> void
675
+ def inspect: () -> String
676
+ end
677
+
678
+ class Community < Resource
679
+ extend Resources::_ResourceClass[Community]
680
+ extend Resources::_Lookup[Community]
681
+ include Resources::_Hydration[Community]
682
+ FIELDS: Array[String]
683
+
684
+ def id: () -> Integer
685
+
686
+ def self.default_params: () -> Hash[String, Array[String]]
687
+ def self.search: (String query, client: Resources::_Client, **untyped params) -> Cursor[Community]
688
+
689
+ def name: () -> String?
690
+ def description: () -> String?
691
+ def created_at: () -> Time?
692
+ def member_count: () -> Integer?
693
+ def access: () -> String?
694
+ def join_policy: () -> String?
695
+ def permalink: () -> String
696
+ def uri: () -> URI::Generic
697
+ end
698
+
699
+ class List < Resource
700
+ extend Resources::_ResourceClass[List]
701
+ extend Resources::_Lookup[List]
702
+ include Resources::_Hydration[List]
703
+ FIELDS: Array[String]
704
+ EXPANSIONS: Array[String]
705
+
706
+ def id: () -> Integer
707
+
708
+ def self.default_params: () -> Hash[String, Array[String]]
709
+ def self.create: (String name, client: Resources::_Client, **untyped params) -> List
710
+ def self.update: (Resources::id list, client: Resources::_Client, **untyped params) -> bool
711
+ def self.delete: (Resources::id list, client: Resources::_Client) -> bool
712
+
713
+ def name: () -> String?
714
+ def description: () -> String?
715
+ def created_at: () -> Time?
716
+ def follower_count: () -> Integer?
717
+ def member_count: () -> Integer?
718
+ def owner_id: () -> Integer?
719
+ def private: () -> bool?
720
+ def private?: () -> bool
721
+ def owner: () -> User?
722
+ def members: (**untyped params) -> Cursor[User]
723
+ def followers: (**untyped params) -> Cursor[User]
724
+ def posts: (**untyped params) -> Cursor[Post]
725
+ def tweets: (**untyped params) -> Cursor[Post]
726
+ def permalink: () -> String
727
+ def uri: () -> URI::Generic
728
+ def member?: (Resources::id user, ?max_pages: Integer?) -> bool
729
+ def add_member: (Resources::id user) -> bool
730
+ def update: (**untyped params) -> bool
731
+ def remove_member: (Resources::id user) -> bool
732
+ def delete: () -> bool
733
+ end
734
+
735
+ class DirectMessage < Resource
736
+ extend Resources::_ResourceClass[DirectMessage]
737
+ extend Resources::_Lookup[DirectMessage]
738
+ include Resources::_Hydration[DirectMessage]
739
+ FIELDS: Array[String]
740
+ EXPANSIONS: Array[String]
741
+
742
+ def id: () -> Integer
743
+
744
+ def self.default_params: () -> Hash[String, Array[String]]
745
+ def self.all: (client: Resources::_Client, **untyped params) -> Cursor[DirectMessage]
746
+ def self.with: (Resources::id user, client: Resources::_Client, **untyped params) -> Cursor[DirectMessage]
747
+ def self.create: (Resources::id user, ?String? text, client: Resources::_Client, ?media_ids: Resources::media_ids, **untyped params) -> DirectMessage
748
+ def self.create_group: (Array[Resources::id] users, ?String? text, client: Resources::_Client, ?media_ids: Resources::media_ids, **untyped params) -> DirectMessage
749
+ def self.create_in: (DirectMessage | String | Integer conversation, ?String? text, client: Resources::_Client, ?media_ids: Resources::media_ids, **untyped params) -> DirectMessage
750
+ def self.`in`: (DirectMessage | String | Integer conversation, client: Resources::_Client, **untyped params) -> Cursor[DirectMessage]
751
+ def self.delete: (Resources::id message, client: Resources::_Client) -> bool
752
+
753
+ def text: () -> String?
754
+ def event_type: () -> String?
755
+ def created_at: () -> Time?
756
+ def sender_id: () -> Integer?
757
+ def dm_conversation_id: () -> String?
758
+ def participant_ids: () -> Array[Integer]
759
+ def referenced_posts: () -> Array[Hash[String, String]]
760
+ def referenced_tweets: () -> Array[Hash[String, String]]
761
+ def attachments: () -> Hash[String, untyped]?
762
+ def entities: () -> Hash[String, untyped]?
763
+ def sender: () -> User?
764
+ def participants: () -> Array[User]
765
+ def media: () -> Array[Media]
766
+ def references: () -> Array[Post]
767
+ def from?: (Resources::id user) -> bool
768
+ def group?: () -> bool
769
+ def peer: (Resources::id user) -> User?
770
+ def delete: () -> bool
771
+ end
772
+
773
+ class Space < Resource
774
+ extend Resources::_ResourceClass[Space]
775
+ extend Resources::_Lookup[Space]
776
+ extend Resources::_BatchLookup[Space]
777
+ include Resources::_Hydration[Space]
778
+ FIELDS: Array[String]
779
+ EXPANSIONS: Array[String]
780
+
781
+ def id: () -> String
782
+
783
+ def self.default_params: () -> Hash[String, Array[String]]
784
+ def self.search: (String query, client: Resources::_Client, **untyped params) -> Cursor[Space]
785
+ def self.find_all_by_creator: (Array[Resources::id] users, client: Resources::_Client, ?concurrency: Integer, **untyped params) ?{ (Problem problem) -> void } -> Array[Space]
786
+
787
+ def title: () -> String?
788
+ def state: () -> String?
789
+ def lang: () -> String?
790
+ def created_at: () -> Time?
791
+ def started_at: () -> Time?
792
+ def ended_at: () -> Time?
793
+ def scheduled_start: () -> Time?
794
+ def updated_at: () -> Time?
795
+ def ticketed: () -> bool?
796
+ def ticketed?: () -> bool
797
+ def participant_count: () -> Integer?
798
+ def subscriber_count: () -> Integer?
799
+ def creator_id: () -> Integer?
800
+ def host_ids: () -> Array[Integer]
801
+ def speaker_ids: () -> Array[Integer]
802
+ def invited_user_ids: () -> Array[Integer]
803
+ def topic_ids: () -> Array[Integer]
804
+ def creator: () -> User?
805
+ def hosts: () -> Array[User]
806
+ def speakers: () -> Array[User]
807
+ def invited_users: () -> Array[User]
808
+ def topics: () -> Array[Topic]
809
+ def posts: (**untyped params) -> Cursor[Post]
810
+ def tweets: (**untyped params) -> Cursor[Post]
811
+ def buyers: (**untyped params) -> Cursor[User]
812
+ end
813
+ end