Class: Zernio::TwitterEngagementApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/twitter_engagement_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TwitterEngagementApi

Returns a new instance of TwitterEngagementApi.



19
20
21
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#bookmark_post(bookmark_post_request, opts = {}) ⇒ BookmarkPost200Response

Bookmark a tweet Bookmark a tweet by ID. Requires the bookmark.write OAuth scope. Rate limit: 50 requests per 15-min window.

Parameters:

  • bookmark_post_request (BookmarkPostRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 27

def bookmark_post(bookmark_post_request, opts = {})
  data, _status_code, _headers = bookmark_post_with_http_info(bookmark_post_request, opts)
  data
end

#bookmark_post_with_http_info(bookmark_post_request, opts = {}) ⇒ Array<(BookmarkPost200Response, Integer, Hash)>

Bookmark a tweet Bookmark a tweet by ID. Requires the bookmark.write OAuth scope. Rate limit: 50 requests per 15-min window.

Parameters:

  • bookmark_post_request (BookmarkPostRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(BookmarkPost200Response, Integer, Hash)>)

    BookmarkPost200Response data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 37

def bookmark_post_with_http_info(bookmark_post_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TwitterEngagementApi.bookmark_post ...'
  end
  # verify the required parameter 'bookmark_post_request' is set
  if @api_client.config.client_side_validation && bookmark_post_request.nil?
    fail ArgumentError, "Missing the required parameter 'bookmark_post_request' when calling TwitterEngagementApi.bookmark_post"
  end
  # resource path
  local_var_path = '/v1/twitter/bookmark'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(bookmark_post_request)

  # return_type
  return_type = opts[:debug_return_type] || 'BookmarkPost200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"TwitterEngagementApi.bookmark_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TwitterEngagementApi#bookmark_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#follow_user(follow_user_request, opts = {}) ⇒ FollowUser200Response

Follow a user Follow a user on X/Twitter. Requires the follows.write OAuth scope. For protected accounts, a follow request is sent instead (pending_follow will be true).

Parameters:

  • follow_user_request (FollowUserRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



95
96
97
98
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 95

def follow_user(follow_user_request, opts = {})
  data, _status_code, _headers = follow_user_with_http_info(follow_user_request, opts)
  data
end

#follow_user_with_http_info(follow_user_request, opts = {}) ⇒ Array<(FollowUser200Response, Integer, Hash)>

Follow a user Follow a user on X/Twitter. Requires the follows.write OAuth scope. For protected accounts, a follow request is sent instead (pending_follow will be true).

Parameters:

  • follow_user_request (FollowUserRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FollowUser200Response, Integer, Hash)>)

    FollowUser200Response data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 105

def follow_user_with_http_info(follow_user_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TwitterEngagementApi.follow_user ...'
  end
  # verify the required parameter 'follow_user_request' is set
  if @api_client.config.client_side_validation && follow_user_request.nil?
    fail ArgumentError, "Missing the required parameter 'follow_user_request' when calling TwitterEngagementApi.follow_user"
  end
  # resource path
  local_var_path = '/v1/twitter/follow'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(follow_user_request)

  # return_type
  return_type = opts[:debug_return_type] || 'FollowUser200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"TwitterEngagementApi.follow_user",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TwitterEngagementApi#follow_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_bookmark(account_id, tweet_id, opts = {}) ⇒ RemoveBookmark200Response

Remove bookmark Remove a bookmark from a tweet.

Parameters:

  • account_id (String)
  • tweet_id (String)

    The ID of the tweet to unbookmark

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



164
165
166
167
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 164

def remove_bookmark(, tweet_id, opts = {})
  data, _status_code, _headers = remove_bookmark_with_http_info(, tweet_id, opts)
  data
end

#remove_bookmark_with_http_info(account_id, tweet_id, opts = {}) ⇒ Array<(RemoveBookmark200Response, Integer, Hash)>

Remove bookmark Remove a bookmark from a tweet.

Parameters:

  • account_id (String)
  • tweet_id (String)

    The ID of the tweet to unbookmark

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RemoveBookmark200Response, Integer, Hash)>)

    RemoveBookmark200Response data, response status code and response headers



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 175

def remove_bookmark_with_http_info(, tweet_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TwitterEngagementApi.remove_bookmark ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling TwitterEngagementApi.remove_bookmark"
  end
  # verify the required parameter 'tweet_id' is set
  if @api_client.config.client_side_validation && tweet_id.nil?
    fail ArgumentError, "Missing the required parameter 'tweet_id' when calling TwitterEngagementApi.remove_bookmark"
  end
  # resource path
  local_var_path = '/v1/twitter/bookmark'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'tweetId'] = tweet_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RemoveBookmark200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"TwitterEngagementApi.remove_bookmark",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TwitterEngagementApi#remove_bookmark\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#retweet_post(retweet_post_request, opts = {}) ⇒ RetweetPost200Response

Retweet a post Retweet (repost) a tweet by ID. Rate limit: 50 requests per 15-min window. Shares the 300/3hr creation limit with tweet creation.

Parameters:

  • retweet_post_request (RetweetPostRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



234
235
236
237
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 234

def retweet_post(retweet_post_request, opts = {})
  data, _status_code, _headers = retweet_post_with_http_info(retweet_post_request, opts)
  data
end

#retweet_post_with_http_info(retweet_post_request, opts = {}) ⇒ Array<(RetweetPost200Response, Integer, Hash)>

Retweet a post Retweet (repost) a tweet by ID. Rate limit: 50 requests per 15-min window. Shares the 300/3hr creation limit with tweet creation.

Parameters:

  • retweet_post_request (RetweetPostRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RetweetPost200Response, Integer, Hash)>)

    RetweetPost200Response data, response status code and response headers



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 244

def retweet_post_with_http_info(retweet_post_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TwitterEngagementApi.retweet_post ...'
  end
  # verify the required parameter 'retweet_post_request' is set
  if @api_client.config.client_side_validation && retweet_post_request.nil?
    fail ArgumentError, "Missing the required parameter 'retweet_post_request' when calling TwitterEngagementApi.retweet_post"
  end
  # resource path
  local_var_path = '/v1/twitter/retweet'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(retweet_post_request)

  # return_type
  return_type = opts[:debug_return_type] || 'RetweetPost200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"TwitterEngagementApi.retweet_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TwitterEngagementApi#retweet_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#undo_retweet(account_id, tweet_id, opts = {}) ⇒ UndoRetweet200Response

Undo retweet Undo a retweet (un-repost a tweet).

Parameters:

  • account_id (String)
  • tweet_id (String)

    The ID of the original tweet to un-retweet

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



303
304
305
306
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 303

def undo_retweet(, tweet_id, opts = {})
  data, _status_code, _headers = undo_retweet_with_http_info(, tweet_id, opts)
  data
end

#undo_retweet_with_http_info(account_id, tweet_id, opts = {}) ⇒ Array<(UndoRetweet200Response, Integer, Hash)>

Undo retweet Undo a retweet (un-repost a tweet).

Parameters:

  • account_id (String)
  • tweet_id (String)

    The ID of the original tweet to un-retweet

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UndoRetweet200Response, Integer, Hash)>)

    UndoRetweet200Response data, response status code and response headers



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 314

