End Property
Public Function UpdateStatus(ByVal status As String, ByVal replyToId As Long, ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
Dim param As New Dictionary(Of String, String)
param.Add("status", status)
If replyToId > 0 Then param.Add("in_reply_to_status_id", replyToId.ToString)
End Function
Public Function DestroyStatus(ByVal id As Long) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
-
Return httpCon.GetContent(PostMethod, _
CreateTwitterUri("/1/statuses/destroy/" + id.ToString + ".xml"), _
Nothing, _
End Function
Public Function DestroyDirectMessage(ByVal id As Long) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
-
Return httpCon.GetContent(PostMethod, _
CreateTwitterUri("/1/direct_messages/destroy/" + id.ToString + ".xml"), _
Nothing, _
End Function
Public Function RetweetStatus(ByVal id As Long, ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
Return httpCon.GetContent(PostMethod, _
CreateTwitterUri("/1/statuses/retweet/" + id.ToString() + ".xml"), _
Nothing, _
End Function
Public Function CreateFriendships(ByVal screenName As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
Dim param As New Dictionary(Of String, String)
param.Add("screen_name", screenName)
End Function
Public Function DestroyFriendships(ByVal screenName As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
Dim param As New Dictionary(Of String, String)
param.Add("screen_name", screenName)
End Function
Public Function ShowFriendships(ByVal souceScreenName As String, ByVal targetScreenName As String, ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
Dim param As New Dictionary(Of String, String)
param.Add("source_screen_name", souceScreenName)
param.Add("target_screen_name", targetScreenName)
End Function
Public Function ShowStatuses(ByVal id As Long, ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
-
Return httpCon.GetContent(GetMethod, _
CreateTwitterUri("/1/statuses/show/" + id.ToString() + ".xml"), _
Nothing, _
End Function
Public Function CreateFavorites(ByVal id As Long) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
-
Return httpCon.GetContent(PostMethod, _
CreateTwitterUri("/1/favorites/create/" + id.ToString() + ".xml"), _
Nothing, _
End Function
Public Function DestroyFavorites(ByVal id As Long) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
-
Return httpCon.GetContent(PostMethod, _
CreateTwitterUri("/1/favorites/destroy/" + id.ToString() + ".xml"), _
Nothing, _
Nothing)
End Function
- Public Function HomeTimeline(ByVal count As Integer, ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
+ Public Function HomeTimeline(ByVal count As Integer, ByVal max_id As Long, ByVal since_id As Long, ByRef content As String) As HttpStatusCode
Dim param As New Dictionary(Of String, String)
If count > 0 Then
param.Add("count", count.ToString())
End If
+ If max_id > 0 Then
+ param.Add("max_id", max_id.ToString())
+ End If
+ If since_id > 0 Then
+ param.Add("since_id", since_id.ToString())
+ End If
Return httpCon.GetContent(GetMethod, _
CreateTwitterUri("/1/statuses/home_timeline.xml"), _
_remainCountApi)
End Function
- Public Function Mentions(ByVal count As Integer, ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
+ Public Function Mentions(ByVal count As Integer, ByVal max_id As Long, ByVal since_id As Long, ByRef content As String) As HttpStatusCode
Dim param As New Dictionary(Of String, String)
If count > 0 Then
param.Add("count", count.ToString())
End If
+ If max_id > 0 Then
+ param.Add("max_id", max_id.ToString())
+ End If
+ If since_id > 0 Then
+ param.Add("since_id", since_id.ToString())
+ End If
Return httpCon.GetContent(GetMethod, _
CreateTwitterUri("/1/statuses/mentions.xml"), _
_remainCountApi)
End Function
- Public Function DirectMessages(ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
+ Public Function DirectMessages(ByVal count As Integer, ByVal max_id As Long, ByVal since_id As Long, ByRef content As String) As HttpStatusCode
+ Dim param As New Dictionary(Of String, String)
+ If count > 0 Then
+ param.Add("count", count.ToString())
+ End If
+ If max_id > 0 Then
+ param.Add("max_id", max_id.ToString())
+ End If
+ If since_id > 0 Then
+ param.Add("since_id", since_id.ToString())
End If
Return httpCon.GetContent(GetMethod, _
_remainCountApi)
End Function
- Public Function DirectMessagesSent(ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
+ Public Function DirectMessagesSent(ByVal count As Integer, ByVal max_id As Long, ByVal since_id As Long, ByRef content As String) As HttpStatusCode
+ Dim param As New Dictionary(Of String, String)
+ If count > 0 Then
+ param.Add("count", count.ToString())
+ End If
+ If max_id > 0 Then
+ param.Add("max_id", max_id.ToString())
+ End If
+ If since_id > 0 Then
+ param.Add("since_id", since_id.ToString())
End If
Return httpCon.GetContent(GetMethod, _
End Function
Public Function Favorites(ByVal count As Integer, ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
Dim param As New Dictionary(Of String, String)
If count <> 20 Then param.Add("count", count.ToString())
End Function
Public Function FollowerIds(ByVal cursor As Long, ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
Dim param As New Dictionary(Of String, String)
param.Add("cursor", cursor.ToString())
End Function
Public Function RateLimitStatus(ByRef content As String) As HttpStatusCode
- If Me.AuthenticatedUsername = "" Then
- Return HttpStatusCode.Unauthorized
- End If
-
Return httpCon.GetContent(GetMethod, _
CreateTwitterUri("/1/account/rate_limit_status.xml"), _
Nothing, _
Nothing)
End Function
+ Public Function GetLists(ByVal user As String, ByVal cursor As Long, ByRef content As String) As HttpStatusCode
+ Dim param As New Dictionary(Of String, String)
+ param.Add("cursor", cursor.ToString)
+ Return httpCon.GetContent(GetMethod, _
+ CreateTwitterUri("/1/" + user + "/lists.xml"), _
+ param, _
+ content, _
+ _remainCountApi)
+ End Function
+
+ Public Function GetListsSubscriptions(ByVal user As String, ByVal cursor As Long, ByRef content As String) As HttpStatusCode
+ Dim param As New Dictionary(Of String, String)
+ param.Add("cursor", cursor.ToString)
+ Return httpCon.GetContent(GetMethod, _
+ CreateTwitterUri("/1/" + user + "/lists/subscriptions.xml"), _
+ param, _
+ content, _
+ _remainCountApi)
+ End Function
+
+ Public Function GetListsStatuses(ByVal user As String, ByVal list_id As String, ByVal per_page As Integer, ByVal max_id As Long, ByVal since_id As Long, ByRef content As String) As HttpStatusCode
+ '\94F\8fØ\82È\82\82Ä\82à\8eæ\93¾\82Å\82«\82é\82ª\81Aprotected\83\86\81[\83U\81[\95ª\82ª\94²\82¯\82é
+ Dim param As New Dictionary(Of String, String)
+ If per_page > 0 Then
+ param.Add("per_page", per_page.ToString())
+ End If
+ If max_id > 0 Then
+ param.Add("max_id", max_id.ToString())
+ End If
+ If since_id > 0 Then
+ param.Add("since_id", since_id.ToString())
+ End If
+
+ Return httpCon.GetContent(GetMethod, _
+ CreateTwitterUri("/1/" + user + "/lists/" + list_id + "/statuses.xml"), _
+ param, _
+ content, _
+ _remainCountApi)
+ End Function
+
+
+#Region "Proxy API"
Private Shared _twitterUrl As String = "api.twitter.com"
'Private TwitterUrl As String = "sorayukigtap.appspot.com/api"
Private Shared _TwitterSearchUrl As String = "search.twitter.com"
_TwitterSearchUrl = value
End Set
End Property
+#End Region
+
End Class
''''Wedata対応
'Private Const wedataUrl As String = "http://wedata.net/databases/Tween/items.json"
+ 'max_idで古い発言を取得するために保持(lists分は個別タブで管理)
+ Private minHomeTimeline As Long = Long.MaxValue
+ Private minMentions As Long = Long.MaxValue
+ Private minDirectmessage As Long = Long.MaxValue
+ Private minDirectmessageSent As Long = Long.MaxValue
+ Private minFavorites As Long = Long.MaxValue
+
Private twCon As New HttpTwitter
Public Function Authenticate(ByVal username As String, ByVal password As String) As Boolean
Dim content As String = ""
Try
If gType = WORKERTYPE.Timeline Then
- res = twCon.HomeTimeline(_countApi, content)
+ res = twCon.HomeTimeline(_countApi, 0, 0, content)
countQuery = _countApi
Else
- res = twCon.Mentions(_countApiReply, content)
+ res = twCon.Mentions(_countApiReply, 0, 0, content)
countQuery = _countApiReply
End If
Catch ex As Exception
Dim post As New PostClass
Try
post.Id = Long.Parse(xentry.Item("id").InnerText)
+ If gType = WORKERTYPE.Timeline Then
+ If minHomeTimeline > post.Id Then minHomeTimeline = post.Id
+ Else
+ If minMentions > post.Id Then minMentions = post.Id
+ End If
'二重取得回避
SyncLock LockObj
If TabInformations.GetInstance.ContainsKey(post.Id) Then Continue For
Try
If gType = WORKERTYPE.DirectMessegeRcv Then
- res = twCon.DirectMessages(content)
+ res = twCon.DirectMessages(0, 0, 0, content)
Else
- res = twCon.DirectMessagesSent(content)
+ res = twCon.DirectMessagesSent(0, 0, 0, content)
End If
Catch ex As Exception
Return "Err:" + ex.Message
Dim post As New PostClass
Try
post.Id = Long.Parse(xentry.Item("id").InnerText)
+ If gType = WORKERTYPE.DirectMessegeRcv Then
+ If minDirectmessage > post.Id Then minDirectmessage = post.Id
+ Else
+ If minDirectmessageSent > post.Id Then minDirectmessageSent = post.Id
+ End If
'二重取得回避
SyncLock LockObj
If TabInformations.GetInstance.GetTabByType(TabUsageType.DirectMessage).Contains(post.Id) Then Continue For
Dim post As New PostClass
Try
post.Id = Long.Parse(xentry.Item("id").InnerText)
+ If minFavorites > post.Id Then minFavorites = post.Id
'二重取得回避
SyncLock LockObj
If TabInformations.GetInstance.ContainsKey(post.Id) Then Continue For