Class: XTwitterScraper::Resources::Styles
- Inherits:
-
Object
- Object
- XTwitterScraper::Resources::Styles
- Defined in:
- lib/x_twitter_scraper/resources/styles.rb,
sig/x_twitter_scraper/resources/styles.rbs
Overview
AI tweet composition, drafts, writing styles, and radar
Instance Method Summary collapse
-
#analyze(username:, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Analyze writing style from recent tweets.
-
#compare(username1:, username2:, request_options: {}) ⇒ XTwitterScraper::Models::StyleCompareResponse
Compare two style profiles.
-
#delete(id, request_options: {}) ⇒ nil
Delete a style profile.
-
#get_performance(id, request_options: {}) ⇒ XTwitterScraper::Models::StyleGetPerformanceResponse
Get engagement metrics for style tweets.
-
#initialize(client:) ⇒ Styles
constructor
private
A new instance of Styles.
-
#list(request_options: {}) ⇒ XTwitterScraper::Models::StyleListResponse
List cached style profiles.
-
#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Get cached style profile.
-
#update(id, label:, tweets:, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Save style profile with custom tweets.
Constructor Details
#initialize(client:) ⇒ Styles
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Styles.
165 166 167 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 165 def initialize(client:) @client = client end |
Instance Method Details
#analyze(username:, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Analyze writing style from recent tweets
106 107 108 109 110 111 112 113 114 115 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 106 def analyze(params) parsed, = XTwitterScraper::StyleAnalyzeParams.dump_request(params) @client.request( method: :post, path: "styles", body: parsed, model: XTwitterScraper::StyleProfile, options: ) end |
#compare(username1:, username2:, request_options: {}) ⇒ XTwitterScraper::Models::StyleCompareResponse
Compare two style profiles
130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 130 def compare(params) parsed, = XTwitterScraper::StyleCompareParams.dump_request(params) query = XTwitterScraper::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "styles/compare", query: query, model: XTwitterScraper::Models::StyleCompareResponse, options: ) end |
#delete(id, request_options: {}) ⇒ nil
Delete a style profile
86 87 88 89 90 91 92 93 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 86 def delete(id, params = {}) @client.request( method: :delete, path: ["styles/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#get_performance(id, request_options: {}) ⇒ XTwitterScraper::Models::StyleGetPerformanceResponse
Get engagement metrics for style tweets
153 154 155 156 157 158 159 160 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 153 def get_performance(id, params = {}) @client.request( method: :get, path: ["styles/%1$s/performance", id], model: XTwitterScraper::Models::StyleGetPerformanceResponse, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ XTwitterScraper::Models::StyleListResponse
List cached style profiles
66 67 68 69 70 71 72 73 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 66 def list(params = {}) @client.request( method: :get, path: "styles", model: XTwitterScraper::Models::StyleListResponse, options: params[:request_options] ) end |
#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Get cached style profile
22 23 24 25 26 27 28 29 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 22 def retrieve(id, params = {}) @client.request( method: :get, path: ["styles/%1$s", id], model: XTwitterScraper::StyleProfile, options: params[:request_options] ) end |
#update(id, label:, tweets:, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Save style profile with custom tweets
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 46 def update(id, params) parsed, = XTwitterScraper::StyleUpdateParams.dump_request(params) @client.request( method: :put, path: ["styles/%1$s", id], body: parsed, model: XTwitterScraper::StyleProfile, options: ) end |