Gjsify LogoGjsify Logo

Index

Enumerations

Classes

Interfaces

Variables

Functions

Variables

IMAGE_LARGE_HEIGHT: number
IMAGE_LARGE_WIDTH: number
IMAGE_NORMAL_HEIGHT: number
IMAGE_NORMAL_WIDTH: number
IMAGE_THUMBNAIL_HEIGHT: number
IMAGE_THUMBNAIL_WIDTH: number
MAJOR_VERSION: number
MICRO_VERSION: number
MINOR_VERSION: number

Functions

  • Format age as a human-readable string in the given rating system. This is the way to present system-specific strings in a UI.

    Parameters

    Returns string | null

  • Determine the most appropriate #AsContentRatingSystem for the given locale. Content rating systems are selected by territory. If no content rating system seems suitable, %AS_CONTENT_RATING_SYSTEM_IARC is returned.

    Parameters

    • locale: string

      a locale, in the format described in man 3 setlocale

    Returns AppStream.ContentRatingSystem

  • Get an array of all the possible return values of as_content_rating_system_format_age() for the given system. The array is sorted with youngest CSM age first.

    Parameters

    Returns string[]

  • getAppstreamVersion(): string
  • Get the version of the AppStream library that is currently used as a string.

    Returns string

  • getCurrentDistroComponentId(): string
  • Returns the component-ID of the current distribution based on contents of the /etc/os-release file. This function is a shorthand for %as_distro_details_get_cid

    Returns string

  • Get a list of the default Freedesktop and AppStream categories that software components (especially GUI applications) can be sorted into in software centers.

    Parameters

    • withSpecial: boolean

      Include special categories (e.g. "addons", and "all"/"featured" in submenus)

    Returns AppStream.Category[]

  • getLicenseUrl(license: string): string
  • Get a web URL to the license text and more license information for an SPDX license identifier.

    Parameters

    • license: string

      The SPDX license ID.

    Returns string

  • gstringReplace(string: GLib.String, find: string, replace: string): number
  • Replaces all occurences of find with the string replace in a #GString.

    Parameters

    • string: GLib.String

      a #GString

    • find: string

      the string to find in string

    • replace: string

      the string to insert in place of find

    Returns number

  • gstringReplace2(string: GLib.String, find: string, replace: string, limit: number): number
  • Replaces the string find with the string replace in a #GString up to limit times. If the number of instances of find in the #GString is less than limit, all instances are replaced. If limit is 0, all instances of find are replaced.

    Parameters

    • string: GLib.String

      a #GString

    • find: string

      the string to find in string

    • replace: string

      the string to insert in place of find

    • limit: number

      the maximum instances of find to replace with replace, or 0 for no limit

    Returns number

  • isSpdxLicenseExceptionId(exceptionId: string): boolean
  • Searches the known list of SPDX license exception IDs.

    Parameters

    • exceptionId: string

      a single SPDX license exception ID, e.g. "GCC-exception-3.1"

    Returns boolean

  • isSpdxLicenseExpression(license: string): boolean
  • Checks the licence string to check it being a valid licence. NOTE: SPDX licenses can't typically contain brackets.

    Parameters

    • license: string

      a SPDX license string, e.g. "CC-BY-3.0 and GFDL-1.3"

    Returns boolean

  • isSpdxLicenseId(licenseId: string): boolean
  • Searches the known list of SPDX license IDs.

    Parameters

    • licenseId: string

      a single SPDX license ID, e.g. "GPL-3.0"

    Returns boolean

  • issueKindFromString(kindStr: string): IssueKind
  • licenseIsFreeLicense(license: string): boolean
  • Check if the given license is for free-as-in-freedom software. A free software license is either approved by the Free Software Foundation or the Open Source Initiative.

    This function does not yet handle complex license expressions with AND and OR. If the expression contains any of these, it will still simply check if all mentioned licenses are Free licenses. Currently, any license exception recognized by SPDX is assumed to not impact the free-ness status of a software component.

    Please note that this function does not give any legal advice. Please read the license texts to learn more about the individual licenses and their conditions.

    Parameters

    • license: string

      The SPDX license string to test.

    Returns boolean

  • licenseIsMetadataLicense(license: string): boolean
  • Check if the metadata license is suitable for mixing with other metadata and redistributing the bundled result (this means we prefer permissive licenses here, to not require people shipping catalog metadata to perform a full license review).

    This method checks against a hardcoded list of permissive licenses commonly used to license metadata under.

    Parameters

    • license: string

      The SPDX license string to test.

    Returns boolean

  • licenseIsMetadataLicenseId(licenseId: string): boolean
  • Tests license ID against the vetted list of licenses that can be used for metainfo metadata. This function will not work for license expressions, if you need to test an SPDX license expression for compliance, please use %as_license_is_metadata_license insread.

    Parameters

    • licenseId: string

      a single SPDX license ID, e.g. "FSFAP"

    Returns boolean

  • licenseToSpdxId(license: string): string
  • Converts a non-SPDX license into an SPDX format string where possible.

    Parameters

    • license: string

      a not-quite SPDX license string, e.g. "GPLv3+"

    Returns string

  • markupConvertSimple(markup: string): string
  • markupStrsplitWords(text: string, lineLen: number): string[]
  • Splits up a long line into an array of smaller strings, each being no longer than line_len. Words are not split.

    Parameters

    • text: string

      the text to split.

    • lineLen: number

      the maximum length of the output line

    Returns string[]

  • mergeKindFromString(kindStr: string): MergeKind
  • metadataErrorQuark(): Quark
  • Converts the enumerated value to a localized text representation, using the plural forms (e.g. "Libraries" instead of "Library").

    This can be useful when displaying provided items in GUI dialogs.

    Parameters

    Returns string

  • Converts the enumerated value to an text representation. The enum is converted into a two-letter identifier ("eq", "ge", etc.) for use in the XML representation.

    Parameters

    Returns string

  • Converts the enumerated value to an text representation. The enum is converted into an identifier consisting of two mathematical comparison operators ("==", ">=", etc.) for use in the YAML representation and user interfaces.

    Parameters

    Returns string

  • spdxLicenseDetokenize(licenseTokens: string): string | null
  • De-tokenizes the SPDX licenses into a string.

    Parameters

    • licenseTokens: string

      license tokens, typically from as_spdx_license_tokenize()

    Returns string | null

  • spdxLicenseTokenize(license: string): string[] | null
  • Tokenizes the SPDX license string (or any simarly formatted string) into parts. Any license parts of the string e.g. "LGPL-2.0+" are prefexed with "", the conjunctive replaced with "&", the disjunctive replaced with "|" and the WITH operator for license exceptions replaced with "^". Brackets are added as indervidual tokens and other strings are appended into single tokens where possible.

    Parameters

    • license: string

      a license string, e.g. "LGPLv2+ and (QPL or GPLv2) and MIT"

    Returns string[] | null

  • Builds an identifier string unique to the individual dataset using the supplied information.

    Parameters

    • scope: ComponentScope

      Scope of the metadata as #AsComponentScope e.g. %AS_COMPONENT_SCOPE_SYSTEM

    • bundleKind: AppStream.BundleKind

      Bundling system providing this data, e.g. 'package' or 'flatpak'

    • origin: string

      Origin string, e.g. 'os' or 'gnome-apps-nightly'

    • cid: string

      AppStream component ID, e.g. 'org.freedesktop.appstream.cli'

    • branch: string

      Branch, e.g. '3-20' or 'master'

    Returns string

  • utilsCompareVersions(a: string, b: string): number
  • Compare alpha and numeric segments of two versions. The version compare algorithm is also used by RPM.

    Parameters

    • a: string
    • b: string

    Returns number

  • utilsDataIdEqual(dataId1: string, dataId2: string): boolean
  • Checks two component data IDs for equality allowing globs to match.

    Parameters

    • dataId1: string

      a data ID

    • dataId2: string

      another data ID

    Returns boolean

  • utilsDataIdGetCid(dataId: string): string
  • Get the component-id part of the data-id.

    Parameters

    • dataId: string

      The data-id.

    Returns string

  • utilsDataIdHash(dataId: string): number
  • Converts a data-id to a hash value.

    This function implements the widely used DJB hash on the ID subset of the data-id string.

    It can be passed to g_hash_table_new() as the hash_func parameter, when using non-NULL strings or unique_ids as keys in a GHashTable.

    Parameters

    • dataId: string

      a data ID

    Returns number

  • utilsDataIdMatch(dataId1: string, dataId2: string, matchFlags: DataIdMatchFlags): boolean
  • Checks two data IDs for equality allowing globs to match, whilst also allowing clients to whitelist sections that have to match.

    Parameters

    • dataId1: string

      a data ID

    • dataId2: string

      another data ID

    • matchFlags: DataIdMatchFlags

      a #AsDataIdMatchFlags bitfield, e.g. %AS_DATA_ID_MATCH_FLAG_ID

    Returns boolean

  • utilsDataIdValid(dataId: string): boolean
  • Checks if a data ID is valid i.e. has the correct number of sections.

    Parameters

    • dataId: string

      a component data ID

    Returns boolean

  • utilsInstallMetadataFile(location: MetadataLocation, filename: string, origin: string, destdir: string): boolean
  • Installs an AppStream MetaInfo, AppStream Metadata Collection or AppStream Icon tarball file to the right place on the filesystem. Please note that this function does almost no validation and may guess missing values such as icon sizes and origin names. Ensure your metadata is good before installing it.

    Parameters

    • location: MetadataLocation

      the #AsMetadataLocation, e.g. %AS_METADATA_LOCATION_CACHE

    • filename: string

      the full path of the file to install

    • origin: string

      the origin to use for the installation, or %NULL

    • destdir: string

      the destdir to use, or %NULL

    Returns boolean

  • utilsIsCategoryName(categoryName: string): boolean
  • utilsIsDesktopEnvironment(desktop: string): boolean
  • Searches the known list of desktop environments AppStream knows about.

    Parameters

    • desktop: string

      a desktop environment id.

    Returns boolean

  • utilsIsPlatformTriplet(triplet: string): boolean
  • Test if the given string is a valid platform triplet recognized by AppStream.

    Parameters

    • triplet: string

      a platform triplet.

    Returns boolean

  • utilsIsTld(tld: string): boolean
  • Searches the known list of TLDs we allow for AppStream IDs. This excludes internationalized names.

    Parameters

    • tld: string

      a top-level domain without dot, e.g. "de", "org", "name"

    Returns boolean

  • utilsLocaleIsCompatible(locale1: string, locale2: string): boolean
  • Calculates if one locale is compatible with another. When doing the calculation the locale and language code is taken into account if possible.

    Parameters

    • locale1: string

      a locale string, or %NULL

    • locale2: string

      a locale string, or %NULL

    Returns boolean

  • Sorts all components in cpts into the #AsCategory categories listed in categories.

    Parameters

    • cpts: AppStream.Component[]

      List of components.

    • categories: AppStream.Category[]

      List of categories to sort components into.

    • checkDuplicates: boolean

      Whether to check for duplicates.

    Returns void

  • vercmp(a: string, b: string, flags: VercmpFlags): number
  • Compare alpha and numeric segments of two software versions, considering flags.

    Parameters

    • a: string

      First version number

    • b: string

      Second version number

    • flags: VercmpFlags

      Flags, e.g. %AS_VERCMP_FLAG_NONE

    Returns number

  • vercmpSimple(a: string, b: string): number
  • Compare alpha and numeric segments of two software versions.

    Parameters

    • a: string

      First version number

    • b: string

      Second version number

    Returns number

  • versionString(): string
  • Get the version of the AppStream library that is currently used at runtime as a string.

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method