SnapdClient

SnapdClient — Client connection to snapd

Functions

void (*SnapdProgressCallback) ()
SnapdClient * snapd_client_new ()
gboolean snapd_client_connect_sync ()
SnapdAuthData * snapd_client_login_sync ()
void snapd_client_login_async ()
SnapdAuthData * snapd_client_login_finish ()
void snapd_client_set_auth_data ()
SnapdAuthData * snapd_client_get_auth_data ()
SnapdSystemInformation * snapd_client_get_system_information_sync ()
void snapd_client_get_system_information_async ()
SnapdSystemInformation * snapd_client_get_system_information_finish ()
GPtrArray * snapd_client_list_sync ()
void snapd_client_list_async ()
GPtrArray * snapd_client_list_finish ()
SnapdSnap * snapd_client_list_one_sync ()
void snapd_client_list_one_async ()
SnapdSnap * snapd_client_list_one_finish ()
SnapdIcon * snapd_client_get_icon_sync ()
void snapd_client_get_icon_async ()
SnapdIcon * snapd_client_get_icon_finish ()
gboolean snapd_client_get_interfaces_sync ()
void snapd_client_get_interfaces_async ()
gboolean snapd_client_get_interfaces_finish ()
gboolean snapd_client_connect_interface_sync ()
void snapd_client_connect_interface_async ()
gboolean snapd_client_connect_interface_finish ()
gboolean snapd_client_disconnect_interface_sync ()
void snapd_client_disconnect_interface_async ()
gboolean snapd_client_disconnect_interface_finish ()
GPtrArray * snapd_client_find_sync ()
void snapd_client_find_async ()
GPtrArray * snapd_client_find_finish ()
gboolean snapd_client_install_sync ()
void snapd_client_install_async ()
gboolean snapd_client_install_finish ()
gboolean snapd_client_refresh_sync ()
void snapd_client_refresh_async ()
gboolean snapd_client_refresh_finish ()
gboolean snapd_client_remove_sync ()
void snapd_client_remove_async ()
gboolean snapd_client_remove_finish ()
gboolean snapd_client_enable_sync ()
void snapd_client_enable_async ()
gboolean snapd_client_enable_finish ()
gboolean snapd_client_disable_sync ()
void snapd_client_disable_async ()
gboolean snapd_client_disable_finish ()
GPtrArray * snapd_client_get_payment_methods_sync ()
void snapd_client_get_payment_methods_async ()
GPtrArray * snapd_client_get_payment_methods_finish ()
gboolean snapd_client_buy_sync ()
void snapd_client_buy_async ()
gboolean snapd_client_buy_finish ()

Types and Values

Object Hierarchy

    GObject
    ╰── SnapdClient

Includes

#include <snapd-glib/snapd-glib.h>

Description

A SnapdClient is the means of talking to snapd.

To communicate with snapd create a client with snapd_client_new() then connect with snapd_client_connect_sync().

Some requests require authorization which can be set with snapd_client_set_auth_data().

Functions

SnapdProgressCallback ()

void
(*SnapdProgressCallback) (SnapdClient *client,
                          SnapdTask *main_task,
                          GPtrArray *tasks,
                          gpointer user_data);

Signature for callback function used in snapd_client_connect_interface_sync(), snapd_client_disconnect_interface_async(), snapd_client_install_sync(), snapd_client_refresh_sync(), snapd_client_remove_sync(), snapd_client_enable_sync() and snapd_client_disable_sync().

Parameters

client

a SnapdClient

 

main_task

a SnapdTask describing the overall task in progress

 

tasks

tasks to be done / being done.

[element-type SnapdTask]

user_data

user data passed to the callback

 

snapd_client_new ()

SnapdClient *
snapd_client_new (void);

Create a new client to talk to snapd.

Returns

a new SnapdClient


snapd_client_connect_sync ()

gboolean
snapd_client_connect_sync (SnapdClient *client,
                           GCancellable *cancellable,
                           GError **error);

Connect to snapd.

Parameters

client

a SnapdClient

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError or NULL

 

Returns

TRUE if successfully connected to snapd.


snapd_client_login_sync ()

SnapdAuthData *
snapd_client_login_sync (SnapdClient *client,
                         const gchar *username,
                         const gchar *password,
                         const gchar *otp,
                         GCancellable *cancellable,
                         GError **error);

Log in to snapd and get authorization to install/remove snaps. This call requires root access; use snapd_login_sync() if you are non-root.

Parameters