def undo_retweet_with_http_info(, tweet_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TwitterEngagementApi.undo_retweet ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling TwitterEngagementApi.undo_retweet"
  end
  # verify the required parameter 'tweet_id' is set
  if @api_client.config.client_side_validation && tweet_id.nil?
    fail ArgumentError, "Missing the required parameter 'tweet_id' when calling TwitterEngagementApi.undo_retweet"
  end
  # resource path
  local_var_path = '/v1/twitter/retweet'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'tweetId'] = tweet_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'UndoRetweet200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"TwitterEngagementApi.undo_retweet",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TwitterEngagementApi#undo_retweet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#unfollow_user(account_id, target_user_id, opts = {}) ⇒ UnfollowUser200Response

Unfollow a user Unfollow a user on X/Twitter.

Parameters:

  • account_id (String)
  • target_user_id (String)

    The Twitter ID of the user to unfollow

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



374
375
376
377
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 374

def unfollow_user(, target_user_id, opts = {})
  data, _status_code, _headers = unfollow_user_with_http_info(, target_user_id, opts)
  data
end

#unfollow_user_with_http_info(account_id, target_user_id, opts = {}) ⇒ Array<(UnfollowUser200Response, Integer, Hash)>

Unfollow a user Unfollow a user on X/Twitter.

Parameters:

  • account_id (String)
  • target_user_id (String)

    The Twitter ID of the user to unfollow

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UnfollowUser200Response, Integer, Hash)>)

    UnfollowUser200Response data, response status code and response headers



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/zernio-sdk/api/twitter_engagement_api.rb', line 385

def unfollow_user_with_http_info(, target_user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TwitterEngagementApi.unfollow_user ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling TwitterEngagementApi.unfollow_user"
  end
  # verify the required parameter 'target_user_id' is set
  if @api_client.config.client_side_validation && target_user_id.nil?
    fail ArgumentError, "Missing the required parameter 'target_user_id' when calling TwitterEngagementApi.unfollow_user"
  end
  # resource path
  local_var_path = '/v1/twitter/follow'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 
  query_params[:'targetUserId'] = target_user_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'UnfollowUser200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"TwitterEngagementApi.unfollow_user",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TwitterEngagementApi#unfollow_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end