Github

object Github

Utility managing Github access (except the link in WorldScreenCommunityPopup)

Singleton - RateLimit is shared app-wide and has local variables, and is not tested for thread safety. Therefore, additional effort is required should tryGetGithubReposWithTopic ever be called non-sequentially. download and downloadAndExtract should be thread-safe as they are self-contained. They do not join in the RateLimit handling because Github doc suggests each API has a separate limit (and I found none for cloning via a zip).

Types

RateLimit
Link copied to clipboard
object RateLimit

Implements the ability wo work with GitHub's rate limit, recognize blocks from previous attempts, wait and retry.

Repo
Link copied to clipboard
class Repo

Part of RepoSearch in Github API response - one repository entry in items

RepoOwner
Link copied to clipboard
class RepoOwner

Part of Repo in Github API response

RepoSearch
Link copied to clipboard
class RepoSearch

Parsed GitHub repo search response

Functions

download
Link copied to clipboard
fun download(url: String, action: (HttpURLConnection) -> Unit = {}): InputStream?

Helper opens am url and accesses its input stream, logging errors to the console

downloadAndExtract
Link copied to clipboard
fun downloadAndExtract(gitRepoUrl: String, defaultBranch: String, folderFileHandle: FileHandle): FileHandle?

Download a mod and extract, deleting any pre-existing version.

equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
renameOrMove
Link copied to clipboard
private fun FileHandle.renameOrMove(dest: FileHandle)
toString
Link copied to clipboard
open fun toString(): String
tryGetGithubReposWithTopic
Link copied to clipboard
fun tryGetGithubReposWithTopic(amountPerPage: Int, page: Int): Github.RepoSearch?

Query GitHub for repositories marked "unciv-mod"

Sources

jvm source
Link copied to clipboard