162
162
* @method api.getAccounts
163
163
* @param filters {Object} A dictionary of parameters to filter the result. The filtering keys are:
164
* - application: the ID of a application (see /usr/share/accounts/applications/ or ~/.local/share/accounts/applications/ for a list of the available applications)
164
* - applicationId: the ID of a application (see /usr/share/accounts/applications/ or ~/.local/share/accounts/applications/ for a list of the available applications)
165
165
* - provider: the ID of a provider (see /usr/share/accounts/providers/ or ~/.local/share/accounts/providers/ for a list of the available providers)
166
166
* - service: the ID of a service (see /usr/share/accounts/services/ or ~/.local/share/accounts/services/ for a list of the available services)
219
* Requests access to an account.
221
* Applications must invoke this method in order to obtain access
222
* to an account. The user will be prompted to grant access to
223
* either an existing account, to create a new one or to decline
226
* @method api.requestAccount
227
* @param applicationId {String} The ID of the application
228
* requesting the account (see /usr/share/accounts/applications/ or
229
* ~/.local/share/accounts/applications/ for a list of the
230
* available applications)
231
* @param providerId {String} The ID of the provider of the desired
232
* account (see /usr/share/accounts/providers/ or
233
* ~/.local/share/accounts/providers/ for a list of the available
235
* @param callback {Function()} Callback which will be invoked
236
* after the access request has been decided (either with the
237
* access to an account being granted, or with a refusal).
240
var api = external.getUnityObject(1.0);
241
var oa = api.OnlineAccounts;
243
var appId = 'com.ubuntu.developer.me.MyPackage_MyApp';
244
oa.api.requestAccount(appId,
247
oa.api.getAccounts({ 'application': appId }, function(result) {
248
for (var i = 0; i < result.length; ++i) {
249
console.log("name: " + result[i].displayName()
250
+ ', id: ' + result[i].accountId()
251
+ ', providerName: ' + result[i].provider().displayName
252
+ ', enabled: ' + (result[i].enabled() ? "true" : "false")
258
requestAccount: function(applicationId, providerId, callback) {
259
backendBridge.call('OnlineAccounts.Client.requestAccount',
260
[ applicationId, providerId],