## AsRelease AsRelease — Object representing a single upstream release |

## Stability Level

Stable, unless otherwise indicated

## Functions

AsRelease * | as_release_new ()
gint | as_release_vercmp ()
AsReleaseState | as_release_state_from_string ()
const gchar * | as_release_state_to_string ()
const gchar * | as_release_get_version ()
GBytes * | as_release_get_blob ()
guint64 | as_release_get_timestamp ()
const gchar * | as_release_get_description ()
GPtrArray * | as_release_get_locations ()
const gchar * | as_release_get_location_default ()
AsChecksum * | as_release_get_checksum_by_fn ()
AsChecksum * | as_release_get_checksum_by_target ()
GPtrArray * | as_release_get_checksums ()
AsUrgencyKind | as_release_get_urgency ()
AsReleaseState | as_release_get_state ()
guint64 | as_release_get_size ()
void | as_release_set_version ()
void | as_release_set_blob ()
void | as_release_set_timestamp ()
void | as_release_set_description ()
void | as_release_add_location ()
void | as_release_add_checksum ()
void | as_release_set_urgency ()
void | as_release_set_state ()
void | as_release_set_size ()

## Types and Values

#define | AS_TYPE_RELEASE
struct | AsReleaseClass
enum | AsReleaseState
| AsRelease

## Object Hierarchy

        GObject
        ╰── AsRelease

## Includes

    #include <appstream-glib.h>

## Description

This object represents a single upstream release, typically a minor update. Releases can contain a localized description of paragraph and list elements and also have a version number and timestamp.

Releases can be automatically generated by parsing upstream ChangeLogs or .spec files, or can be populated using AppData files.

See also: AsApp

## Functions

### as_release_new ()

    AsRelease *
    as_release_new (void);

Creates a new AsRelease.

#### Returns

a AsRelease.

[transfer full]

Since: 0.1.0

### as_release_vercmp ()

    gint
    as_release_vercmp (AsRelease *rel1,
                       AsRelease *rel2);

Compares two release.

#### Parameters

rel1 | a AsRelease instance. |
rel2 | a AsRelease instance. |

#### Returns

-1 if rel1 > rel2, +1 if rel1 < rel2, 0 otherwise

Since: 0.4.2

### as_release_state_from_string ()

    AsReleaseState
    as_release_state_from_string (const gchar *state);

Converts the text representation to an enumerated value.

#### Parameters

state | a string |

#### Returns

A AsReleaseState, e.g. `AS_RELEASE_STATE_INSTALLED`.

Since: 0.6.6

### as_release_state_to_string ()

    const gchar *
    as_release_state_to_string (AsReleaseState state);

Converts the enumerated value to an text representation.

#### Parameters

state | the AsReleaseState, e.g. `AS_RELEASE_STATE_INSTALLED` |

#### Returns

string version of `state` , or `NULL` for unknown

Since: 0.6.6

### as_release_get_version ()

    const gchar *
    as_release_get_version (AsRelease *release);

Gets the release version.

#### Parameters

release | a AsRelease instance. |

#### Returns

string, or `NULL` for not set or invalid

Since: 0.1.0

### as_release_get_blob ()

    GBytes *
    as_release_get_blob (AsRelease *release,
                         const gchar *filename);

Gets the release blob, which is typically firmware file data.

#### Parameters

release | a AsRelease instance. |
filename | a filename |

#### Returns

a GBytes, or `NULL` for not set

Since: 0.5.2

### as_release_get_timestamp ()

    guint64
    as_release_get_timestamp (AsRelease *release);

Gets the release timestamp.

#### Parameters

release | a AsRelease instance. |

#### Returns

timestamp, or 0 for unset

Since: 0.1.0

### as_release_get_description ()

    const gchar *
    as_release_get_description (AsRelease *release,
                                const gchar *locale);

Gets the release description markup for a given locale.

#### Parameters

release | a AsRelease instance. |
locale | the locale, or `NULL`. e.g. "en_GB" |

#### Returns

markup, or `NULL` for not set or invalid

Since: 0.1.0

### as_release_get_locations ()

    GPtrArray *
    as_release_get_locations (AsRelease *release);

Gets the release locations, typically URLs.

#### Parameters

release | a AsRelease instance. |

#### Returns

list of locations.

[transfer none][element-type utf8]

Since: 0.3.5

### as_release_get_location_default ()

    const gchar *
    as_release_get_location_default (AsRelease *release);

Gets the default release location, typically a URL.

#### Parameters

release | a AsRelease instance. |

#### Returns

string, or `NULL` for not set or invalid

Since: 0.3.5

### as_release_get_checksum_by_fn ()

    AsChecksum *
    as_release_get_checksum_by_fn (AsRelease *release,
                                   const gchar *fn);

Gets the checksum for a release.

#### Parameters

release | a AsRelease instance |
fn | a file basename |

#### Returns

an AsChecksum, or `NULL` for not found.

[transfer none]

Since: 0.4.2

### as_release_get_checksum_by_target ()

    AsChecksum *
    as_release_get_checksum_by_target (AsRelease *release,
                                       AsChecksumTarget target);

Gets the checksum for a release.

#### Parameters

release | a AsRelease instance |
target | a AsChecksumTarget, e.g. `AS_CHECKSUM_TARGET_CONTAINER` |

#### Returns

an AsChecksum, or `NULL` for not found.

[transfer none]

Since: 0.4.2

### as_release_get_checksums ()

    GPtrArray *
    as_release_get_checksums (AsRelease *release);

Gets the release checksums.

#### Parameters

release | a AsRelease instance. |

#### Returns

list of checksums.

[transfer none][element-type AsChecksum]

Since: 0.4.2

### as_release_get_urgency ()

    AsUrgencyKind
    as_release_get_urgency (AsRelease *release);

Gets the release urgency.

#### Parameters

release | a AsRelease instance. |

#### Returns

enumberated value, or `AS_URGENCY_KIND_UNKNOWN` for not set or invalid

Since: 0.5.1

### as_release_get_state ()

    AsReleaseState
    as_release_get_state (AsRelease *release);

Gets the release state.

#### Parameters

release | a AsRelease instance. |

#### Returns

enumberated value, or `AS_RELEASE_STATE_UNKNOWN` for not set or invalid

Since: 0.5.8

### as_release_get_size ()

    guint64
    as_release_get_size (AsRelease *release,
                         AsSizeKind kind);

Gets the release size.

#### Parameters

release | a AsRelease instance |
kind | a AsSizeKind, e.g. AS_SIZE_KIND_DOWNLOAD |

#### Returns

The size in bytes, or 0 for unknown.

Since: 0.5.2

### as_release_set_version ()

    void
    as_release_set_version (AsRelease *release,
                            const gchar *version);

Sets the release version.

#### Parameters

release | a AsRelease instance. |
version | the version string. |

Since: 0.1.0

### as_release_set_blob ()

    void
    as_release_set_blob (AsRelease *release,
                         const gchar *filename,
                         GBytes *blob);

Sets a release blob, which is typically firmware data or a detached signature.

NOTE: This is not stored in the XML file, and is only available in-memory.

#### Parameters

release | a AsRelease instance. |
filename | a filename |
blob | the GBytes data blob |

Since: 0.5.2

### as_release_set_timestamp ()

    void
    as_release_set_timestamp (AsRelease *release,
                              guint64 timestamp);

Sets the release timestamp.

#### Parameters

release | a AsRelease instance. |
timestamp | the timestamp value. |

Since: 0.1.0

### as_release_set_description ()

    void
    as_release_set_description (AsRelease *release,
                                const gchar *locale,
                                const gchar *description);

Sets the description release markup.

#### Parameters

release | a AsRelease instance. |
locale | the locale, or `NULL`. e.g. "en_GB" |
description | the description markup. |

Since: 0.1.0

### as_release_add_location ()

    void
    as_release_add_location (AsRelease *release,
                             const gchar *location);

Adds a release location.

#### Parameters

release | a AsRelease instance. |
location | the location string. |

Since: 0.3.5

### as_release_add_checksum ()

    void
    as_release_add_checksum (AsRelease *release,
                             AsChecksum *checksum);

Adds a release checksum.

#### Parameters

release | a AsRelease instance. |
checksum | a AsChecksum instance. |

Since: 0.4.2

### as_release_set_urgency ()

    void
    as_release_set_urgency (AsRelease *release,
                            AsUrgencyKind urgency);

Sets the release urgency.

#### Parameters

release | a AsRelease instance. |
urgency | the release urgency, e.g. `AS_URGENCY_KIND_CRITICAL` |

Since: 0.5.1

### as_release_set_state ()

    void
    as_release_set_state (AsRelease *release,
                          AsReleaseState state);

Sets the release state.

#### Parameters

release | a AsRelease instance. |
state | the release state, e.g. `AS_RELEASE_STATE_INSTALLED` |

Since: 0.5.8

### as_release_set_size ()

    void
    as_release_set_size (AsRelease *release,
                         AsSizeKind kind,
                         guint64 size);

Sets the release size.

#### Parameters

release | a AsRelease instance |
kind | a AsSizeKind, e.g. AS_SIZE_KIND_DOWNLOAD |
size | a size in bytes, or 0 for unknown |

Since: 0.5.2

## Types and Values

### AS_TYPE_RELEASE

    #define AS_TYPE_RELEASE (as_release_get_type ())

### struct AsReleaseClass

    struct AsReleaseClass {
    	GObjectClass		parent_class;
    };

### enum AsReleaseState

The release state.

#### Members

AS_RELEASE_STATE_UNKNOWN | Unknown state |
AS_RELEASE_STATE_INSTALLED | Release is installed |
AS_RELEASE_STATE_AVAILABLE | Release is available |

### AsRelease

    typedef struct _AsRelease AsRelease;