fix: Add changes left behind

This commit is contained in:
Alberto Ponces 2022-09-07 02:41:02 +01:00
parent a3c29cbfa2
commit d8b8664cc1

View File

@ -16,10 +16,10 @@ class GithubAPI {
'com.garzotto.pflotsh.ecmwf_a': 'ecmwf', 'com.garzotto.pflotsh.ecmwf_a': 'ecmwf',
}; };
Future<String?> latestReleaseVersion(String org, String repoName) async { Future<String?> latestReleaseVersion(String repoName) async {
try { try {
var latestRelease = await _github.repositories.getLatestRelease( var latestRelease = await _github.repositories.getLatestRelease(
RepositorySlug(org, repoName), RepositorySlug.full(repoName),
); );
return latestRelease.tagName; return latestRelease.tagName;
} on Exception { } on Exception {
@ -27,14 +27,10 @@ class GithubAPI {
} }
} }
Future<File?> latestReleaseFile( Future<File?> latestReleaseFile(String extension, String repoName) async {
String extension,
String org,
String repoName,
) async {
try { try {
var latestRelease = await _github.repositories.getLatestRelease( var latestRelease = await _github.repositories.getLatestRelease(
RepositorySlug(org, repoName), RepositorySlug.full(repoName),
); );
String? url = latestRelease.assets String? url = latestRelease.assets
?.firstWhere((asset) => ?.firstWhere((asset) =>
@ -52,10 +48,10 @@ class GithubAPI {
return null; return null;
} }
Future<String> latestCommitTime(String org, String repoName) async { Future<String> latestCommitTime(String repoName) async {
try { try {
var repo = await _github.repositories.getRepository( var repo = await _github.repositories.getRepository(
RepositorySlug(org, repoName), RepositorySlug.full(repoName),
); );
return repo.pushedAt != null return repo.pushedAt != null
? format(repo.pushedAt!, locale: 'en_short') ? format(repo.pushedAt!, locale: 'en_short')
@ -65,15 +61,14 @@ class GithubAPI {
} }
} }
Future<List<Contributor>> getContributors(String org, String repoName) async { Future<List<Contributor>> getContributors(String repoName) async {
return await (_github.repositories.listContributors( return await (_github.repositories.listContributors(
RepositorySlug(org, repoName), RepositorySlug.full(repoName),
)).toList(); )).toList();
} }
Future<List<RepositoryCommit>> getCommits( Future<List<RepositoryCommit>> getCommits(
String packageName, String packageName,
String org,
String repoName, String repoName,
) async { ) async {
String path = String path =
@ -81,7 +76,7 @@ class GithubAPI {
return await (PaginationHelper(_github) return await (PaginationHelper(_github)
.objects<Map<String, dynamic>, RepositoryCommit>( .objects<Map<String, dynamic>, RepositoryCommit>(
'GET', 'GET',
'/repos/$org/$repoName/commits', '/repos/$repoName/commits',
(i) => RepositoryCommit.fromJson(i), (i) => RepositoryCommit.fromJson(i),
params: <String, dynamic>{'path': path}, params: <String, dynamic>{'path': path},
)).toList(); )).toList();