|
Packit |
79f644 |
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
]>
|
|
Packit |
79f644 |
<part id="overview">
|
|
Packit |
79f644 |
<title>GNOME Online Accounts Overview</title>
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
<chapter id="overview-writing">
|
|
Packit |
79f644 |
<title>Writing GOA applications</title>
|
|
Packit |
79f644 |
<para>
|
|
Packit |
79f644 |
The term <emphasis>GOA application</emphasis> is used to
|
|
Packit |
79f644 |
describe applications or libraries that are using the
|
|
Packit |
79f644 |
linkend="ref-dbus">GNOME Online Accounts D-Bus APIs</link>
|
|
Packit |
79f644 |
either directly or through the
|
|
Packit |
79f644 |
linkend="ref-library">supplied client library</link>.
|
|
Packit |
79f644 |
</para>
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
<sect1>
|
|
Packit |
79f644 |
<title>Account Objects</title>
|
|
Packit |
79f644 |
<para>
|
|
Packit |
79f644 |
A GOA application typically creates #GoaClient object to get a
|
|
Packit |
79f644 |
list of accounts and listen for changes. Each account provide
|
|
Packit |
79f644 |
one or more specific services (such as
|
|
Packit |
79f644 |
linkend="gdbus-org.gnome.OnlineAccounts.Mail">mail</link>,
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
linkend="gdbus-org.gnome.OnlineAccounts.Calendar">calendaring</link>
|
|
Packit |
79f644 |
or
|
|
Packit |
79f644 |
linkend="gdbus-org.gnome.OnlineAccounts.Contacts">contacts</link>)
|
|
Packit |
79f644 |
so the application will need to set up a filter for the
|
|
Packit |
79f644 |
services it is interested in. For example, a mail application
|
|
Packit |
79f644 |
would only be interested in GOA accounts with mail- and
|
|
Packit |
79f644 |
contacts-services, not accounts with
|
|
Packit |
79f644 |
calendaring-services. Applications can use methods on the
|
|
Packit |
79f644 |
#GoaObject type (such as goa_object_peek_mail()) to check what
|
|
Packit |
79f644 |
kind of services an account provides. Note that this list can
|
|
Packit |
79f644 |
change at run-time if e.g. the user toggles a <guilabel>Use
|
|
Packit |
79f644 |
account for Mail</guilabel> check-button.
|
|
Packit |
79f644 |
</para>
|
|
Packit |
79f644 |
<para>
|
|
Packit |
79f644 |
Applications may use the
|
|
Packit |
79f644 |
linkend="gdbus-property-org-gnome-OnlineAccounts-Account.Id">Account.Id</link>
|
|
Packit |
79f644 |
property as a unique key to store information obtained from
|
|
Packit |
79f644 |
an account.
|
|
Packit |
79f644 |
</para>
|
|
Packit |
79f644 |
<para>
|
|
Packit |
79f644 |
Applications must not destroy data if an account object is
|
|
Packit |
79f644 |
removed (e.g. when the #GoaClient::account-removed signal is
|
|
Packit |
79f644 |
emitted) - for example, if the <command>goa-daemon</command>
|
|
Packit |
79f644 |
program crashes or is restarted on software upgrade, account
|
|
Packit |
79f644 |
objects will be removed only to be added back the next time
|
|
Packit |
79f644 |
<command>goa-daemon</command> is started.
|
|
Packit |
79f644 |
</para>
|
|
Packit |
79f644 |
<para>
|
|
Packit |
79f644 |
Applications should use the
|
|
Packit |
79f644 |
<link linkend="gdbus-property-org-gnome-OnlineAccounts-Account.ProviderName">Account.ProviderIcon</link>,
|
|
Packit |
79f644 |
<link linkend="gdbus-property-org-gnome-OnlineAccounts-Account.ProviderName">Account.ProviderName</link>
|
|
Packit |
79f644 |
and
|
|
Packit |
79f644 |
<link linkend="gdbus-property-org-gnome-OnlineAccounts-Account.ProviderName">Account.PresentationIdentity</link>
|
|
Packit |
79f644 |
properties when presenting an account in an user interface.
|
|
Packit |
79f644 |
For example, for a hypothetical online services provider Acme,
|
|
Packit |
79f644 |
this would be the Acme Logo, the word "Acme" and the identity
|
|
Packit |
79f644 |
could be either an email address such as
|
|
Packit |
79f644 |
<email></email> or an user
|
|
Packit |
79f644 |
handle such as <literal>davidz25</literal> or
|
|
Packit |
79f644 |
<literal>chunkylover53</literal>.
|
|
Packit |
79f644 |
</para>
|
|
Packit |
79f644 |
</sect1>
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
<sect1>
|
|
Packit |
79f644 |
<title>Accessing Services</title>
|
|
Packit |
79f644 |
<para>
|
|
Packit |
79f644 |
A GOA application needs to handle service-specific protocols
|
|
Packit |
79f644 |
and quirks itself. Some service-types, such as
|
|
Packit |
79f644 |
linkend="gdbus-org.gnome.OnlineAccounts.Mail">mail</link>, may
|
|
Packit |
79f644 |
use standard protocols such as
|
|
Packit |
79f644 |
url="http://tools.ietf.org/html/rfc3501">IMAP</ulink> or
|
|
Packit |
79f644 |
<ulink url="http://tools.ietf.org/html/rfc5321">SMTP</ulink>
|
|
Packit |
79f644 |
but they also may not. GOA applications should always look at
|
|
Packit |
79f644 |
the
|
|
Packit |
79f644 |
linkend="gdbus-property-org-gnome-OnlineAccounts-Account.ProviderType">Account.ProviderType</link>
|
|
Packit |
79f644 |
property to infer what kind of protocol and endpoint to use.
|
|
Packit |
79f644 |
</para>
|
|
Packit |
79f644 |
</sect1>
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
<sect1>
|
|
Packit |
79f644 |
<title>Credentials Handling</title>
|
|
Packit |
79f644 |
<para>
|
|
Packit |
79f644 |
For accessing a service, the application typically needs to
|
|
Packit |
79f644 |
present credentials. The application can request the
|
|
Packit |
79f644 |
credentials via GOA. First the application should invoke the
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
linkend="gdbus-method-org-gnome-OnlineAccounts-Account.EnsureCredentials">Account.EnsureCredentials()</link>
|
|
Packit |
79f644 |
method on the account object. If this succeeds, the
|
|
Packit |
79f644 |
application can request the credentials using e.g.
|
|
Packit |
79f644 |
linkend="gdbus-method-org-gnome-OnlineAccounts-OAuthBased.GetAccessToken">OAuthBased.GetAccessToken()</link>
|
|
Packit |
79f644 |
or
|
|
Packit |
79f644 |
linkend="gdbus-method-org-gnome-OnlineAccounts-OAuth2Based.GetAccessToken">OAuth2Based.GetAccessToken()</link>
|
|
Packit |
79f644 |
depending on what kind of credentials the account is using.
|
|
Packit |
79f644 |
If the service returns an authorization error (say, the access
|
|
Packit |
79f644 |
token expired), the application should call
|
|
Packit |
79f644 |
linkend="gdbus-method-org-gnome-OnlineAccounts-Account.EnsureCredentials">Account.EnsureCredentials()</link>
|
|
Packit |
79f644 |
again to e.g. renew the credentials.
|
|
Packit |
79f644 |
</para>
|
|
Packit |
79f644 |
<para>
|
|
Packit |
79f644 |
On the other hand, if
|
|
Packit |
79f644 |
linkend="gdbus-method-org-gnome-OnlineAccounts-Account.EnsureCredentials">Account.EnsureCredentials()</link>
|
|
Packit |
79f644 |
ever fails, then the user will get notified that there is a
|
|
Packit |
79f644 |
problem with the account so he can take actions to fix it.
|
|
Packit |
79f644 |
Applications can listen to changes on the
|
|
Packit |
79f644 |
linkend="gdbus-property-org-gnome-OnlineAccounts-Account.AttentionNeeded">Account.AttentionNeeded</link>
|
|
Packit |
79f644 |
property to get notified when it's time to try accessing the
|
|
Packit |
79f644 |
account again.
|
|
Packit |
79f644 |
</para>
|
|
Packit |
79f644 |
<para>
|
|
Packit |
79f644 |
Note that the implementation for a provider may switch from
|
|
Packit |
79f644 |
e.g. OAuth to OAuth2 in a newer release of GNOME Online
|
|
Packit |
79f644 |
Accounts. Therefore, applications must never assume that the
|
|
Packit |
79f644 |
#GoaObject for an account implements a fixed set of
|
|
Packit |
79f644 |
interfaces.
|
|
Packit |
79f644 |
</para>
|
|
Packit |
79f644 |
</sect1>
|
|
Packit |
79f644 |
|
|
Packit |
79f644 |
</chapter>
|
|
Packit |
79f644 |
</part>
|