aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/miz_hi/smileessence/twitter/API.java
blob: db2fe72158792e31a8acdb20d987c8d8783e412f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
package net.miz_hi.smileessence.twitter;

import net.miz_hi.smileessence.Client;
import net.miz_hi.smileessence.auth.Account;
import twitter4j.*;


public class API
{

	/*
     * TWEET
	 */

    public static Status getStatus(Account account, long id) throws TwitterException
    {
        return TwitterManager.getTwitter(account).showStatus(id);
    }

    public static void favorite(Account account, long statusId) throws TwitterException
    {
        TwitterManager.getTwitter(account).createFavorite(statusId);
    }

    public static void unfavorite(Account account, long statusId) throws TwitterException
    {
        TwitterManager.getTwitter(account).destroyFavorite(statusId);
    }

    public static void retweet(Account account, long statusId) throws TwitterException
    {
        TwitterManager.getTwitter(account).retweetStatus(statusId);
    }

    public static void destroyTweet(Account account, long statusId) throws TwitterException
    {
        TwitterManager.getTwitter(account).destroyStatus(statusId);
    }

    public static void tweet(Account account, String str) throws TwitterException
    {
        Tweet.update(account, str);
    }

    public static void tweet(Account account, String str, long l) throws TwitterException
    {
        Tweet.update(account, str, l);
    }

    public static void tweet(Account account, StatusUpdate update) throws TwitterException
    {
        Tweet.update(account, update);
    }

    public static boolean isStatusUpdateLimit()
    {
        return Tweet.isStatusUpdateLimit();
    }

	/*
     * USER
	 */

    public static User getUser(Account account, long id) throws TwitterException
    {
        return TwitterManager.getTwitter(account).showUser(id);
    }

    public static User getUser(Account account, String screenName) throws TwitterException
    {
        return TwitterManager.getTwitter(account).showUser(screenName);
    }

    public static void follow(Account account, String screenName) throws TwitterException
    {
        TwitterManager.getTwitter(account).createFriendship(screenName);
    }

    public static void unfollow(Account account, String screenName) throws TwitterException
    {
        TwitterManager.getTwitter(account).destroyFriendship(screenName);
    }

    public static void block(Account account, String screenName) throws TwitterException
    {
        TwitterManager.getTwitter(account).createBlock(screenName);
    }

    public static void unblock(Account account, String screenName) throws TwitterException
    {
        TwitterManager.getTwitter(account).destroyBlock(screenName);
    }

    public static void spam(Account account, String screenName) throws TwitterException
    {
        TwitterManager.getTwitter(account).reportSpam(screenName);
    }

	/*
     * RELATIONSHIP
	 */

    public static Relationship getRelationship(Account account, long id) throws TwitterException
    {
        return TwitterManager.getTwitter(account).showFriendship(account.getUserId(), id);
    }

    public static Relationship getRelationship(Account account, String screenName) throws TwitterException
    {
        return TwitterManager.getTwitter(account).showFriendship(account.getScreenName(), screenName);
    }
	
	/*
	 * TIMELINE
	 */

    public static ResponseList<Status> getHomeTimeline(Account account, Paging page) throws TwitterException
    {
        return TwitterManager.getTwitter(account).getHomeTimeline(page);
    }

    public static ResponseList<Status> getMentions(Account account, Paging page) throws TwitterException
    {
        return TwitterManager.getTwitter(account).getMentionsTimeline(page);
    }

    public static ResponseList<Status> getUserTimeline(Account account, long userId, Paging page) throws TwitterException
    {
        return TwitterManager.getTwitter(account).getUserTimeline(userId, page);
    }

    public static ResponseList<Status> getUserTimeline(Account account, String screenName, Paging page) throws TwitterException
    {
        return TwitterManager.getTwitter(account).getUserTimeline(screenName, page);
    }

	/*
	 * LIST
	 */

    public static ResponseList<UserList> getReadableLists(Account account) throws TwitterException
    {
        return TwitterManager.getTwitter(account).getUserLists(Client.getMainAccount().getUserId());
    }

    public static ResponseList<Status> getListTimeline(Account account, int listId, Paging page) throws TwitterException
    {
        return TwitterManager.getTwitter(account).getUserListStatuses(listId, page);
    }
}