x_api_scraper 0.1.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.
- checksums.yaml +7 -0
- data/lib/crystalline/enum.rbi +17 -0
- data/lib/crystalline/metadata_fields.rb +265 -0
- data/lib/crystalline/module.rb +188 -0
- data/lib/crystalline/types.rb +170 -0
- data/lib/crystalline/utils.rb +69 -0
- data/lib/crystalline.rb +13 -0
- data/lib/x_api_scraper.rb +41 -0
- data/lib/xapi_scraper/account.rb +194 -0
- data/lib/xapi_scraper/actions.rb +2166 -0
- data/lib/xapi_scraper/analysis.rb +230 -0
- data/lib/xapi_scraper/articles.rb +410 -0
- data/lib/xapi_scraper/client.rb +133 -0
- data/lib/xapi_scraper/communities.rb +1352 -0
- data/lib/xapi_scraper/dm.rb +990 -0
- data/lib/xapi_scraper/engagement.rb +792 -0
- data/lib/xapi_scraper/followers.rb +420 -0
- data/lib/xapi_scraper/following.rb +230 -0
- data/lib/xapi_scraper/lists.rb +1156 -0
- data/lib/xapi_scraper/models/callbacks.rb +12 -0
- data/lib/xapi_scraper/models/components/accountverifymodel.rb +82 -0
- data/lib/xapi_scraper/models/components/accountverifymodel.rbi +38 -0
- data/lib/xapi_scraper/models/components/accountverifyresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/accountverifyresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/advancedsearchcursorquery.rb +51 -0
- data/lib/xapi_scraper/models/components/advancedsearchcursorquery.rbi +26 -0
- data/lib/xapi_scraper/models/components/advancedsearchcursorresponse.rb +76 -0
- data/lib/xapi_scraper/models/components/advancedsearchcursorresponse.rbi +38 -0
- data/lib/xapi_scraper/models/components/articleblock.rb +50 -0
- data/lib/xapi_scraper/models/components/articleblock.rbi +26 -0
- data/lib/xapi_scraper/models/components/articleblockrange.rb +47 -0
- data/lib/xapi_scraper/models/components/articleblockrange.rbi +26 -0
- data/lib/xapi_scraper/models/components/blockuserresponse.rb +54 -0
- data/lib/xapi_scraper/models/components/blockuserresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/bookmarkbody.rb +43 -0
- data/lib/xapi_scraper/models/components/bookmarkbody.rbi +20 -0
- data/lib/xapi_scraper/models/components/cashtagsquery.rb +192 -0
- data/lib/xapi_scraper/models/components/cashtagsquery.rbi +98 -0
- data/lib/xapi_scraper/models/components/cashtagsquery_language.rb +76 -0
- data/lib/xapi_scraper/models/components/cashtagsquery_language.rbi +9 -0
- data/lib/xapi_scraper/models/components/cashtagsquery_sortby.rb +18 -0
- data/lib/xapi_scraper/models/components/cashtagsquery_sortby.rbi +9 -0
- data/lib/xapi_scraper/models/components/communitymodel.rb +164 -0
- data/lib/xapi_scraper/models/components/communitymodel.rbi +92 -0
- data/lib/xapi_scraper/models/components/communitytweetsresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/communitytweetsresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/context.rb +25 -0
- data/lib/xapi_scraper/models/components/context.rbi +9 -0
- data/lib/xapi_scraper/models/components/conversationv3model.rb +57 -0
- data/lib/xapi_scraper/models/components/conversationv3model.rbi +32 -0
- data/lib/xapi_scraper/models/components/createthreaddata.rb +35 -0
- data/lib/xapi_scraper/models/components/createthreaddata.rbi +14 -0
- data/lib/xapi_scraper/models/components/createthreadquery.rb +51 -0
- data/lib/xapi_scraper/models/components/createthreadquery.rbi +26 -0
- data/lib/xapi_scraper/models/components/createthreadresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/createthreadresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/createthreadtweetitem.rb +31 -0
- data/lib/xapi_scraper/models/components/createthreadtweetitem.rbi +14 -0
- data/lib/xapi_scraper/models/components/deletebookmarkquery.rb +35 -0
- data/lib/xapi_scraper/models/components/deletebookmarkquery.rbi +14 -0
- data/lib/xapi_scraper/models/components/deleteretweetquery.rb +35 -0
- data/lib/xapi_scraper/models/components/deleteretweetquery.rbi +14 -0
- data/lib/xapi_scraper/models/components/deletetweetquery.rb +51 -0
- data/lib/xapi_scraper/models/components/deletetweetquery.rbi +26 -0
- data/lib/xapi_scraper/models/components/deletetweetresponse.rb +51 -0
- data/lib/xapi_scraper/models/components/deletetweetresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/dmhistoryv3data.rb +54 -0
- data/lib/xapi_scraper/models/components/dmhistoryv3data.rbi +26 -0
- data/lib/xapi_scraper/models/components/dmstatusmodelv2.rb +122 -0
- data/lib/xapi_scraper/models/components/dmstatusmodelv2.rbi +62 -0
- data/lib/xapi_scraper/models/components/dmstatusresponsev2.rb +47 -0
- data/lib/xapi_scraper/models/components/dmstatusresponsev2.rbi +26 -0
- data/lib/xapi_scraper/models/components/followersfollowingv3query.rb +51 -0
- data/lib/xapi_scraper/models/components/followersfollowingv3query.rbi +26 -0
- data/lib/xapi_scraper/models/components/followuserquery.rb +43 -0
- data/lib/xapi_scraper/models/components/followuserquery.rbi +20 -0
- data/lib/xapi_scraper/models/components/getalltweetsrepliescursorquery.rb +43 -0
- data/lib/xapi_scraper/models/components/getalltweetsrepliescursorquery.rbi +20 -0
- data/lib/xapi_scraper/models/components/getalltweetsrepliescursorresponse.rb +76 -0
- data/lib/xapi_scraper/models/components/getalltweetsrepliescursorresponse.rbi +38 -0
- data/lib/xapi_scraper/models/components/getcommunitymemberscursorquery.rb +43 -0
- data/lib/xapi_scraper/models/components/getcommunitymemberscursorquery.rbi +20 -0
- data/lib/xapi_scraper/models/components/getcommunitymemberscursorresponse.rb +72 -0
- data/lib/xapi_scraper/models/components/getcommunitymemberscursorresponse.rbi +38 -0
- data/lib/xapi_scraper/models/components/getcommunityresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/getcommunityresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/getcommunitytweetscursorquery.rb +60 -0
- data/lib/xapi_scraper/models/components/getcommunitytweetscursorquery.rbi +26 -0
- data/lib/xapi_scraper/models/components/getcommunitytweetscursorresponse.rb +72 -0
- data/lib/xapi_scraper/models/components/getcommunitytweetscursorresponse.rbi +38 -0
- data/lib/xapi_scraper/models/components/getconversationsv3query.rb +62 -0
- data/lib/xapi_scraper/models/components/getconversationsv3query.rbi +32 -0
- data/lib/xapi_scraper/models/components/getconversationsv3response.rb +47 -0
- data/lib/xapi_scraper/models/components/getconversationsv3response.rbi +26 -0
- data/lib/xapi_scraper/models/components/getdmhistoryv3query.rb +94 -0
- data/lib/xapi_scraper/models/components/getdmhistoryv3query.rbi +50 -0
- data/lib/xapi_scraper/models/components/getdmhistoryv3response.rb +47 -0
- data/lib/xapi_scraper/models/components/getdmhistoryv3response.rbi +26 -0
- data/lib/xapi_scraper/models/components/getdmmediav3data.rb +77 -0
- data/lib/xapi_scraper/models/components/getdmmediav3data.rbi +44 -0
- data/lib/xapi_scraper/models/components/getdmmediav3query.rb +112 -0
- data/lib/xapi_scraper/models/components/getdmmediav3query.rbi +56 -0
- data/lib/xapi_scraper/models/components/getdmmediav3response.rb +47 -0
- data/lib/xapi_scraper/models/components/getdmmediav3response.rbi +26 -0
- data/lib/xapi_scraper/models/components/getlistmemberscursorquery.rb +43 -0
- data/lib/xapi_scraper/models/components/getlistmemberscursorquery.rbi +20 -0
- data/lib/xapi_scraper/models/components/getlistmemberscursorresponse.rb +72 -0
- data/lib/xapi_scraper/models/components/getlistmemberscursorresponse.rbi +38 -0
- data/lib/xapi_scraper/models/components/getlisttweetscursorquery.rb +43 -0
- data/lib/xapi_scraper/models/components/getlisttweetscursorquery.rbi +20 -0
- data/lib/xapi_scraper/models/components/getlisttweetscursorresponse.rb +72 -0
- data/lib/xapi_scraper/models/components/getlisttweetscursorresponse.rbi +38 -0
- data/lib/xapi_scraper/models/components/getquotescursorquery.rb +63 -0
- data/lib/xapi_scraper/models/components/getquotescursorquery.rbi +26 -0
- data/lib/xapi_scraper/models/components/getquotescursorquery_sort_by.rb +18 -0
- data/lib/xapi_scraper/models/components/getquotescursorquery_sort_by.rbi +9 -0
- data/lib/xapi_scraper/models/components/getquotescursorresponse.rb +72 -0
- data/lib/xapi_scraper/models/components/getquotescursorresponse.rbi +38 -0
- data/lib/xapi_scraper/models/components/getquotesquery.rb +59 -0
- data/lib/xapi_scraper/models/components/getquotesquery.rbi +26 -0
- data/lib/xapi_scraper/models/components/getquotesquery_sort_by.rb +18 -0
- data/lib/xapi_scraper/models/components/getquotesquery_sort_by.rbi +9 -0
- data/lib/xapi_scraper/models/components/getquotesresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/getquotesresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/getrepliespagequery.rb +51 -0
- data/lib/xapi_scraper/models/components/getrepliespagequery.rbi +20 -0
- data/lib/xapi_scraper/models/components/getrepliespagequery_sort_by.rb +19 -0
- data/lib/xapi_scraper/models/components/getrepliespagequery_sort_by.rbi +9 -0
- data/lib/xapi_scraper/models/components/getrepliespageresponse.rb +85 -0
- data/lib/xapi_scraper/models/components/getrepliespageresponse.rbi +44 -0
- data/lib/xapi_scraper/models/components/getretweeterscursorquery.rb +43 -0
- data/lib/xapi_scraper/models/components/getretweeterscursorquery.rbi +20 -0
- data/lib/xapi_scraper/models/components/getretweeterscursorresponse.rb +72 -0
- data/lib/xapi_scraper/models/components/getretweeterscursorresponse.rbi +38 -0
- data/lib/xapi_scraper/models/components/gettweetsbyidresponse.rb +58 -0
- data/lib/xapi_scraper/models/components/gettweetsbyidresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/hashtagsquery.rb +192 -0
- data/lib/xapi_scraper/models/components/hashtagsquery.rbi +98 -0
- data/lib/xapi_scraper/models/components/hashtagsquery_language.rb +76 -0
- data/lib/xapi_scraper/models/components/hashtagsquery_language.rbi +9 -0
- data/lib/xapi_scraper/models/components/hashtagsquery_sortby.rb +18 -0
- data/lib/xapi_scraper/models/components/hashtagsquery_sortby.rbi +9 -0
- data/lib/xapi_scraper/models/components/likeactionbody.rb +43 -0
- data/lib/xapi_scraper/models/components/likeactionbody.rbi +20 -0
- data/lib/xapi_scraper/models/components/listmembersresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/listmembersresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/listmodel.rb +77 -0
- data/lib/xapi_scraper/models/components/listmodel.rbi +44 -0
- data/lib/xapi_scraper/models/components/listsubscribersresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/listsubscribersresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/listtweetsresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/listtweetsresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/loc.rb +25 -0
- data/lib/xapi_scraper/models/components/loc.rbi +9 -0
- data/lib/xapi_scraper/models/components/mediamodel.rb +194 -0
- data/lib/xapi_scraper/models/components/mediamodel.rbi +110 -0
- data/lib/xapi_scraper/models/components/messagemodel.rb +100 -0
- data/lib/xapi_scraper/models/components/messagemodel.rbi +56 -0
- data/lib/xapi_scraper/models/components/posttweetdata.rb +51 -0
- data/lib/xapi_scraper/models/components/posttweetdata.rbi +26 -0
- data/lib/xapi_scraper/models/components/posttweetquery.rb +122 -0
- data/lib/xapi_scraper/models/components/posttweetquery.rbi +62 -0
- data/lib/xapi_scraper/models/components/posttweetresponse.rb +58 -0
- data/lib/xapi_scraper/models/components/posttweetresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/posttweetwithoutcookiequery.rb +102 -0
- data/lib/xapi_scraper/models/components/posttweetwithoutcookiequery.rbi +50 -0
- data/lib/xapi_scraper/models/components/quotetweetquery.rb +112 -0
- data/lib/xapi_scraper/models/components/quotetweetquery.rbi +56 -0
- data/lib/xapi_scraper/models/components/retweetactionbody.rb +43 -0
- data/lib/xapi_scraper/models/components/retweetactionbody.rbi +20 -0
- data/lib/xapi_scraper/models/components/searchcommunityquery.rb +43 -0
- data/lib/xapi_scraper/models/components/searchcommunityquery.rbi +20 -0
- data/lib/xapi_scraper/models/components/searchcommunityresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/searchcommunityresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/searchcommunitytweetsquery.rb +51 -0
- data/lib/xapi_scraper/models/components/searchcommunitytweetsquery.rbi +26 -0
- data/lib/xapi_scraper/models/components/searchlistquery.rb +43 -0
- data/lib/xapi_scraper/models/components/searchlistquery.rbi +20 -0
- data/lib/xapi_scraper/models/components/searchlistresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/searchlistresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/searchresponse.rb +54 -0
- data/lib/xapi_scraper/models/components/searchresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/searchuserresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/searchuserresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/security.rb +34 -0
- data/lib/xapi_scraper/models/components/security.rbi +14 -0
- data/lib/xapi_scraper/models/components/senddmresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/senddmresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/senddmv3query.rb +90 -0
- data/lib/xapi_scraper/models/components/senddmv3query.rbi +50 -0
- data/lib/xapi_scraper/models/components/sentimentanalysismodel.rb +43 -0
- data/lib/xapi_scraper/models/components/sentimentanalysismodel.rbi +20 -0
- data/lib/xapi_scraper/models/components/sentimentanalysisquery.rb +31 -0
- data/lib/xapi_scraper/models/components/sentimentanalysisquery.rbi +14 -0
- data/lib/xapi_scraper/models/components/sentimentanalysisresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/sentimentanalysisresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/standardresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/standardresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/streammodel.rb +51 -0
- data/lib/xapi_scraper/models/components/streammodel.rbi +26 -0
- data/lib/xapi_scraper/models/components/tweet_type.rb +19 -0
- data/lib/xapi_scraper/models/components/tweet_type.rbi +9 -0
- data/lib/xapi_scraper/models/components/tweetactionresponse.rb +51 -0
- data/lib/xapi_scraper/models/components/tweetactionresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/tweetmodel.rb +518 -0
- data/lib/xapi_scraper/models/components/tweetmodel.rbi +302 -0
- data/lib/xapi_scraper/models/components/tweetthreadbyidbody.rb +53 -0
- data/lib/xapi_scraper/models/components/tweetthreadbyidbody.rbi +26 -0
- data/lib/xapi_scraper/models/components/twitteraccountbasedstandardresponse.rb +58 -0
- data/lib/xapi_scraper/models/components/twitteraccountbasedstandardresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/twitteruseraboutresponse.rb +208 -0
- data/lib/xapi_scraper/models/components/twitteruseraboutresponse.rbi +116 -0
- data/lib/xapi_scraper/models/components/twitteruseraboutstandardresponse.rb +58 -0
- data/lib/xapi_scraper/models/components/twitteruseraboutstandardresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/unfavoritetweetquery.rb +35 -0
- data/lib/xapi_scraper/models/components/unfavoritetweetquery.rbi +14 -0
- data/lib/xapi_scraper/models/components/unfollowuserquery.rb +43 -0
- data/lib/xapi_scraper/models/components/unfollowuserquery.rbi +20 -0
- data/lib/xapi_scraper/models/components/unfollowuserresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/unfollowuserresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/urlmodel.rb +47 -0
- data/lib/xapi_scraper/models/components/urlmodel.rbi +26 -0
- data/lib/xapi_scraper/models/components/userinfo.rb +348 -0
- data/lib/xapi_scraper/models/components/userinfo.rbi +200 -0
- data/lib/xapi_scraper/models/components/usermodel.rb +344 -0
- data/lib/xapi_scraper/models/components/usermodel.rbi +200 -0
- data/lib/xapi_scraper/models/components/usersdetailsresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/usersdetailsresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/usertimelinefillquery.rb +35 -0
- data/lib/xapi_scraper/models/components/usertimelinefillquery.rbi +14 -0
- data/lib/xapi_scraper/models/components/usertimelinepagequery.rb +43 -0
- data/lib/xapi_scraper/models/components/usertimelinepagequery.rbi +20 -0
- data/lib/xapi_scraper/models/components/usertimelinepageresponse.rb +112 -0
- data/lib/xapi_scraper/models/components/usertimelinepageresponse.rbi +56 -0
- data/lib/xapi_scraper/models/components/usertimelineresponse.rb +76 -0
- data/lib/xapi_scraper/models/components/usertimelineresponse.rbi +38 -0
- data/lib/xapi_scraper/models/components/usertweetitem.rb +225 -0
- data/lib/xapi_scraper/models/components/usertweetitem.rbi +122 -0
- data/lib/xapi_scraper/models/components/validationerror.rb +67 -0
- data/lib/xapi_scraper/models/components/validationerror.rbi +38 -0
- data/lib/xapi_scraper/models/components/verifiedfollowersdata.rb +58 -0
- data/lib/xapi_scraper/models/components/verifiedfollowersdata.rbi +26 -0
- data/lib/xapi_scraper/models/components/verifiedfollowersresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/verifiedfollowersresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components/xarticlemodel.rb +305 -0
- data/lib/xapi_scraper/models/components/xarticlemodel.rbi +170 -0
- data/lib/xapi_scraper/models/components/xarticleresponse.rb +47 -0
- data/lib/xapi_scraper/models/components/xarticleresponse.rbi +26 -0
- data/lib/xapi_scraper/models/components.rb +128 -0
- data/lib/xapi_scraper/models/errors/apierror.rb +39 -0
- data/lib/xapi_scraper/models/errors/apierror.rbi +27 -0
- data/lib/xapi_scraper/models/errors/httpvalidationerror.rb +48 -0
- data/lib/xapi_scraper/models/errors/httpvalidationerror.rbi +20 -0
- data/lib/xapi_scraper/models/errors.rb +13 -0
- data/lib/xapi_scraper/models/operations/accountgetbalance_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/accountgetbalance_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/analysissentiment_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/analysissentiment_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/articlesfetch_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/articlesfetch_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/articlesmarkdown_request.rb +31 -0
- data/lib/xapi_scraper/models/operations/articlesmarkdown_request.rbi +14 -0
- data/lib/xapi_scraper/models/operations/articlesmarkdown_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/articlesmarkdown_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/communitiesget_request.rb +34 -0
- data/lib/xapi_scraper/models/operations/communitiesget_request.rbi +14 -0
- data/lib/xapi_scraper/models/operations/communitiesget_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/communitiesget_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/communitiesmembers_request.rb +42 -0
- data/lib/xapi_scraper/models/operations/communitiesmembers_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/communitiesmembers_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/communitiesmembers_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/communitiesmemberspage_response.rb +54 -0
- data/lib/xapi_scraper/models/operations/communitiesmemberspage_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/communitiessearch_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/communitiessearch_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/communitiessearchtweets_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/communitiessearchtweets_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/communitiestweets_request.rb +50 -0
- data/lib/xapi_scraper/models/operations/communitiestweets_request.rbi +26 -0
- data/lib/xapi_scraper/models/operations/communitiestweets_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/communitiestweets_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/communitiestweetspage_response.rb +54 -0
- data/lib/xapi_scraper/models/operations/communitiestweetspage_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/country.rb +79 -0
- data/lib/xapi_scraper/models/operations/country.rbi +9 -0
- data/lib/xapi_scraper/models/operations/dmconversations_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/dmconversations_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/dmhistory_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/dmhistory_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/dmmedia_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/dmmedia_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/dmsend_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/dmsend_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/dmstatus_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/dmstatus_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/listsmembers_request.rb +38 -0
- data/lib/xapi_scraper/models/operations/listsmembers_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/listsmembers_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/listsmembers_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/listsmemberspage_response.rb +54 -0
- data/lib/xapi_scraper/models/operations/listsmemberspage_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/listssearch_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/listssearch_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/listssubscribers_request.rb +38 -0
- data/lib/xapi_scraper/models/operations/listssubscribers_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/listssubscribers_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/listssubscribers_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/liststweets_request.rb +38 -0
- data/lib/xapi_scraper/models/operations/liststweets_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/liststweets_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/liststweets_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/liststweetspage_response.rb +54 -0
- data/lib/xapi_scraper/models/operations/liststweetspage_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/searchadvanced_response.rb +54 -0
- data/lib/xapi_scraper/models/operations/searchadvanced_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/searchcashtags_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/searchcashtags_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/searchhashtags_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/searchhashtags_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/timelinestweetsandreplies_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/timelinestweetsandreplies_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/timelinestweetsandreplies_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/timelinestweetsandreplies_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/timelinestweetsandrepliespage_response.rb +54 -0
- data/lib/xapi_scraper/models/operations/timelinestweetsandrepliespage_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/timelinesuser_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/timelinesuser_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/timelinesuser_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/timelinesuser_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/timelinesuserpage_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/timelinesuserpage_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/timelinesuserpage_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/timelinesuserpage_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/trendingbycountry_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/trendingbycountry_request.rbi +14 -0
- data/lib/xapi_scraper/models/operations/trendingbycountry_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/trendingbycountry_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/trendingcontents_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/trendingcontents_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/trendingcontents_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/trendingcontents_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/trendingcountries_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/trendingcountries_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/trendingtopics_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/trendingtopics_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/trendingtweets_request.rb +63 -0
- data/lib/xapi_scraper/models/operations/trendingtweets_request.rbi +32 -0
- data/lib/xapi_scraper/models/operations/trendingtweets_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/trendingtweets_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweet_type.rb +19 -0
- data/lib/xapi_scraper/models/operations/tweet_type.rbi +9 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsbookmark_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsbookmark_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsbookmark_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsbookmark_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionscreate_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionscreate_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionscreatethread_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionscreatethread_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionscreatewithoutcookie_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionscreatewithoutcookie_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsdeletebatch_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsdeletebatch_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionslike_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/tweetsactionslike_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/tweetsactionslike_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionslike_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsquote_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsquote_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsretweet_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsretweet_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsretweet_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsretweet_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunbookmark_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunbookmark_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunbookmark_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunbookmark_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunlike_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunlike_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunlike_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunlike_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunretweet_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunretweet_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunretweet_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsactionsunretweet_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsdetail_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsdetail_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementquotes_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementquotes_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementquotespage_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementquotespage_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementretweeters_request.rb +39 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementretweeters_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementretweeters_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementretweeters_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementretweeterspage_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsengagementretweeterspage_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetslookup_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetslookup_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsrepliespage_request.rb +35 -0
- data/lib/xapi_scraper/models/operations/tweetsrepliespage_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/tweetsrepliespage_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsrepliespage_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetssimilar_request.rb +30 -0
- data/lib/xapi_scraper/models/operations/tweetssimilar_request.rbi +14 -0
- data/lib/xapi_scraper/models/operations/tweetssimilar_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetssimilar_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/tweetsthread_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/tweetsthread_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersfollow_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/usersfollow_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersfollowerslist_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/usersfollowerslist_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersfollowersverified_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/usersfollowersverified_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersfollowinglist_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/usersfollowinglist_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersgetabout_request.rb +31 -0
- data/lib/xapi_scraper/models/operations/usersgetabout_request.rbi +14 -0
- data/lib/xapi_scraper/models/operations/usersgetabout_response.rb +54 -0
- data/lib/xapi_scraper/models/operations/usersgetabout_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersgetaccountbased_response.rb +54 -0
- data/lib/xapi_scraper/models/operations/usersgetaccountbased_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersgetbyids_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/usersgetbyids_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersgetbyusernames_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/usersgetbyusernames_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersgetstatuses_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/usersgetstatuses_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/userssearch_request.rb +39 -0
- data/lib/xapi_scraper/models/operations/userssearch_request.rbi +20 -0
- data/lib/xapi_scraper/models/operations/userssearch_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/userssearch_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersunfollow_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/usersunfollow_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations/usersverifyaccount_response.rb +51 -0
- data/lib/xapi_scraper/models/operations/usersverifyaccount_response.rbi +32 -0
- data/lib/xapi_scraper/models/operations.rb +127 -0
- data/lib/xapi_scraper/replies.rb +235 -0
- data/lib/xapi_scraper/sdk_hooks/hooks.rb +99 -0
- data/lib/xapi_scraper/sdk_hooks/registration.rb +34 -0
- data/lib/xapi_scraper/sdk_hooks/types.rb +180 -0
- data/lib/xapi_scraper/sdkconfiguration.rb +107 -0
- data/lib/xapi_scraper/sdkconfiguration.rbi +83 -0
- data/lib/xapi_scraper/search.rb +610 -0
- data/lib/xapi_scraper/timelines.rb +805 -0
- data/lib/xapi_scraper/trending.rb +888 -0
- data/lib/xapi_scraper/tweets.rb +801 -0
- data/lib/xapi_scraper/users.rb +1748 -0
- data/lib/xapi_scraper/utils/forms.rb +232 -0
- data/lib/xapi_scraper/utils/headers.rb +82 -0
- data/lib/xapi_scraper/utils/query_params.rb +167 -0
- data/lib/xapi_scraper/utils/request_bodies.rb +79 -0
- data/lib/xapi_scraper/utils/retries.rb +139 -0
- data/lib/xapi_scraper/utils/security.rb +158 -0
- data/lib/xapi_scraper/utils/url.rb +124 -0
- data/lib/xapi_scraper/utils/utils.rb +241 -0
- metadata +720 -0
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
# typed: true
|
|
4
|
+
# frozen_string_literal: true
|
|
5
|
+
|
|
6
|
+
require "faraday"
|
|
7
|
+
require "faraday/multipart"
|
|
8
|
+
require "faraday/retry"
|
|
9
|
+
require "sorbet-runtime"
|
|
10
|
+
|
|
11
|
+
require_relative "sdk_hooks/hooks"
|
|
12
|
+
require_relative "utils/retries"
|
|
13
|
+
|
|
14
|
+
module XapiScraper
|
|
15
|
+
extend T::Sig
|
|
16
|
+
|
|
17
|
+
class Engagement
|
|
18
|
+
extend T::Sig
|
|
19
|
+
|
|
20
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
|
21
|
+
def initialize(sdk_config)
|
|
22
|
+
@sdk_configuration = sdk_config
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
sig { params(base_url: String, url_variables: T.nilable(T::Hash[Symbol, T.any(String, T::Enum)])).returns(String) }
|
|
26
|
+
def get_url(base_url:, url_variables: nil)
|
|
27
|
+
sd_base_url, sd_options = @sdk_configuration.get_server_details
|
|
28
|
+
|
|
29
|
+
if base_url.nil?
|
|
30
|
+
base_url = sd_base_url
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
if url_variables.nil?
|
|
34
|
+
url_variables = sd_options
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
return Utils.template_url(base_url, url_variables)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
sig {
|
|
41
|
+
params(
|
|
42
|
+
request: Models::Operations::TweetsEngagementRetweetersRequest,
|
|
43
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
44
|
+
timeout_ms: T.nilable(Integer),
|
|
45
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
46
|
+
)
|
|
47
|
+
.returns(Models::Operations::TweetsEngagementRetweetersResponse)
|
|
48
|
+
}
|
|
49
|
+
def retweeters(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
50
|
+
# retweeters - Get Retweeters
|
|
51
|
+
# Retrieve retweeters in a single request. Automatically paginates until count is reached or no more results. Minimum 10, maximum 5000 users.
|
|
52
|
+
url, params = @sdk_configuration.get_server_details
|
|
53
|
+
base_url = Utils.template_url(url, params)
|
|
54
|
+
url = Utils.generate_url(
|
|
55
|
+
Models::Operations::TweetsEngagementRetweetersRequest,
|
|
56
|
+
base_url,
|
|
57
|
+
"/twitter/tweets/{tweet_id}/retweeters/{target_count}",
|
|
58
|
+
request
|
|
59
|
+
)
|
|
60
|
+
headers = {}
|
|
61
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
62
|
+
headers["Accept"] = "application/json"
|
|
63
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
64
|
+
retries ||= @sdk_configuration.retry_config
|
|
65
|
+
retries ||= Utils::RetryConfig.new(
|
|
66
|
+
backoff: Utils::BackoffStrategy.new(
|
|
67
|
+
exponent: 1.5,
|
|
68
|
+
initial_interval: 500,
|
|
69
|
+
max_elapsed_time: 3_600_000,
|
|
70
|
+
max_interval: 60_000
|
|
71
|
+
),
|
|
72
|
+
retry_connection_errors: true,
|
|
73
|
+
strategy: "backoff"
|
|
74
|
+
)
|
|
75
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
76
|
+
retry_options[:retry_statuses] = [408, 409, 429, 500, 501, 502, 503, 504, 505]
|
|
77
|
+
|
|
78
|
+
security = @sdk_configuration.security_source&.call
|
|
79
|
+
|
|
80
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
81
|
+
timeout ||= @sdk_configuration.timeout
|
|
82
|
+
|
|
83
|
+
connection = @sdk_configuration.client.dup
|
|
84
|
+
connection.use(Utils::RetryMiddleware, retry_options)
|
|
85
|
+
|
|
86
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
87
|
+
config: @sdk_configuration,
|
|
88
|
+
base_url: base_url,
|
|
89
|
+
oauth2_scopes: nil,
|
|
90
|
+
operation_id: "tweetsEngagementRetweeters",
|
|
91
|
+
security_source: @sdk_configuration.security_source
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
95
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
96
|
+
|
|
97
|
+
begin
|
|
98
|
+
http_response = T.must(connection).get(url) do |req|
|
|
99
|
+
req.headers.merge!(headers)
|
|
100
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
101
|
+
Utils.configure_request_security(req, security)
|
|
102
|
+
http_headers&.each do |key, value|
|
|
103
|
+
req.headers[key.to_s] = value
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
@sdk_configuration.hooks.before_request(
|
|
107
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
108
|
+
hook_ctx: hook_ctx
|
|
109
|
+
),
|
|
110
|
+
request: req
|
|
111
|
+
)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
rescue StandardError => e
|
|
115
|
+
error = e
|
|
116
|
+
ensure
|
|
117
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
118
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
119
|
+
error: error,
|
|
120
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
121
|
+
hook_ctx: hook_ctx
|
|
122
|
+
),
|
|
123
|
+
response: http_response
|
|
124
|
+
)
|
|
125
|
+
else
|
|
126
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
127
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
128
|
+
hook_ctx: hook_ctx
|
|
129
|
+
),
|
|
130
|
+
response: http_response
|
|
131
|
+
)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if http_response.nil?
|
|
135
|
+
raise error if !error.nil?
|
|
136
|
+
raise "no response"
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
141
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
142
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
143
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
144
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
145
|
+
hook_ctx: hook_ctx
|
|
146
|
+
),
|
|
147
|
+
response: http_response
|
|
148
|
+
)
|
|
149
|
+
response_data = http_response.env.response_body
|
|
150
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::SearchUserResponse)
|
|
151
|
+
response = Models::Operations::TweetsEngagementRetweetersResponse.new(
|
|
152
|
+
status_code: http_response.status,
|
|
153
|
+
content_type: content_type,
|
|
154
|
+
raw_response: http_response,
|
|
155
|
+
search_user_response: T.unsafe(obj)
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
return response
|
|
159
|
+
else
|
|
160
|
+
raise(
|
|
161
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
162
|
+
status_code: http_response.status,
|
|
163
|
+
body: http_response.env.response_body,
|
|
164
|
+
raw_response: http_response
|
|
165
|
+
),
|
|
166
|
+
"Unknown content type received"
|
|
167
|
+
)
|
|
168
|
+
end
|
|
169
|
+
elsif Utils.match_status_code(http_response.status, ["422"])
|
|
170
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
171
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
172
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
173
|
+
hook_ctx: hook_ctx
|
|
174
|
+
),
|
|
175
|
+
response: http_response
|
|
176
|
+
)
|
|
177
|
+
response_data = http_response.env.response_body
|
|
178
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::HTTPValidationError)
|
|
179
|
+
obj.raw_response = http_response
|
|
180
|
+
raise obj
|
|
181
|
+
else
|
|
182
|
+
raise(
|
|
183
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
184
|
+
status_code: http_response.status,
|
|
185
|
+
body: http_response.env.response_body,
|
|
186
|
+
raw_response: http_response
|
|
187
|
+
),
|
|
188
|
+
"Unknown content type received"
|
|
189
|
+
)
|
|
190
|
+
end
|
|
191
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
192
|
+
raise(
|
|
193
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
194
|
+
status_code: http_response.status,
|
|
195
|
+
body: http_response.env.response_body,
|
|
196
|
+
raw_response: http_response
|
|
197
|
+
),
|
|
198
|
+
"API error occurred"
|
|
199
|
+
)
|
|
200
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
201
|
+
raise(
|
|
202
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
203
|
+
status_code: http_response.status,
|
|
204
|
+
body: http_response.env.response_body,
|
|
205
|
+
raw_response: http_response
|
|
206
|
+
),
|
|
207
|
+
"API error occurred"
|
|
208
|
+
)
|
|
209
|
+
else
|
|
210
|
+
raise(
|
|
211
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
212
|
+
status_code: http_response.status,
|
|
213
|
+
body: http_response.env.response_body,
|
|
214
|
+
raw_response: http_response
|
|
215
|
+
),
|
|
216
|
+
"Unknown status code received"
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
sig {
|
|
223
|
+
params(
|
|
224
|
+
request: Models::Components::GetRetweetersCursorQuery,
|
|
225
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
226
|
+
timeout_ms: T.nilable(Integer),
|
|
227
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
228
|
+
)
|
|
229
|
+
.returns(Models::Operations::TweetsEngagementRetweetersPageResponse)
|
|
230
|
+
}
|
|
231
|
+
def retweeters_page(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
232
|
+
# retweeters_page - Get Retweeters by Page
|
|
233
|
+
# Retrieve retweeters using cursor-based pagination. Each page returns up to 20 users. Pass next_cursor from the previous response to continue.
|
|
234
|
+
url, params = @sdk_configuration.get_server_details
|
|
235
|
+
base_url = Utils.template_url(url, params)
|
|
236
|
+
url = "#{base_url}/twitter/tweets/retweeters/page"
|
|
237
|
+
headers = {}
|
|
238
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
239
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :request, :json)
|
|
240
|
+
headers["content-type"] = req_content_type
|
|
241
|
+
raise StandardError, "request body is required" if data.nil? && form.nil?
|
|
242
|
+
|
|
243
|
+
if form && !form.empty?
|
|
244
|
+
body = Utils.encode_form(form)
|
|
245
|
+
elsif Utils.match_content_type(req_content_type, "application/x-www-form-urlencoded")
|
|
246
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
247
|
+
else
|
|
248
|
+
body = data
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
headers["Accept"] = "application/json"
|
|
252
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
253
|
+
retries ||= @sdk_configuration.retry_config
|
|
254
|
+
retries ||= Utils::RetryConfig.new(
|
|
255
|
+
backoff: Utils::BackoffStrategy.new(
|
|
256
|
+
exponent: 1.5,
|
|
257
|
+
initial_interval: 500,
|
|
258
|
+
max_elapsed_time: 3_600_000,
|
|
259
|
+
max_interval: 60_000
|
|
260
|
+
),
|
|
261
|
+
retry_connection_errors: true,
|
|
262
|
+
strategy: "backoff"
|
|
263
|
+
)
|
|
264
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
265
|
+
retry_options[:retry_statuses] = [408, 409, 429, 500, 501, 502, 503, 504, 505]
|
|
266
|
+
|
|
267
|
+
security = @sdk_configuration.security_source&.call
|
|
268
|
+
|
|
269
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
270
|
+
timeout ||= @sdk_configuration.timeout
|
|
271
|
+
|
|
272
|
+
connection = @sdk_configuration.client.dup
|
|
273
|
+
connection.use(Utils::RetryMiddleware, retry_options)
|
|
274
|
+
|
|
275
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
276
|
+
config: @sdk_configuration,
|
|
277
|
+
base_url: base_url,
|
|
278
|
+
oauth2_scopes: nil,
|
|
279
|
+
operation_id: "tweetsEngagementRetweetersPage",
|
|
280
|
+
security_source: @sdk_configuration.security_source
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
284
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
285
|
+
|
|
286
|
+
begin
|
|
287
|
+
http_response = T.must(connection).post(url) do |req|
|
|
288
|
+
req.body = body
|
|
289
|
+
req.headers.merge!(headers)
|
|
290
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
291
|
+
Utils.configure_request_security(req, security)
|
|
292
|
+
http_headers&.each do |key, value|
|
|
293
|
+
req.headers[key.to_s] = value
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
@sdk_configuration.hooks.before_request(
|
|
297
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
298
|
+
hook_ctx: hook_ctx
|
|
299
|
+
),
|
|
300
|
+
request: req
|
|
301
|
+
)
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
rescue StandardError => e
|
|
305
|
+
error = e
|
|
306
|
+
ensure
|
|
307
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
308
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
309
|
+
error: error,
|
|
310
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
311
|
+
hook_ctx: hook_ctx
|
|
312
|
+
),
|
|
313
|
+
response: http_response
|
|
314
|
+
)
|
|
315
|
+
else
|
|
316
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
317
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
318
|
+
hook_ctx: hook_ctx
|
|
319
|
+
),
|
|
320
|
+
response: http_response
|
|
321
|
+
)
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
if http_response.nil?
|
|
325
|
+
raise error if !error.nil?
|
|
326
|
+
raise "no response"
|
|
327
|
+
end
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
331
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
332
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
333
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
334
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
335
|
+
hook_ctx: hook_ctx
|
|
336
|
+
),
|
|
337
|
+
response: http_response
|
|
338
|
+
)
|
|
339
|
+
response_data = http_response.env.response_body
|
|
340
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::GetRetweetersCursorResponse)
|
|
341
|
+
response = Models::Operations::TweetsEngagementRetweetersPageResponse.new(
|
|
342
|
+
status_code: http_response.status,
|
|
343
|
+
content_type: content_type,
|
|
344
|
+
raw_response: http_response,
|
|
345
|
+
get_retweeters_cursor_response: T.unsafe(obj)
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
return response
|
|
349
|
+
else
|
|
350
|
+
raise(
|
|
351
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
352
|
+
status_code: http_response.status,
|
|
353
|
+
body: http_response.env.response_body,
|
|
354
|
+
raw_response: http_response
|
|
355
|
+
),
|
|
356
|
+
"Unknown content type received"
|
|
357
|
+
)
|
|
358
|
+
end
|
|
359
|
+
elsif Utils.match_status_code(http_response.status, ["422"])
|
|
360
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
361
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
362
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
363
|
+
hook_ctx: hook_ctx
|
|
364
|
+
),
|
|
365
|
+
response: http_response
|
|
366
|
+
)
|
|
367
|
+
response_data = http_response.env.response_body
|
|
368
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::HTTPValidationError)
|
|
369
|
+
obj.raw_response = http_response
|
|
370
|
+
raise obj
|
|
371
|
+
else
|
|
372
|
+
raise(
|
|
373
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
374
|
+
status_code: http_response.status,
|
|
375
|
+
body: http_response.env.response_body,
|
|
376
|
+
raw_response: http_response
|
|
377
|
+
),
|
|
378
|
+
"Unknown content type received"
|
|
379
|
+
)
|
|
380
|
+
end
|
|
381
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
382
|
+
raise(
|
|
383
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
384
|
+
status_code: http_response.status,
|
|
385
|
+
body: http_response.env.response_body,
|
|
386
|
+
raw_response: http_response
|
|
387
|
+
),
|
|
388
|
+
"API error occurred"
|
|
389
|
+
)
|
|
390
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
391
|
+
raise(
|
|
392
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
393
|
+
status_code: http_response.status,
|
|
394
|
+
body: http_response.env.response_body,
|
|
395
|
+
raw_response: http_response
|
|
396
|
+
),
|
|
397
|
+
"API error occurred"
|
|
398
|
+
)
|
|
399
|
+
else
|
|
400
|
+
raise(
|
|
401
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
402
|
+
status_code: http_response.status,
|
|
403
|
+
body: http_response.env.response_body,
|
|
404
|
+
raw_response: http_response
|
|
405
|
+
),
|
|
406
|
+
"Unknown status code received"
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
end
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
sig {
|
|
413
|
+
params(
|
|
414
|
+
request: Models::Components::GetQuotesQuery,
|
|
415
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
416
|
+
timeout_ms: T.nilable(Integer),
|
|
417
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
418
|
+
)
|
|
419
|
+
.returns(Models::Operations::TweetsEngagementQuotesResponse)
|
|
420
|
+
}
|
|
421
|
+
def quotes(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
422
|
+
# quotes - Get Quote Tweets
|
|
423
|
+
# Retrieve quote tweets in a single request. Automatically paginates until count is reached or no more results. Use `Latest` for chronological order or `Top` for ranked results. Minimum 10, maximum 5000 tweets.
|
|
424
|
+
url, params = @sdk_configuration.get_server_details
|
|
425
|
+
base_url = Utils.template_url(url, params)
|
|
426
|
+
url = "#{base_url}/twitter/tweets/quotes"
|
|
427
|
+
headers = {}
|
|
428
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
429
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :request, :json)
|
|
430
|
+
headers["content-type"] = req_content_type
|
|
431
|
+
raise StandardError, "request body is required" if data.nil? && form.nil?
|
|
432
|
+
|
|
433
|
+
if form && !form.empty?
|
|
434
|
+
body = Utils.encode_form(form)
|
|
435
|
+
elsif Utils.match_content_type(req_content_type, "application/x-www-form-urlencoded")
|
|
436
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
437
|
+
else
|
|
438
|
+
body = data
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
headers["Accept"] = "application/json"
|
|
442
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
443
|
+
retries ||= @sdk_configuration.retry_config
|
|
444
|
+
retries ||= Utils::RetryConfig.new(
|
|
445
|
+
backoff: Utils::BackoffStrategy.new(
|
|
446
|
+
exponent: 1.5,
|
|
447
|
+
initial_interval: 500,
|
|
448
|
+
max_elapsed_time: 3_600_000,
|
|
449
|
+
max_interval: 60_000
|
|
450
|
+
),
|
|
451
|
+
retry_connection_errors: true,
|
|
452
|
+
strategy: "backoff"
|
|
453
|
+
)
|
|
454
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
455
|
+
retry_options[:retry_statuses] = [408, 409, 429, 500, 501, 502, 503, 504, 505]
|
|
456
|
+
|
|
457
|
+
security = @sdk_configuration.security_source&.call
|
|
458
|
+
|
|
459
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
460
|
+
timeout ||= @sdk_configuration.timeout
|
|
461
|
+
|
|
462
|
+
connection = @sdk_configuration.client.dup
|
|
463
|
+
connection.use(Utils::RetryMiddleware, retry_options)
|
|
464
|
+
|
|
465
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
466
|
+
config: @sdk_configuration,
|
|
467
|
+
base_url: base_url,
|
|
468
|
+
oauth2_scopes: nil,
|
|
469
|
+
operation_id: "tweetsEngagementQuotes",
|
|
470
|
+
security_source: @sdk_configuration.security_source
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
474
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
475
|
+
|
|
476
|
+
begin
|
|
477
|
+
http_response = T.must(connection).post(url) do |req|
|
|
478
|
+
req.body = body
|
|
479
|
+
req.headers.merge!(headers)
|
|
480
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
481
|
+
Utils.configure_request_security(req, security)
|
|
482
|
+
http_headers&.each do |key, value|
|
|
483
|
+
req.headers[key.to_s] = value
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
@sdk_configuration.hooks.before_request(
|
|
487
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
488
|
+
hook_ctx: hook_ctx
|
|
489
|
+
),
|
|
490
|
+
request: req
|
|
491
|
+
)
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
rescue StandardError => e
|
|
495
|
+
error = e
|
|
496
|
+
ensure
|
|
497
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
498
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
499
|
+
error: error,
|
|
500
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
501
|
+
hook_ctx: hook_ctx
|
|
502
|
+
),
|
|
503
|
+
response: http_response
|
|
504
|
+
)
|
|
505
|
+
else
|
|
506
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
507
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
508
|
+
hook_ctx: hook_ctx
|
|
509
|
+
),
|
|
510
|
+
response: http_response
|
|
511
|
+
)
|
|
512
|
+
end
|
|
513
|
+
|
|
514
|
+
if http_response.nil?
|
|
515
|
+
raise error if !error.nil?
|
|
516
|
+
raise "no response"
|
|
517
|
+
end
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
521
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
522
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
523
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
524
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
525
|
+
hook_ctx: hook_ctx
|
|
526
|
+
),
|
|
527
|
+
response: http_response
|
|
528
|
+
)
|
|
529
|
+
response_data = http_response.env.response_body
|
|
530
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::GetQuotesResponse)
|
|
531
|
+
response = Models::Operations::TweetsEngagementQuotesResponse.new(
|
|
532
|
+
status_code: http_response.status,
|
|
533
|
+
content_type: content_type,
|
|
534
|
+
raw_response: http_response,
|
|
535
|
+
get_quotes_response: T.unsafe(obj)
|
|
536
|
+
)
|
|
537
|
+
|
|
538
|
+
return response
|
|
539
|
+
else
|
|
540
|
+
raise(
|
|
541
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
542
|
+
status_code: http_response.status,
|
|
543
|
+
body: http_response.env.response_body,
|
|
544
|
+
raw_response: http_response
|
|
545
|
+
),
|
|
546
|
+
"Unknown content type received"
|
|
547
|
+
)
|
|
548
|
+
end
|
|
549
|
+
elsif Utils.match_status_code(http_response.status, ["422"])
|
|
550
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
551
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
552
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
553
|
+
hook_ctx: hook_ctx
|
|
554
|
+
),
|
|
555
|
+
response: http_response
|
|
556
|
+
)
|
|
557
|
+
response_data = http_response.env.response_body
|
|
558
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::HTTPValidationError)
|
|
559
|
+
obj.raw_response = http_response
|
|
560
|
+
raise obj
|
|
561
|
+
else
|
|
562
|
+
raise(
|
|
563
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
564
|
+
status_code: http_response.status,
|
|
565
|
+
body: http_response.env.response_body,
|
|
566
|
+
raw_response: http_response
|
|
567
|
+
),
|
|
568
|
+
"Unknown content type received"
|
|
569
|
+
)
|
|
570
|
+
end
|
|
571
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
572
|
+
raise(
|
|
573
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
574
|
+
status_code: http_response.status,
|
|
575
|
+
body: http_response.env.response_body,
|
|
576
|
+
raw_response: http_response
|
|
577
|
+
),
|
|
578
|
+
"API error occurred"
|
|
579
|
+
)
|
|
580
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
581
|
+
raise(
|
|
582
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
583
|
+
status_code: http_response.status,
|
|
584
|
+
body: http_response.env.response_body,
|
|
585
|
+
raw_response: http_response
|
|
586
|
+
),
|
|
587
|
+
"API error occurred"
|
|
588
|
+
)
|
|
589
|
+
else
|
|
590
|
+
raise(
|
|
591
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
592
|
+
status_code: http_response.status,
|
|
593
|
+
body: http_response.env.response_body,
|
|
594
|
+
raw_response: http_response
|
|
595
|
+
),
|
|
596
|
+
"Unknown status code received"
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
end
|
|
600
|
+
end
|
|
601
|
+
|
|
602
|
+
sig {
|
|
603
|
+
params(
|
|
604
|
+
request: Models::Components::GetQuotesCursorQuery,
|
|
605
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
606
|
+
timeout_ms: T.nilable(Integer),
|
|
607
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
608
|
+
)
|
|
609
|
+
.returns(Models::Operations::TweetsEngagementQuotesPageResponse)
|
|
610
|
+
}
|
|
611
|
+
def quotes_page(request:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
612
|
+
# quotes_page - Get Quote Tweets by Page
|
|
613
|
+
# Retrieve quote tweets using cursor-based pagination. Each page returns up to 20 tweets. Use `Latest` for chronological order or `Top` for ranked results. Pass next_cursor from the previous response to continue.
|
|
614
|
+
url, params = @sdk_configuration.get_server_details
|
|
615
|
+
base_url = Utils.template_url(url, params)
|
|
616
|
+
url = "#{base_url}/twitter/tweets/quotes/page"
|
|
617
|
+
headers = {}
|
|
618
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
619
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :request, :json)
|
|
620
|
+
headers["content-type"] = req_content_type
|
|
621
|
+
raise StandardError, "request body is required" if data.nil? && form.nil?
|
|
622
|
+
|
|
623
|
+
if form && !form.empty?
|
|
624
|
+
body = Utils.encode_form(form)
|
|
625
|
+
elsif Utils.match_content_type(req_content_type, "application/x-www-form-urlencoded")
|
|
626
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
627
|
+
else
|
|
628
|
+
body = data
|
|
629
|
+
end
|
|
630
|
+
|
|
631
|
+
headers["Accept"] = "application/json"
|
|
632
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
633
|
+
retries ||= @sdk_configuration.retry_config
|
|
634
|
+
retries ||= Utils::RetryConfig.new(
|
|
635
|
+
backoff: Utils::BackoffStrategy.new(
|
|
636
|
+
exponent: 1.5,
|
|
637
|
+
initial_interval: 500,
|
|
638
|
+
max_elapsed_time: 3_600_000,
|
|
639
|
+
max_interval: 60_000
|
|
640
|
+
),
|
|
641
|
+
retry_connection_errors: true,
|
|
642
|
+
strategy: "backoff"
|
|
643
|
+
)
|
|
644
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
645
|
+
retry_options[:retry_statuses] = [408, 409, 429, 500, 501, 502, 503, 504, 505]
|
|
646
|
+
|
|
647
|
+
security = @sdk_configuration.security_source&.call
|
|
648
|
+
|
|
649
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
650
|
+
timeout ||= @sdk_configuration.timeout
|
|
651
|
+
|
|
652
|
+
connection = @sdk_configuration.client.dup
|
|
653
|
+
connection.use(Utils::RetryMiddleware, retry_options)
|
|
654
|
+
|
|
655
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
656
|
+
config: @sdk_configuration,
|
|
657
|
+
base_url: base_url,
|
|
658
|
+
oauth2_scopes: nil,
|
|
659
|
+
operation_id: "tweetsEngagementQuotesPage",
|
|
660
|
+
security_source: @sdk_configuration.security_source
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
664
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
665
|
+
|
|
666
|
+
begin
|
|
667
|
+
http_response = T.must(connection).post(url) do |req|
|
|
668
|
+
req.body = body
|
|
669
|
+
req.headers.merge!(headers)
|
|
670
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
671
|
+
Utils.configure_request_security(req, security)
|
|
672
|
+
http_headers&.each do |key, value|
|
|
673
|
+
req.headers[key.to_s] = value
|
|
674
|
+
end
|
|
675
|
+
|
|
676
|
+
@sdk_configuration.hooks.before_request(
|
|
677
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
678
|
+
hook_ctx: hook_ctx
|
|
679
|
+
),
|
|
680
|
+
request: req
|
|
681
|
+
)
|
|
682
|
+
end
|
|
683
|
+
|
|
684
|
+
rescue StandardError => e
|
|
685
|
+
error = e
|
|
686
|
+
ensure
|
|
687
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
688
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
689
|
+
error: error,
|
|
690
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
691
|
+
hook_ctx: hook_ctx
|
|
692
|
+
),
|
|
693
|
+
response: http_response
|
|
694
|
+
)
|
|
695
|
+
else
|
|
696
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
697
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
698
|
+
hook_ctx: hook_ctx
|
|
699
|
+
),
|
|
700
|
+
response: http_response
|
|
701
|
+
)
|
|
702
|
+
end
|
|
703
|
+
|
|
704
|
+
if http_response.nil?
|
|
705
|
+
raise error if !error.nil?
|
|
706
|
+
raise "no response"
|
|
707
|
+
end
|
|
708
|
+
end
|
|
709
|
+
|
|
710
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
711
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
712
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
713
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
714
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
715
|
+
hook_ctx: hook_ctx
|
|
716
|
+
),
|
|
717
|
+
response: http_response
|
|
718
|
+
)
|
|
719
|
+
response_data = http_response.env.response_body
|
|
720
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::GetQuotesCursorResponse)
|
|
721
|
+
response = Models::Operations::TweetsEngagementQuotesPageResponse.new(
|
|
722
|
+
status_code: http_response.status,
|
|
723
|
+
content_type: content_type,
|
|
724
|
+
raw_response: http_response,
|
|
725
|
+
get_quotes_cursor_response: T.unsafe(obj)
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
return response
|
|
729
|
+
else
|
|
730
|
+
raise(
|
|
731
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
732
|
+
status_code: http_response.status,
|
|
733
|
+
body: http_response.env.response_body,
|
|
734
|
+
raw_response: http_response
|
|
735
|
+
),
|
|
736
|
+
"Unknown content type received"
|
|
737
|
+
)
|
|
738
|
+
end
|
|
739
|
+
elsif Utils.match_status_code(http_response.status, ["422"])
|
|
740
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
741
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
742
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
743
|
+
hook_ctx: hook_ctx
|
|
744
|
+
),
|
|
745
|
+
response: http_response
|
|
746
|
+
)
|
|
747
|
+
response_data = http_response.env.response_body
|
|
748
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::HTTPValidationError)
|
|
749
|
+
obj.raw_response = http_response
|
|
750
|
+
raise obj
|
|
751
|
+
else
|
|
752
|
+
raise(
|
|
753
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
754
|
+
status_code: http_response.status,
|
|
755
|
+
body: http_response.env.response_body,
|
|
756
|
+
raw_response: http_response
|
|
757
|
+
),
|
|
758
|
+
"Unknown content type received"
|
|
759
|
+
)
|
|
760
|
+
end
|
|
761
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
762
|
+
raise(
|
|
763
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
764
|
+
status_code: http_response.status,
|
|
765
|
+
body: http_response.env.response_body,
|
|
766
|
+
raw_response: http_response
|
|
767
|
+
),
|
|
768
|
+
"API error occurred"
|
|
769
|
+
)
|
|
770
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
771
|
+
raise(
|
|
772
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
773
|
+
status_code: http_response.status,
|
|
774
|
+
body: http_response.env.response_body,
|
|
775
|
+
raw_response: http_response
|
|
776
|
+
),
|
|
777
|
+
"API error occurred"
|
|
778
|
+
)
|
|
779
|
+
else
|
|
780
|
+
raise(
|
|
781
|
+
::XapiScraper::Models::Errors::APIError.new(
|
|
782
|
+
status_code: http_response.status,
|
|
783
|
+
body: http_response.env.response_body,
|
|
784
|
+
raw_response: http_response
|
|
785
|
+
),
|
|
786
|
+
"Unknown status code received"
|
|
787
|
+
)
|
|
788
|
+
|
|
789
|
+
end
|
|
790
|
+
end
|
|
791
|
+
end
|
|
792
|
+
end
|