Class Definition

class @com.twitter #_[name="Twitter Account"] #_[description="Connect your ThingEngine with Twitter"] #[version=103] #[package_version=103] { import loader from @org.thingpedia.v2(); import config from @org.thingpedia.config.oauth2(); monitorable list query search(in opt count: Number #_[prompt="How many tweets do you want?"] #_[canonical="count"], out text: String #_[canonical="text"] #[string_values="tt:long_free_text"], out hashtags: Array(Entity(tt:hashtag)) #_[canonical="hashtags"] #[string_values="com.twitter:hashtag"], out urls: Array(Entity(tt:url)) #_[canonical="urls"], out author: Entity(tt:username) #_[prompt="From which user do you want tweets?"] #_[canonical="author"] #[string_values="com.twitter:username"], out in_reply_to: Entity(tt:username) #_[prompt="In reply to which user do you want tweets?"] #_[canonical="in reply to"] #[string_values="com.twitter:username"], out tweet_id: Entity(com.twitter:id) #_[canonical="tweet id"]) #_[canonical="search on twitter"] #_[confirmation="recent tweets"] #_[formatted=[{type="text",text="@${author} tweeted: ${text}"}]] #_[confirmation_remote="recent tweets"] #[poll_interval=600000ms] #[doc="search recent tweets; default is 5"]; monitorable list query home_timeline(out text: String #_[canonical="text"] #[string_values="tt:long_free_text"], out hashtags: Array(Entity(tt:hashtag)) #_[canonical="hashtags"] #[string_values="com.twitter:hashtag"], out urls: Array(Entity(tt:url)) #_[canonical="urls"], out author: Entity(tt:username) #_[canonical="author"] #[string_values="com.twitter:username"], out in_reply_to: Entity(tt:username) #_[canonical="in reply to"] #[string_values="com.twitter:username"], out tweet_id: Entity(com.twitter:id) #_[canonical="tweet id"]) #_[canonical="twitter home timeline"] #_[confirmation="tweets from anyone you follow"] #_[confirmation_remote="tweets from anyone $__person's follow"] #_[formatted=[{type="text",text="@${author} tweeted: ${text}"}]] #[poll_interval=600000ms] #[doc="shows your Twitter timeline (the home page of Twitter)"]; monitorable list query my_tweets(out text: String #_[canonical="text"] #[string_values="tt:long_free_text"], out hashtags: Array(Entity(tt:hashtag)) #_[canonical="hashtags"] #[string_values="com.twitter:hashtag"], out urls: Array(Entity(tt:url)) #_[canonical="urls"], out in_reply_to: Entity(tt:username) #_[canonical="in reply to"] #[string_values="com.twitter:username"], out tweet_id: Entity(com.twitter:id) #_[canonical="tweet id"]) #_[canonical="my tweets on twitter"] #_[confirmation="tweets from you"] #_[confirmation_remote="tweets from $__person"] #_[formatted=[{type="text",text="You tweeted: ${text}"}]] #[poll_interval=600000ms] #[doc="get your recent tweets"]; monitorable list query direct_messages(out sender: Entity(tt:username) #_[canonical="sender"] #[string_values="com.twitter:username"], out message: String #_[canonical="message"] #[string_values="tt:message"]) #_[canonical="twitter direct messages"] #_[confirmation="direct messages you received on Twitter"] #_[confirmation_remote="direct messages $__person received on Twitter"] #_[formatted=[{type="text",text="@${sender}: ${message}"}]] #[poll_interval=600000ms] #[doc="get recent direct messages you received"]; action send_direct_message(in req to: Entity(tt:username) #_[prompt="Who do you want to send the message to?"] #_[canonical="to"] #[string_values="com.twitter:username"], in req message: String #_[prompt="What message do you want to send?"] #_[canonical="message"] #[string_values="tt:message"]) #_[canonical="send dm on twitter"] #_[confirmation="send a direct message on Twitter to $to saying $message"] #_[confirmation_remote="send a direct message on $__person's Twitter to $to saying $message"] #[doc="send a direct message"]; action post_picture(in req caption: String #_[prompt="What caption do you want?"] #_[canonical="caption"] #[string_values="com.instagram:caption"], in req picture_url: Entity(tt:picture) #_[prompt="Upload the picture now."] #_[canonical="picture url"]) #_[canonical="post picture on twitter"] #_[confirmation="tweet $caption with an attached picture"] #_[confirmation_remote="post $caption and a picture on $__person's Twitter"] #[doc="post a tweet with a picture"]; action follow(in req user_name: Entity(tt:username) #_[prompt="What user do you want to follow?"] #_[canonical="user name"] #[string_values="com.twitter:username"]) #_[canonical="follow on twitter"] #_[confirmation="follow $user_name on Twitter"] #_[confirmation_remote="follow $user_name with $__person's Twitter"] #[doc="follow the named user"]; action unfollow(in req user_name: Entity(tt:username) #_[prompt="What user do you want to unfollow?"] #_[canonical="user name"] #[string_values="com.twitter:username"]) #_[canonical="unfollow on twitter"] #_[confirmation="unfollow $user_name on Twitter"] #_[confirmation_remote="unfollow $user_name from $__person's Twitter"] #[doc="stop following the named user; this call succeeds even if the user was already followed before"]; action post(in req status: String #_[prompt="What do you want to tweet?"] #_[canonical="status"] #[string_values="tt:long_free_text"]) #_[canonical="post on twitter"] #_[confirmation="tweet $status"] #_[confirmation_remote="post $status on $__person's Twitter"] #[doc="post a tweet; use # to include a hashtag and @ to reply"]; action retweet(in req tweet_id: Entity(com.twitter:id) #_[prompt="What tweet do you want to retweet?"] #_[canonical="tweet id"]) #_[canonical="retweet"] #_[confirmation="retween $tweet_id"] #_[confirmation_remote="retweet $tweet_id on $__person's Twitter Account"] #[doc="retweet a given tweet, by id"]; }

Dataset

dataset @com.twitter language "en" { stream := monitor (@com.twitter.home_timeline()) #_[utterances=["when someone i follow tweets", "when i receive a tweet", "when there is a new tweet in my timeline", "when somebody i follow on twitter posts", "when there is a new post on my twitter timeline"]] #[id=28017000] #[name=""]; stream (p_author :Entity(tt:username)) := monitor ((@com.twitter.home_timeline()), author == p_author) #_[utterances=["when user ${p_author:no-undefined} tweets", "when i receive a tweet from ${p_author:no-undefined}"]] #[id=28017005] #[name=""]; stream (p_in_reply_to :Entity(tt:username)) := monitor ((@com.twitter.home_timeline()), in_reply_to == p_in_reply_to) #_[utterances=["when someone i follow replies to user ${p_in_reply_to} on twitter"]] #[id=28017007] #[name=""]; stream := monitor (@com.twitter.direct_messages()) #_[utterances=["when i receive a direct message on twitter", "when somebody dms me", "when somebody sends me a direct message", "when somebody sends me a message on twitter", "when somebody messages me on twitter", "when i get a message on twitter"]] #[id=28017008] #[name=""]; stream (p_sender :Entity(tt:username)) := monitor ((@com.twitter.direct_messages()), sender == p_sender) #_[utterances=["when i receive a direct message from ${p_sender:no-undefined} on twitter", "if i receive a dm on twitter from ${p_sender:no-undefined}", "when ${p_sender:no-undefined} dms me", "when ${p_sender:no-undefined} sends me a direct message on twitter"]] #[id=28017014] #[name=""]; stream := monitor (@com.twitter.my_tweets()) #_[utterances=["when i tweet", "when i post something to twitter", "when i make a new tweet", "when i make a new twitter post"]] #[id=28017018] #[name=""]; stream (p_in_reply_to :Entity(tt:username)) := monitor ((@com.twitter.my_tweets()), in_reply_to == p_in_reply_to) #_[utterances=["when i reply to ${p_in_reply_to} on twitter", "when i make a new tweet in reply to ${p_in_reply_to} on twitter", "when i mention $p_in_reply_to on twitter"]] #[id=28017022] #[name=""]; query (p_text :String) := (@com.twitter.search()), text =~ p_text #_[utterances=["tweets matching ${p_text} on twitter", "${p_text:const} tweets", "recent tweets about $p_text"]] #[id=28017025] #[name=""]; query := @com.twitter.search() #_[utterances=["recent tweets", "the latest tweets"]] #[id=28017028] #[name=""]; query (p_author :Entity(tt:username)) := (@com.twitter.search()), author == p_author #_[utterances=["recent tweets from ${p_author:no-undefined}", "recents posts from ${p_author:no-undefined} on twitter"]] #[id=28017030] #[name=""]; query (p_author :Entity(tt:username), p_text :String) := (@com.twitter.search()), (text =~ p_text && author == p_author) #_[utterances=["recent tweets from ${p_author} matching ${p_text}", "recents posts on twitter from ${p_author:no-undefined} matching $p_text"]] #[id=28017032] #[name=""]; query (p_in_reply_to :Entity(tt:username)) := (@com.twitter.search()), in_reply_to == p_in_reply_to #_[utterances=["recent tweets in reply to ${p_in_reply_to}"]] #[id=28017034] #[name=""]; query (p_in_reply_to :Entity(tt:username), p_text :String) := (@com.twitter.search()), (text =~ p_text && in_reply_to == p_in_reply_to) #_[utterances=["recent tweets in reply to ${p_in_reply_to} matching ${p_text}"]] #[id=28017035] #[name=""]; query (p_hashtag :Entity(tt:hashtag)) := (@com.twitter.search()), contains(hashtags, p_hashtag) #_[utterances=["tweets with hashtag ${p_hashtag} on twitter", "tweets with hashtag ${p_hashtag}", "tweets about $p_hashtag"]] #[id=28017036] #[name=""]; query (p_count :Number, p_hashtag :Entity(tt:hashtag)) := (@com.twitter.search(count=p_count)), contains(hashtags, p_hashtag) #_[utterances=["${p_count:const} recent tweets with hashtag $p_hashtag"]] #[id=28017039] #[name=""]; query (p_author :Entity(tt:username), p_hashtag :Entity(tt:hashtag)) := (@com.twitter.search()), (contains(hashtags, p_hashtag) && author == p_author) #_[utterances=["tweets from ${p_author} with hashtag $p_hashtag", "posts on twitter from $p_author with hashtag $p_hashtag"]] #[id=28017040] #[name=""]; query (p_hashtag :Entity(tt:hashtag), p_in_reply_to :Entity(tt:username)) := (@com.twitter.search()), (contains(hashtags, p_hashtag) && in_reply_to == p_in_reply_to) #_[utterances=["tweets with hashtag ${p_hashtag} in reply to ${p_in_reply_to}"]] #[id=28017042] #[name=""]; query (p_author :Entity(tt:username), p_in_reply_to :Entity(tt:username)) := (@com.twitter.search()), (author == p_author && in_reply_to == p_in_reply_to) #_[utterances=["posts on twitter from $p_author in reply to ${p_in_reply_to}"]] #[id=28017043] #[name=""]; action (p_status :String) := @com.twitter.post(status=p_status) #_[utterances=["tweet ${p_status}", "post on twitter saying ${p_status}", "post ${p_status} on twitter", "tweet that ${p_status:const}", "make a post on twitter that says $p_status", "make a tweet on twitter that says $p_status"]] #[id=28017044] #[name=""]; action (p_to :Entity(tt:username), p_message :String) := @com.twitter.send_direct_message(to=p_to, message=p_message) #_[utterances=["send a dm on twitter to ${p_to} saying ${p_message}", "send a direct message on twitter to ${p_to} saying ${p_message}", "dm ${p_to} on twitter saying ${p_message}", "send a message on twitter to ${p_to} saying ${p_message}"]] #[id=28017050] #[name=""]; action (p_caption :String) := @com.twitter.post_picture(caption=p_caption, picture_url=$?) #_[utterances=["tweet a picture with caption ${p_caption}", "post a picture on twitter saying ${p_caption}"]] #[id=28017054] #[name=""]; action := @com.twitter.post_picture(caption=$?, picture_url=$?) #_[utterances=["tweet a picture", "post a picture on twitter"]] #[id=28017056] #[name=""]; action (p_user_name :Entity(tt:username)) := @com.twitter.follow(user_name=p_user_name) #_[utterances=["follow ${p_user_name} on twitter", "become a follower of ${p_user_name} on twitter", "be a twitter follower of ${p_user_name}", "become a twitter follower of ${p_user_name}"]] #[id=28017058] #[name=""]; action (p_user_name :Entity(tt:username)) := @com.twitter.unfollow(user_name=p_user_name) #_[utterances=["unfollow ${p_user_name} on twitter", "stop following ${p_user_name} on twitter"]] #[id=28017062] #[name=""]; query := @com.twitter.home_timeline() #_[utterances=["tweets from anyone i follow", "tweets in my timeline"]] #[id=28017064] #[name=""]; query (p_text :String) := (@com.twitter.home_timeline()), text =~ p_text #_[utterances=["tweets from anyone i follow that contain ${p_text}", "tweets from anyone i follow that match ${p_text}"]] #[id=28017066] #[name=""]; query (p_in_reply_to :Entity(tt:username)) := (@com.twitter.my_tweets()), in_reply_to == p_in_reply_to #_[utterances=["my twitter replies to ${p_in_reply_to}", "my twitter mentions to $p_in_reply_to", "my tweets that mention $p_in_reply_to"]] #[id=28017068] #[name=""]; query := @com.twitter.my_tweets() #_[utterances=["my tweets", "my posts on twitter", "my recent tweets", "tweets i made"]] #[id=28017071] #[name=""]; query := @com.twitter.direct_messages() #_[utterances=["my twitter direct messages", "the direct messages i received on twitter", "the messages i got on twitter", "my twitter messages", "my twitter dms"]] #[id=28017075] #[name=""]; query (p_in_reply_to :Entity(tt:username)) := (@com.twitter.home_timeline()), in_reply_to == p_in_reply_to #_[utterances=["tweets from anyone i follow in reply to ${p_in_reply_to}"]] #[id=28017080] #[name=""]; query (p_hashtag :Entity(tt:hashtag)) := (@com.twitter.my_tweets()), contains(hashtags, p_hashtag) #_[utterances=["my tweets with hashtag ${p_hashtag}", "tweets i made with hashtag ${p_hashtag}"]] #[id=28017081] #[name=""]; query (p_hashtag :Entity(tt:hashtag)) := (@com.twitter.home_timeline()), contains(hashtags, p_hashtag) #_[utterances=["tweets from people i follow about ${p_hashtag:const}"]] #[id=28017083] #[name=""]; action (p_tweet_id :Entity(com.twitter:id)) := @com.twitter.retweet(tweet_id=p_tweet_id) #_[utterances=["retweet ${p_tweet_id}", "retweet $p_tweet_id to my followers"]] #[id=28017084] #[name=""]; program := { monitor (@com.twitter.home_timeline()) => @com.twitter.retweet(tweet_id=tweet_id); } #_[utterances=["automatically retweet anyone i follow"]] #[id=28017086] #[name=""]; action (p_picture_url :Entity(tt:picture)) := @com.twitter.post_picture(picture_url=p_picture_url, caption=$?) #_[utterances=["post ${p_picture_url} on twitter", "upload $p_picture_url to twitter", "make a tweet containing $p_picture_url"]] #[id=28017087] #[name=""]; action (p_picture_url :Entity(tt:picture), p_caption :String) := @com.twitter.post_picture(picture_url=p_picture_url, caption=p_caption) #_[utterances=["post ${p_picture_url} on twitter with caption ${p_caption}", "caption ${p_picture_url} as ${p_caption:const} and post it on twitter", "upload ${p_picture_url} on twitter with caption ${p_caption}"]] #[id=28017090] #[name=""]; action := @com.twitter.post(status=$?) #_[utterances=["tweet something", "make a tweet", "make a twitter post", "post on twitter"]] #[id=28017093] #[name=""]; action (p_to :Entity(tt:username)) := @com.twitter.send_direct_message(to=p_to, message=$?) #_[utterances=["send a message to $p_to on twitter", "send a twitter message to $p_to", "send a twitter direct message to $p_to", "send a twitter dm to $p_to", "dm $p_to on twitter"]] #[id=28017097] #[name=""]; }