Class GameVersions

java.lang.Object
net.darkhax.curseforgegradle.api.versions.GameVersions

public final class GameVersions extends Object
Instances of this class are used to query the CurseForge API for valid game versions. Each instance represents a specific game API and is specific to the project and task that instantiated it.
  • Constructor Details

    • GameVersions

      public GameVersions(String endpoint, String projectName, String taskName)
      Users should not be constructing this themselves. Each instance of this class should be unique to the task that spawned it.
      Parameters:
      endpoint - The base URL for the API.
      projectName - The name of the project uploading a file. This is used for debug logging.
      taskName - The name of the task uploading a file. This is used for debug logging.
  • Method Details

    • refresh

      public void refresh(String apiToken)
      Discards the current version data and refreshes it with new data from the API.
      Parameters:
      apiToken - The CurseForge API token required to retrieve game version data.
    • getVersion

      public Version getVersion(String versionString)
      Gets a Version by it's name or slug. The version name takes priority over the version slug when matching. Matches made by this method are case sensitive!
      Parameters:
      versionString - The version to lookup.
      Returns:
      The game version that was found. A null value indicates that the version is likely invalid.
    • resolveVersions

      public Set<Long> resolveVersions(Set<String> toResolve)
      Resolves a set of version names/slugs into their CurseForge API Ids. If a given version candidate is not valid an exception will be raised.
      Parameters:
      toResolve - The set of version names and slugs to resolve.
      Returns:
      A set of CurseForge API Ids for the valid version candidates.