AsComponent

## AsComponent AsComponent — Object representing a software component |

## Functions

const gchar * | as_component_kind_to_string ()
AsComponentKind | as_component_kind_from_string ()
const gchar * | as_merge_kind_to_string ()
AsMergeKind | as_merge_kind_from_string ()
const gchar * | as_component_scope_to_string ()
AsComponentScope | as_component_scope_from_string ()
const gchar * | as_releases_kind_to_string ()
AsReleasesKind | as_releases_kind_from_string ()
AsComponent * | as_component_new ()
AsValueFlags | as_component_get_value_flags ()
void | as_component_set_value_flags ()
const gchar * | as_component_get_active_locale ()
void | as_component_set_active_locale ()
const gchar * | as_component_get_id ()
void | as_component_set_id ()
const gchar * | as_component_get_data_id ()
void | as_component_set_data_id ()
AsComponentKind | as_component_get_kind ()
void | as_component_set_kind ()
const gchar * | as_component_get_date_eol ()
void | as_component_set_date_eol ()
guint64 | as_component_get_timestamp_eol ()
const gchar * | as_component_get_origin ()
void | as_component_set_origin ()
const gchar * | as_component_get_branch ()
void | as_component_set_branch ()
AsComponentScope | as_component_get_scope ()
void | as_component_set_scope ()
gchar * | as_component_get_pkgname ()
gchar ** | as_component_get_pkgnames ()
void | as_component_set_pkgnames ()
void | as_component_set_pkgname ()
const gchar * | as_component_get_source_pkgname ()
void | as_component_set_source_pkgname ()
const gchar * | as_component_get_name ()
void | as_component_set_name ()
const gchar * | as_component_get_summary ()
void | as_component_set_summary ()
const gchar * | as_component_get_description ()
void | as_component_set_description ()
GPtrArray * | as_component_get_launchables ()
AsLaunchable * | as_component_get_launchable ()
void | as_component_add_launchable ()
const gchar * | as_component_get_metadata_license ()
void | as_component_set_metadata_license ()
const gchar * | as_component_get_project_license ()
void | as_component_set_project_license ()
const gchar * | as_component_get_project_group ()
void | as_component_set_project_group ()
const gchar * | as_component_get_developer_name ()
void | as_component_set_developer_name ()
GPtrArray * | as_component_get_compulsory_for_desktops ()
void | as_component_set_compulsory_for_desktop ()
gboolean | as_component_is_compulsory_for_desktop ()
GPtrArray * | as_component_get_categories ()
void | as_component_add_category ()
gboolean | as_component_has_category ()
GPtrArray * | as_component_get_screenshots ()
void | as_component_add_screenshot ()
gchar ** | as_component_get_keywords ()
void | as_component_set_keywords ()
GPtrArray * | as_component_get_icons ()
AsIcon * | as_component_get_icon_by_size ()
AsIcon * | as_component_get_icon_stock ()
void | as_component_add_icon ()
GPtrArray * | as_component_get_provided ()
void | as_component_add_provided ()
AsProvided * | as_component_get_provided_for_kind ()
void | as_component_add_provided_item ()
const gchar * | as_component_get_url ()
void | as_component_add_url ()
gboolean | as_component_load_releases_from_bytes ()
gboolean | as_component_load_releases ()
GPtrArray * | as_component_get_releases ()
void | as_component_add_release ()
AsReleasesKind | as_component_get_releases_kind ()
void | as_component_set_releases_kind ()
const gchar * | as_component_get_releases_url ()
void | as_component_set_releases_url ()
GPtrArray * | as_component_get_extends ()
void | as_component_add_extends ()
GPtrArray * | as_component_get_addons ()
void | as_component_add_addon ()
GList * | as_component_get_languages ()
gint | as_component_get_language ()
void | as_component_add_language ()
void | as_component_clear_languages ()
GPtrArray * | as_component_get_translations ()
void | as_component_add_translation ()
gboolean | as_component_has_bundle ()
GPtrArray * | as_component_get_bundles ()
AsBundle * | as_component_get_bundle ()
void | as_component_add_bundle ()
GPtrArray * | as_component_get_suggested ()
void | as_component_add_suggested ()
GPtrArray * | as_component_get_search_tokens ()
guint | as_component_search_matches ()
guint | as_component_search_matches_all ()
AsMergeKind | as_component_get_merge_kind ()
void | as_component_set_merge_kind ()
gboolean | as_component_is_member_of_category ()
gboolean | as_component_is_ignored ()
gboolean | as_component_is_valid ()
gchar * | as_component_to_string ()
gint | as_component_get_priority ()
void | as_component_set_priority ()
GHashTable * | as_component_get_custom ()
const gchar * | as_component_get_custom_value ()
gboolean | as_component_insert_custom_value ()
GPtrArray * | as_component_get_content_ratings ()
AsContentRating * | as_component_get_content_rating ()
void | as_component_add_content_rating ()
GPtrArray * | as_component_get_requires ()
GPtrArray * | as_component_get_recommends ()
GPtrArray * | as_component_get_supports ()
void | as_component_add_relation ()
GPtrArray * | as_component_get_replaces ()
void | as_component_add_replaces ()
GPtrArray * | as_component_get_agreements ()
void | as_component_add_agreement ()
AsAgreement * | as_component_get_agreement_by_kind ()
AsBranding * | as_component_get_branding ()
void | as_component_set_branding ()
void | as_component_clear_tags ()
gboolean | as_component_add_tag ()
gboolean | as_component_remove_tag ()
gboolean | as_component_has_tag ()
const gchar * | as_component_get_name_variant_suffix ()
void | as_component_set_name_variant_suffix ()
guint | as_component_get_sort_score ()
void | as_component_set_sort_score ()
GPtrArray * | as_component_get_reviews ()
void | as_component_add_review ()
AsContext * | as_component_get_context ()
GHashTable * | as_component_get_name_table ()
GHashTable * | as_component_get_summary_table ()
GHashTable * | as_component_get_keywords_table ()
gboolean | as_component_is_free ()
gboolean | as_component_load_from_bytes ()
gchar * | as_component_to_xml_data ()
const gchar * | as_component_get_desktop_id ()
gboolean | as_component_load_from_xml_data ()

## Types and Values

#define | AS_TYPE_COMPONENT
struct | AsComponentClass
enum | AsComponentKind
#define | AS_COMPONENT_KIND_INPUTMETHOD
enum | AsMergeKind
enum | AsComponentScope
enum | AsValueFlags
enum | AsSearchTokenMatch
#define | AS_SEARCH_TOKEN_MATCH_MIMETYPE
enum | AsReleasesKind
| AsComponent

