mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-31 13:00:14 +02:00
Lint all files
This commit is contained in:
@@ -14,11 +14,15 @@ class GitHubStars implements MassAppUrlSource {
|
||||
late List<String> requiredArgs = [tr('uname')];
|
||||
|
||||
Future<Map<String, List<String>>> getOnePageOfUserStarredUrlsWithDescriptions(
|
||||
String username, int page) async {
|
||||
String username,
|
||||
int page,
|
||||
) async {
|
||||
Response res = await get(
|
||||
Uri.parse(
|
||||
'https://api.github.com/users/$username/starred?per_page=100&page=$page'),
|
||||
headers: await GitHub().getRequestHeaders({}));
|
||||
Uri.parse(
|
||||
'https://api.github.com/users/$username/starred?per_page=100&page=$page',
|
||||
),
|
||||
headers: await GitHub().getRequestHeaders({}),
|
||||
);
|
||||
if (res.statusCode == 200) {
|
||||
Map<String, List<String>> urlsWithDescriptions = {};
|
||||
for (var e in (jsonDecode(res.body) as List<dynamic>)) {
|
||||
@@ -27,8 +31,8 @@ class GitHubStars implements MassAppUrlSource {
|
||||
e['full_name'] as String,
|
||||
e['description'] != null
|
||||
? e['description'] as String
|
||||
: tr('noDescription')
|
||||
]
|
||||
: tr('noDescription'),
|
||||
],
|
||||
});
|
||||
}
|
||||
return urlsWithDescriptions;
|
||||
@@ -41,15 +45,18 @@ class GitHubStars implements MassAppUrlSource {
|
||||
|
||||
@override
|
||||
Future<Map<String, List<String>>> getUrlsWithDescriptions(
|
||||
List<String> args) async {
|
||||
List<String> args,
|
||||
) async {
|
||||
if (args.length != requiredArgs.length) {
|
||||
throw ObtainiumError(tr('wrongArgNum'));
|
||||
}
|
||||
Map<String, List<String>> urlsWithDescriptions = {};
|
||||
var page = 1;
|
||||
while (true) {
|
||||
var pageUrls =
|
||||
await getOnePageOfUserStarredUrlsWithDescriptions(args[0], page++);
|
||||
var pageUrls = await getOnePageOfUserStarredUrlsWithDescriptions(
|
||||
args[0],
|
||||
page++,
|
||||
);
|
||||
urlsWithDescriptions.addAll(pageUrls);
|
||||
if (pageUrls.length < 100) {
|
||||
break;
|
||||
|
Reference in New Issue
Block a user