git-touch-android-ios-app/lib/models/bitbucket.dart

156 lines
3.9 KiB
Dart
Raw Normal View History

2020-02-02 07:08:58 +01:00
import 'package:json_annotation/json_annotation.dart';
part 'bitbucket.g.dart';
2020-02-02 09:40:12 +01:00
@JsonSerializable(fieldRename: FieldRename.snake)
class BbPagination {
2021-05-16 09:16:35 +02:00
int? pagelen;
int? size;
int? page;
String? next;
List? values;
2020-02-02 09:40:12 +01:00
BbPagination();
factory BbPagination.fromJson(Map<String, dynamic> json) =>
_$BbPaginationFromJson(json);
}
2020-02-02 07:08:58 +01:00
@JsonSerializable(fieldRename: FieldRename.snake)
2020-02-02 11:58:05 +01:00
class BbRepoOwner {
2021-05-16 09:16:35 +02:00
String? nickname;
String? displayName;
String? type; // user, team
Map<String, dynamic>? links;
String? get avatarUrl => links!['avatar']['href'];
2020-02-02 11:58:05 +01:00
BbRepoOwner();
factory BbRepoOwner.fromJson(Map<String, dynamic> json) =>
_$BbRepoOwnerFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbUser extends BbRepoOwner {
2021-05-16 09:16:35 +02:00
String? username;
bool? isStaff;
DateTime? createdOn;
String? accountId;
2020-02-02 07:08:58 +01:00
BbUser();
factory BbUser.fromJson(Map<String, dynamic> json) => _$BbUserFromJson(json);
}
2020-02-02 09:40:12 +01:00
@JsonSerializable(fieldRename: FieldRename.snake)
class BbRepo {
2021-05-16 09:16:35 +02:00
String? name;
BbRepoOwner? owner;
String? website;
String? language;
int? size;
String? type; // repository
bool? isPrivate;
DateTime? createdOn;
DateTime? updatedOn;
String? description;
String? fullName;
String? slug;
BbRepoMainbranch? mainbranch;
Map<String, dynamic>? links;
String get ownerLogin => fullName!.split('/')[0]; // owner has no username
String? get avatarUrl => links!['avatar']['href'];
2020-02-02 09:40:12 +01:00
BbRepo();
factory BbRepo.fromJson(Map<String, dynamic> json) => _$BbRepoFromJson(json);
}
2020-02-02 11:58:05 +01:00
@JsonSerializable(fieldRename: FieldRename.snake)
class BbRepoMainbranch {
2021-05-16 09:16:35 +02:00
String? type;
String? name;
2020-02-02 11:58:05 +01:00
BbRepoMainbranch();
factory BbRepoMainbranch.fromJson(Map<String, dynamic> json) =>
_$BbRepoMainbranchFromJson(json);
}
2020-02-02 12:50:00 +01:00
@JsonSerializable(fieldRename: FieldRename.snake)
class BbTree {
2021-05-16 09:16:35 +02:00
String? type;
String? path;
int? size;
Map<String, dynamic>? links;
2020-02-02 12:50:00 +01:00
BbTree();
factory BbTree.fromJson(Map<String, dynamic> json) => _$BbTreeFromJson(json);
}
2020-02-03 07:40:56 +01:00
@JsonSerializable(fieldRename: FieldRename.snake)
class BbCommit {
2021-05-16 09:16:35 +02:00
String? message;
DateTime? date;
String? hash;
BbCommitAuthor? author;
2020-02-03 07:40:56 +01:00
BbCommit();
factory BbCommit.fromJson(Map<String, dynamic> json) =>
_$BbCommitFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbCommitAuthor {
2021-05-16 09:16:35 +02:00
String? raw;
BbRepoOwner? user;
2020-02-03 07:40:56 +01:00
BbCommitAuthor();
factory BbCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$BbCommitAuthorFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbIssues {
2021-05-16 09:16:35 +02:00
String? priority;
String? state;
BbRepo? repository;
String? title;
BbRepoOwner? reporter;
DateTime? createdOn;
Map<String, dynamic>? links;
String? get issueLink => links!['self']['href'];
BbIssues();
factory BbIssues.fromJson(Map<String, dynamic> json) =>
_$BbIssuesFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbPulls {
2021-05-16 09:16:35 +02:00
String? description;
BbRepoOwner? author;
String? title;
Map<String, dynamic>? links;
String? get pullRequestLink => links!['self']['href'];
DateTime? createdOn;
BbPulls();
factory BbPulls.fromJson(Map<String, dynamic> json) =>
_$BbPullsFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbCommentContent {
2021-05-16 09:16:35 +02:00
String? raw;
String? markup;
String? html;
BbCommentContent();
factory BbCommentContent.fromJson(Map<String, dynamic> json) =>
_$BbCommentContentFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbComment {
2021-05-16 09:16:35 +02:00
String? createdOn;
String? updatedOn;
BbCommentContent? content;
BbRepoOwner? user;
BbComment();
factory BbComment.fromJson(Map<String, dynamic> json) =>
_$BbCommentFromJson(json);
}
@JsonSerializable(fieldRename: FieldRename.snake)
class BbBranch {
2021-05-16 09:16:35 +02:00
String? name;
String? type;
BbBranch();
factory BbBranch.fromJson(Map<String, dynamic> json) =>
_$BbBranchFromJson(json);
}