## Includes

    #include <appstream.h>

## Description

This object represents an Appstream software component which is associated to a package in the distribution's repositories. A component can be anything, ranging from an application to a font, a codec or even a non-visual software project providing libraries and python-modules for other applications to use.

The type of the component is stored as AsComponentKind and can be queried to find out which kind of component we're dealing with.

See also: AsProvidesKind, AsDatabase

## Functions

### as_component_kind_to_string ()

    const gchar *
    as_component_kind_to_string (AsComponentKind kind);

Converts the enumerated value to an text representation.

#### Parameters

kind | the AsComponentKind. |

#### Returns

string version of `kind`

### as_component_kind_from_string ()

    AsComponentKind
    as_component_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

#### Parameters

kind_str | the string. |

#### Returns

a AsComponentKind or `AS_COMPONENT_KIND_UNKNOWN` for unknown

### as_merge_kind_to_string ()

    const gchar *
    as_merge_kind_to_string (AsMergeKind kind);

Converts the enumerated value to an text representation.

#### Parameters

kind | the AsMergeKind. |

#### Returns

string version of `kind`

### as_merge_kind_from_string ()

    AsMergeKind
    as_merge_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

#### Parameters

kind_str | the string. |

#### Returns

a AsMergeKind or `AS_MERGE_KIND_NONE` for unknown

### as_component_scope_to_string ()

    const gchar *
    as_component_scope_to_string (AsComponentScope scope);

Converts the enumerated value to an text representation.

#### Parameters

scope | the AsComponentScope. |

#### Returns

string version of `scope`

### as_component_scope_from_string ()

    AsComponentScope
    as_component_scope_from_string (const gchar *scope_str);

Converts the text representation to an enumerated value.

#### Parameters

scope_str | the string. |

#### Returns

a AsComponentScope or `AS_COMPONENT_SCOPE_UNKNOWN` for unknown

### as_releases_kind_to_string ()

    const gchar *
    as_releases_kind_to_string (AsReleasesKind kind);

Converts the enumerated value to an text representation.

#### Parameters

kind | the AsReleaseKind. |

#### Returns

string version of `kind`

Since: 0.16.0

### as_releases_kind_from_string ()

    AsReleasesKind
    as_releases_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

#### Parameters

kind_str | the string. |

#### Returns

an AsReleaseKind or `AS_RELEASE_KIND_UNKNOWN` for unknown

Since: 0.16.0

### as_component_new ()

    AsComponent *
    as_component_new (void);

Creates a new AsComponent.

#### Returns

a new AsComponent.

[transfer full]

### as_component_get_value_flags ()

    AsValueFlags
    as_component_get_value_flags (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

#### Returns

The AsValueFlags that are set on `cpt` .

### as_component_set_value_flags ()

    void
    as_component_set_value_flags (AsComponent *cpt,
                                  AsValueFlags flags);

#### Parameters

cpt | a AsComponent instance. |
flags | AsValueFlags to set on `cpt` . |

### as_component_get_active_locale ()

    const gchar *
    as_component_get_active_locale (AsComponent *cpt);

Get the current active locale for this component, which is used to get localized messages.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the current active locale.

### as_component_set_active_locale ()

    void
    as_component_set_active_locale (AsComponent *cpt,
                                    const gchar *locale);

Set the current active locale for this component, which is used to get localized messages. If the AsComponent was fetched from a localized database, usually only one locale is available.

#### Parameters

cpt | a AsComponent instance. |
locale | a POSIX or BCP47 locale, or `NULL`. e.g. "en_GB". | [nullable]

### as_component_get_id ()

    const gchar *
    as_component_get_id (AsComponent *cpt);

Get the unique AppStream identifier for this component. This ID is unique for the described component, but does not uniquely identify the metadata set.

For a unique ID for this metadata set in the current session, use `as_component_get_data_id`()

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the unique AppStream identifier.

### as_component_set_id ()

    void
    as_component_set_id (AsComponent *cpt,
                         const gchar *value);

Set the AppStream identifier for this component.

#### Parameters

cpt | a AsComponent instance. |
value | the unique identifier. |

### as_component_get_data_id ()

    const gchar *
    as_component_get_data_id (AsComponent *cpt);

Get a unique identifier for this metadata set. This unique ID is only valid for the current session, as opposed to the AppStream ID which uniquely identifies a software component.

The format of the unique id usually is: %{scope}/%{origin}/%{distribution_system}/%{appstream_id}

For example: system/os/package/org.example.FooBar

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the unique session-specific identifier.

### as_component_set_data_id ()

    void
    as_component_set_data_id (AsComponent *cpt,
                              const gchar *value);

Set the session-specific unique metadata identifier for this component. If two components have a different data_id but the same ID, they will be treated as independent sets of metadata describing the same component type.

#### Parameters

cpt | a AsComponent instance. |
value | the unique session-specific identifier. |

### as_component_get_kind ()

    AsComponentKind
    as_component_get_kind (AsComponent *cpt);

Returns the AsComponentKind of this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the kind of this.

### as_component_set_kind ()

    void
    as_component_set_kind (AsComponent *cpt,
                           AsComponentKind value);

Sets the AsComponentKind of this component.

#### Parameters

cpt | a AsComponent instance. |
value | the AsComponentKind. |

### as_component_get_date_eol ()

    const gchar *
    as_component_get_date_eol (AsComponent *cpt);

Gets the end-of-life date for the entire component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

The EOL date as string in ISO8601 format.

Since: 0.15.2

### as_component_set_date_eol ()

    void
    as_component_set_date_eol (AsComponent *cpt,
                               const gchar *date);

Sets an end-of-life date for this component.

#### Parameters

cpt | a AsComponent instance. |
date | the EOL date in ISO8601 format. |

Since: 0.15.2

### as_component_get_timestamp_eol ()

    guint64
    as_component_get_timestamp_eol (AsComponent *cpt);

Gets the UNIX timestamp for the date when this component is out of support (end-of-life) and will receive no more updates, not even security fixes.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

UNIX timestamp, or 0 for unset or invalid.

Since: 0.15.2

### as_component_get_origin ()

    const gchar *
    as_component_get_origin (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

### as_component_set_origin ()

    void
    as_component_set_origin (AsComponent *cpt,
                             const gchar *origin);

#### Parameters

cpt | a AsComponent instance. |
origin | the origin. |

### as_component_get_branch ()

    const gchar *
    as_component_get_branch (AsComponent *cpt);

Gets the branch for the application.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

string, or `NULL` if unset

Since: 0.14.0

### as_component_set_branch ()

    void
    as_component_set_branch (AsComponent *cpt,
                             const gchar *branch);

Set the branch that the component instance was sourced from.

#### Parameters

cpt | a AsComponent instance. |
branch | the branch, e.g. "master" or "3-16". |

Since: 0.14.0

### as_component_get_scope ()

    AsComponentScope
    as_component_get_scope (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the AsComponentScope of this component.

Since: 0.10.2

### as_component_set_scope ()

    void
    as_component_set_scope (AsComponent *cpt,
                            AsComponentScope scope);

Sets the AsComponentScope of this component.

#### Parameters

cpt | a AsComponent instance. |
scope | the AsComponentKind. |

### as_component_get_pkgname ()

    gchar *
    as_component_get_pkgname (AsComponent *cpt);

Get the first package name of the list of packages that need to be installed for this component to be present on the system. Since most components consist of only one package, this is safe to use for about 90% of all cases.

However, to support a component fully, please use `as_component_get_pkgnames`() for getting all packages that need to be installed, and use this method only to e.g. get the main package to perform a quick "is it installed?" check.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

String array of package names.

[transfer none]

### as_component_get_pkgnames ()

    gchar **
    as_component_get_pkgnames (AsComponent *cpt);

Get a list of package names which this component consists of. This usually is just one package name.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

String array of package names.

[transfer none]

### as_component_set_pkgnames ()

    void
    as_component_set_pkgnames (AsComponent *cpt,
                               gchar **packages);

Set a list of package names this component consists of. (This should usually be just one package name)

#### Parameters

cpt | a AsComponent instance. |
packages | . | [array zero-terminated=1]

### as_component_set_pkgname ()

    void
    as_component_set_pkgname (AsComponent *cpt,
                              const gchar *pkgname);

Set the package name that provides this component.

#### Parameters

cpt | a AsComponent instance. |
pkgname | the package name |

Since: 0.14.5

### as_component_get_source_pkgname ()

    const gchar *
    as_component_get_source_pkgname (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the source package name.

### as_component_set_source_pkgname ()

    void
    as_component_set_source_pkgname (AsComponent *cpt,
                                     const gchar *spkgname);

#### Parameters

cpt | a AsComponent instance. |
spkgname | the source package name. |

### as_component_get_name ()

    const gchar *
    as_component_get_name (AsComponent *cpt);

A human-readable name for this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the name.

### as_component_set_name ()

    void
    as_component_set_name (AsComponent *cpt,
                           const gchar *value,
                           const gchar *locale);

Set a human-readable name for this component.

#### Parameters

cpt | A valid AsComponent |
value | The name |
locale | The BCP47 locale for this value, or `NULL` to use the current active one. | [nullable]

### as_component_get_summary ()

    const gchar *
    as_component_get_summary (AsComponent *cpt);

Get a short description of this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the summary.

### as_component_set_summary ()

    void
    as_component_set_summary (AsComponent *cpt,
                              const gchar *value,
                              const gchar *locale);

Set a short description for this component.

#### Parameters

cpt | A valid AsComponent |
value | The summary |
locale | The BCP47 locale for this value, or `NULL` to use the current active one. | [nullable]

### as_component_get_description ()

    const gchar *
    as_component_get_description (AsComponent *cpt);

Get the localized long description of this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the description.

### as_component_set_description ()

    void
    as_component_set_description (AsComponent *cpt,
                                  const gchar *value,
                                  const gchar *locale);

Set long description for this component.

#### Parameters

cpt | A valid AsComponent |
value | The long description |
locale | The BCP47 locale for this value, or `NULL` to use the current active one. | [nullable]

### as_component_get_launchables ()

    GPtrArray *
    as_component_get_launchables (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

#### Returns

an array.

[transfer none][element-type AsLaunchable]

Since: 0.11.0

### as_component_get_launchable ()

    AsLaunchable *
    as_component_get_launchable (AsComponent *cpt,
                                 AsLaunchableKind kind);

Gets a AsLaunchable of a specific type that contains launchable entries for this component.

#### Parameters

cpt | a AsComponent instance. |
kind | a launch kind, e.g. `AS_LAUNCHABLE_KIND_DESKTOP_ID` |

#### Returns

a AsLaunchable or `NULL` if not found.

[transfer none][nullable]

Since: 0.11.0

### as_component_add_launchable ()

    void
    as_component_add_launchable (AsComponent *cpt,
                                 AsLaunchable *launchable);

Adds a AsLaunchable containing launchables entries for this component.

#### Parameters

cpt | a AsComponent instance. |
launchable | a AsLaunchable instance. |

Since: 0.11.0

### as_component_get_metadata_license ()

    const gchar *
    as_component_get_metadata_license (AsComponent *cpt);

The license the metadata iself is subjected to.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the license.

### as_component_set_metadata_license ()

    void
    as_component_set_metadata_license (AsComponent *cpt,
                                       const gchar *value);

Set the license this metadata is licensed under.

#### Parameters

cpt | a AsComponent instance. |
value | the metadata license. |

### as_component_get_project_license ()

    const gchar *
    as_component_get_project_license (AsComponent *cpt);

Get the license of the project this component belongs to.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the license.

### as_component_set_project_license ()

    void
    as_component_set_project_license (AsComponent *cpt,
                                      const gchar *value);

Set the project license.

#### Parameters

cpt | a AsComponent instance. |
value | the project license. |

### as_component_get_project_group ()

    const gchar *
    as_component_get_project_group (AsComponent *cpt);

Get the component's project group.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the project group.

### as_component_set_project_group ()

    void
    as_component_set_project_group (AsComponent *cpt,
                                    const gchar *value);

Set the component's project group.

#### Parameters

cpt | a AsComponent instance. |
value | the project group. |

### as_component_get_developer_name ()

    const gchar *
    as_component_get_developer_name (AsComponent *cpt);

Get the component's developer or development team name.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the developer name.

### as_component_set_developer_name ()

    void
    as_component_set_developer_name (AsComponent *cpt,
                                     const gchar *value,
                                     const gchar *locale);

Set the the component's developer or development team name.

#### Parameters

cpt | a AsComponent instance. |
value | the developer or developer team name |
locale | the BCP47 locale, or `NULL`. e.g. "en-GB". | [nullable]

### as_component_get_compulsory_for_desktops ()

    GPtrArray *
    as_component_get_compulsory_for_desktops
                                   (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

#### Returns

A list of desktops where this component is compulsory.

[transfer none][element-type utf8]

### as_component_set_compulsory_for_desktop ()

    void
    as_component_set_compulsory_for_desktop
                                   (AsComponent *cpt,
                                    const gchar *desktop);

Mark this component to be compulsory for the specified desktop environment.

#### Parameters

cpt | a AsComponent instance. |
desktop | The name of the desktop. |

### as_component_is_compulsory_for_desktop ()

    gboolean
    as_component_is_compulsory_for_desktop
                                   (AsComponent *cpt,
                                    const gchar *desktop);

Check if this component is compulsory for the given desktop.

#### Parameters

cpt | an AsComponent object |
desktop | the desktop-id to test for |

#### Returns

`TRUE` if compulsory, `FALSE` otherwise.

### as_component_get_categories ()

    GPtrArray *
    as_component_get_categories (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

#### Returns

String array of categories.

[transfer none][element-type utf8]

### as_component_add_category ()

    void
    as_component_add_category (AsComponent *cpt,
                               const gchar *category);

Add a category.

#### Parameters

cpt | a AsComponent instance. |
category | the categories name to add. |

### as_component_has_category ()

    gboolean
    as_component_has_category (AsComponent *cpt,
                               const gchar *category);

Check if component is in the specified category.

#### Parameters

cpt | an AsComponent object |
category | the specified category to check |

#### Returns

`TRUE` if the component is in the specified category.

### as_component_get_screenshots ()

    GPtrArray *
    as_component_get_screenshots (AsComponent *cpt);

Get a list of associated screenshots.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

an array of AsScreenshot instances.

[element-type AsScreenshot][transfer none]

### as_component_add_screenshot ()

    void
    as_component_add_screenshot (AsComponent *cpt,
                                 AsScreenshot *sshot);

Add an AsScreenshot to this component.

#### Parameters

cpt | a AsComponent instance. |
sshot | The AsScreenshot to add |

### as_component_get_keywords ()

    gchar **
    as_component_get_keywords (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

#### Returns

String array of keywords.

[transfer none]

### as_component_set_keywords ()

    void
    as_component_set_keywords (AsComponent *cpt,
                               gchar **value,
                               const gchar *locale);

Set keywords for this component.

#### Parameters

cpt | a AsComponent instance. |
value | String-array of keywords. | [array zero-terminated=1]
locale | BCP47 locale of the values, or `NULL` to use current locale. | [nullable]

### as_component_get_icons ()

    GPtrArray *
    as_component_get_icons (AsComponent *cpt);

#### Parameters

cpt | an AsComponent instance |

#### Returns

A GPtrArray of all icons for this component.

[element-type AsIcon][transfer none]

### as_component_get_icon_by_size ()

    AsIcon *
    as_component_get_icon_by_size (AsComponent *cpt,
                                   guint width,
                                   guint height);

Gets an icon matching the size constraints. The icons are not filtered by type, and the first icon which matches the size is returned. If you want more control over which icons you use for displaying, use the `as_component_get_icons`() function to get a list of all icons.

Note that this function is not HiDPI aware! It will never return an icon with a scaling factor > 1.

#### Parameters

cpt | an AsComponent instance |
width | The icon width in pixels. |
height | the icon height in pixels. |

#### Returns

An icon matching the given width/height, or `NULL` if not found.

[transfer none][nullable]

### as_component_get_icon_stock ()

    AsIcon *
    as_component_get_icon_stock (AsComponent *cpt);

Gets a stock icon for this component if one is associated with it. Will return `NULL` otherwise.

#### Parameters

cpt | an AsComponent instance |

#### Returns

An stock icon, or `NULL` if none found.

[transfer none][nullable]

### as_component_add_icon ()

    void
    as_component_add_icon (AsComponent *cpt,
                           AsIcon *icon);

Add an icon to this component.

#### Parameters

cpt | an AsComponent instance |
icon | the valid AsIcon instance to add. |

### as_component_get_provided ()

    GPtrArray *
    as_component_get_provided (AsComponent *cpt);

Get a list of AsProvided objects associated with this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

A list of AsProvided objects.

[transfer none][element-type AsProvided]

### as_component_add_provided ()

    void
    as_component_add_provided (AsComponent *cpt,
                               AsProvided *prov);

Add a set of provided items to this component.

#### Parameters

cpt | a AsComponent instance. |
prov | a AsProvided instance. |

Since: 0.6.2

### as_component_get_provided_for_kind ()

    AsProvided *
    as_component_get_provided_for_kind (AsComponent *cpt,
                                        AsProvidedKind kind);

Get an AsProvided object for the given interface type, containing information about the public interfaces (mimetypes, firmware, DBus services, ...) this component provides.

#### Parameters

cpt | a AsComponent instance. |
kind | kind of the provided item, e.g. `AS_PROVIDED_KIND_MIMETYPE` |

#### Returns

AsProvided containing the items this component provides, or `NULL`.

[transfer none][nullable]

### as_component_add_provided_item ()

    void
    as_component_add_provided_item (AsComponent *cpt,
                                    AsProvidedKind kind,
                                    const gchar *item);

Adds a provided item to the component with the given `kind` , creating a new `AsProvided` for this kind internally if necessary.

#### Parameters

cpt | a AsComponent instance. |
kind | the kind of the provided item (e.g. `AS_PROVIDED_KIND_MEDIATYPE`) |
item | the item to add. |

### as_component_get_url ()

    const gchar *
    as_component_get_url (AsComponent *cpt,
                          AsUrlKind url_kind);

Gets a URL.

#### Parameters

cpt | a AsComponent instance. |
url_kind | the URL kind, e.g. `AS_URL_KIND_HOMEPAGE`. |

#### Returns

string, or `NULL` if unset.

[nullable]

Since: 0.6.2

### as_component_add_url ()

    void
    as_component_add_url (AsComponent *cpt,
                          AsUrlKind url_kind,
                          const gchar *url);

Adds some URL data to the component.

#### Parameters

cpt | a AsComponent instance. |
url_kind | the URL kind, e.g. `AS_URL_KIND_HOMEPAGE` |
url | the full URL. |

Since: 0.6.2

### as_component_load_releases_from_bytes ()

    gboolean
    as_component_load_releases_from_bytes (AsComponent *cpt,
                                           GBytes *bytes,
                                           GError **error);

Load release information from XML bytes.

#### Parameters

cpt | a AsComponent instance. |
bytes | the release XML data as GBytes |
error | a GError. |

#### Returns

`TRUE` on success.

Since: 0.16.0

### as_component_load_releases ()

    gboolean
    as_component_load_releases (AsComponent *cpt,
                                gboolean reload,
                                gboolean allow_net,
                                GError **error);

Load data from an external source, possibly a local file or a network resource.

#### Parameters

cpt | a AsComponent instance. |
reload | set to `TRUE` to discard existing data and reload. |
allow_net | allow fetching release data from the internet. |
error | a GError. |

#### Returns

`TRUE` on success.

Since: 0.16.0

### as_component_get_releases ()

    GPtrArray *
    as_component_get_releases (AsComponent *cpt);

Get an array of the AsRelease items this component provides.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

A list of releases.

[element-type AsRelease][transfer none]

### as_component_add_release ()

    void
    as_component_add_release (AsComponent *cpt,
                              AsRelease *release);

Add an AsRelease to this component.

#### Parameters

cpt | a AsComponent instance. |
release | The AsRelease to add |

### as_component_get_releases_kind ()

    AsReleasesKind
    as_component_get_releases_kind (AsComponent *cpt);

Returns the AsReleasesKind of the release metadata associated with this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

The kind.

Since: 0.16.0

### as_component_set_releases_kind ()

    void
    as_component_set_releases_kind (AsComponent *cpt,
                                    AsReleasesKind kind);

Sets the AsReleasesKind of the release metadata associated with this component.

#### Parameters

cpt | a AsComponent instance. |
kind | the AsComponentKind. |

Since: 0.16.0

### as_component_get_releases_url ()

    const gchar *
    as_component_get_releases_url (AsComponent *cpt);

Get a remote URL to obtain release information for the component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

The URL of external release data.

Since: 0.16.0

### as_component_set_releases_url ()

    void
    as_component_set_releases_url (AsComponent *cpt,
                                   const gchar *url);

Set a remote URL pointing to an AppStream release info file.

#### Parameters

cpt | a AsComponent instance. |
url | the web URL where release data is found. |

Since: 0.16.0

### as_component_get_extends ()

    GPtrArray *
    as_component_get_extends (AsComponent *cpt);

Returns a string list of IDs of components which are extended by this addon.

See `as_component_get_extends`() for the reverse.

#### Parameters

cpt | an AsComponent instance. |

#### Returns

A GPtrArray or `NULL` if not set.

[element-type utf8][transfer none][nullable]

Since: 0.15.5

### as_component_add_extends ()

    void
    as_component_add_extends (AsComponent *cpt,
                              const gchar *cpt_id);

Add a reference to the extended component

#### Parameters

cpt | a AsComponent instance. |
cpt_id | The id of a component which is extended by this component |

Since: 0.15.5

### as_component_get_addons ()

    GPtrArray *
    as_component_get_addons (AsComponent *cpt);

Returns a list of AsComponent objects which are addons extending this component in functionality.

This is the reverse of `as_component_get_extends`()

#### Parameters

cpt | an AsComponent instance. |

#### Returns

An array of AsComponent.

[transfer none][element-type AsComponent]

Since: 0.9.2

### as_component_add_addon ()

    void
    as_component_add_addon (AsComponent *cpt,
                            AsComponent *addon);

Add a reference to the addon that is enhancing this component.

#### Parameters

cpt | a AsComponent instance. |
addon | The AsComponent that extends `cpt` |

Since: 0.9.2

### as_component_get_languages ()

    GList *
    as_component_get_languages (AsComponent *cpt);

Get a list of all languages.

#### Parameters

cpt | an AsComponent instance. |

#### Returns

list of locales.

[transfer container][element-type utf8]

Since: 0.7.0

### as_component_get_language ()

    gint
    as_component_get_language (AsComponent *cpt,
                               const gchar *locale);

Gets the translation coverage in percent for a specific locale

#### Parameters

cpt | an AsComponent instance. |
locale | the BCP47 locale, or `NULL`. e.g. "en-GB". | [nullable]

#### Returns

a percentage value, -1 if locale was not found

Since: 0.7.0

### as_component_add_language ()

    void
    as_component_add_language (AsComponent *cpt,
                               const gchar *locale,
                               gint percentage);

Adds a language to the component.

#### Parameters

cpt | an AsComponent instance. |
locale | the BCP47 locale, or `NULL`. e.g. "en-GB". | [nullable]
percentage | the percentage completion of the translation, 0 for locales with unknown amount of translation |

Since: 0.7.0

### as_component_clear_languages ()

    void
    as_component_clear_languages (AsComponent *cpt);

Remove all registered language translation information.

#### Parameters

cpt | an AsComponent instance. |

Since: 0.14.5

### as_component_get_translations ()

    GPtrArray *
    as_component_get_translations (AsComponent *cpt);

Get a GPtrArray of AsTranslation objects describing the translation systems and translation-ids (e.g. Gettext domains) used by this software component.

Only set for metainfo files.

#### Parameters

cpt | an AsComponent instance. |

#### Returns

An array of AsTranslation objects.

[transfer none][element-type AsTranslation]

Since: 0.9.2

### as_component_add_translation ()

    void
    as_component_add_translation (AsComponent *cpt,
                                  AsTranslation *tr);

Assign an AsTranslation object describing the translation system used by this component.

#### Parameters

cpt | an AsComponent instance. |
tr | an AsTranslation instance. |

Since: 0.9.2

### as_component_has_bundle ()

    gboolean
    as_component_has_bundle (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

#### Returns

`TRUE` if this component has a bundle associated.

### as_component_get_bundles ()

    GPtrArray *
    as_component_get_bundles (AsComponent *cpt);

Get a list of all software bundles associated with this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

A list of AsBundle.

[transfer none][element-type AsBundle]

Since: 0.10

### as_component_get_bundle ()

    AsBundle *
    as_component_get_bundle (AsComponent *cpt,
                             AsBundleKind bundle_kind);

Gets a bundle identifier string.

#### Parameters

cpt | a AsComponent instance. |
bundle_kind | the bundle kind, e.g. `AS_BUNDLE_KIND_LIMBA`. |

#### Returns

An AsBundle, or `NULL` if not set.

[transfer none][nullable]

Since: 0.8.0

### as_component_add_bundle ()

    void
    as_component_add_bundle (AsComponent *cpt,
                             AsBundle *bundle);

Adds a bundle to the component.

#### Parameters

cpt | a AsComponent instance. |
bundle | The AsBundle to add. |

Since: 0.8.0

### as_component_get_suggested ()

    GPtrArray *
    as_component_get_suggested (AsComponent *cpt);

Get a list of associated suggestions.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

an array of AsSuggested instances.

[transfer none][element-type AsSuggested]

### as_component_add_suggested ()

    void
    as_component_add_suggested (AsComponent *cpt,
                                AsSuggested *suggested);

Add an AsSuggested to this component.

#### Parameters

cpt | a AsComponent instance. |
suggested | The AsSuggested |

### as_component_get_search_tokens ()

    GPtrArray *
    as_component_get_search_tokens (AsComponent *cpt);

Returns all search tokens for this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

The string search tokens.

[transfer container][element-type utf8]

Since: 0.9.7

### as_component_search_matches ()

    guint
    as_component_search_matches (AsComponent *cpt,
                                 const gchar *term);

Searches component data for a specific keyword.

#### Parameters

cpt | a AsComponent instance. |
term | the search term. |

#### Returns

a match scrore, where 0 is no match and 100 is the best match.

Since: 0.9.7

### as_component_search_matches_all ()

    guint
    as_component_search_matches_all (AsComponent *cpt,
                                     gchar **terms);

Searches component data for all the specific keywords.

#### Parameters

cpt | a AsComponent instance. |
terms | the search terms. |

#### Returns

a match score, where 0 is no match and larger numbers are better matches.

Since: 0.9.8

### as_component_get_merge_kind ()

    AsMergeKind
    as_component_get_merge_kind (AsComponent *cpt);

Get the merge method which should apply to duplicate components with this ID.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the AsMergeKind of this component.

Since: 0.9.8

### as_component_set_merge_kind ()

    void
    as_component_set_merge_kind (AsComponent *cpt,
                                 AsMergeKind kind);

Sets the AsMergeKind for this component.

#### Parameters

cpt | a AsComponent instance. |
kind | the AsMergeKind. |

Since: 0.9.8

### as_component_is_member_of_category ()

    gboolean
    as_component_is_member_of_category (AsComponent *cpt,
                                        AsCategory *category);

Test if the component `cpt` is a member of category `category` .

#### Parameters

cpt | a AsComponent instance. |
category | The category to test. |

### as_component_is_ignored ()

    gboolean
    as_component_is_ignored (AsComponent *cpt);

#### Parameters

cpt | a AsComponent instance. |

#### Returns

Whether this component's metadata should be ignored.

Since: 0.10.2

### as_component_is_valid ()

    gboolean
    as_component_is_valid (AsComponent *cpt);

Check if the essential properties of this Component are populated with useful data.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

TRUE if the component data was validated successfully.

### as_component_to_string ()

    gchar *
    as_component_to_string (AsComponent *cpt);

Returns a string identifying this component. (useful for debugging)

#### Parameters

cpt | a AsComponent instance. |

#### Returns

A descriptive string.

[transfer full]

### as_component_get_priority ()

    gint
    as_component_get_priority (AsComponent *cpt);

Returns the priority of this component. This method is used internally.

#### Parameters

cpt | a AsComponent instance. |

Since: 0.6.1

### as_component_set_priority ()

    void
    as_component_set_priority (AsComponent *cpt,
                               gint priority);

Sets the priority of this component. This method is used internally.

#### Parameters

cpt | a AsComponent instance. |
priority | the given priority |

Since: 0.6.1

### as_component_get_custom ()

    GHashTable *
    as_component_get_custom (AsComponent *cpt);

#### Parameters

cpt | An AsComponent. |

#### Returns

Hash table of custom user defined data fields.

[transfer none]

Since: 0.10.5

### as_component_get_custom_value ()

    const gchar *
    as_component_get_custom_value (AsComponent *cpt,
                                   const gchar *key);

Retrieve value for a custom data entry with the given key.

#### Parameters

cpt | An AsComponent. |
key | Field name. |

Since: 0.10.5

### as_component_insert_custom_value ()

    gboolean
    as_component_insert_custom_value (AsComponent *cpt,
                                      const gchar *key,
                                      const gchar *value);

Add a key and value pair to the custom data table.

#### Parameters

cpt | An AsComponent. |
key | Key name. |
value | A string value. |

#### Returns

`TRUE` if the key did not exist yet.

Since: 0.10.5

### as_component_get_content_ratings ()

    GPtrArray *
    as_component_get_content_ratings (AsComponent *cpt);

Gets all content ratings defined for this software.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

an array.

[element-type AsContentRating][transfer none]

Since: 0.11.0

### as_component_get_content_rating ()

    AsContentRating *
    as_component_get_content_rating (AsComponent *cpt,
                                     const gchar *kind);

Gets a content ratings of a specific type that are defined for this component.

#### Parameters

cpt | a AsComponent instance. |
kind | a ratings kind, e.g. "oars-1.0" |

#### Returns

a AsContentRating or `NULL` if not found.

[transfer none][nullable]

Since: 0.11.0

### as_component_add_content_rating ()

    void
    as_component_add_content_rating (AsComponent *cpt,
                                     AsContentRating *content_rating);

Adds a content rating to this component.

#### Parameters

cpt | a AsComponent instance. |
content_rating | a AsContentRating instance. |

Since: 0.11.0

### as_component_get_requires ()

    GPtrArray *
    as_component_get_requires (AsComponent *cpt);

Get an array of items that are required by this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

an array.

[transfer none][element-type AsRelation]

Since: 0.12.0

### as_component_get_recommends ()

    GPtrArray *
    as_component_get_recommends (AsComponent *cpt);

Get an array of items that are recommended by this component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

an array.

[transfer none][element-type AsRelation]

Since: 0.12.0

### as_component_get_supports ()

    GPtrArray *
    as_component_get_supports (AsComponent *cpt);

Get an array of items that are supported by this component, e.g. to indicate support for a specific piece of hardware.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

an array.

[transfer none][element-type AsRelation]

Since: 0.15.0

### as_component_add_relation ()

    void
    as_component_add_relation (AsComponent *cpt,
                               AsRelation *relation);

Adds a AsRelation to set a recommends or requires relation of component `cpt` on the item mentioned in the AsRelation.

#### Parameters

cpt | a AsComponent instance. |
relation | a AsRelation instance. |

Since: 0.12.0

### as_component_get_replaces ()

    GPtrArray *
    as_component_get_replaces (AsComponent *cpt);

Get a list of component IDs of components that this software replaces entirely.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

an array of component-IDs.

[transfer none][element-type utf8]

### as_component_add_replaces ()

    void
    as_component_add_replaces (AsComponent *cpt,
                               const gchar *cid);

Add the component ID of a component that gets replaced by the current component.

#### Parameters

cpt | a AsComponent instance. |
cid | an AppStream component ID |

### as_component_get_agreements ()

    GPtrArray *
    as_component_get_agreements (AsComponent *cpt);

Get a list of all agreements registered with this software component.

#### Parameters

cpt | an AsComponent instance. |

#### Returns

An array of AsAgreement.

[transfer none][element-type AsAgreement]

Since: 0.15.0

### as_component_add_agreement ()

    void
    as_component_add_agreement (AsComponent *cpt,
                                AsAgreement *agreement);

Adds an agreement to the software component.

#### Parameters

cpt | a AsComponent instance. |
agreement | an AsAgreement instance. |

Since: 0.12.1

### as_component_get_agreement_by_kind ()

    AsAgreement *
    as_component_get_agreement_by_kind (AsComponent *cpt,
                                        AsAgreementKind kind);

Gets an agreement the component has specified for the particular kind.

#### Parameters

cpt | a AsComponent instance. |
kind | an agreement kind, e.g. `AS_AGREEMENT_KIND_EULA` |

#### Returns

a AsAgreement or `NULL` for not found.

[transfer none][nullable]

Since: 0.12.1

### as_component_get_branding ()

    AsBranding *
    as_component_get_branding (AsComponent *cpt);

Get the branding associated with this component, or `NULL` in case this component has no special branding.

#### Parameters

cpt | an AsComponent instance. |

#### Returns

An AsBranding.

[transfer none][nullable]

Since: 0.15.2

### as_component_set_branding ()

    void
    as_component_set_branding (AsComponent *cpt,
                               AsBranding *branding);

Set branding for this component.

#### Parameters

cpt | a AsComponent instance. |
branding | an AsBranding instance. |

Since: 0.15.2

### as_component_clear_tags ()

    void
    as_component_clear_tags (AsComponent *cpt);

Remove all tags associated with this component.

#### Parameters

cpt | a AsComponent instance. |

Since: 0.15.0

### as_component_add_tag ()

    gboolean
    as_component_add_tag (AsComponent *cpt,
                          const gchar *ns,
                          const gchar *tag);

Add a tag to this component.

#### Parameters

cpt | a AsComponent instance. |
ns | The namespace the tag belongs to |
tag | The tag name |

#### Returns

`TRUE` if the tag was added.

Since: 0.15.0

### as_component_remove_tag ()

    gboolean
    as_component_remove_tag (AsComponent *cpt,
                             const gchar *ns,
                             const gchar *tag);

Remove a tag from this component

#### Parameters

cpt | a AsComponent instance. |
ns | The namespace the tag belongs to |
tag | The tag name |

#### Returns

`TRUE` if the tag was removed.

Since: 0.15.0

### as_component_has_tag ()

    gboolean
    as_component_has_tag (AsComponent *cpt,
                          const gchar *ns,
                          const gchar *tag);

Test if the component is tagged with the selected tag.

#### Parameters

cpt | a AsComponent instance. |
ns | The namespace the tag belongs to |
tag | The tag name |

#### Returns

`TRUE` if tag exists.

Since: 0.15.0

### as_component_get_name_variant_suffix ()

    const gchar *
    as_component_get_name_variant_suffix (AsComponent *cpt);

Get variant suffix for the component name (only to be displayed if two components have the same name).

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the variant suffix

Since: 0.12.10

### as_component_set_name_variant_suffix ()

    void
    as_component_set_name_variant_suffix (AsComponent *cpt,
                                          const gchar *value,
                                          const gchar *locale);

Set a variant suffix for the component name (only to be displayed if components have the same name).

#### Parameters

cpt | a AsComponent instance. |
value | the developer or developer team name |
locale | the BCP47 locale, or `NULL`. e.g. "en-GB". | [nullable]

Since: 0.12.10

### as_component_get_sort_score ()

    guint
    as_component_get_sort_score (AsComponent *cpt);

Returns the sorting priority of this component.

This will only return a valid value if this component was the result of or involved in a search operation which returned sorted results. In most cases you will not need to access this value explicitly, as all results of search operations in AppStream are already sorted from best match to worst.

The returned value is an arbitrary integer value, valid only for the search terms involved in the search operation that yielded this component as a result.

#### Parameters

cpt | a AsComponent instance. |

Since: 0.12.11

### as_component_set_sort_score ()

    void
    as_component_set_sort_score (AsComponent *cpt,
                                 guint score);

Sets the sorting score of this component.

#### Parameters

cpt | a AsComponent instance. |
score | the given sorting score |

Since: 0.9.8

### as_component_get_reviews ()

    GPtrArray *
    as_component_get_reviews (AsComponent *cpt);

Gets any reviews associated with the component.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

an array.

[element-type AsReview][transfer none]

Since: 0.14.0

### as_component_add_review ()

    void
    as_component_add_review (AsComponent *cpt,
                             AsReview *review);

Adds a user review to a software component.

#### Parameters

cpt | a AsComponent instance. |
review | a AsReview instance. |

Since: 0.14.0

### as_component_get_context ()

    AsContext *
    as_component_get_context (AsComponent *cpt);

Get the AsContext associated with this component. This function may return `NULL` if no context is set (which will be the case if the component was not loaded from a file or cache but constructed in memory).

#### Parameters

cpt | a AsComponent instance. |

#### Returns

the associated AsContext or `NULL`.

[transfer none][nullable]

Since: 0.11.2

### as_component_get_name_table ()

    GHashTable *
    as_component_get_name_table (AsComponent *cpt);

Get the internal locale to component name mapping table.

#### Parameters

cpt | an AsComponent instance. |

#### Returns

locale->names map.

[transfer none]

### as_component_get_summary_table ()

    GHashTable *
    as_component_get_summary_table (AsComponent *cpt);

Get the internal locale to component summary mapping table.

#### Parameters

cpt | an AsComponent instance. |

#### Returns

locale->summary map.

[transfer none]

### as_component_get_keywords_table ()

    GHashTable *
    as_component_get_keywords_table (AsComponent *cpt);

Retrieve the internal hash table mapping languages to keword arrays.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

Hash table locale->keyword arrays.

[transfer none]

### as_component_is_free ()

    gboolean
    as_component_is_free (AsComponent *cpt);

Returns `TRUE` if this component is free and open source software. To determine this status, this function will check if it comes from a vetted free-software-only source or whether its licenses are only free software licenses.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

`TRUE` if this component is free software.

Since: 0.15.5

### as_component_load_from_bytes ()

    gboolean
    as_component_load_from_bytes (AsComponent *cpt,
                                  AsContext *context,
                                  AsFormatKind format,
                                  GBytes *bytes,
                                  GError **error);

Load metadata for this component from an XML string. You normally do not want to use this method directly and instead use the more convenient API of AsMetadata to create and update components.

If this function returns `TRUE`, a valid component is returned unless the selected format was `AS_FORMAT_KIND_DESKTOP_ENTRY`, in which case a component ID will have to be set explicitly by the caller in order to make the component valid.

#### Parameters

cpt | an AsComponent instance. |
context | an AsContext instance. |
format | the format of the data to load, e.g. `AS_FORMAT_KIND_XML` |
bytes | the data to load. |
error | a GError. |

#### Returns

`TRUE` on success.

Since: 0.14.0

### as_component_to_xml_data ()

    gchar *
    as_component_to_xml_data (AsComponent *cpt,
                              AsContext *context,
                              GError **error);

Serialize this component into an XML string. You normally do not want to use this method directly and instead use the more convenient API of AsMetadata to serialize components.

#### Parameters

cpt | an AsComponent instance. |
context | an AsContext instance. |
error | a GError. |

#### Returns

`TRUE` on success.

Since: 0.12.10

### as_component_get_desktop_id ()

    const gchar *
    as_component_get_desktop_id (AsComponent *cpt);

###

`as_component_get_desktop_id` has been deprecated since version 0.11.0 and should not be used in newly-written code.

Replaced by AsLaunchable and `as_component_get_launchable`

Get the Desktop Entry ID for this component, if it is of type "desktop-application". For most desktop-application components, this is the name of the .desktop file.

Refer to https://specifications.freedesktop.org/desktop-entry-spec/latest/ape.html for more information.

#### Parameters

cpt | a AsComponent instance. |

#### Returns

The desktop file id.

Since: 0.9.8

### as_component_load_from_xml_data ()

    gboolean
    as_component_load_from_xml_data (AsComponent *cpt,
                                     AsContext *context,
                                     const gchar *data,
                                     GError **error);

###

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

Load metadata for this component from an XML string. You normally do not want to use this method directly and instead use the more convenient API of AsMetadata to create and update components.

#### Parameters

cpt | an AsComponent instance. |
context | an AsContext instance. |
data | The XML data to load. |
error | a GError. |

#### Returns

`TRUE` on success.

Since: 0.12.10

## Types and Values

### AS_TYPE_COMPONENT

    #define AS_TYPE_COMPONENT (as_component_get_type ())

### struct AsComponentClass

    struct AsComponentClass {
    	GObjectClass		parent_class;
    };

### enum AsComponentKind

The type of an AsComponent.

#### Members

AS_COMPONENT_KIND_UNKNOWN | Type invalid or not known |
AS_COMPONENT_KIND_GENERIC | A generic (= without specialized type) component |
AS_COMPONENT_KIND_DESKTOP_APP | An application with a .desktop-file |
AS_COMPONENT_KIND_CONSOLE_APP | A console application |
AS_COMPONENT_KIND_WEB_APP | A web application |
AS_COMPONENT_KIND_ADDON | An extension of existing software, which does not run standalone |
AS_COMPONENT_KIND_FONT | A font |
AS_COMPONENT_KIND_CODEC | A multimedia codec |
AS_COMPONENT_KIND_INPUT_METHOD | An input-method provider |
AS_COMPONENT_KIND_FIRMWARE | Firmware |
AS_COMPONENT_KIND_DRIVER | A driver |
AS_COMPONENT_KIND_LOCALIZATION | Software localization (usually l10n resources) |
AS_COMPONENT_KIND_SERVICE | A system service launched by the init system |
AS_COMPONENT_KIND_REPOSITORY | A remote software or data source |
AS_COMPONENT_KIND_OPERATING_SYSTEM | A computer operating system |
AS_COMPONENT_KIND_ICON_THEME | An icon theme following the XDG specification |
AS_COMPONENT_KIND_RUNTIME | An application runtime platform |

### AS_COMPONENT_KIND_INPUTMETHOD

    #define AS_COMPONENT_KIND_INPUTMETHOD AS_COMPONENT_KIND_INPUT_METHOD

### enum AsMergeKind

Defines how AsComponent data should be merged if the component is set for merge.

#### Members

AS_MERGE_KIND_NONE | No merge is happening. |
AS_MERGE_KIND_REPLACE | Merge replacing data of target. |
AS_MERGE_KIND_APPEND | Merge appending data to target. |
AS_MERGE_KIND_REMOVE_COMPONENT | Remove the entire component if it matches. |

### enum AsComponentScope

Scope of the AsComponent (system-wide or user-scope)

#### Members

AS_COMPONENT_SCOPE_UNKNOWN | Unknown scope |
AS_COMPONENT_SCOPE_SYSTEM | System scope |
AS_COMPONENT_SCOPE_USER | User scope |

### enum AsValueFlags

Set how values assigned to an AsComponent should be treated when they are set or retrieved.

#### Members

AS_VALUE_FLAG_NONE | No flags. |
AS_VALUE_FLAG_DUPLICATE_CHECK | Check for duplicates when adding items to list values. |
AS_VALUE_FLAG_NO_TRANSLATION_FALLBACK | Don't fall back to C when retrieving translated values. |

### enum AsSearchTokenMatch

The token match kind, which we want to be exactly 16 bits for storage reasons.

#### Members

AS_SEARCH_TOKEN_MATCH_NONE | No token matching |
AS_SEARCH_TOKEN_MATCH_MEDIATYPE | Use the component mediatypes |
AS_SEARCH_TOKEN_MATCH_PKGNAME | Use the component package name |
AS_SEARCH_TOKEN_MATCH_ORIGIN | Use the app origin |
AS_SEARCH_TOKEN_MATCH_DESCRIPTION | Use the component description |
AS_SEARCH_TOKEN_MATCH_SUMMARY |  |
AS_SEARCH_TOKEN_MATCH_KEYWORD | Use the component keyword |
AS_SEARCH_TOKEN_MATCH_NAME | Use the component name |
AS_SEARCH_TOKEN_MATCH_ID | Use the component ID |

### AS_SEARCH_TOKEN_MATCH_MIMETYPE

    #define AS_SEARCH_TOKEN_MATCH_MIMETYPE AS_SEARCH_TOKEN_MATCH_MEDIATYPE

### enum AsReleasesKind

The kind of a releases block.

#### Members

AS_RELEASES_KIND_UNKNOWN | Unknown releases type |
AS_RELEASES_KIND_EMBEDDED | Release info is embedded in metainfo file |
AS_RELEASES_KIND_EXTERNAL | Release info is split to a separate file |

Since: 0.16.0

### AsComponent

    typedef struct _AsComponent AsComponent;