Skip to content

Instantly share code, notes, and snippets.

@BenWard
Created June 26, 2011 21:33
Show Gist options
  • Save BenWard/1047991 to your computer and use it in GitHub Desktop.
Save BenWard/1047991 to your computer and use it in GitHub Desktop.
Hypothetical way of manifesting Web Intents for a service to the browser, along with some facility for property name mapping and proprietary requirements.
{
'vendor': 'twitter',
'intents': [
{
'name': "Follow",
'verb': 'follow',
'url': 'http://twitter.com/intent/follow',
'required_params': ['screen_name'],
'param_map': {
'user_name': 'screen_name'
}
},
{
'name': "View Profile",
'verb': 'profile',
'url': 'http://twitter.com/intent/user',
'required_params': ['screen_name'],
'param_map': {
'user_name': 'screen_name'
}
},
{
'name': "Tweet",
'verb': 'post',
'url': 'http://twitter.com/intent/tweet'
},
{
'name': "Tweet Link",
'verb': 'share',
'required_params': ['url'],
'url': 'http://twitter.com/share'
},
{
'name': "Retweet",
'verb': 'share',
'required_params': ['tweet_id'],
'url': 'http://twitter.com/intent/retweet',
'param_map': {
'object_id': 'tweet_id'
}
},
{
'name': "Reply to Tweet",
'verb': 'reply',
'url': 'http://twitter.com/intent/tweet',
'required_params': ['in_reply_to'],
'param_map': {
'parent_id': 'in_reply_to'
}
},
{
'name': "Favorite",
'verb': 'save',
'url': 'http://twitter.com/intent/favorite',
'required_params': ['tweet_id'],
'param_map': {
'object_id': 'tweet_id'
}
},
{
'name': "Direct Message",
'verb': 'post',
'url': 'http://twitter.com/intent/message',
'required_params': ['screen_name'],
'param_map': { 'user_name': 'screen_name' }
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment