Twitter Component


Properties

consumerKey
  The consumer key to be used when authorizing with Twitter via OAuth.
Data type: string
Designer Writable true <twitter name="twitterName" consumerKey="Test consumerKey">
Code Writeable true twitterName.consumerKey = "Test consumerKey"
Code Readable true let variable = twitterName.consumerKey

consumerSecret
  The consumer secret to be used when authorizing with Twitter via OAuth.
Data type: string
Designer Writable true <twitter name="twitterName" consumerSecret="Test consumerSecret">
Code Writeable true twitterName.consumerSecret = "Test consumerSecret"
Code Readable true let variable = twitterName.consumerSecret

directMessages
  This property contains a list of the most recent messages mentioning the logged-in user. Initially, the list is empty. To set it, the program must
Data type: array
Designer Writable false
Code Writeable false
Code Readable true let variable = twitterName.directMessages

followers
  This property contains a list of the followers of the logged-in user. Initially, the list is empty. To set it, the program must
Data type: array
Designer Writable false
Code Writeable false
Code Readable true let variable = twitterName.followers

friendTimeline
  This property contains the 20 most recent messages of users being followed. Initially, the list is empty. To set it, the program must
Data type: array
Designer Writable false
Code Writeable false
Code Readable true let variable = twitterName.friendTimeline

mentions
  This property contains a list of mentions of the logged-in user. Initially, the list is empty. To set it, the program must
Data type: array
Designer Writable false
Code Writeable false
Code Readable true let variable = twitterName.mentions

searchResults
  This property, which is initially empty, is set to a list of search results after the program
Data type: array
Designer Writable false
Code Writeable false
Code Readable true let variable = twitterName.searchResults

username
  The user name of the authorized user. Empty if there is no authorized user.
Data type: string
Designer Writable false
Code Writeable false
Code Readable true let variable = twitterName.username

class
  The styling class of the the component
Data type: string
Designer Writable true <twitter name="twitterName" class="Test class">
Code Writeable false
Code Readable false

id
  The styling id of the the component
Data type: string
Designer Writable true <twitter name="twitterName" id="Test id">
Code Writeable false
Code Readable false

name
  The name of the component that will be used to refer to it in code.
Data type: string
Designer Writable true <twitter name="twitterName" name="testComponent">
Code Writeable false
Code Readable false

Methods

Method name Description Parameters
authorize Redirects user to login to Twitter via the Web browser using the OAuth protocol if we don't already have authorization.
twitterName.authorize()
checkAuthorized Check whether we already have access, and if so, causes the IsAuthorized event handler to be called.
twitterName.checkAuthorized()
deAuthorize Removes Twitter authorization from this running app instance.
twitterName.deAuthorize()
directMessage This sends a direct (private) message to the specified user. The message will be trimmed if it exceeds 160 characters. Requirements: This should only be called after the IsAuthorized event has been raised, indicating that the user has successfully logged in to Twitter.
twitterName.directMessage(user, message)
twitterName.directMessage("Test user", "Test message")
user string
message string
follow Starts following a user.
twitterName.follow(user)
twitterName.follow("Test user")
user string
requestDirectMessages Requests the 20 most recent direct messages sent to the logged-in user. When the messages have been retrieved, the system will raise the DirectMessagesReceived event and set the DirectMessages property to the list of messages. Requirements: This should only be called after the IsAuthorized event has been raised, indicating that the user has successfully logged in to Twitter.
twitterName.requestDirectMessages()
requestFollowers Gets who is following you.
twitterName.requestFollowers()
requestFriendTimeline Gets the most recent 20 messages in the user's timeline.
twitterName.requestFriendTimeline()
requestMentions Requests the 20 most recent mentions of the logged-in user. When the mentions have been retrieved, the system will raise the MentionsReceived event and set the Mentions property to the list of mentions. Requirements: This should only be called after the IsAuthorized event has been raised, indicating that the user has successfully logged in to Twitter.
twitterName.requestMentions()
searchTwitter This searches Twitter for the given String query. Requirements: This should only be called after the IsAuthorized event has been raised, indicating that the user has successfully logged in to Twitter.
twitterName.searchTwitter(query)
twitterName.searchTwitter("Test query")
query string
stopFollowing Stops following a user.
twitterName.stopFollowing(user)
twitterName.stopFollowing("Test user")
user string
tweet This sends a tweet as the logged-in user with the specified Text, which will be trimmed if it exceeds 160 characters. Requirements: This should only be called after the IsAuthorized event has been raised, indicating that the user has successfully logged in to Twitter.
twitterName.tweet(status)
twitterName.tweet("Test status")
status string
tweetWithImage This sends a tweet as the logged-in user with the specified Text and a path to the image to be uploaded, which will be trimmed if it exceeds 160 characters. If an image is not found or invalid, the update will not be sent. Requirements: This should only be called after the IsAuthorized event has been raised, indicating that the user has successfully logged in to Twitter.
twitterName.tweetWithImage(status, imagePath)
twitterName.tweetWithImage("Test status", "Test imagePath")
status string
imagePath string
addEventListener Method used to create event listeners.
See Events below for samples.
eventName string
eventCallbackFunction callback

Events

Event name Description Parameters
directMessagesReceived This event is raised when the recent messages requested through RequestDirectMessages have been retrieved. A list of the messages can then be found in the messages parameter or the DirectMessages property.
twitterName.addEventListener(
    "directMessagesReceived",
    function (messages) {
        //Your code here
    }
)
messages list
followersReceived This event is raised when all of the followers of the logged-in user requested through RequestFollowers have been retrieved. A list of the followers can then be found in the followers parameter or the Followers property.
twitterName.addEventListener(
    "followersReceived",
    function (followers2) {
        //Your code here
    }
)
followers2 list
friendTimelineReceived This event is raised when the messages requested through RequestFriendTimeline have been retrieved. The timeline parameter and the FriendTimeline property will contain a list of lists, where each sub-list contains a status update of the form (username message).
twitterName.addEventListener(
    "friendTimelineReceived",
    function (timeline) {
        //Your code here
    }
)
timeline list
isAuthorized This event is raised after the program calls Authorize if the authorization was successful. It is also called after a call to CheckAuthorized if we already have a valid access token. After this event has been raised, any other method for this component can be called.
twitterName.addEventListener(
    "isAuthorized",
    function () {
        //Your code here
    }
)
mentionsReceived This event is raised when the mentions of the logged-in user requested through RequestMentions have been retrieved. A list of the mentions can then be found in the mentions parameter or the Mentions property.
twitterName.addEventListener(
    "mentionsReceived",
    function (mentions) {
        //Your code here
    }
)
mentions list
searchSuccessful This event is raised when the results of the search requested through SearchTwitter have been retrieved. A list of the results can then be found in the results parameter or the SearchResults property.
twitterName.addEventListener(
    "searchSuccessful",
    function (searchResults) {
        //Your code here
    }
)
searchResults list