ChatBoostSource.fromJson constructor
Creates a ChatBoostSource
object from a JSON object.
Implementation
factory ChatBoostSource.fromJson(Map<String, dynamic> json) {
switch (json['type']) {
case 'premium':
return ChatBoostSourcePremium.fromJson(json);
case 'gift_code':
return ChatBoostSourceGiftCode.fromJson(json);
case 'giveaway':
return ChatBoostSourceGiveaway.fromJson(json);
default:
throw TeleverseException(
"Invalid value '${json['type']}' for ChatBoostSourceType.",
description:
'The given value does not match any ChatBoostSourceType.',
type: TeleverseExceptionType.invalidParameter,
);
}
}