return deserialize(arr.to_json).as(Array[Issue])
end
- # Get the last published issue.
- fun get_repo_last_issue(repo: Repo): nullable Issue do
- var array = get("/repos/{repo.full_name}/issues")
- if not array isa JsonArray then return null
- if array.is_empty then return null
- var obj = array.first
- if not obj isa JsonObject then return null
- return deserialize(obj.to_json).as(nullable Issue)
- end
-
# List of labels associated with their names.
fun get_repo_labels(repo: Repo, page, per_page: nullable Int): Array[Label] do
return new GithubArray[Label].from(get(
fun get_issues(job: LoaderJob) do
if config.no_issues then return
- var i = job.last_issue
- var last_issue = get_last_issue(job)
- if last_issue != null then
- while i <= last_issue.number do
- get_issue(job, i)
- job.last_issue = i
+ var api = config.wallet.api
+ var page = 1
+ var issues = api.get_repo_issues(job.repo.full_name, page, 100)
+ while issues.not_empty do
+ for issue in issues do
+ get_issue(job, issue.number)
+ job.last_issue = issue.number
jobs.save job
- i += 1
end
end
end
- # Load the `repo` last issue or abort.
- private fun get_last_issue(job: LoaderJob): nullable Issue do
- var api = config.wallet.api
- return api.get_repo_last_issue(job.repo)
- end
-
# Load an issue or abort.
private fun get_issue(job: LoaderJob, issue_number: Int) do
if issues.find_by_id("{job.repo.mongo_id}/{issue_number}") != null then return