OwnedGift class sealed

This object describes a gift received and owned by a user or a chat. Currently, it can be one of

  • OwnedGiftRegular
  • OwnedGiftUnique
Annotations
  • @Freezed(unionKey: 'type', unionValueCase: FreezedUnionCase.snake)

Constructors

OwnedGift.fromJson(Map<String, dynamic> json)
Creates an instance of OwnedGift from JSON data
factory
OwnedGift.regular({@JsonKey(name: 'type') @Default(OwnedGiftType.regular) OwnedGiftType type, @JsonKey(name: 'gift') required Gift gift, @JsonKey(name: 'owned_gift_id') String? ownedGiftId, @JsonKey(name: 'sender_user') User? senderUser, @JsonKey(name: 'send_date') required int sendDate, @JsonKey(name: 'text') String? text, @JsonKey(name: 'entities') List<MessageEntity>? entities, @JsonKey(name: 'is_private') bool? isPrivate, @JsonKey(name: 'is_saved') bool? isSaved, @JsonKey(name: 'can_be_upgraded') bool? canBeUpgraded, @JsonKey(name: 'was_refunded') bool? wasRefunded, @JsonKey(name: 'convert_star_count') int? convertStarCount, @JsonKey(name: 'prepaid_upgrade_star_count') int? prepaidUpgradeStarCount})
Describes a regular gift owned by a user or a chat.
const
factory
OwnedGift.unique({@JsonKey(name: 'type') @Default(OwnedGiftType.unique) OwnedGiftType type, @JsonKey(name: 'gift') required UniqueGift gift, @JsonKey(name: 'owned_gift_id') String? ownedGiftId, @JsonKey(name: 'sender_user') User? senderUser, @JsonKey(name: 'send_date') required int sendDate, @JsonKey(name: 'is_saved') bool? isSaved, @JsonKey(name: 'can_be_transferred') bool? canBeTransferred, @JsonKey(name: 'transfer_star_count') int? transferStarCount})
Describes a unique gift received and owned by a user or a chat.
const
factory

Properties

copyWith → $OwnedGiftCopyWith<OwnedGift>
Create a copy of OwnedGift with the given fields replaced by the non-null parameter values.
no setterinherited
gift Object
Information about the regular gift
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isSaved bool?
Optional. True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only
no setterinherited
ownedGiftId String?
Optional. Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sendDate int
Date the gift was sent in Unix time
no setterinherited
senderUser User?
Optional. Sender of the gift if it is a known user
no setterinherited
type OwnedGiftType
Type of the gift, always "regular"
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this OwnedGift to a JSON map.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited