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
Available extensions
Annotations
  • @Freezed.new(unionKey: 'type', unionValueCase: FreezedUnionCase.snake)

Constructors

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

map<TResult extends Object?>({required TResult regular(OwnedGiftRegular value), required TResult unique(OwnedGiftUnique value)}) → TResult

Available on OwnedGift, provided by the OwnedGiftPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? regular(OwnedGiftRegular value)?, TResult? unique(OwnedGiftUnique value)?}) → TResult?

Available on OwnedGift, provided by the OwnedGiftPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult regular(OwnedGiftRegular value)?, TResult unique(OwnedGiftUnique value)?, required TResult orElse()}) → TResult

Available on OwnedGift, provided by the OwnedGiftPatterns extension

A variant of map that fallback to returning orElse.
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