client

a SnapdClient.

 

username

usename to log in with.

 

password

password to log in with.

 

otp

response to one-time password challenge.

[allow-none]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

a SnapdAuthData or NULL on error.

[transfer full]


snapd_client_login_async ()

void
snapd_client_login_async (SnapdClient *client,
                          const gchar *username,
                          const gchar *password,
                          const gchar *otp,
                          GCancellable *cancellable,
                          GAsyncReadyCallback callback,
                          gpointer user_data);

Asynchronously get authorization to install/remove snaps. See snapd_client_login_sync() for more information.

Parameters

client

a SnapdClient.

 

username

usename to log in with.

 

password

password to log in with.

 

otp

response to one-time password challenge.

[allow-none]

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_login_finish ()

SnapdAuthData *
snapd_client_login_finish (SnapdClient *client,
                           GAsyncResult *result,
                           GError **error);

Complete request started with snapd_client_login_async(). See snapd_client_login_sync() for more information.

Complete request started with snapd_client_login_async(). See snapd_client_login_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

a SnapdAuthData or NULL on error.

[transfer full]


snapd_client_set_auth_data ()

void
snapd_client_set_auth_data (SnapdClient *client,
                            SnapdAuthData *auth_data);

Set the authorization data to use for requests. Authorization data can be obtained by:

Parameters

client

a SnapdClient.

 

auth_data

a SnapdAuthData or NULL.

[allow-none]

snapd_client_get_auth_data ()

SnapdAuthData *
snapd_client_get_auth_data (SnapdClient *client);

Get the authorization data that is used for requests.

Parameters

client

a SnapdClient.

 

Returns

a SnapdAuthData or NULL.

[transfer none][allow-none]


snapd_client_get_system_information_sync ()

SnapdSystemInformation *
snapd_client_get_system_information_sync
                               (SnapdClient *client,
                                GCancellable *cancellable,
                                GError **error);

Request system information from snapd. While this blocks, snapd is expected to return the information quickly.

Parameters

client

a SnapdClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

a SnapdSystemInformation or NULL on error.

[transfer full]


snapd_client_get_system_information_async ()

