FriendsDispatcher
Interface to the Friends dispatcher More...
Signals
- likeComplete(bool success, string errorMessage)
- retweetComplete(bool success, string errorMessage)
- sendComplete(bool success, string errorMessage)
- unlikeComplete(bool success, string errorMessage)
- uploadComplete(bool success, string errorMessage)
Methods
- object likeAsync(int accountId, string messageId)
- object retweetAsync(int accountId, string messageId)
- object sendAsync(string message)
- object sendForAccountAsync(int accountId, string message)
- object sendReplyAsync(int accountId, string messageId, string message)
- object unlikeAsync(int accountId, string messageId)
- object uploadForAccountAsync(int accountId, string uri, string description)
Detailed Description
FriendsDispatcher provides an interface for applications to use the Friends dispatcher
Example of use:
Item { FriendsDispatcher { id: friends onSendComplete: { if (success) { activitySpinner.visible = false; entry.text = ""; console.log ("Send completed successfully"); } else { activitySpinner.visible = false; console.log ("Send failed: " + errorMessage); } } } TextArea { id: entry height: units.gu(4) placeholderText: i18n.tr("Compose") autoSize: true ActivityIndicator { id: activitySpinner objectName: "activitySpinner" anchors.centerIn: entry visible: false running: visible } } Button { id: sendButton width: units.gu(9) height: units.gu(4) text: i18n.tr("Send") onClicked: { console.log ("Post: " + entry.text); activitySpinner.visible = true var account = 1; //The account ID from Ubuntu.OnlineAccounts friends.sendForAccountAsync(account, entry.text); } } }
Signal Documentation
Emitted when likeAsync completes. Check success for success or failure and errorMessage contains the error string returned from the dispatcher.
Emitted when retweetAsync completes. Check success for success or failure and errorMessage contains the error string returned from the dispatcher.
Emitted when any of the async send methods completes. Check success for success or failure and errorMessage contains the error string returned from the dispatcher.
Emitted when unlikeAsync completes. Check success for success or failure and errorMessage contains the error string returned from the dispatcher.
Emitted when uploadForAccountAsync completes. Check success for success or failure and errorMessage contains the error string returned from the dispatcher.
Method Documentation
Likes a post for the specified messageId. Use likeComplete callback to check for success.
- accountId is the accountId, as provided by Ubuntu.OnlineAccounts
- messageId for the post to like
See also likeComplete.
Retweets a post for the specified messageId. Use retweetComplete callback to check for success.
- accountId is the accountId, as provided by Ubuntu.OnlineAccounts
- messageId for the post to retweet
See also retweetComplete.
Posts a status update to all enabled account, use sendComplete callback to check for success.
See also sendComplete.
Posts a status update to the specified account, use sendComplete callback to check for success.
See also sendComplete.
Posts a reply status update to all enabled account, use sendComplete callback to check for success.
See also sendComplete.
Un-likes a post for the specified messageId. Use unlikeComplete callback to check for success.
- accountId is the accountId, as provided by Ubuntu.OnlineAccounts
- messageId for the post to un-like
See also unlikeComplete.
Uploads file from uri to the specified account, use uploadComplete callback to check for success.
- accountId is the accountId, as provided by Ubuntu.OnlineAccounts
- uri is a URI to an image to upload, for example file:///tmp/example.jpg
- description is a description to be included in the post
See also uploadComplete.