aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/net/lacolaco/smileessence/twitter/TweetReactions.kt
blob: b71a4319fefd6a367f49e80ca25753b03ec473d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package net.lacolaco.smileessence.twitter

import net.lacolaco.smileessence.World
import net.lacolaco.smileessence.entity.Tweet
import net.lacolaco.smileessence.util.bg

fun World.retweetAsync(id: Long) = bg {
    Tweet.fromTwitter(TwitterTaskException.wrap { twitter.tweets().retweetStatus(id) }, id)
}

fun World.favoriteAsync(id: Long) = bg {
    Tweet.fromTwitter(TwitterTaskException.wrap { twitter.favorites().createFavorite(id) }, id)
}

fun World.unfavoriteAsync(id: Long) = bg {
    Tweet.fromTwitter(TwitterTaskException.wrap { twitter.favorites().destroyFavorite(id) }, id)
}