How do I use PackageKit?

If you are writing an application that wants to install packages on demand,
and don't care about the low level details, there's a
session helper API
that you should use.
It's much simpler than using PackageKit directly.

Using the command line

The pkcon text-mode program allows you to interact with
PackageKit on the command line. For example:

[hughsie@hughsie-work PackageKit]$ pkcon --filter=~devel search name power
installed DeviceKit-power-001-0.8.20080811git.fc9 Power Management Service
installed gnome-power-manager-2.23.4-1.118.20080801svn.fc9.hughsie GNOME Power Manager
installed powerman-2.1-1.fc9 PowerMan - Power to the Cluster
installed powertop-1.9-3.fc9 Power consumption monitor
available gnome-power-manager-2.22.1-1.fc9 GNOME Power Manager
available kadu-powerkadu-0.6.0-3.fc9 PowerKadu
available kadu-powerkadu-0.6.0.1-1.fc9 PowerKadu
available kpowersave-0.7.3-3.fc9 KPowersave is the KDE frontend for powermanagement
available powerman-1.0.32-5.fc9 PowerMan - Power to the Cluster
available powermanga-0.90-3 Arcade 2D shoot-them-up game

The pkmon program allows you to monitor what PackageKit is
doing on the command line and is mainly used for debugging.

The pkgenpack program allows you to generate
Service Packs with a package and its dependencies.

Using graphical tools:

gnome-software and gnome-packagekit provide a rich
set of GTK tools for automatically updating your computer and installing software.

Using libpackagekit:

The libpackagekit gobject library
wraps the DBus interface in a nice glib-style API.
This makes designing programs that use libpackagekit can concentrate on
core functionality rather that the DBus and PackageKit internals.
PkTask in libpackagekit can be used as easily as:

Using the raw DBus API:

Using the DBus methods and signals directly means that no glib or
gobject dependency is needed, although this means you will have to
manage the transaction_id multiplexing in any client program.
This is not difficult, although does require more code than just using
libpackagekit.
The latest interface is available in the source tree or on-line.