Where in the API is TWTRTweetActionCompletion triggered?


#1

I’m wanting to perform likes and retweets and I see TWTRTweetActionCompletion in the TwitterKit source:

/**
 *  Completion block called when a Tweet action (favorite/retweet) is performed.
 *
 *  @param response Metadata associated with the response to a URL load request.
 *  @param tweet    The Tweet object representing the new state of this Tweet from
 *                  the perspective of the currently-logged in user.
 *  @param error    Error object describing the error that occurred. This will be either a 
 *                  network error or an NSError with an errorCode corresponding to 
 *                  TWTRAPIErrorCodeAlreadyFavorited or TWTRAPIErrorCodeAlreadyRetweeted
 *                  for an attempted action that has already been taken from the servers
 *                  point of view for this logged-in user.
 */
public typealias TWTRTweetActionCompletion = (TWTRTweet?, NSError?) -> Void

But I can’t find anywhere in the TwitterKit API to perform a like or a retweet (apart from rolling my own manual request). Is this typealias just placeholder for future functionality or am I missing something?


#2

Hi @sketch34! Great to hear from you. I think you’ll find the answers to your questions, here https://docs.fabric.io/android/twitter/show-tweets.html#tweet-actions.

Let me know! Thanks :slight_smile:


#3

Hi Todd, I’m on iOS and it looks like that part of the doc is talking about actions available on TweetView. What I was wondering was if the iOS Fabric API has convenience methods for doing favourite/retweet to the REST API, e.g. like it has the loadTweet() method. Seeing this typealias in the source made me think there might be but I couldn’t find them anywhere.


#4

Hi @sketch34! Hope you are doing well. You can have a look at the code documentation here, https://docs.fabric.io/appledocs/Twitter/index.html. Thanks!


#5

Thanks mate but I’ve had a look there and I can’t find anything that allows you to perform a like or retweet programatically. I ended up just doing it myself via the manual twitter request API sendTwitterRequest:completion: