Blame doc/goa-overview.xml

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