SnapdClient

SnapdClient — Client connection to snapd

Functions

void (*SnapdProgressCallback) ()
SnapdClient * snapd_client_new ()
SnapdClient * snapd_client_new_from_socket ()
gboolean snapd_client_connect_sync ()
void snapd_client_connect_async ()
gboolean snapd_client_connect_finish ()
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 ()
void snapd_client_get_assertions_async ()
gchar ** snapd_client_get_assertions_finish ()
gchar ** snapd_client_get_assertions_sync ()
void snapd_client_add_assertions_async ()
gboolean snapd_client_add_assertions_finish ()
gboolean snapd_client_add_assertions_sync ()
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 ()
void snapd_client_find_section_async ()
GPtrArray * snapd_client_find_section_sync ()
GPtrArray * snapd_client_find_section_finish ()
GPtrArray * snapd_client_find_refreshable_sync ()
void snapd_client_find_refreshable_async ()
GPtrArray * snapd_client_find_refreshable_finish ()
gboolean snapd_client_install_sync ()
void snapd_client_install_async ()
gboolean snapd_client_install_finish ()
gboolean snapd_client_install2_sync ()
void snapd_client_install2_async ()
gboolean snapd_client_install2_finish ()
void snapd_client_install_stream_async ()
gboolean snapd_client_install_stream_finish ()
gboolean snapd_client_install_stream_sync ()
void snapd_client_try_async ()
gboolean snapd_client_try_finish ()
gboolean snapd_client_try_sync ()
gboolean snapd_client_refresh_sync ()
void snapd_client_refresh_async ()
gboolean snapd_client_refresh_finish ()
gchar ** snapd_client_refresh_all_sync ()
void snapd_client_refresh_all_async ()
gchar ** snapd_client_refresh_all_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 ()
gboolean snapd_client_check_buy_sync ()
void snapd_client_check_buy_async ()
gboolean snapd_client_check_buy_finish ()
gboolean snapd_client_buy_sync ()
void snapd_client_buy_async ()
gboolean snapd_client_buy_finish ()
SnapdUserInformation * snapd_client_create_user_sync ()
void snapd_client_create_user_async ()
SnapdUserInformation * snapd_client_create_user_finish ()
GPtrArray * snapd_client_create_users_sync ()
void snapd_client_create_users_async ()
GPtrArray * snapd_client_create_users_finish ()
gchar ** snapd_client_get_sections_sync ()
void snapd_client_get_sections_async ()
gchar ** snapd_client_get_sections_finish ()
void snapd_client_get_aliases_async ()
GPtrArray * snapd_client_get_aliases_finish ()
GPtrArray * snapd_client_get_aliases_sync ()
void snapd_client_enable_aliases_async ()
gboolean snapd_client_enable_aliases_finish ()
gboolean snapd_client_enable_aliases_sync ()
void snapd_client_disable_aliases_async ()
gboolean snapd_client_disable_aliases_finish ()
gboolean snapd_client_disable_aliases_sync ()
void snapd_client_reset_aliases_async ()
gboolean snapd_client_reset_aliases_finish ()
gboolean snapd_client_reset_aliases_sync ()
void snapd_client_run_snapctl_async ()
gboolean snapd_client_run_snapctl_finish ()
gboolean snapd_client_run_snapctl_sync ()

Types and Values

Object Hierarchy

    GFlags
    ├── SnapdCreateUserFlags
    ├── SnapdFindFlags
    ╰── SnapdInstallFlags
    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,
                          SnapdChange *change,
                          gpointer deprecated,
                          gpointer user_data);

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

Parameters

client

a SnapdClient

 

change

a SnapdChange describing the change in progress

 

deprecated

A deprecated field that is no longer used.

 

user_data

user data passed to the callback

 

Since: 1.0


snapd_client_new ()

SnapdClient *
snapd_client_new (void);

Create a new client to talk to snapd.

Returns

a new SnapdClient

Since: 1.0


snapd_client_new_from_socket ()

SnapdClient *
snapd_client_new_from_socket (GSocket *socket);

Create a new client to talk on an existing socket.

Parameters

socket

A GSocket that is connected to snapd.

 

Returns

