TransactionPartner.user constructor

  1. @Assert('type == TransactionPartnerType.user', 'type must be TransactionPartnerType.user')
const TransactionPartner.user({
  1. @JsonKey(name: 'type') @Default(TransactionPartnerType.user) TransactionPartnerType type,
  2. @JsonKey(name: 'user') required User user,
  3. @JsonKey(name: 'invoice_payload') String? invoicePayload,
  4. @JsonKey(name: 'paid_media') List<PaidMedia>? paidMedia,
  5. @JsonKey(name: 'paid_media_payload') String? paidMediaPayload,
  6. @JsonKey(name: 'subscription_period') int? subscriptionPeriod,
  7. @JsonKey(name: 'gift') Gift? gift,
  8. @JsonKey(name: 'affiliate') AffiliateInfo? affiliate,
})

Represents a transaction with a user

Implementation

@Assert(
  'type == TransactionPartnerType.user',
  'type must be TransactionPartnerType.user',
)
const factory TransactionPartner.user({
  /// Type of the transaction partner, must be "user"
  @JsonKey(name: 'type')
  @Default(TransactionPartnerType.user)
  TransactionPartnerType type,

  /// Information about the user.
  @JsonKey(name: 'user') required final User user,

  /// Bot-specified invoice payload.
  @JsonKey(name: 'invoice_payload') final String? invoicePayload,

  /// Optional. Information about the paid media bought by the user
  @JsonKey(name: 'paid_media') final List<PaidMedia>? paidMedia,

  /// Optional. Bot-specified paid media payload
  @JsonKey(name: 'paid_media_payload') final String? paidMediaPayload,

  /// Optional. The duration of the paid subscription.
  @JsonKey(name: 'subscription_period') final int? subscriptionPeriod,

  /// Optional. The gift sent to the user by the bot.
  @JsonKey(name: 'gift') final Gift? gift,

  /// Optional. Information about the affiliate that received a commission via
  /// this transaction
  @JsonKey(name: 'affiliate') final AffiliateInfo? affiliate,
}) = TransactionPartnerUser;