feat(gitee): watch, star a repo (#157)

* feat(gitee): watch, star a repo

* fix: pass in props as Tuple

* feat: bitbucket branches

* fix: use class instead of map
This commit is contained in:
Shreyas Thirumalai
2021-01-11 20:01:54 +05:30
committed by GitHub
parent 2017014ffd
commit c75288ef97
6 changed files with 145 additions and 26 deletions

View File

@@ -337,7 +337,15 @@ class AuthModel with ChangeNotifier {
'${activeAccount.domain}/api/v5$p',
headers: headers,
);
break;
return;
}
case 'PUT':
{
await http.put(
'${activeAccount.domain}/api/v5$p',
headers: headers,
);
return;
}
case 'POST':
{
@@ -357,6 +365,12 @@ class AuthModel with ChangeNotifier {
);
break;
}
case 'NO CONTENT':
{
res = await http.get('${activeAccount.domain}/api/v5$p',
headers: headers);
return res;
}
default:
{
res = await http.get('${activeAccount.domain}/api/v5$p',
@@ -364,11 +378,8 @@ class AuthModel with ChangeNotifier {
break;
}
}
if (requestType != 'DELETE') {
final info = json.decode(utf8.decode(res.bodyBytes));
return info;
}
return;
final info = json.decode(utf8.decode(res.bodyBytes));
return info;
}
Future<DataWithPage> fetchGiteeWithPage(String path,

View File

@@ -144,3 +144,12 @@ class BbComment {
factory BbComment.fromJson(Map<String, dynamic> json) =>
_$BbCommentFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbBranch {
String name;
String type;
BbBranch();
factory BbBranch.fromJson(Map<String, dynamic> json) =>
_$BbBranchFromJson(json);
}

View File

@@ -247,3 +247,14 @@ Map<String, dynamic> _$BbCommentToJson(BbComment instance) => <String, dynamic>{
'content': instance.content,
'user': instance.user,
};
BbBranch _$BbBranchFromJson(Map<String, dynamic> json) {
return BbBranch()
..name = json['name'] as String
..type = json['type'] as String;
}
Map<String, dynamic> _$BbBranchToJson(BbBranch instance) => <String, dynamic>{
'name': instance.name,
'type': instance.type,
};