SnapdSnap

SnapdSnap — Snap metadata

Functions

GPtrArray * snapd_snap_get_apps ()
const gchar * snapd_snap_get_base ()
const gchar * snapd_snap_get_broken ()
const gchar * snapd_snap_get_channel ()
GPtrArray * snapd_snap_get_channels ()
SnapdChannel * snapd_snap_match_channel ()
GStrv snapd_snap_get_common_ids ()
SnapdConfinement snapd_snap_get_confinement ()
const gchar * snapd_snap_get_contact ()
const gchar * snapd_snap_get_description ()
const gchar * snapd_snap_get_developer ()
gboolean snapd_snap_get_devmode ()
gint64 snapd_snap_get_download_size ()
const gchar * snapd_snap_get_icon ()
const gchar * snapd_snap_get_id ()
GDateTime * snapd_snap_get_install_date ()
gint64 snapd_snap_get_installed_size ()
gboolean snapd_snap_get_jailmode ()
const gchar * snapd_snap_get_license ()
GPtrArray * snapd_snap_get_media ()
const gchar * snapd_snap_get_mounted_from ()
const gchar * snapd_snap_get_name ()
GPtrArray * snapd_snap_get_prices ()
gboolean snapd_snap_get_private ()
const gchar * snapd_snap_get_publisher_display_name ()
const gchar * snapd_snap_get_publisher_id ()
const gchar * snapd_snap_get_publisher_username ()
SnapdPublisherValidation snapd_snap_get_publisher_validation ()
const gchar * snapd_snap_get_revision ()
GPtrArray * snapd_snap_get_screenshots ()
SnapdSnapType snapd_snap_get_snap_type ()
SnapdSnapStatus snapd_snap_get_status ()
const gchar * snapd_snap_get_summary ()
const gchar * snapd_snap_get_title ()
const gchar * snapd_snap_get_tracking_channel ()
GStrv snapd_snap_get_tracks ()
gboolean snapd_snap_get_trymode ()
const gchar * snapd_snap_get_version ()

Properties

GPtrArray * apps Read / Write / Construct Only
gchar * base Read / Write / Construct Only
gchar * broken Read / Write / Construct Only
gchar * channel Read / Write / Construct Only
GPtrArray * channels Read / Write / Construct Only
GStrv common-ids Read / Write / Construct Only
SnapdConfinement confinement Read / Write / Construct Only
gchar * contact Read / Write / Construct Only
gchar * description Read / Write / Construct Only
gchar * developer Read / Write / Construct Only
gboolean devmode Read / Write / Construct Only
gint64 download-size Read / Write / Construct Only
gchar * icon Read / Write / Construct Only
gchar * id Read / Write / Construct Only
GDateTime * install-date Read / Write / Construct Only
gint64 installed-size Read / Write / Construct Only
gboolean jailmode Read / Write / Construct Only
gchar * license Read / Write / Construct Only
GPtrArray * media Read / Write / Construct Only
gchar * mounted-from Read / Write / Construct Only
gchar * name Read / Write / Construct Only
GPtrArray * prices Read / Write / Construct Only
gboolean private Read / Write / Construct Only
gchar * publisher-display-name Read / Write / Construct Only
gchar * publisher-id Read / Write / Construct Only
gchar * publisher-username Read / Write / Construct Only
SnapdPublisherValidation publisher-validation Read / Write / Construct Only
gchar * revision Read / Write / Construct Only
GPtrArray * screenshots Read / Write / Construct Only
SnapdSnapType snap-type Read / Write / Construct Only
SnapdSnapStatus status Read / Write / Construct Only
gchar * summary Read / Write / Construct Only
gchar * title Read / Write / Construct Only
gchar * tracking-channel Read / Write / Construct Only
GStrv tracks Read / Write / Construct Only
gboolean trymode Read / Write / Construct Only
gchar * version Read / Write / Construct Only

Types and Values

Object Hierarchy

    GEnum
    ├── SnapdConfinement
    ├── SnapdPublisherValidation
    ├── SnapdSnapStatus
    ╰── SnapdSnapType
    GObject
    ╰── SnapdSnap

Includes

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

Description

A SnapdSnap contains the metadata for a given snap. Snap metadata can be retrieved using snapd_client_list_sync(), snapd_client_list_one_sync() or snapd_client_find_sync().

Functions

snapd_snap_get_apps ()

GPtrArray *
snapd_snap_get_apps (SnapdSnap *snap);

Get the apps this snap provides.

Parameters

snap

a SnapdSnap.

 

Returns

an array of SnapdApp.

[transfer none][element-type SnapdApp]

Since: 1.0


snapd_snap_get_base ()

const gchar *
snapd_snap_get_base (SnapdSnap *snap);

Get the base snap this snap uses.

Parameters

snap

a SnapdSnap.

 

Returns

a snap name or NULL if not set.

[allow-none]

Since: 1.45


snapd_snap_get_broken ()

const gchar *
snapd_snap_get_broken (SnapdSnap *snap);

Get the reason this snap is broken.

Parameters

snap

a SnapdSnap.

 

Returns

an error string or NULL if not broken.

[allow-none]

Since: 1.25


snapd_snap_get_channel ()

const gchar *
snapd_snap_get_channel (SnapdSnap *snap);

Get the channel this snap is from, e.g. "stable".

Parameters

snap

a SnapdSnap.

 

Returns

a channel name.

Since: 1.0


snapd_snap_get_channels ()

GPtrArray *
snapd_snap_get_channels (SnapdSnap *snap);

Gets the available channels for this snap.

Parameters

snap

a SnapdSnap.

 

Returns

an array of SnapdChannel.

[transfer none][element-type SnapdChannel]

Since: 1.22


snapd_snap_match_channel ()

SnapdChannel *
snapd_snap_match_channel (SnapdSnap *snap,
                          const gchar *name);

Finds the available channel that best matches the given name. If none matches NULL is returned.

Parameters

snap

a SnapdSnap.

 

name

a channel name.

 

Returns

an SnapdChannel or NULL.

[transfer none][allow-none]

Since: 1.22


snapd_snap_get_common_ids ()

GStrv
snapd_snap_get_common_ids (SnapdSnap *snap);

Get common IDs associated with this snap.

Parameters

snap

a SnapdSnap.

 

Returns

an array of common ids.

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

Since: 1.41


snapd_snap_get_confinement ()

SnapdConfinement
snapd_snap_get_confinement (SnapdSnap *snap);

Get the confinement this snap is using, e.g. SNAPD_CONFINEMENT_STRICT.

Parameters

snap

a SnapdSnap.

 

Returns

a SnapdConfinement.

Since: 1.0


snapd_snap_get_contact ()

const gchar *
snapd_snap_get_contact (SnapdSnap *snap);

Get the means of contacting the snap developer, e.g. "mailto:developerexample.com ".

Parameters

snap

a SnapdSnap.

 

Returns

a contact URL.

Since: 1.13


snapd_snap_get_description ()

const gchar *
snapd_snap_get_description (SnapdSnap *snap);

Get a multi-line description of this snap. The description is formatted using a subset of Markdown. To parse this use a SnapdMarkdownParser.

Parameters

snap

a SnapdSnap.

 

Returns

description text.

Since: 1.0


snapd_snap_get_developer ()

const gchar *
snapd_snap_get_developer (SnapdSnap *snap);

snapd_snap_get_developer has been deprecated since version 1.42 and should not be used in newly-written code.

Use snapd_snap_get_publisher_username()

Get the developer who created this snap.

Parameters

snap

a SnapdSnap.

 

Returns

a developer name.

Since: 1.0


snapd_snap_get_devmode ()

gboolean
snapd_snap_get_devmode (SnapdSnap *snap);

Get if this snap is running in developer mode.

Parameters

snap

a SnapdSnap.

 

Returns

TRUE if this snap is running in devmode.

Since: 1.0


snapd_snap_get_download_size ()

gint64
snapd_snap_get_download_size (SnapdSnap *snap);

Get the download size of this snap or 0 if unknown.

Parameters

snap

a SnapdSnap.

 

Returns

a byte count.

Since: 1.0


snapd_snap_get_icon ()

const gchar *
snapd_snap_get_icon (SnapdSnap *snap);

Get the icon for this Snap, either a URL or an absolute path to retrieve it from snapd directly.

Parameters

snap

a SnapdSnap.

 

Returns

a URL or path.

Since: 1.0


snapd_snap_get_id ()

const gchar *
snapd_snap_get_id (SnapdSnap *snap);

Gets the unique ID for this snap.

Parameters

snap

a SnapdSnap.

 

Returns

an ID.

Since: 1.0


snapd_snap_get_install_date ()

GDateTime *
snapd_snap_get_install_date (SnapdSnap *snap);

Get the date this snap was installed or NULL if unknown.

Parameters

snap

a SnapdSnap.

 

Returns

a GDateTime or NULL.

[transfer none][allow-none]

Since: 1.0


snapd_snap_get_installed_size ()

gint64
snapd_snap_get_installed_size (SnapdSnap *snap);

Get the installed size of this snap or 0 if unknown.

Parameters

snap

a SnapdSnap.

 

Returns

a byte count.

Since: 1.0


snapd_snap_get_jailmode ()

gboolean
snapd_snap_get_jailmode (SnapdSnap *snap);

Get if this snap is running in enforced confinement (jail) mode.

Parameters

snap

a SnapdSnap.

 

Returns

TRUE if this snap is running in jailmode.

Since: 1.8


snapd_snap_get_license ()

const gchar *
snapd_snap_get_license (SnapdSnap *snap);

Gets the SPDX license expression for this snap, e.g. "GPL-3.0+".

Parameters

snap

a SnapdSnap.

 

Returns

an SPDX license expression or NULL.

[allow-none]

Since: 1.19


snapd_snap_get_media ()

GPtrArray *
snapd_snap_get_media (SnapdSnap *snap);

Get media that is associated with this snap.

Parameters

snap

a SnapdSnap.

 

Returns

an array of SnapdMedia.

[transfer none][element-type SnapdMedia]

Since: 1.45


snapd_snap_get_mounted_from ()

const gchar *
snapd_snap_get_mounted_from (SnapdSnap *snap);

Gets the path this snap is mounted from, which is a .snap file for installed snaps and a directory for snaps in try mode.

Parameters

snap

a SnapdSnap.

 

Returns

a file path or NULL.

[allow-none]

Since: 1.45


snapd_snap_get_name ()

const gchar *
snapd_snap_get_name (SnapdSnap *snap);

Get the name of this snap. This is used to reference this snap, e.g. for installing / removing.

Parameters

snap

a SnapdSnap.

 

Returns

a name.

Since: 1.0


snapd_snap_get_prices ()

GPtrArray *
snapd_snap_get_prices (SnapdSnap *snap);

Get the prices that this snap can be purchased at.

Parameters

snap

a SnapdSnap.

 

Returns

an array of SnapdPrice.

[transfer none][element-type SnapdPrice]

Since: 1.0


snapd_snap_get_private ()

gboolean
snapd_snap_get_private (SnapdSnap *snap);

Get if this snap is only available to the developer.

Parameters

snap

a SnapdSnap.

 

Returns

TRUE if this is a private snap.

Since: 1.0


snapd_snap_get_publisher_display_name ()

const gchar *
snapd_snap_get_publisher_display_name (SnapdSnap *snap);

Get the display name of the publisher who created this snap.

Parameters

snap

a SnapdSnap.

 

Returns

a publisher display name.

Since: 1.42


snapd_snap_get_publisher_id ()

const gchar *
snapd_snap_get_publisher_id (SnapdSnap *snap);

Get the ID of the publisher who created this snap.

Parameters

snap

a SnapdSnap.

 

Returns

a publisher ID.

Since: 1.42


snapd_snap_get_publisher_username ()

const gchar *
snapd_snap_get_publisher_username (SnapdSnap *snap);

Get the username of the publisher who created this snap.

Parameters

snap

a SnapdSnap.

 

Returns

a publisher username.

Since: 1.42


snapd_snap_get_publisher_validation ()

SnapdPublisherValidation
snapd_snap_get_publisher_validation (SnapdSnap *snap);

Get the validation for the snap publisher, e.g. SNAPD_PUBLISHER_VALIDATION_VERIFIED

Parameters

snap

a SnapdSnap.

 

Since: 1.42


snapd_snap_get_revision ()

const gchar *
snapd_snap_get_revision (SnapdSnap *snap);

Get the revision for this snap. The format of the string is undefined. See also snapd_snap_get_version().

Parameters

snap

a SnapdSnap.

 

Returns

a revision string.

Since: 1.0


snapd_snap_get_screenshots ()

GPtrArray *
snapd_snap_get_screenshots (SnapdSnap *snap);

snapd_snap_get_screenshots has been deprecated since version 1.45 and should not be used in newly-written code.

Use snapd_snap_get_media()

Get the screenshots that are available for this snap.

Parameters

snap

a SnapdSnap.

 

Returns

an array of SnapdScreenshot.

[transfer none][element-type SnapdScreenshot]

Since: 1.0


snapd_snap_get_snap_type ()

SnapdSnapType
snapd_snap_get_snap_type (SnapdSnap *snap);

Get the type of snap, e.g. SNAPD_SNAP_TYPE_APP

Parameters

snap

a SnapdSnap.

 

Returns

a SnapdSnapType.

Since: 1.0


snapd_snap_get_status ()

SnapdSnapStatus
snapd_snap_get_status (SnapdSnap *snap);

Get the current status of this snap, e.g. SNAPD_SNAP_STATUS_INSTALLED.

Parameters

snap

a SnapdSnap.

 

Returns

a SnapdSnapStatus.

Since: 1.0


snapd_snap_get_summary ()

const gchar *
snapd_snap_get_summary (SnapdSnap *snap);

Get a single line summary for this snap, e.g. "Best app ever!".

Parameters

snap

a SnapdSnap.

 

Returns

a summary string.

Since: 1.0


snapd_snap_get_title ()

const gchar *
snapd_snap_get_title (SnapdSnap *snap);

Get the title for this snap. If not available use the snap name instead.

Parameters

snap

a SnapdSnap.

 

Returns

a title or NULL.

[allow-none]

Since: 1.14


snapd_snap_get_tracking_channel ()

const gchar *
snapd_snap_get_tracking_channel (SnapdSnap *snap);

Get the channel that updates will be installed from, e.g. "stable".

Parameters

snap

a SnapdSnap.

 

Returns

a channel name.

Since: 1.7


snapd_snap_get_tracks ()

GStrv
snapd_snap_get_tracks (SnapdSnap *snap);

Get the tracks that are available.

Parameters

snap

a SnapdSnap.

 

Returns

an ordered array of track names.

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

Since: 1.22


snapd_snap_get_trymode ()

gboolean
snapd_snap_get_trymode (SnapdSnap *snap);

Get if this snap is running in try mode (installed locally and able to be directly modified).

Parameters

snap

a SnapdSnap.

 

Returns

TRUE if using trymode.

Since: 1.0


snapd_snap_get_version ()

const gchar *
snapd_snap_get_version (SnapdSnap *snap);

Get the version for this snap. The format of the string is undefined. See also snapd_snap_get_revision().

Parameters

snap

a SnapdSnap.

 

Returns

a version string.

Since: 1.0

Types and Values

enum SnapdConfinement

Confinement used by a snap.

Members

SNAPD_CONFINEMENT_UNKNOWN

the confinement of the snap is unknown.

 

SNAPD_CONFINEMENT_STRICT

the snap is using confinement.

 

SNAPD_CONFINEMENT_DEVMODE

the snap is in dev mode (i.e. unconfined).

 

SNAPD_CONFINEMENT_CLASSIC

the snap is using classic confinement.

 

Since: 1.0


enum SnapdSnapType

Type of snap.

Members

SNAPD_SNAP_TYPE_UNKNOWN

the type of snap is unknown.

 

SNAPD_SNAP_TYPE_APP

the snap is an application.

 

SNAPD_SNAP_TYPE_KERNEL

the snap is a kernel.

 

SNAPD_SNAP_TYPE_GADGET

the snapd is a gadget.

 

SNAPD_SNAP_TYPE_OS

the snap is an operating system.

 

Since: 1.0


enum SnapdSnapStatus

The current state of a snap.

Members

SNAPD_SNAP_STATUS_UNKNOWN

the snap state is unknown.

 

SNAPD_SNAP_STATUS_AVAILABLE

the snap is available for installation.

 

SNAPD_SNAP_STATUS_PRICED

the snap is available for purchase.

 

SNAPD_SNAP_STATUS_INSTALLED

the snap is installed but not active.

 

SNAPD_SNAP_STATUS_ACTIVE

the snap is installed and active.

 

Since: 1.0


enum SnapdPublisherValidation

State of validation for a publisher.

Members

SNAPD_PUBLISHER_VALIDATION_UNKNOWN

the validation state of the publisher is unknown.

 

SNAPD_PUBLISHER_VALIDATION_UNPROVEN

the publisher has not proven their identity.

 

SNAPD_PUBLISHER_VALIDATION_VERIFIED

the publisher has had their identity verified.

 

Since: 1.42


SnapdSnap

typedef struct _SnapdSnap SnapdSnap;

SnapdSnap contains Snap metadata.

Since: 1.0

Property Details

The “apps” property

  “apps”                     GPtrArray *

Apps this snap contains.

Flags: Read / Write / Construct Only


The “base” property

  “base”                     gchar *

Base snap this snap uses.

Flags: Read / Write / Construct Only

Default value: NULL


The “broken” property

  “broken”                   gchar *

Error string if snap is broken.

Flags: Read / Write / Construct Only

Default value: NULL


The “channel” property

  “channel”                  gchar *

Channel the snap is from.

Flags: Read / Write / Construct Only

Default value: NULL


The “channels” property

  “channels”                 GPtrArray *

Channels this snap is available on.

Flags: Read / Write / Construct Only


The “common-ids” property

  “common-ids”               GStrv

Common IDs.

Flags: Read / Write / Construct Only


The “confinement” property

  “confinement”              SnapdConfinement

Confinement requested by the snap.

Flags: Read / Write / Construct Only

Default value: SNAPD_CONFINEMENT_UNKNOWN


The “contact” property

  “contact”                  gchar *

Method of contacting developer.

Flags: Read / Write / Construct Only

Default value: NULL


The “description” property

  “description”              gchar *

Description of the snap.

Flags: Read / Write / Construct Only

Default value: NULL


The “developer” property

  “developer”                gchar *

Developer who created the snap.

Flags: Read / Write / Construct Only

Default value: NULL


The “devmode” property

  “devmode”                  gboolean

TRUE if the snap is currently installed in devmode.

Flags: Read / Write / Construct Only

Default value: FALSE


The “download-size” property

  “download-size”            gint64

Download size in bytes.

Flags: Read / Write / Construct Only

Default value: 0


The “icon” property

  “icon”                     gchar *

URL to the snap icon.

Flags: Read / Write / Construct Only

Default value: NULL


The “id” property

  “id”                       gchar *

Unique ID for this snap.

Flags: Read / Write / Construct Only

Default value: NULL


The “install-date” property

  “install-date”             GDateTime *

Date this snap was installed.

Flags: Read / Write / Construct Only


The “installed-size” property

  “installed-size”           gint64

Installed size in bytes.

Flags: Read / Write / Construct Only

Default value: 0


The “jailmode” property

  “jailmode”                 gboolean

TRUE if the snap is currently installed in jailmode.

Flags: Read / Write / Construct Only

Default value: FALSE


The “license” property

  “license”                  gchar *

The snap license as an SPDX expression.

Flags: Read / Write / Construct Only

Default value: NULL


The “media” property

  “media”                    GPtrArray *

Media associated with this snap.

Flags: Read / Write / Construct Only


The “mounted-from” property

  “mounted-from”             gchar *

Path snap is mounted from.

Flags: Read / Write / Construct Only

Default value: NULL


The “name” property

  “name”                     gchar *

The snap name.

Flags: Read / Write / Construct Only

Default value: NULL


The “prices” property

  “prices”                   GPtrArray *

Prices this snap can be purchased for.

Flags: Read / Write / Construct Only


The “private” property

  “private”                  gboolean

TRUE if this snap is only available to its author.

Flags: Read / Write / Construct Only

Default value: FALSE


The “publisher-display-name” property

  “publisher-display-name”   gchar *

Display name for snap publisher.

Flags: Read / Write / Construct Only

Default value: NULL


The “publisher-id” property

  “publisher-id”             gchar *

ID for snap publisher.

Flags: Read / Write / Construct Only

Default value: NULL


The “publisher-username” property

  “publisher-username”       gchar *

Username for snap publisher.

Flags: Read / Write / Construct Only

Default value: NULL


The “publisher-validation” property

  “publisher-validation”     SnapdPublisherValidation

Validation for snap publisher.

Flags: Read / Write / Construct Only

Default value: SNAPD_PUBLISHER_VALIDATION_UNKNOWN


The “revision” property

  “revision”                 gchar *

Revision of this snap.

Flags: Read / Write / Construct Only

Default value: NULL


The “screenshots” property

  “screenshots”              GPtrArray *

Screenshots of this snap.

Flags: Read / Write / Construct Only


The “snap-type” property

  “snap-type”                SnapdSnapType

Snap type.

Flags: Read / Write / Construct Only

Default value: SNAPD_SNAP_TYPE_UNKNOWN


The “status” property

  “status”                   SnapdSnapStatus

State of this snap.

Flags: Read / Write / Construct Only

Default value: SNAPD_SNAP_STATUS_UNKNOWN


The “summary” property

  “summary”                  gchar *

One line description.

Flags: Read / Write / Construct Only

Default value: NULL


The “title” property

  “title”                    gchar *

The snap title.

Flags: Read / Write / Construct Only

Default value: NULL


The “tracking-channel” property

  “tracking-channel”         gchar *

Channel the snap is currently tracking.

Flags: Read / Write / Construct Only

Default value: NULL


The “tracks” property

  “tracks”                   GStrv

Track names.

Flags: Read / Write / Construct Only


The “trymode” property

  “trymode”                  gboolean

TRUE if this snap is installed in try mode.

Flags: Read / Write / Construct Only

Default value: FALSE


The “version” property

  “version”                  gchar *

Snap version.

Flags: Read / Write / Construct Only

Default value: NULL