-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
128 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
part of 'models.dart'; | ||
|
||
/// This object represents a service message about a user boosting a chat. | ||
class ChatBoostAdded { | ||
/// Number of boosts added by the user | ||
final int boostCount; | ||
|
||
/// Chat Boost Added constructor | ||
const ChatBoostAdded({ | ||
required this.boostCount, | ||
}); | ||
|
||
/// Converts a ChatBoostAdded into a Map | ||
Map<String, dynamic> toJson() { | ||
return <String, dynamic>{ | ||
'boostCount': boostCount, | ||
}; | ||
} | ||
|
||
/// Create a ChatBoostAdded from a Map | ||
factory ChatBoostAdded.fromJson(Map<String, dynamic> map) { | ||
return ChatBoostAdded( | ||
boostCount: map['boostCount'] as int, | ||
); | ||
} | ||
|
||
@override | ||
String toString() => 'ChatBoostAdded(boostCount: $boostCount)'; | ||
|
||
@override | ||
bool operator ==(covariant ChatBoostAdded other) { | ||
if (identical(this, other)) return true; | ||
|
||
return other.boostCount == boostCount; | ||
} | ||
|
||
@override | ||
int get hashCode => boostCount.hashCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
part of 'models.dart'; | ||
|
||
/// This object represents a message about a forwarded story in the chat. Currently holds no information. | ||
/// This object represents a message about a forwarded story in the chat. | ||
class Story { | ||
/// Chat that posted the story | ||
final Chat chat; | ||
|
||
/// Unique identifier for the story in the chat | ||
final int id; | ||
|
||
/// Constructs an instance of Story. | ||
const Story(); | ||
const Story({ | ||
required this.chat, | ||
required this.id, | ||
}); | ||
|
||
/// Constructs an instance of Story from a JSON map. | ||
factory Story.fromJson(Map<String, dynamic> json) { | ||
return Story(); | ||
return Story( | ||
chat: Chat.fromJson(json['chat'] as Map<String, dynamic>), | ||
id: json['id'] as int, | ||
); | ||
} | ||
|
||
/// Returns JSON-encodeable map of this object. | ||
Map<String, dynamic> toJson() => <String, dynamic>{}; | ||
Map<String, dynamic> toJson() { | ||
return { | ||
'chat': chat.toJson(), | ||
'id': id, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters