## XdgAppRef XdgAppRef — Application reference |

## Functions

char * | xdg_app_ref_format_ref ()
const char * | xdg_app_ref_get_arch ()
const char * | xdg_app_ref_get_branch ()
const char * | xdg_app_ref_get_commit ()
XdgAppRefKind | xdg_app_ref_get_kind ()
const char * | xdg_app_ref_get_name ()
XdgAppRef * | xdg_app_ref_parse ()

## Properties

gchar * | arch | Read / Write
gchar * | branch | Read / Write
gchar * | commit | Read / Write
XdgAppRefKind | kind | Read / Write
gchar * | name | Read / Write

## Types and Values

struct | XdgAppRef
enum | XdgAppRefKind

## Object Hierarchy

        GObject
        ╰── XdgAppRef
            ├── XdgAppInstalledRef
            ╰── XdgAppRemoteRef

## Description

Currently xdg-app manages two types of binary artifacts: applications, and runtimes. Applications contain a program that desktop users can run, while runtimes contain only libraries and data. An XdgAppRef object (or short: ref) can refer to either of these.

Both applications and runtimes are identified by a 4-tuple of strings: kind, name, arch and branch, e.g. app/org.gnome.evince/x86_64/master. The functions `xdg_app_ref_parse()` and `xdg_app_ref_format_ref()` can be used to convert XdgAppRef objects into this string representation and back.

To uniquely identify a particular version of an application or runtime, you need a commit.

The subclasses XdgAppInstalledRef and XdgAppRemoteRef provide more information for artifacts that are locally installed or available from a remote repository.

## Functions

### xdg_app_ref_format_ref ()

    char *
    xdg_app_ref_format_ref (XdgAppRef *self);

Convert an XdgAppRef object into a string representation that can be parsed by `xdg_app_ref_parse()`.

#### Parameters

self | a XdgAppRef |

#### Returns

string representation.

[transfer full]

### xdg_app_ref_get_arch ()

    const char *
    xdg_app_ref_get_arch (XdgAppRef *self);

Gets the arch or the ref.

#### Parameters

self | a XdgAppRef |

#### Returns

the arch.

[transfer none]

### xdg_app_ref_get_branch ()

    const char *
    xdg_app_ref_get_branch (XdgAppRef *self);

Gets the branch of the ref.

#### Parameters

self | a XdgAppRef |

#### Returns

the branch.

[transfer none]

### xdg_app_ref_get_commit ()

    const char *
    xdg_app_ref_get_commit (XdgAppRef *self);

Gets the commit of the ref.

#### Parameters

self | a XdgAppRef |

#### Returns

the commit.

[transfer none]

### xdg_app_ref_get_kind ()

    XdgAppRefKind
    xdg_app_ref_get_kind (XdgAppRef *self);

Gets the kind of artifact that this ref refers to.

#### Parameters

self | a XdgAppRef |

#### Returns

the kind of artifact

### xdg_app_ref_get_name ()

    const char *
    xdg_app_ref_get_name (XdgAppRef *self);

Gets the name of the ref.

#### Parameters

self | a XdgAppRef |

#### Returns

the name.

[transfer none]

### xdg_app_ref_parse ()

    XdgAppRef *
    xdg_app_ref_parse (const char *ref,
                       GError **error);

Tries to parse a full ref name and return a XdgAppRef (without a commit set) or fail if the ref is invalid somehow.

#### Parameters

ref | A string ref name, such as "app/org.test.App/86_64/master" |
error | return location for a GError |

#### Returns

an XdgAppRef, or `NULL`.

[transfer full]

## Types and Values

### struct XdgAppRef

    struct XdgAppRef;

### enum XdgAppRefKind

The kind of artifact that a XdgAppRef refers to.

#### Members

XDG_APP_REF_KIND_APP | An application |
XDG_APP_REF_KIND_RUNTIME | A runtime that applications can use. |

## Property Details

### The `“arch”` property

      “arch”                     gchar *

The architecture of the application or runtime.

Flags: Read / Write

Default value: NULL

### The `“branch”` property

      “branch”                   gchar *

The branch of the application or runtime.

Flags: Read / Write

Default value: NULL

### The `“commit”` property

      “commit”                   gchar *

The commit.

Flags: Read / Write

Default value: NULL

### The `“kind”` property

      “kind”                     XdgAppRefKind

The kind of artifact.

Flags: Read / Write

Default value: XDG_APP_REF_KIND_APP

### The `“name”` property

      “name”                     gchar *

The name of the application or runtime.

Flags: Read / Write

Default value: NULL