a new SnapdClient

Since: 1.5


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

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

[allow-none]

Returns

TRUE if successfully connected to snapd.

Since: 1.0


snapd_client_connect_async ()

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

Asynchronously connect to snapd. See snapd_client_connect_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]

Since: 1.3


snapd_client_connect_finish ()

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

Complete request started with snapd_client_connect_async(). See snapd_client_connect_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 if successfully connected to snapd.

Since: 1.3


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]

Since: 1.0


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]

Since: 1.0


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.

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]

Since: 1.0


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]

Since: 1.0


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]

Since: 1.0


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]

Since: 1.0


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]

Since: 1.0


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.

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]

Since: 1.0


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]

Since: 1.0


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]

Since: 1.0


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]

Since: 1.0


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]

Since: 1.0


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]

Since: 1.0


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.

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]

Since: 1.0


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]

Since: 1.0


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]

Since: 1.0


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]

Since: 1.0


snapd_client_get_assertions_async ()

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

Asynchronously get assertions. See snapd_client_get_assertions_sync() for more information.

Parameters

client

a SnapdClient.

 

type

assertion type 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]

Since: 1.8


snapd_client_get_assertions_finish ()

gchar **
snapd_client_get_assertions_finish (SnapdClient *client,
                                    GAsyncResult *result,
                                    GError **error);

Complete request started with snapd_client_get_assertions_async(). See snapd_client_get_assertions_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 assertions or NULL on error.

[transfer full][array zero-terminated=1]

Since: 1.8


snapd_client_get_assertions_sync ()

gchar **
snapd_client_get_assertions_sync (SnapdClient *client,
                                  const gchar *type,
                                  GCancellable *cancellable,
                                  GError **error);

Get assertions.

Parameters

client

a SnapdClient.

 

type

assertion type to get.

 

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 assertions or NULL on error.

[transfer full][array zero-terminated=1]

Since: 1.8


snapd_client_add_assertions_async ()

void
snapd_client_add_assertions_async (SnapdClient *client,
                                   gchar **assertions,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Asynchronously add an assertion. See snapd_client_add_assertions_sync() for more information.

Parameters

client

a SnapdClient.

 

assertions

assertions to add.

 

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]

Since: 1.8


snapd_client_add_assertions_finish ()

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

Complete request started with snapd_client_add_assertions_async(). See snapd_client_add_assertions_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.

Since: 1.8


snapd_client_add_assertions_sync ()

gboolean
snapd_client_add_assertions_sync (SnapdClient *client,
                                  gchar **assertions,
                                  GCancellable *cancellable,
                                  GError **error);

Add an assertion.

Parameters

client

a SnapdClient.

 

assertions

assertions to add.

 

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.

Since: 1.8


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 array of SnapdPlug or NULL.

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

slots

the location to store the array of SnapdSlot 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.

Since: 1.0


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]

Since: 1.0


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 array of SnapdPlug or NULL.

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

slots

the location to store the array of SnapdSlot 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.

Since: 1.0


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.

Since: 1.0


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]

Since: 1.0


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.

Since: 1.0


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.

Since: 1.0


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]

Since: 1.0


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.

Since: 1.0


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 or NULL to find all.

[allow-none]

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]

Since: 1.0


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 or NULL to find all.

[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]

Since: 1.0


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]

Since: 1.0


snapd_client_find_section_async ()

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

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

Parameters

client

a SnapdClient.

 

flags

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

 

section

store section to search in or NULL to search in all sections.

[allow-none]

query

query string to send or NULL to find all.

[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]

Since: 1.7


snapd_client_find_section_sync ()

GPtrArray *
snapd_client_find_section_sync (SnapdClient *client,
                                SnapdFindFlags flags,
                                const gchar *section,
                                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.

 

section

store section to search in or NULL to search in all sections.

[allow-none]

query

query string to send or NULL to find all.

[allow-none]

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]

Since: 1.7


snapd_client_find_section_finish ()

GPtrArray *
snapd_client_find_section_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]

Since: 1.7


snapd_client_find_refreshable_sync ()

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

Find snaps in store that are newer revisions than locally installed versions.

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]

Since: 1.8


snapd_client_find_refreshable_async ()

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

Asynchronously find snaps in store that are newer revisions than locally installed versions. See snapd_client_find_refreshable_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]

Since: 1.8


snapd_client_find_refreshable_finish ()

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

Complete request started with snapd_client_find_refreshable_async(). See snapd_client_find_refreshable_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]

Since: 1.5


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);

snapd_client_install_sync is deprecated and should not be used in newly-written code.

Use snapd_client_install2_sync()

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.

Since: 1.0


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);

snapd_client_install_async is deprecated and should not be used in newly-written code.

Use snapd_client_install2_async()

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]

Since: 1.0


snapd_client_install_finish ()

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

snapd_client_install_finish is deprecated and should not be used in newly-written code.

Use snapd_client_install2_finish()

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.

Since: 1.0


snapd_client_install2_sync ()

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

Install a snap from the store.

Parameters

client

a SnapdClient.

 

flags

a set of SnapdInstallFlags to control install options.

 

name

name of snap to install.

 

channel

channel to install from or NULL for default.

[allow-none]

revision

revision to install 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.

Since: 1.12


snapd_client_install2_async ()

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

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

Parameters

client

a SnapdClient.

 

flags

a set of SnapdInstallFlags to control install options.

 

name

name of snap to install.

 

channel

channel to install from or NULL for default.

[allow-none]

revision

revision to install 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]

Since: 1.12


snapd_client_install2_finish ()

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

Complete request started with snapd_client_install2_async(). See snapd_client_install2_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.

Since: 1.12


snapd_client_install_stream_async ()

void
snapd_client_install_stream_async (SnapdClient *client,
                                   SnapdInstallFlags flags,
                                   GInputStream *stream,
                                   SnapdProgressCallback progress_callback,
                                   gpointer progress_callback_data,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Asynchronously install a snap. See snapd_client_install_stream_sync() for more information.

Parameters

client

a SnapdClient.

 

flags

a set of SnapdInstallFlags to control install options.

 

stream

a GInputStream containing the snap file contents to install.

 

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]

Since: 1.9


snapd_client_install_stream_finish ()

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

Complete request started with snapd_client_install_stream_async(). See snapd_client_install_stream_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.

Since: 1.9


snapd_client_install_stream_sync ()

gboolean
snapd_client_install_stream_sync (SnapdClient *client,
                                  SnapdInstallFlags flags,
                                  GInputStream *stream,
                                  SnapdProgressCallback progress_callback,
                                  gpointer progress_callback_data,
                                  GCancellable *cancellable,
                                  GError **error);

Install a snap. The snap contents are provided in the form of an input stream. To install from a local file, do the following:

1
2
3
4
5
6
7
8
9
10
11
g_autoptr(GFile) file = g_file_new_for_path (path_to_snap_file);
g_autoptr(GInputStream) stream = g_file_read (file, cancellable, &error);
snapd_client_install_stream_sync (client, stream, progress_cb, NULL, cancellable, &error);
\]

Or if you have the file in memory you can use:

|[
g_autoptr(GInputStream) stream = g_memory_input_stream_new_from_data (data, data_length, free_data);
snapd_client_install_stream_sync (client, stream, progress_cb, NULL, cancellable, &error);
\]

Parameters

client

a SnapdClient.

 

flags

a set of SnapdInstallFlags to control install options.

 

stream

a GInputStream containing the snap file contents to install.

 

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.

Since: 1.9


snapd_client_try_async ()

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

Asynchronously try a snap. See snapd_client_try_sync() for more information.

Parameters

client

a SnapdClient.

 

path

path to snap directory to try.

 

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]

Since: 1.9


snapd_client_try_finish ()

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

Complete request started with snapd_client_try_async(). See snapd_client_try_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.

Since: 1.9


snapd_client_try_sync ()

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

Try a snap.

Parameters

client

a SnapdClient.

 

path

path to snap directory to try.

 

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.

Since: 1.9


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.

Since: 1.0


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]

Since: 1.0


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.

Since: 1.0


snapd_client_refresh_all_sync ()

