ChatBoostSource class sealed

This object describes the source of a chat boost. It can be one of

  • ChatBoostSourcePremium
  • ChatBoostSourceGiftCode
  • ChatBoostSourceGiveaway
Available extensions
Annotations
  • @Freezed.new(unionKey: 'source', unionValueCase: FreezedUnionCase.snake)

Constructors

ChatBoostSource.fromJson(Map<String, dynamic> json)
factory
ChatBoostSource.giftCode({@JsonKey.new(name: 'source') @Default.new(ChatBoostSourceType.giftCode) ChatBoostSourceType source, @JsonKey.new(name: 'user') required User user})
The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
const
factory
ChatBoostSource.giveaway({@JsonKey.new(name: 'source') @Default.new(ChatBoostSourceType.giveaway) ChatBoostSourceType source, @JsonKey.new(name: 'giveaway_message_id') required int giveawayMessageId, @JsonKey.new(name: 'user') User? user, @JsonKey.new(name: 'prize_star_count') int? prizeStarCount, @JsonKey.new(name: 'is_unclaimed') bool? isUnclaimed})
The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways.
const
factory
ChatBoostSource.premium({@JsonKey.new(name: 'source') @Default.new(ChatBoostSourceType.premium) ChatBoostSourceType source, @JsonKey.new(name: 'user') required User user})
The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user.
const
factory

Properties

copyWith → $ChatBoostSourceCopyWith<ChatBoostSource>
Create a copy of ChatBoostSource with the given fields replaced by the non-null parameter values.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source ChatBoostSourceType
Source of the boost, always "premium"
no setterinherited
user User?
User that boosted the chat
no setterinherited

Methods

map<TResult extends Object?>({required TResult premium(ChatBoostSourcePremium value), required TResult giftCode(ChatBoostSourceGiftCode value), required TResult giveaway(ChatBoostSourceGiveaway value)}) → TResult

Available on ChatBoostSource, provided by the ChatBoostSourcePatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? premium(ChatBoostSourcePremium value)?, TResult? giftCode(ChatBoostSourceGiftCode value)?, TResult? giveaway(ChatBoostSourceGiveaway value)?}) → TResult?

Available on ChatBoostSource, provided by the ChatBoostSourcePatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult premium(ChatBoostSourcePremium value)?, TResult giftCode(ChatBoostSourceGiftCode value)?, TResult giveaway(ChatBoostSourceGiveaway value)?, required TResult orElse()}) → TResult

Available on ChatBoostSource, provided by the ChatBoostSourcePatterns 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 ChatBoostSource to a JSON map.
inherited
toString() String
A string representation of this object.
inherited

Operators

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