void
snapd_client_get_system_information_async
                               (SnapdClient *client,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Request system information asynchronously from snapd. See snapd_client_get_system_information_sync() for more information.

Parameters

client

a SnapdClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_get_system_information_finish ()

SnapdSystemInformation *
snapd_client_get_system_information_finish
                               (SnapdClient *client,
                                GAsyncResult *result,
                                GError **error);

Complete request started with snapd_client_get_system_information_async(). See snapd_client_get_system_information_sync() for more information.

Complete request started with snapd_client_get_system_information_async(). See snapd_client_get_system_information_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

a SnapdSystemInformation or NULL on error.

[transfer full]


snapd_client_list_sync ()

GPtrArray *
snapd_client_list_sync (SnapdClient *client,
                        GCancellable *cancellable,
                        GError **error);

Get information on all installed snaps.

Parameters

client

a SnapdClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

an array of SnapdSnap or NULL on error.

[transfer container][element-type SnapdSnap]


snapd_client_list_async ()

void
snapd_client_list_async (SnapdClient *client,
                         GCancellable *cancellable,
                         GAsyncReadyCallback callback,
                         gpointer user_data);

Asynchronously get information on all installed snaps. See snapd_client_list_sync() for more information.

Parameters

client

a SnapdClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_list_finish ()

GPtrArray *
snapd_client_list_finish (SnapdClient *client,
                          GAsyncResult *result,
                          GError **error);

Complete request started with snapd_client_list_async(). See snapd_client_list_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

an array of SnapdSnap or NULL on error.

[transfer container][element-type SnapdSnap]


snapd_client_list_one_sync ()

SnapdSnap *
snapd_client_list_one_sync (SnapdClient *client,
                            const gchar *name,
                            GCancellable *cancellable,
                            GError **error);

Get information of a single installed snap.

Parameters

client

a SnapdClient.

 

name

name of snap to get.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

a SnapdSnap or NULL on error.

[transfer full]


snapd_client_list_one_async ()

void
snapd_client_list_one_async (SnapdClient *client,
                             const gchar *name,
                             GCancellable *cancellable,
                             GAsyncReadyCallback callback,
                             gpointer user_data);

Asynchronously get information of a single installed snap. See snapd_client_list_one_sync() for more information.

Parameters

client

a SnapdClient.

 

name

name of snap to get.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_list_one_finish ()

SnapdSnap *
snapd_client_list_one_finish (SnapdClient *client,
                              GAsyncResult *result,
                              GError **error);

Complete request started with snapd_client_list_one_async(). See snapd_client_list_one_sync() for more information.

Complete request started with snapd_client_list_one_async(). See snapd_client_list_one_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

a SnapdSnap or NULL on error.

[transfer full]


snapd_client_get_icon_sync ()

SnapdIcon *
snapd_client_get_icon_sync (SnapdClient *client,
                            const gchar *name,
                            GCancellable *cancellable,
                            GError **error);

Get the icon for an installed snap.

Parameters

client

a SnapdClient.

 

name

name of snap to get icon for.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

a SnapdIcon or NULL on error.

[transfer full]


snapd_client_get_icon_async ()

void
snapd_client_get_icon_async (SnapdClient *client,
                             const gchar *name,
                             GCancellable *cancellable,
                             GAsyncReadyCallback callback,
                             gpointer user_data);

Asynchronously get the icon for an installed snap. See snapd_client_get_icon_sync() for more information.

Parameters

client

a SnapdClient.

 

name

name of snap to get icon for.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_get_icon_finish ()

SnapdIcon *
snapd_client_get_icon_finish (SnapdClient *client,
                              GAsyncResult *result,
                              GError **error);

Complete request started with snapd_client_get_icon_async(). See snapd_client_get_icon_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

a SnapdIcon or NULL on error.

[transfer full]


snapd_client_get_interfaces_sync ()

gboolean
snapd_client_get_interfaces_sync (SnapdClient *client,
                                  GPtrArray **plugs,
                                  GPtrArray **slots,
                                  GCancellable *cancellable,
                                  GError **error);

Get the installed snap interfaces.

Parameters

client

a SnapdClient.

 

plugs

the location to store the plug array or NULL.

[out][allow-none][transfer container][element-type SnapdPlug]

slots

the location to store the slot array or NULL.

[out][allow-none][transfer container][element-type SnapdSlot]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_get_interfaces_async ()

void
snapd_client_get_interfaces_async (SnapdClient *client,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Asynchronously get the installed snap interfaces. See snapd_client_get_interfaces_sync() for more information.

Parameters

client

a SnapdClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_get_interfaces_finish ()

gboolean
snapd_client_get_interfaces_finish (SnapdClient *client,
                                    GAsyncResult *result,
                                    GPtrArray **plugs,
                                    GPtrArray **slots,
                                    GError **error);

Complete request started with snapd_client_get_interfaces_async(). See snapd_client_get_interfaces_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

plugs

the location to store the plug array or NULL.

[out][allow-none][transfer container][element-type SnapdPlug]

slots

the location to store the slot array or NULL.

[out][allow-none][transfer container][element-type SnapdSlot]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_connect_interface_sync ()

gboolean
snapd_client_connect_interface_sync (SnapdClient *client,
                                     const gchar *plug_snap,
                                     const gchar *plug_name,
                                     const gchar *slot_snap,
                                     const gchar *slot_name,
                                     SnapdProgressCallback progress_callback,
                                     gpointer progress_callback_data,
                                     GCancellable *cancellable,
                                     GError **error);

Connect two interfaces together. An asynchronous version of this function is snapd_client_connect_interface_async().

Parameters

client

a SnapdClient.

 

plug_snap

name of snap containing plug.

 

plug_name

name of plug to connect.

 

slot_snap

name of snap containing socket.

 

slot_name

name of slot to connect.

 

progress_callback

function to callback with progress.

[allow-none][scope async]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_connect_interface_async ()

void
snapd_client_connect_interface_async (SnapdClient *client,
                                      const gchar *plug_snap,
                                      const gchar *plug_name,
                                      const gchar *slot_snap,
                                      const gchar *slot_name,
                                      SnapdProgressCallback progress_callback,
                                      gpointer progress_callback_data,
                                      GCancellable *cancellable,
                                      GAsyncReadyCallback callback,
                                      gpointer user_data);

Asynchronously connect two interfaces together. See snapd_client_connect_interface_sync() for more information.

Parameters

client

a SnapdClient.

 

plug_snap

name of snap containing plug.

 

plug_name

name of plug to connect.

 

slot_snap

name of snap containing socket.

 

slot_name

name of slot to connect.

 

progress_callback

function to callback with progress.

[allow-none][scope async]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_connect_interface_finish ()

gboolean
snapd_client_connect_interface_finish (SnapdClient *client,
                                       GAsyncResult *result,
                                       GError **error);

Complete request started with snapd_client_connect_interface_async(). See snapd_client_connect_interface_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_disconnect_interface_sync ()

gboolean
snapd_client_disconnect_interface_sync
                               (SnapdClient *client,
                                const gchar *plug_snap,
                                const gchar *plug_name,
                                const gchar *slot_snap,
                                const gchar *slot_name,
                                SnapdProgressCallback progress_callback,
                                gpointer progress_callback_data,
                                GCancellable *cancellable,
                                GError **error);

Disconnect two interfaces.

Parameters

client

a SnapdClient.

 

plug_snap

name of snap containing plug.

 

plug_name

name of plug to disconnect.

 

slot_snap

name of snap containing socket.

 

slot_name

name of slot to disconnect.

 

progress_callback

function to callback with progress.

[allow-none][scope call]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_disconnect_interface_async ()

void
snapd_client_disconnect_interface_async
                               (SnapdClient *client,
                                const gchar *plug_snap,
                                const gchar *plug_name,
                                const gchar *slot_snap,
                                const gchar *slot_name,
                                SnapdProgressCallback progress_callback,
                                gpointer progress_callback_data,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously disconnect two interfaces. See snapd_client_disconnect_interface_sync() for more information.

Parameters

client

a SnapdClient.

 

plug_snap

name of snap containing plug.

 

plug_name

name of plug to disconnect.

 

slot_snap

name of snap containing socket.

 

slot_name

name of slot to disconnect.

 

progress_callback

function to callback with progress.

[allow-none][scope async]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_disconnect_interface_finish ()

gboolean
snapd_client_disconnect_interface_finish
                               (SnapdClient *client,
                                GAsyncResult *result,
                                GError **error);

Complete request started with snapd_client_disconnect_interface_async(). See snapd_client_disconnect_interface_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_find_sync ()

GPtrArray *
snapd_client_find_sync (SnapdClient *client,
                        SnapdFindFlags flags,
                        const gchar *query,
                        gchar **suggested_currency,
                        GCancellable *cancellable,
                        GError **error);

Find snaps in the store.

Parameters

client

a SnapdClient.

 

flags

a set of SnapdFindFlags to control how the find is performed.

 

query

query string to send.

 

suggested_currency

location to store the ISO 4217 currency that is suggested to purchase with.

[allow-none]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

an array of SnapdSnap or NULL on error.

[transfer container][element-type SnapdSnap]


snapd_client_find_async ()

void
snapd_client_find_async (SnapdClient *client,
                         SnapdFindFlags flags,
                         const gchar *query,
                         GCancellable *cancellable,
                         GAsyncReadyCallback callback,
                         gpointer user_data);

Asynchronously find snaps in the store. See snapd_client_find_sync() for more information.

Parameters

client

a SnapdClient.

 

flags

a set of SnapdFindFlags to control how the find is performed.

 

query

query string to send.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_find_finish ()

GPtrArray *
snapd_client_find_finish (SnapdClient *client,
                          GAsyncResult *result,
                          gchar **suggested_currency,
                          GError **error);

Complete request started with snapd_client_find_async(). See snapd_client_find_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

suggested_currency

location to store the ISO 4217 currency that is suggested to purchase with.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

an array of SnapdSnap or NULL on error.

[transfer container][element-type SnapdSnap]


snapd_client_install_sync ()

gboolean
snapd_client_install_sync (SnapdClient *client,
                           const gchar *name,
                           const gchar *channel,
                           SnapdProgressCallback progress_callback,
                           gpointer progress_callback_data,
                           GCancellable *cancellable,
                           GError **error);

Install a snap from the store.

Parameters

client

a SnapdClient.

 

name

name of snap to install.

 

channel

channel to install from or NULL for default.

[allow-none]

progress_callback

function to callback with progress.

[allow-none][scope call]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_install_async ()

void
snapd_client_install_async (SnapdClient *client,
                            const gchar *name,
                            const gchar *channel,
                            SnapdProgressCallback progress_callback,
                            gpointer progress_callback_data,
                            GCancellable *cancellable,
                            GAsyncReadyCallback callback,
                            gpointer user_data);

Asynchronously install a snap from the store. See snapd_client_install_sync() for more information.

Parameters

client

a SnapdClient.

 

name

name of snap to install.

 

channel

channel to install from or NULL for default.

[allow-none]

progress_callback

function to callback with progress.

[allow-none][scope async]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_install_finish ()

gboolean
snapd_client_install_finish (SnapdClient *client,
                             GAsyncResult *result,
                             GError **error);

Complete request started with snapd_client_install_async(). See snapd_client_install_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_refresh_sync ()

gboolean
snapd_client_refresh_sync (SnapdClient *client,
                           const gchar *name,
                           const gchar *channel,
                           SnapdProgressCallback progress_callback,
                           gpointer progress_callback_data,
                           GCancellable *cancellable,
                           GError **error);

Ensure an installed snap is at the latest version.

Parameters

client

a SnapdClient.

 

name

name of snap to refresh.

 

channel

channel to refresh from or NULL for default.

[allow-none]

progress_callback

function to callback with progress.

[allow-none][scope call]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_refresh_async ()

void
snapd_client_refresh_async (SnapdClient *client,
                            const gchar *name,
                            const gchar *channel,
                            SnapdProgressCallback progress_callback,
                            gpointer progress_callback_data,
                            GCancellable *cancellable,
                            GAsyncReadyCallback callback,
                            gpointer user_data);

Asynchronously ensure an installed snap is at the latest version. See snapd_client_refresh_sync() for more information.

Parameters

client

a SnapdClient.

 

name

name of snap to refresh.

 

channel

channel to refresh from or NULL for default.

[allow-none]

progress_callback

function to callback with progress.

[allow-none][scope async]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_refresh_finish ()

gboolean
snapd_client_refresh_finish (SnapdClient *client,
                             GAsyncResult *result,
                             GError **error);

Complete request started with snapd_client_refresh_async(). See snapd_client_refresh_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_remove_sync ()

gboolean
snapd_client_remove_sync (SnapdClient *client,
                          const gchar *name,
                          SnapdProgressCallback progress_callback,
                          gpointer progress_callback_data,
                          GCancellable *cancellable,
                          GError **error);

Uninstall a snap.

Parameters

client

a SnapdClient.

 

name

name of snap to remove.

 

progress_callback

function to callback with progress.

[allow-none][scope call]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_remove_async ()

void
snapd_client_remove_async (SnapdClient *client,
                           const gchar *name,
                           SnapdProgressCallback progress_callback,
                           gpointer progress_callback_data,
                           GCancellable *cancellable,
                           GAsyncReadyCallback callback,
                           gpointer user_data);

Asynchronously uninstall a snap. See snapd_client_remove_sync() for more information.

Parameters

client

a SnapdClient.

 

name

name of snap to remove.

 

progress_callback

function to callback with progress.

[allow-none][scope async]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_remove_finish ()

gboolean
snapd_client_remove_finish (SnapdClient *client,
                            GAsyncResult *result,
                            GError **error);

Complete request started with snapd_client_remove_async(). See snapd_client_remove_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_enable_sync ()

gboolean
snapd_client_enable_sync (SnapdClient *client,
                          const gchar *name,
                          SnapdProgressCallback progress_callback,
                          gpointer progress_callback_data,
                          GCancellable *cancellable,
                          GError **error);

Enable an installed snap.

Parameters

client

a SnapdClient.

 

name

name of snap to enable.

 

progress_callback

function to callback with progress.

[allow-none][scope call]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_enable_async ()

void
snapd_client_enable_async (SnapdClient *client,
                           const gchar *name,
                           SnapdProgressCallback progress_callback,
                           gpointer progress_callback_data,
                           GCancellable *cancellable,
                           GAsyncReadyCallback callback,
                           gpointer user_data);

Asynchronously enable an installed snap. See snapd_client_enable_sync() for more information.

Parameters

client

a SnapdClient.

 

name

name of snap to enable.

 

progress_callback

function to callback with progress.

[allow-none][scope async]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_enable_finish ()

gboolean
snapd_client_enable_finish (SnapdClient *client,
                            GAsyncResult *result,
                            GError **error);

Complete request started with snapd_client_enable_async(). See snapd_client_enable_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_disable_sync ()

gboolean
snapd_client_disable_sync (SnapdClient *client,
                           const gchar *name,
                           SnapdProgressCallback progress_callback,
                           gpointer progress_callback_data,
                           GCancellable *cancellable,
                           GError **error);

Disable an installed snap.

Parameters

client

a SnapdClient.

 

name

name of snap to disable.

 

progress_callback

function to callback with progress.

[allow-none][scope call]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_disable_async ()

void
snapd_client_disable_async (SnapdClient *client,
                            const gchar *name,
                            SnapdProgressCallback progress_callback,
                            gpointer progress_callback_data,
                            GCancellable *cancellable,
                            GAsyncReadyCallback callback,
                            gpointer user_data);

Asynchronously disable an installed snap. See snapd_client_disable_sync() for more information.

Parameters

client

a SnapdClient.

 

name

name of snap to disable.

 

progress_callback

function to callback with progress.

[allow-none][scope async]

progress_callback_data

user data to pass to progress_callback .

[closure]

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_disable_finish ()

gboolean
snapd_client_disable_finish (SnapdClient *client,
                             GAsyncResult *result,
                             GError **error);

Complete request started with snapd_client_disable_async(). See snapd_client_disable_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_get_payment_methods_sync ()

GPtrArray *
snapd_client_get_payment_methods_sync (SnapdClient *client,
                                       gboolean *allows_automatic_payment,
                                       GCancellable *cancellable,
                                       GError **error);

Get the available payment methods.

Parameters

client

a SnapdClient.

 

allows_automatic_payment

the location to store if automatic payments are allowed or NULL.

[allow-none]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

an array of SnapdPaymentMethod or NULL on error.

[transfer container][element-type SnapdPaymentMethod]


snapd_client_get_payment_methods_async ()

void
snapd_client_get_payment_methods_async
                               (SnapdClient *client,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously get the payment methods. See snapd_client_get_payment_methods_sync() for more information.

Asynchronously get the available payment methods. See snapd_client_get_payment_methods_sync() for more information.

Parameters

client

a SnapdClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_get_payment_methods_finish ()

GPtrArray *
snapd_client_get_payment_methods_finish
                               (SnapdClient *client,
                                GAsyncResult *result,
                                gboolean *allows_automatic_payment,
                                GError **error);

Complete request started with snapd_client_get_payment_methods_async(). See snapd_client_get_payment_methods_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

allows_automatic_payment

location to store TRUE if automatic payment is allowed.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

an array of SnapdPaymentMethod or NULL on error.

[transfer container][element-type SnapdPaymentMethod]


snapd_client_buy_sync ()

gboolean
snapd_client_buy_sync (SnapdClient *client,
                       SnapdSnap *snap,
                       SnapdPrice *price,
                       SnapdPaymentMethod *payment_method,
                       GCancellable *cancellable,
                       GError **error);

Buy a snap from the store. Once purchased, this snap can be installed with snapd_client_install_sync().

Parameters

client

a SnapdClient.

 

snap

snap to buy.

 

price

price to pay.

 

payment_method

payment method to use or NULL to use default.

[allow-none]

cancellable

a GCancellable or NULL.

[allow-none]

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.


snapd_client_buy_async ()

void
snapd_client_buy_async (SnapdClient *client,
                        SnapdSnap *snap,
                        SnapdPrice *price,
                        SnapdPaymentMethod *payment_method,
                        GCancellable *cancellable,
                        GAsyncReadyCallback callback,
                        gpointer user_data);

Asynchronously buy a snap from the store. See snapd_client_buy_sync() for more information.

Parameters

client

a SnapdClient.

 

snap

snap to buy.

 

price

price to pay.

 

payment_method

payment method to use or NULL to use default.

[allow-none]

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when the request is satisfied.

[scope async]

user_data

the data to pass to callback function.

[closure]

snapd_client_buy_finish ()

gboolean
snapd_client_buy_finish (SnapdClient *client,
                         GAsyncResult *result,
                         GError **error);

Complete request started with snapd_client_buy_async(). See snapd_client_buy_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

error

GError location to store the error occurring, or NULL to ignore.

[allow-none]

Returns

TRUE on success or FALSE on error.

Types and Values

SnapdClient

typedef struct _SnapdClient SnapdClient;

SnapdClient is an opaque data structure and can only be accessed using the provided functions.


struct SnapdClientClass

struct SnapdClientClass {
};

Class structure for SnapdClient.


enum SnapdFindFlags

Flag to change how a find is performed.

Members

SNAPD_FIND_FLAGS_NONE

No flags, default behaviour

 

SNAPD_FIND_FLAGS_MATCH_NAME

Search for snaps whose name matches the given string. The match is exact unless the string ends in *.

 

SNAPD_FIND_FLAGS_SELECT_PRIVATE

Search private snaps

 

SNAPD_FIND_FLAGS_SELECT_REFRESH

Search refreshable snaps