gchar **
snapd_client_refresh_all_sync (SnapdClient *client,
                               SnapdProgressCallback progress_callback,
                               gpointer progress_callback_data,
                               GCancellable *cancellable,
                               GError **error);

Update all installed snaps to their latest version.

Parameters

client

a SnapdClient.

 

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

a NULL-terminated array of the snap names refreshed or NULL on error.

[transfer full]

Since: 1.5


snapd_client_refresh_all_async ()

void
snapd_client_refresh_all_async (SnapdClient *client,
                                SnapdProgressCallback progress_callback,
                                gpointer progress_callback_data,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously ensure all snaps are updated to their latest versions. See snapd_client_refresh_all_sync() for more information.

Parameters

client

a SnapdClient.

 

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]

Since: 1.5


snapd_client_refresh_all_finish ()

gchar **
snapd_client_refresh_all_finish (SnapdClient *client,
                                 GAsyncResult *result,
                                 GError **error);

Complete request started with snapd_client_refresh_all_async(). See snapd_client_refresh_all_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 NULL-terminated array of the snap names refreshed or NULL on error.

[transfer full]

Since: 1.5


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.

Since: 1.0


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]

Since: 1.0


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.

Since: 1.0


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.

Since: 1.0


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]

Since: 1.0


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.

Since: 1.0


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.

Since: 1.0


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]

Since: 1.0


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.

Since: 1.0


snapd_client_check_buy_sync ()

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

Check if able to buy 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

TRUE if able to buy snaps or FALSE on error.

Since: 1.3


snapd_client_check_buy_async ()

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

Asynchronously check if able to buy snaps. See snapd_client_check_buy_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]

Since: 1.3


snapd_client_check_buy_finish ()

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

Complete request started with snapd_client_check_buy_async(). See snapd_client_check_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.

Since: 1.3


snapd_client_buy_sync ()

gboolean
snapd_client_buy_sync (SnapdClient *client,
                       const gchar *id,
                       gdouble amount,
                       const gchar *currency,
                       GCancellable *cancellable,
                       GError **error);

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

Parameters

client

a SnapdClient.

 

id

id of snap to buy.

 

amount

amount of currency to spend, e.g. 0.99.

 

currency

the currency to buy with as an ISO 4217 currency code, e.g. "NZD".

 

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.

Since: 1.3


snapd_client_buy_async ()

void
snapd_client_buy_async (SnapdClient *client,
                        const gchar *id,
                        gdouble amount,
                        const gchar *currency,
                        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.

 

id

id of snap to buy.

 

amount

amount of currency to spend, e.g. 0.99.

 

currency

the currency to buy with as an ISO 4217 currency code, e.g. "NZD".

 

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]

Since: 1.3


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.

Since: 1.3


snapd_client_create_user_sync ()

SnapdUserInformation *
snapd_client_create_user_sync (SnapdClient *client,
                               const gchar *email,
                               SnapdCreateUserFlags flags,
                               GCancellable *cancellable,
                               GError **error);

Create a local user account for the given user.

Parameters

client

a SnapdClient.

 

email

the email of the user to create.

 

flags

a set of SnapdCreateUserFlags to control how the user account is created.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

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

[allow-none]

Returns

a SnapdUserInformation or NULL on error.

[transfer full]

Since: 1.3


snapd_client_create_user_async ()

void
snapd_client_create_user_async (SnapdClient *client,
                                const gchar *email,
                                SnapdCreateUserFlags flags,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously create a local user account. See snapd_client_create_user_sync() for more information.

Parameters

client

a SnapdClient.

 

email

the email of the user to create.

 

flags

a set of SnapdCreateUserFlags to control how the user account is created.

 

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]

Since: 1.3


snapd_client_create_user_finish ()

SnapdUserInformation *
snapd_client_create_user_finish (SnapdClient *client,
                                 GAsyncResult *result,
                                 GError **error);

Complete request started with snapd_client_create_user_async(). See snapd_client_create_user_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 SnapdUserInformation or NULL on error.

[transfer full]

Since: 1.3


snapd_client_create_users_sync ()

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

Create local user accounts using the system-user assertions that are valid for this device.

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 SnapdUserInformation or NULL on error.

[transfer container][element-type SnapdUserInformation]

Since: 1.3


