如何使用Fabric sdk为twitter安卓应用添加关注或创建友谊 链接在这里 https://docs.fabric.io/android/twitter/index.html 我无法从面料文档中获取以下信息
答案 0 :(得分:2)
这是答案 实际上,它已经为api调用做了必要的终点
Sub objectsToDictionaryTest()
Dim CResults As Dictionary
Dim accessKey As DCRKey
Dim key As DCRKey
Dim value As DCR
'--------------------------------------------------------------------------------
Set CResults = New Scripting.Dictionary
'Let's create an object of [DCRKey] class (it will be used as a key when adding to
'the dictionary) and an object of [DCR] class (it will be used as a value).
Set accessKey = New DCRKey
With accessKey
.loadcase = 10
.node = 2000
.csystem = "Global"
End With
Set value = New DCR
With value
.C1 = 10
.C2 = 20
.Fs = 3
End With
'Now, let's add a new entry to the dictionary [CResults]
CResults.Add accessKey, value
'Let's create the other object of [DCRKey] that have exactly the same properties
'as object assigned to the variable [accessKey].
Set key = New DCRKey
With key
.loadcase = 10
.node = 2000
.csystem = "Global"
End With
'Now, let's check how dictionary is acting when we try to find an entry by [accesKey] and [key].
Debug.Print "[accessKey] exists: " & CResults.Exists(accessKey) 'it should return True.
Debug.Print "[key] exists: " & CResults.Exists(key) 'it should return False.
Debug.Print "[Value for accessKey]: " & CResults.Item(accessKey).Fs 'it should print 3
'The line below should cause an run-time error 424: Object required.
Debug.Print "[Value for key]: " & CResults.Item(key).Fs
End Sub
然后使用它
public class TwitterFollow extends TwitterApiClient {
public TwitterFollow(TwitterSession session) {
super(session);
}
public FollowService getFollowService() {
return getService(FollowService.class);
}
/*interface used for Auth Api call for CreateFriendship*/
public interface FollowService {
@POST("/1.1/friendships/create.json")
public void create(@Query("screen_name") String screen_name, @Query("user_id") String user_id, @Query("follow") boolean follow, Callback<User> cb);
}
}
答案 1 :(得分:0)
@SunilRaikwar,create方法必须调用&lt; 用户&gt; 作为返回值,而不是参数:
public class TwitterFollowApi extends TwitterApiClient {
public TwitterFollowApi(TwitterSession session) {
super(session);
}
public FollowService getFollowService() {
return getService(FollowService.class);
}
/*interface used for Auth Api call for CreateFriendship*/
public interface FollowService {
@POST("/1.1/friendships/create.json")
Call<User> create(@Query("screen_name") String screen_name, @Query("twitterLike") boolean follow);
}
}