## FlatpakRef FlatpakRef — Application reference |

## Functions

char * | flatpak_ref_format_ref ()
const char * | flatpak_ref_get_arch ()
const char * | flatpak_ref_get_branch ()
const char * | flatpak_ref_get_collection_id ()
const char * | flatpak_ref_get_commit ()
FlatpakRefKind | flatpak_ref_get_kind ()
const char * | flatpak_ref_get_name ()
FlatpakRef * | flatpak_ref_parse ()

## Properties

char * | arch | Read / Write / Construct Only
char * | branch | Read / Write / Construct Only
char * | collection-id | Read / Write / Construct Only
char * | commit | Read / Write / Construct Only
FlatpakRefKind | kind | Read / Write / Construct Only
char * | name | Read / Write / Construct Only

## Types and Values

struct | FlatpakRef
enum | FlatpakRefKind

## Object Hierarchy

        GObject
        ╰── FlatpakRef
            ├── FlatpakBundleRef
            ├── FlatpakInstalledRef
            ├── FlatpakRelatedRef
            ╰── FlatpakRemoteRef

## Description

Currently Flatpak 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 FlatpakRef 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 `flatpak_ref_parse()` and `flatpak_ref_format_ref()` can be used to convert FlatpakRef objects into this string representation and back.

Note that the identifiers must be unique within a repo (e.g. Flathub) based only on the name, arch, and branch 3-tuple, without regard to the kind. In other words if app/org.gnome.evince/x86_64/master exists, runtime/org.gnome.evince/x86_64/master must not exist. This requirement is not enforced by libflatpak but is enforced by GNOME Software's use of libappstream, since Appstream IDs are assumed to be unique.

FlatpakRef objects are immutable and can be passed freely between threads.

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

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

## Functions

### flatpak_ref_format_ref ()

    char *
    flatpak_ref_format_ref (FlatpakRef *self);

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

#### Parameters

self | a FlatpakRef |

#### Returns

string representation.

[transfer full]

### flatpak_ref_get_arch ()

    const char *
    flatpak_ref_get_arch (FlatpakRef *self);

Gets the arch or the ref.

#### Parameters

self | a FlatpakRef |

#### Returns

the arch.

[transfer none]

### flatpak_ref_get_branch ()

    const char *
    flatpak_ref_get_branch (FlatpakRef *self);

Gets the branch of the ref.

#### Parameters

self | a FlatpakRef |

#### Returns

the branch.

[transfer none]

### flatpak_ref_get_collection_id ()

    const char *
    flatpak_ref_get_collection_id (FlatpakRef *self);

Gets the collection ID of the ref.

#### Parameters

self | a FlatpakRef |

#### Returns

the collection ID.

[transfer none]

### flatpak_ref_get_commit ()

    const char *
    flatpak_ref_get_commit (FlatpakRef *self);

Gets the commit of the ref.

#### Parameters

self | a FlatpakRef |

#### Returns

the commit.

[transfer none]

### flatpak_ref_get_kind ()

    FlatpakRefKind
    flatpak_ref_get_kind (FlatpakRef *self);

Gets the kind of artifact that this ref refers to.

#### Parameters

self | a FlatpakRef |

#### Returns

the kind of artifact

### flatpak_ref_get_name ()

    const char *
    flatpak_ref_get_name (FlatpakRef *self);

Gets the name of the ref.

#### Parameters

self | a FlatpakRef |

#### Returns

the name.

[transfer none]

### flatpak_ref_parse ()

    FlatpakRef *
    flatpak_ref_parse (const char *ref,
                       GError **error);

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

#### Parameters

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

#### Returns

an FlatpakRef, or `NULL`.

[transfer full]

## Types and Values

### struct FlatpakRef

    struct FlatpakRef;

### enum FlatpakRefKind

The kind of artifact that a FlatpakRef refers to.

#### Members

FLATPAK_REF_KIND_APP | An application |
FLATPAK_REF_KIND_RUNTIME | A runtime that applications can use. |

## Property Details

### The `“arch”` property

      “arch”                     char *

The architecture of the application or runtime.

Owner: FlatpakRef

Flags: Read / Write / Construct Only

Default value: NULL

### The `“branch”` property

      “branch”                   char *

The branch of the application or runtime.

Owner: FlatpakRef

Flags: Read / Write / Construct Only

Default value: NULL

### The `“collection-id”` property

      “collection-id”            char *

The collection ID.

Owner: FlatpakRef

Flags: Read / Write / Construct Only

Default value: NULL

### The `“commit”` property

      “commit”                   char *

The commit.

Owner: FlatpakRef

Flags: Read / Write / Construct Only

Default value: NULL

### The `“kind”` property

      “kind”                     FlatpakRefKind

The kind of artifact.

Owner: FlatpakRef

Flags: Read / Write / Construct Only

Default value: FLATPAK_REF_KIND_APP

### The `“name”` property

      “name”                     char *

The name of the application or runtime.

Owner: FlatpakRef

Flags: Read / Write / Construct Only

Default value: NULL