snapd_client_create_users_async ()

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

Asynchronously create a local user account. See snapd_client_create_user_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]

Since: 1.3


snapd_client_create_users_finish ()

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

Complete request started with snapd_client_create_users_async(). See snapd_client_create_users_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 SnapdUserInformation or NULL on error.

[transfer container][element-type SnapdUserInformation]

Since: 1.3


snapd_client_get_sections_sync ()

gchar **
snapd_client_get_sections_sync (SnapdClient *client,
                                GCancellable *cancellable,
                                GError **error);

Get the store sections.

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 section names or NULL on error.

[transfer full][array zero-terminated=1]

Since: 1.7


snapd_client_get_sections_async ()

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

Asynchronously create a local user account. See snapd_client_get_sections_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]

Since: 1.7


snapd_client_get_sections_finish ()

gchar **
snapd_client_get_sections_finish (SnapdClient *client,
                                  GAsyncResult *result,
                                  GError **error);

Complete request started with snapd_client_get_sections_async(). See snapd_client_get_sections_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 section names or NULL on error.

[transfer full][array zero-terminated=1]

Since: 1.7


snapd_client_get_aliases_async ()

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

Asynchronously get the available aliases. See snapd_client_get_aliases_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]

Since: 1.8


snapd_client_get_aliases_finish ()

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

Complete request started with snapd_client_get_aliases_async(). See snapd_client_get_aliases_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 SnapdAlias or NULL on error.

[transfer container][element-type SnapdAlias]

Since: 1.8


snapd_client_get_aliases_sync ()

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

Get the available aliases.

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 SnapdAlias or NULL on error.

[transfer container][element-type SnapdAlias]

Since: 1.8


snapd_client_enable_aliases_async ()

void
snapd_client_enable_aliases_async (SnapdClient *client,
                                   const gchar *snap,
                                   gchar **aliases,
                                   SnapdProgressCallback progress_callback,
                                   gpointer progress_callback_data,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Asynchronously change the state of aliases. See snapd_client_enable_aliases_sync() for more information.

Parameters

client

a SnapdClient.

 

snap

the name of the snap to modify.

 

aliases

the aliases to modify.

 

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]

Since: 1.8


snapd_client_enable_aliases_finish ()

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

Complete request started with snapd_client_enable_aliases_async(). See snapd_client_enable_aliases_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.

Since: 1.8


snapd_client_enable_aliases_sync ()

gboolean
snapd_client_enable_aliases_sync (SnapdClient *client,
                                  const gchar *snap,
                                  gchar **aliases,
                                  SnapdProgressCallback progress_callback,
                                  gpointer progress_callback_data,
                                  GCancellable *cancellable,
                                  GError **error);

Change the state of aliases.

Parameters

client

a SnapdClient.

 

snap

the name of the snap to modify.

 

aliases

the aliases to modify.

 

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.

Since: 1.8


snapd_client_disable_aliases_async ()

void
snapd_client_disable_aliases_async (SnapdClient *client,
                                    const gchar *snap,
                                    gchar **aliases,
                                    SnapdProgressCallback progress_callback,
                                    gpointer progress_callback_data,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Asynchronously change the state of aliases. See snapd_client_disable_aliases_sync() for more information.

Parameters

client

a SnapdClient.

 

snap

the name of the snap to modify.

 

aliases

the aliases to modify.

 

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]

Since: 1.8


snapd_client_disable_aliases_finish ()

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

Complete request started with snapd_client_disable_aliases_async(). See snapd_client_disable_aliases_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.

Since: 1.8


snapd_client_disable_aliases_sync ()

gboolean
snapd_client_disable_aliases_sync (SnapdClient *client,
                                   const gchar *snap,
                                   gchar **aliases,
                                   SnapdProgressCallback progress_callback,
                                   gpointer progress_callback_data,
                                   GCancellable *cancellable,
                                   GError **error);

Change the state of aliases.

Parameters

client

a SnapdClient.

 

snap

the name of the snap to modify.

 

aliases

the aliases to modify.

 

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.

Since: 1.8


snapd_client_reset_aliases_async ()

