FriendsDispatcher

Interface to the Friends dispatcher More...

Signals

Methods

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

FriendsDispatcher::likeComplete(bool success, string errorMessage)

Emitted when likeAsync completes. Check success for success or failure and errorMessage contains the error string returned from the dispatcher.


FriendsDispatcher::retweetComplete(bool success, string errorMessage)

Emitted when retweetAsync completes. Check success for success or failure and errorMessage contains the error string returned from the dispatcher.


FriendsDispatcher::sendComplete(bool success, string errorMessage)

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.


FriendsDispatcher::unlikeComplete(bool success, string errorMessage)

Emitted when unlikeAsync completes. Check success for success or failure and errorMessage contains the error string returned from the dispatcher.


FriendsDispatcher::uploadComplete(bool success, string errorMessage)

Emitted when uploadForAccountAsync completes. Check success for success or failure and errorMessage contains the error string returned from the dispatcher.


Method Documentation

object FriendsDispatcher::likeAsync(int accountId, string messageId)

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.


object FriendsDispatcher::retweetAsync(int accountId, string messageId)

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.


object FriendsDispatcher::sendAsync(string message)

Posts a status update to all enabled account, use sendComplete callback to check for success.

See also sendComplete.


object FriendsDispatcher::sendForAccountAsync(int accountId, string message)

Posts a status update to the specified account, use sendComplete callback to check for success.

See also sendComplete.


object FriendsDispatcher::sendReplyAsync(int accountId, string messageId, string message)

Posts a reply status update to all enabled account, use sendComplete callback to check for success.

See also sendComplete.


object FriendsDispatcher::unlikeAsync(int accountId, string messageId)

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.


object FriendsDispatcher::uploadForAccountAsync(int accountId, string uri, string description)

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.