void
snapd_client_reset_aliases_async (SnapdClient *client,
                                  const gchar *snap,
                                  gchar **aliases,
                                  SnapdProgressCallback progress_callback,
                                  gpointer progress_callback_data,
                                  GCancellable *cancellable,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);

Asynchronously change the state of aliases. See snapd_client_reset_aliases_sync() for more information.

Parameters

client

a SnapdClient.

 

snap

the name of the snap to modify.

 

aliases

the aliases to modify.

 

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]

Since: 1.8


snapd_client_reset_aliases_finish ()

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

Complete request started with snapd_client_reset_aliases_async(). See snapd_client_reset_aliases_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.

Since: 1.8


snapd_client_reset_aliases_sync ()

gboolean
snapd_client_reset_aliases_sync (SnapdClient *client,
                                 const gchar *snap,
                                 gchar **aliases,
                                 SnapdProgressCallback progress_callback,
                                 gpointer progress_callback_data,
                                 GCancellable *cancellable,
                                 GError **error);

Change the state of aliases.

Parameters

client

a SnapdClient.

 

snap

the name of the snap to modify.

 

aliases

the aliases to modify.

 

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.

Since: 1.8


snapd_client_run_snapctl_async ()

void
snapd_client_run_snapctl_async (SnapdClient *client,
                                const gchar *context_id,
                                gchar **args,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously run a snapctl command. See snapd_client_run_snapctl_sync() for more information.

Parameters

client

a SnapdClient.

 

context_id

context for this call.

 

args

the arguments to pass to snapctl.

 

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]

Since: 1.8


snapd_client_run_snapctl_finish ()

gboolean
snapd_client_run_snapctl_finish (SnapdClient *client,
                                 GAsyncResult *result,
                                 gchar **stdout_output,
                                 gchar **stderr_output,
                                 GError **error);

Complete request started with snapd_client_run_snapctl_async(). See snapd_client_run_snapctl_sync() for more information.

Parameters

client

a SnapdClient.

 

result

a GAsyncResult.

 

stdout_output

the location to write the stdout from the command or NULL.

[out][allow-none]

stderr_output

the location to write the stderr from the command or NULL.

[out][allow-none]

error

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

[allow-none]

Returns

TRUE on success or FALSE on error.

Since: 1.8


snapd_client_run_snapctl_sync ()

gboolean
snapd_client_run_snapctl_sync (SnapdClient *client,
                               const gchar *context_id,
                               gchar **args,
                               gchar **stdout_output,
                               gchar **stderr_output,
                               GCancellable *cancellable,
                               GError **error);

Run a snapctl command.

Parameters

client

a SnapdClient.

 

context_id

context for this call.

 

args

the arguments to pass to snapctl.

 

stdout_output

the location to write the stdout from the command or NULL.

[out][allow-none]

stderr_output

the location to write the stderr from the command or NULL.

[out][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.

Since: 1.8

Types and Values

SnapdClient

typedef struct _SnapdClient SnapdClient;

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

Since: 1.0


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

Deprecated, do not use

 

Since: 1.0


enum SnapdInstallFlags

Flags to control install options.

Members

SNAPD_INSTALL_FLAGS_NONE

No flags, default behaviour.

 

SNAPD_INSTALL_FLAGS_CLASSIC

Put snap in classic mode and disable security confinement.

 

SNAPD_INSTALL_FLAGS_DANGEROUS

Install the given snap file even if there are no pre-acknowledged signatures for it, meaning it was not verified and could be dangerous (implied by SNAPD_INSTALL_FLAGS_DEVMODE).

 

SNAPD_INSTALL_FLAGS_DEVMODE

Put snap in development mode and disable security confinement.

 

SNAPD_INSTALL_FLAGS_JAILMODE

Put snap in enforced confinement mode.

 

Since: 1.12


enum SnapdCreateUserFlags

Flag to control when a user accounts is created.

Members

SNAPD_CREATE_USER_FLAGS_NONE

No flags, default behaviour.

 

SNAPD_CREATE_USER_FLAGS_SUDO

Gives sudo access to created user.

 

SNAPD_CREATE_USER_FLAGS_KNOWN

Use the local system-user assertions to create the user.

 

Since: 1.3