diff --git a/src/Types/AcceptedGiftTypes.php b/src/Types/AcceptedGiftTypes.php new file mode 100644 index 00000000..45f9c80e --- /dev/null +++ b/src/Types/AcceptedGiftTypes.php @@ -0,0 +1,63 @@ + true, + 'limited_gifts' => true, + 'unique_gifts' => true, + 'premium_subscription' => true, + ]; + + protected $unlimitedGifts; + protected $limitedGifts; + protected $uniqueGifts; + protected $premiumSubscription; + + public function getUnlimitedGifts() + { + return $this->unlimitedGifts; + } + + public function setUnlimitedGifts($unlimitedGifts) + { + $this->unlimitedGifts = $unlimitedGifts; + } + + public function getLimitedGifts() + { + return $this->limitedGifts; + } + + public function setLimitedGifts($limitedGifts) + { + $this->limitedGifts = $limitedGifts; + } + + public function getUniqueGifts() + { + return $this->uniqueGifts; + } + + public function setUniqueGifts($uniqueGifts) + { + $this->uniqueGifts = $uniqueGifts; + } + + public function getPremiumSubscription() + { + return $this->premiumSubscription; + } + + public function setPremiumSubscription($premiumSubscription) + { + $this->premiumSubscription = $premiumSubscription; + } +} diff --git a/src/Types/ArrayOfGift.php b/src/Types/ArrayOfGift.php new file mode 100644 index 00000000..140827cc --- /dev/null +++ b/src/Types/ArrayOfGift.php @@ -0,0 +1,23 @@ + true]; + + /** + * @psalm-suppress LessSpecificReturnType,MoreSpecificReturnType + */ + public static function fromResponse($data) + { + self::validate($data); + switch ($data['type']) { + case 'default': + return BotCommandScopeDefault::fromResponse($data); + case 'all_private_chats': + return BotCommandScopeAllPrivateChats::fromResponse($data); + case 'all_group_chats': + return BotCommandScopeAllGroupChats::fromResponse($data); + case 'all_chat_administrators': + return BotCommandScopeAllChatAdministrators::fromResponse($data); + case 'chat': + return BotCommandScopeChat::fromResponse($data); + case 'chat_administrators': + return BotCommandScopeChatAdministrators::fromResponse($data); + case 'chat_member': + return BotCommandScopeChatMember::fromResponse($data); + default: + throw new InvalidArgumentException('Unknown bot command scope type: ' . $data['type']); + } + } + + protected $type; + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } +} diff --git a/src/Types/BotCommandScopeAllChatAdministrators.php b/src/Types/BotCommandScopeAllChatAdministrators.php new file mode 100644 index 00000000..295cacd5 --- /dev/null +++ b/src/Types/BotCommandScopeAllChatAdministrators.php @@ -0,0 +1,26 @@ + true + ]; + + protected $type = 'all_chat_administrators'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/BotCommandScopeAllGroupChats.php b/src/Types/BotCommandScopeAllGroupChats.php new file mode 100644 index 00000000..6792104d --- /dev/null +++ b/src/Types/BotCommandScopeAllGroupChats.php @@ -0,0 +1,26 @@ + true + ]; + + protected $type = 'all_group_chats'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/BotCommandScopeAllPrivateChats.php b/src/Types/BotCommandScopeAllPrivateChats.php new file mode 100644 index 00000000..decaa22e --- /dev/null +++ b/src/Types/BotCommandScopeAllPrivateChats.php @@ -0,0 +1,26 @@ + true + ]; + + protected $type = 'all_private_chats'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/BotCommandScopeChat.php b/src/Types/BotCommandScopeChat.php new file mode 100644 index 00000000..59224edd --- /dev/null +++ b/src/Types/BotCommandScopeChat.php @@ -0,0 +1,38 @@ + true, + 'chat_id' => true + ]; + + protected $type = 'chat'; + protected $chatId; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getChatId() + { + return $this->chatId; + } + + public function setChatId($chatId) + { + $this->chatId = $chatId; + } +} diff --git a/src/Types/BotCommandScopeChatAdministrators.php b/src/Types/BotCommandScopeChatAdministrators.php new file mode 100644 index 00000000..06290955 --- /dev/null +++ b/src/Types/BotCommandScopeChatAdministrators.php @@ -0,0 +1,38 @@ + true, + 'chat_id' => true + ]; + + protected $type = 'chat_administrators'; + protected $chatId; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getChatId() + { + return $this->chatId; + } + + public function setChatId($chatId) + { + $this->chatId = $chatId; + } +} diff --git a/src/Types/BotCommandScopeChatMember.php b/src/Types/BotCommandScopeChatMember.php new file mode 100644 index 00000000..0b19d9dd --- /dev/null +++ b/src/Types/BotCommandScopeChatMember.php @@ -0,0 +1,50 @@ + true, + 'chat_id' => true, + 'user_id' => true + ]; + + protected $type = 'chat_member'; + protected $chatId; + protected $userId; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getChatId() + { + return $this->chatId; + } + + public function setChatId($chatId) + { + $this->chatId = $chatId; + } + + public function getUserId() + { + return $this->userId; + } + + public function setUserId($userId) + { + $this->userId = $userId; + } +} diff --git a/src/Types/BotCommandScopeDefault.php b/src/Types/BotCommandScopeDefault.php new file mode 100644 index 00000000..7b4bff92 --- /dev/null +++ b/src/Types/BotCommandScopeDefault.php @@ -0,0 +1,26 @@ + true + ]; + + protected $type = 'default'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/BotName.php b/src/Types/BotName.php new file mode 100644 index 00000000..fcb2097d --- /dev/null +++ b/src/Types/BotName.php @@ -0,0 +1,31 @@ + true + ]; + + protected $name; + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } +} diff --git a/src/Types/BusinessBotRights.php b/src/Types/BusinessBotRights.php new file mode 100644 index 00000000..2b99992d --- /dev/null +++ b/src/Types/BusinessBotRights.php @@ -0,0 +1,55 @@ + true, + 'can_read_messages' => true, + 'can_delete_sent_messages' => true, + 'can_delete_all_messages' => true, + 'can_edit_name' => true, + 'can_edit_bio' => true, + 'can_edit_profile_photo' => true, + 'can_edit_username' => true, + 'can_change_gift_settings' => true, + 'can_view_gifts_and_stars' => true, + 'can_convert_gifts_to_stars' => true, + 'can_transfer_and_upgrade_gifts' => true, + 'can_transfer_stars' => true, + 'can_manage_stories' => true + ]; + + protected $canReply; + protected $canReadMessages; + protected $canDeleteSentMessages; + protected $canDeleteAllMessages; + protected $canEditName; + protected $canEditBio; + protected $canEditProfilePhoto; + protected $canEditUsername; + protected $canChangeGiftSettings; + protected $canViewGiftsAndStars; + protected $canConvertGiftsToStars; + protected $canTransferAndUpgradeGifts; + protected $canTransferStars; + protected $canManageStories; + + public function getCanReply() + { + return $this->canReply; + } + + public function setCanReply($value) + { + $this->canReply = $value; + } +} diff --git a/src/Types/CopyTextButton.php b/src/Types/CopyTextButton.php new file mode 100644 index 00000000..59c0db8f --- /dev/null +++ b/src/Types/CopyTextButton.php @@ -0,0 +1,31 @@ + true + ]; + + protected $text; + + public function getText() + { + return $this->text; + } + + public function setText($text) + { + $this->text = $text; + } +} diff --git a/src/Types/Gift.php b/src/Types/Gift.php new file mode 100644 index 00000000..032defa5 --- /dev/null +++ b/src/Types/Gift.php @@ -0,0 +1,91 @@ + true, + 'sticker' => Sticker::class, + 'star_count' => true, + 'upgrade_star_count' => true, + 'total_count' => true, + 'remaining_count' => true, + ]; + + protected $id; + protected $sticker; + protected $starCount; + protected $upgradeStarCount; + protected $totalCount; + protected $remainingCount; + + public function getId() + { + return $this->id; + } + + public function setId($id) + { + $this->id = $id; + } + + public function getSticker() + { + return $this->sticker; + } + + public function setSticker($sticker) + { + $this->sticker = $sticker; + } + + public function getStarCount() + { + return $this->starCount; + } + + public function setStarCount($starCount) + { + $this->starCount = $starCount; + } + + public function getUpgradeStarCount() + { + return $this->upgradeStarCount; + } + + public function setUpgradeStarCount($upgradeStarCount) + { + $this->upgradeStarCount = $upgradeStarCount; + } + + public function getTotalCount() + { + return $this->totalCount; + } + + public function setTotalCount($totalCount) + { + $this->totalCount = $totalCount; + } + + public function getRemainingCount() + { + return $this->remainingCount; + } + + public function setRemainingCount($remainingCount) + { + $this->remainingCount = $remainingCount; + } +} diff --git a/src/Types/GiftInfo.php b/src/Types/GiftInfo.php new file mode 100644 index 00000000..2b74bc5e --- /dev/null +++ b/src/Types/GiftInfo.php @@ -0,0 +1,111 @@ + Gift::class, + 'owned_gift_id' => true, + 'convert_star_count' => true, + 'prepaid_upgrade_star_count' => true, + 'can_be_upgraded' => true, + 'text' => true, + 'entities' => ArrayOfMessageEntity::class, + 'is_private' => true, + ]; + + protected $gift; + protected $ownedGiftId; + protected $convertStarCount; + protected $prepaidUpgradeStarCount; + protected $canBeUpgraded; + protected $text; + protected $entities; + protected $isPrivate; + + public function getGift() + { + return $this->gift; + } + + public function setGift($gift) + { + $this->gift = $gift; + } + + public function getOwnedGiftId() + { + return $this->ownedGiftId; + } + + public function setOwnedGiftId($ownedGiftId) + { + $this->ownedGiftId = $ownedGiftId; + } + + public function getConvertStarCount() + { + return $this->convertStarCount; + } + + public function setConvertStarCount($convertStarCount) + { + $this->convertStarCount = $convertStarCount; + } + + public function getPrepaidUpgradeStarCount() + { + return $this->prepaidUpgradeStarCount; + } + + public function setPrepaidUpgradeStarCount($prepaidUpgradeStarCount) + { + $this->prepaidUpgradeStarCount = $prepaidUpgradeStarCount; + } + + public function getCanBeUpgraded() + { + return $this->canBeUpgraded; + } + + public function setCanBeUpgraded($canBeUpgraded) + { + $this->canBeUpgraded = $canBeUpgraded; + } + + public function getText() + { + return $this->text; + } + + public function setText($text) + { + $this->text = $text; + } + + public function getEntities() + { + return $this->entities; + } + + public function setEntities($entities) + { + $this->entities = $entities; + } + + public function getIsPrivate() + { + return $this->isPrivate; + } + + public function setIsPrivate($isPrivate) + { + $this->isPrivate = $isPrivate; + } +} diff --git a/src/Types/Gifts.php b/src/Types/Gifts.php new file mode 100644 index 00000000..d1e2507c --- /dev/null +++ b/src/Types/Gifts.php @@ -0,0 +1,27 @@ + ArrayOfGift::class, + ]; + + protected $gifts; + + public function getGifts() + { + return $this->gifts; + } + + public function setGifts($gifts) + { + $this->gifts = $gifts; + } +} diff --git a/src/Types/InputFile.php b/src/Types/InputFile.php new file mode 100644 index 00000000..d7e14522 --- /dev/null +++ b/src/Types/InputFile.php @@ -0,0 +1,38 @@ + true + ]; + + protected $file; + + public function __construct($file = null) + { + if ($file !== null) { + $this->file = $file; + } + } + + public function getFile() + { + return $this->file; + } + + public function setFile($file) + { + $this->file = $file; + } +} diff --git a/src/Types/InputPaidMedia.php b/src/Types/InputPaidMedia.php new file mode 100644 index 00000000..1b83d0a0 --- /dev/null +++ b/src/Types/InputPaidMedia.php @@ -0,0 +1,63 @@ + true, + 'media' => true + ]; + + /** + * @psalm-suppress LessSpecificReturnType,MoreSpecificReturnType + */ + public static function fromResponse($data) + { + self::validate($data); + switch ($data['type']) { + case 'photo': + return InputPaidMediaPhoto::fromResponse($data); + case 'video': + return InputPaidMediaVideo::fromResponse($data); + default: + throw new InvalidArgumentException('Unknown input paid media type: ' . $data['type']); + } + } + + protected $type; + protected $media; + + public function __construct($media = null) + { + if ($media !== null) { + $this->media = $media; + } + } + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getMedia() + { + return $this->media; + } + + public function setMedia($media) + { + $this->media = $media; + } +} diff --git a/src/Types/InputPaidMediaPhoto.php b/src/Types/InputPaidMediaPhoto.php new file mode 100644 index 00000000..c4154aa8 --- /dev/null +++ b/src/Types/InputPaidMediaPhoto.php @@ -0,0 +1,27 @@ + true, + 'media' => true + ]; + + protected $type = 'photo'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/InputPaidMediaVideo.php b/src/Types/InputPaidMediaVideo.php new file mode 100644 index 00000000..63d182a5 --- /dev/null +++ b/src/Types/InputPaidMediaVideo.php @@ -0,0 +1,111 @@ + true, + 'media' => true, + 'thumbnail' => true, + 'cover' => true, + 'start_timestamp' => true, + 'width' => true, + 'height' => true, + 'duration' => true, + 'supports_streaming' => true + ]; + + protected $type = 'video'; + protected $thumbnail; + protected $cover; + protected $startTimestamp; + protected $width; + protected $height; + protected $duration; + protected $supportsStreaming; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getThumbnail() + { + return $this->thumbnail; + } + + public function setThumbnail($thumbnail) + { + $this->thumbnail = $thumbnail; + } + + public function getCover() + { + return $this->cover; + } + + public function setCover($cover) + { + $this->cover = $cover; + } + + public function getStartTimestamp() + { + return $this->startTimestamp; + } + + public function setStartTimestamp($start) + { + $this->startTimestamp = $start; + } + + public function getWidth() + { + return $this->width; + } + + public function setWidth($width) + { + $this->width = $width; + } + + public function getHeight() + { + return $this->height; + } + + public function setHeight($height) + { + $this->height = $height; + } + + public function getDuration() + { + return $this->duration; + } + + public function setDuration($duration) + { + $this->duration = $duration; + } + + public function getSupportsStreaming() + { + return $this->supportsStreaming; + } + + public function setSupportsStreaming($supports) + { + $this->supportsStreaming = $supports; + } +} diff --git a/src/Types/InputProfilePhoto.php b/src/Types/InputProfilePhoto.php new file mode 100644 index 00000000..686bd026 --- /dev/null +++ b/src/Types/InputProfilePhoto.php @@ -0,0 +1,62 @@ + true + ]; + + /** + * @psalm-suppress LessSpecificReturnType,MoreSpecificReturnType + */ + public static function fromResponse($data) + { + self::validate($data); + switch ($data['type']) { + case 'static': + return InputProfilePhotoStatic::fromResponse($data); + case 'animated': + return InputProfilePhotoAnimated::fromResponse($data); + default: + throw new InvalidArgumentException('Unknown input profile photo type: ' . $data['type']); + } + } + + protected $type; + protected $photo; + + public function __construct($photo = null) + { + if ($photo !== null) { + $this->photo = $photo; + } + } + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getPhoto() + { + return $this->photo; + } + + public function setPhoto($photo) + { + $this->photo = $photo; + } +} diff --git a/src/Types/InputProfilePhotoAnimated.php b/src/Types/InputProfilePhotoAnimated.php new file mode 100644 index 00000000..b5a27381 --- /dev/null +++ b/src/Types/InputProfilePhotoAnimated.php @@ -0,0 +1,50 @@ + true, + 'animation' => true, + 'main_frame_timestamp' => true + ]; + + protected $type = 'animated'; + protected $animation; + protected $mainFrameTimestamp; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getAnimation() + { + return $this->animation; + } + + public function setAnimation($animation) + { + $this->animation = $animation; + } + + public function getMainFrameTimestamp() + { + return $this->mainFrameTimestamp; + } + + public function setMainFrameTimestamp($ts) + { + $this->mainFrameTimestamp = $ts; + } +} diff --git a/src/Types/InputProfilePhotoStatic.php b/src/Types/InputProfilePhotoStatic.php new file mode 100644 index 00000000..78d8bde1 --- /dev/null +++ b/src/Types/InputProfilePhotoStatic.php @@ -0,0 +1,27 @@ + true, + 'photo' => true + ]; + + protected $type = 'static'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/InputStoryContent.php b/src/Types/InputStoryContent.php new file mode 100644 index 00000000..afebb57d --- /dev/null +++ b/src/Types/InputStoryContent.php @@ -0,0 +1,58 @@ +photo = $photo; + } + } + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getPhoto() + { + return $this->photo; + } + + public function setPhoto($photo) + { + $this->photo = $photo; + } +} diff --git a/src/Types/InputStoryContentPhoto.php b/src/Types/InputStoryContentPhoto.php new file mode 100644 index 00000000..3e6e87fd --- /dev/null +++ b/src/Types/InputStoryContentPhoto.php @@ -0,0 +1,27 @@ + true, + 'photo' => true + ]; + + protected $type = 'photo'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/InputStoryContentVideo.php b/src/Types/InputStoryContentVideo.php new file mode 100644 index 00000000..09326d5d --- /dev/null +++ b/src/Types/InputStoryContentVideo.php @@ -0,0 +1,74 @@ + true, + 'video' => true, + 'duration' => true, + 'cover_frame_timestamp' => true, + 'is_animation' => true + ]; + + protected $type = 'video'; + protected $video; + protected $duration; + protected $coverFrameTimestamp; + protected $isAnimation; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getVideo() + { + return $this->video; + } + + public function setVideo($video) + { + $this->video = $video; + } + + public function getDuration() + { + return $this->duration; + } + + public function setDuration($duration) + { + $this->duration = $duration; + } + + public function getCoverFrameTimestamp() + { + return $this->coverFrameTimestamp; + } + + public function setCoverFrameTimestamp($ts) + { + $this->coverFrameTimestamp = $ts; + } + + public function getIsAnimation() + { + return $this->isAnimation; + } + + public function setIsAnimation($isAnimation) + { + $this->isAnimation = $isAnimation; + } +} diff --git a/src/Types/LocationAddress.php b/src/Types/LocationAddress.php new file mode 100644 index 00000000..fa57bdb7 --- /dev/null +++ b/src/Types/LocationAddress.php @@ -0,0 +1,67 @@ + true, + 'state' => true, + 'city' => true, + 'street' => true + ]; + + protected $countryCode; + protected $state; + protected $city; + protected $street; + + public function getCountryCode() + { + return $this->countryCode; + } + + public function setCountryCode($countryCode) + { + $this->countryCode = $countryCode; + } + + public function getState() + { + return $this->state; + } + + public function setState($state) + { + $this->state = $state; + } + + public function getCity() + { + return $this->city; + } + + public function setCity($city) + { + $this->city = $city; + } + + public function getStreet() + { + return $this->street; + } + + public function setStreet($street) + { + $this->street = $street; + } +} diff --git a/src/Types/MenuButton.php b/src/Types/MenuButton.php new file mode 100644 index 00000000..e6655464 --- /dev/null +++ b/src/Types/MenuButton.php @@ -0,0 +1,46 @@ + true + ]; + + /** + * @psalm-suppress LessSpecificReturnType,MoreSpecificReturnType + */ + public static function fromResponse($data) + { + self::validate($data); + switch ($data['type']) { + case 'commands': + return MenuButtonCommands::fromResponse($data); + case 'web_app': + return MenuButtonWebApp::fromResponse($data); + case 'default': + return MenuButtonDefault::fromResponse($data); + default: + throw new InvalidArgumentException('Unknown menu button type: ' . $data['type']); + } + } + + protected $type; + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } +} diff --git a/src/Types/MenuButtonCommands.php b/src/Types/MenuButtonCommands.php new file mode 100644 index 00000000..f182c76e --- /dev/null +++ b/src/Types/MenuButtonCommands.php @@ -0,0 +1,26 @@ + true + ]; + + protected $type = 'commands'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/MenuButtonDefault.php b/src/Types/MenuButtonDefault.php new file mode 100644 index 00000000..9a01b76b --- /dev/null +++ b/src/Types/MenuButtonDefault.php @@ -0,0 +1,26 @@ + true + ]; + + protected $type = 'default'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/MenuButtonWebApp.php b/src/Types/MenuButtonWebApp.php new file mode 100644 index 00000000..7a6deacd --- /dev/null +++ b/src/Types/MenuButtonWebApp.php @@ -0,0 +1,50 @@ + true, + 'text' => true, + 'web_app' => WebAppInfo::class + ]; + + protected $type = 'web_app'; + protected $text; + protected $webApp; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getText() + { + return $this->text; + } + + public function setText($text) + { + $this->text = $text; + } + + public function getWebApp() + { + return $this->webApp; + } + + public function setWebApp($webApp) + { + $this->webApp = $webApp; + } +} diff --git a/src/Types/OwnedGift.php b/src/Types/OwnedGift.php new file mode 100644 index 00000000..1017dba8 --- /dev/null +++ b/src/Types/OwnedGift.php @@ -0,0 +1,92 @@ + true, + 'gift' => true, + 'owned_gift_id' => true, + 'sender_user' => User::class, + 'send_date' => true, + ]; + + protected $type; + protected $gift; + protected $ownedGiftId; + protected $senderUser; + protected $sendDate; + + /** + * @psalm-suppress LessSpecificReturnStatement,MoreSpecificReturnType + */ + public static function fromResponse($data) + { + self::validate($data); + switch ($data['type']) { + case 'regular': + return OwnedGiftRegular::fromResponse($data); + case 'unique': + return OwnedGiftUnique::fromResponse($data); + default: + throw new InvalidArgumentException('Unknown owned gift type: ' . $data['type']); + } + } + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getGift() + { + return $this->gift; + } + + public function setGift($gift) + { + $this->gift = $gift; + } + + public function getOwnedGiftId() + { + return $this->ownedGiftId; + } + + public function setOwnedGiftId($ownedGiftId) + { + $this->ownedGiftId = $ownedGiftId; + } + + public function getSenderUser() + { + return $this->senderUser; + } + + public function setSenderUser($senderUser) + { + $this->senderUser = $senderUser; + } + + public function getSendDate() + { + return $this->sendDate; + } + + public function setSendDate($sendDate) + { + $this->sendDate = $sendDate; + } +} diff --git a/src/Types/OwnedGiftRegular.php b/src/Types/OwnedGiftRegular.php new file mode 100644 index 00000000..b9fac8ec --- /dev/null +++ b/src/Types/OwnedGiftRegular.php @@ -0,0 +1,122 @@ + true, + 'gift' => Gift::class, + 'owned_gift_id' => true, + 'sender_user' => User::class, + 'send_date' => true, + 'text' => true, + 'entities' => ArrayOfMessageEntity::class, + 'is_private' => true, + 'is_saved' => true, + 'can_be_upgraded' => true, + 'was_refunded' => true, + 'convert_star_count' => true, + 'prepaid_upgrade_star_count' => true, + ]; + + protected $text; + protected $entities; + protected $isPrivate; + protected $isSaved; + protected $canBeUpgraded; + protected $wasRefunded; + protected $convertStarCount; + protected $prepaidUpgradeStarCount; + protected $type = 'regular'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getText() + { + return $this->text; + } + + public function setText($text) + { + $this->text = $text; + } + + public function getEntities() + { + return $this->entities; + } + + public function setEntities($entities) + { + $this->entities = $entities; + } + + public function getIsPrivate() + { + return $this->isPrivate; + } + + public function setIsPrivate($isPrivate) + { + $this->isPrivate = $isPrivate; + } + + public function getIsSaved() + { + return $this->isSaved; + } + + public function setIsSaved($isSaved) + { + $this->isSaved = $isSaved; + } + + public function getCanBeUpgraded() + { + return $this->canBeUpgraded; + } + + public function setCanBeUpgraded($canBeUpgraded) + { + $this->canBeUpgraded = $canBeUpgraded; + } + + public function getWasRefunded() + { + return $this->wasRefunded; + } + + public function setWasRefunded($wasRefunded) + { + $this->wasRefunded = $wasRefunded; + } + + public function getConvertStarCount() + { + return $this->convertStarCount; + } + + public function setConvertStarCount($convertStarCount) + { + $this->convertStarCount = $convertStarCount; + } + + public function getPrepaidUpgradeStarCount() + { + return $this->prepaidUpgradeStarCount; + } + + public function setPrepaidUpgradeStarCount($prepaidUpgradeStarCount) + { + $this->prepaidUpgradeStarCount = $prepaidUpgradeStarCount; + } +} diff --git a/src/Types/OwnedGiftUnique.php b/src/Types/OwnedGiftUnique.php new file mode 100644 index 00000000..0fc7a78d --- /dev/null +++ b/src/Types/OwnedGiftUnique.php @@ -0,0 +1,62 @@ + true, + 'gift' => UniqueGift::class, + 'owned_gift_id' => true, + 'sender_user' => User::class, + 'send_date' => true, + 'is_saved' => true, + 'can_be_transferred' => true, + 'transfer_star_count' => true, + ]; + + protected $isSaved; + protected $canBeTransferred; + protected $transferStarCount; + protected $type = 'unique'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getIsSaved() + { + return $this->isSaved; + } + + public function setIsSaved($isSaved) + { + $this->isSaved = $isSaved; + } + + public function getCanBeTransferred() + { + return $this->canBeTransferred; + } + + public function setCanBeTransferred($canBeTransferred) + { + $this->canBeTransferred = $canBeTransferred; + } + + public function getTransferStarCount() + { + return $this->transferStarCount; + } + + public function setTransferStarCount($transferStarCount) + { + $this->transferStarCount = $transferStarCount; + } +} diff --git a/src/Types/OwnedGifts.php b/src/Types/OwnedGifts.php new file mode 100644 index 00000000..88d50a47 --- /dev/null +++ b/src/Types/OwnedGifts.php @@ -0,0 +1,51 @@ + true, + 'gifts' => ArrayOfOwnedGift::class, + 'next_offset' => true, + ]; + + protected $totalCount; + protected $gifts; + protected $nextOffset; + + public function getTotalCount() + { + return $this->totalCount; + } + + public function setTotalCount($totalCount) + { + $this->totalCount = $totalCount; + } + + public function getGifts() + { + return $this->gifts; + } + + public function setGifts($gifts) + { + $this->gifts = $gifts; + } + + public function getNextOffset() + { + return $this->nextOffset; + } + + public function setNextOffset($nextOffset) + { + $this->nextOffset = $nextOffset; + } +} diff --git a/src/Types/PaidMedia.php b/src/Types/PaidMedia.php new file mode 100644 index 00000000..47feee77 --- /dev/null +++ b/src/Types/PaidMedia.php @@ -0,0 +1,44 @@ + true]; + + /** + * @psalm-suppress LessSpecificReturnStatement,MoreSpecificReturnType + */ + public static function fromResponse($data) + { + self::validate($data); + switch ($data['type']) { + case 'preview': + return PaidMediaPreview::fromResponse($data); + case 'photo': + return PaidMediaPhoto::fromResponse($data); + case 'video': + return PaidMediaVideo::fromResponse($data); + default: + throw new InvalidArgumentException('Unknown paid media type: ' . $data['type']); + } + } + + protected $type; + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } +} diff --git a/src/Types/PaidMediaInfo.php b/src/Types/PaidMediaInfo.php new file mode 100644 index 00000000..e884b2af --- /dev/null +++ b/src/Types/PaidMediaInfo.php @@ -0,0 +1,43 @@ + true, + 'paid_media' => PaidMedia::class + ]; + + protected $starCount; + protected $paidMedia; + + public function getStarCount() + { + return $this->starCount; + } + + public function setStarCount($starCount) + { + $this->starCount = $starCount; + } + + public function getPaidMedia() + { + return $this->paidMedia; + } + + public function setPaidMedia($paidMedia) + { + $this->paidMedia = $paidMedia; + } +} diff --git a/src/Types/PaidMediaPhoto.php b/src/Types/PaidMediaPhoto.php new file mode 100644 index 00000000..ad659eb1 --- /dev/null +++ b/src/Types/PaidMediaPhoto.php @@ -0,0 +1,38 @@ + true, + 'photo' => ArrayOfPhotoSize::class + ]; + + protected $type = 'photo'; + protected $photo; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getPhoto() + { + return $this->photo; + } + + public function setPhoto($photo) + { + $this->photo = $photo; + } +} diff --git a/src/Types/PaidMediaPreview.php b/src/Types/PaidMediaPreview.php new file mode 100644 index 00000000..b0b8b7be --- /dev/null +++ b/src/Types/PaidMediaPreview.php @@ -0,0 +1,62 @@ + true, + 'width' => true, + 'height' => true, + 'duration' => true + ]; + + protected static $requiredParams = ['type']; + + protected $type = 'preview'; + protected $width; + protected $height; + protected $duration; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getWidth() + { + return $this->width; + } + + public function setWidth($width) + { + $this->width = $width; + } + + public function getHeight() + { + return $this->height; + } + + public function setHeight($height) + { + $this->height = $height; + } + + public function getDuration() + { + return $this->duration; + } + + public function setDuration($duration) + { + $this->duration = $duration; + } +} diff --git a/src/Types/PaidMediaVideo.php b/src/Types/PaidMediaVideo.php new file mode 100644 index 00000000..a842a34e --- /dev/null +++ b/src/Types/PaidMediaVideo.php @@ -0,0 +1,38 @@ + true, + 'video' => Video::class + ]; + + protected $type = 'video'; + protected $video; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getVideo() + { + return $this->video; + } + + public function setVideo($video) + { + $this->video = $video; + } +} diff --git a/src/Types/PaidMessagePriceChanged.php b/src/Types/PaidMessagePriceChanged.php new file mode 100644 index 00000000..9e27d297 --- /dev/null +++ b/src/Types/PaidMessagePriceChanged.php @@ -0,0 +1,31 @@ + true + ]; + + protected $paidMessageStarCount; + + public function getPaidMessageStarCount() + { + return $this->paidMessageStarCount; + } + + public function setPaidMessageStarCount($count) + { + $this->paidMessageStarCount = $count; + } +} diff --git a/src/Types/ReactionTypePaid.php b/src/Types/ReactionTypePaid.php new file mode 100644 index 00000000..f6218c1d --- /dev/null +++ b/src/Types/ReactionTypePaid.php @@ -0,0 +1,23 @@ + true]; + protected static $requiredParams = ['type']; + + protected $type = 'paid'; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } +} diff --git a/src/Types/StarAmount.php b/src/Types/StarAmount.php new file mode 100644 index 00000000..d1ead7d1 --- /dev/null +++ b/src/Types/StarAmount.php @@ -0,0 +1,39 @@ + true, + 'nanostar_amount' => true, + ]; + + protected $amount; + protected $nanostarAmount; + + public function getAmount() + { + return $this->amount; + } + + public function setAmount($amount) + { + $this->amount = $amount; + } + + public function getNanostarAmount() + { + return $this->nanostarAmount; + } + + public function setNanostarAmount($nanostarAmount) + { + $this->nanostarAmount = $nanostarAmount; + } +} diff --git a/src/Types/StoryArea.php b/src/Types/StoryArea.php new file mode 100644 index 00000000..78499686 --- /dev/null +++ b/src/Types/StoryArea.php @@ -0,0 +1,43 @@ + StoryAreaPosition::class, + 'type' => StoryAreaType::class + ]; + + protected $position; + protected $type; + + public function getPosition() + { + return $this->position; + } + + public function setPosition($position) + { + $this->position = $position; + } + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } +} diff --git a/src/Types/StoryAreaPosition.php b/src/Types/StoryAreaPosition.php new file mode 100644 index 00000000..c7320525 --- /dev/null +++ b/src/Types/StoryAreaPosition.php @@ -0,0 +1,98 @@ + true, + 'y_percentage' => true, + 'width_percentage' => true, + 'height_percentage' => true, + 'rotation_angle' => true, + 'corner_radius_percentage' => true + ]; + + protected $xPercentage; + protected $yPercentage; + protected $widthPercentage; + protected $heightPercentage; + protected $rotationAngle; + protected $cornerRadiusPercentage; + + public function getXPercentage() + { + return $this->xPercentage; + } + + public function setXPercentage($xPercentage) + { + $this->xPercentage = $xPercentage; + } + + public function getYPercentage() + { + return $this->yPercentage; + } + + public function setYPercentage($yPercentage) + { + $this->yPercentage = $yPercentage; + } + + public function getWidthPercentage() + { + return $this->widthPercentage; + } + + public function setWidthPercentage($widthPercentage) + { + $this->widthPercentage = $widthPercentage; + } + + public function getHeightPercentage() + { + return $this->heightPercentage; + } + + public function setHeightPercentage($heightPercentage) + { + $this->heightPercentage = $heightPercentage; + } + + public function getRotationAngle() + { + return $this->rotationAngle; + } + + public function setRotationAngle($rotationAngle) + { + $this->rotationAngle = $rotationAngle; + } + + public function getCornerRadiusPercentage() + { + return $this->cornerRadiusPercentage; + } + + public function setCornerRadiusPercentage($cornerRadiusPercentage) + { + $this->cornerRadiusPercentage = $cornerRadiusPercentage; + } +} diff --git a/src/Types/StoryAreaType.php b/src/Types/StoryAreaType.php new file mode 100644 index 00000000..20b35445 --- /dev/null +++ b/src/Types/StoryAreaType.php @@ -0,0 +1,50 @@ + true + ]; + + /** + * @psalm-suppress LessSpecificReturnStatement,MoreSpecificReturnType + */ + public static function fromResponse($data) + { + self::validate($data); + switch ($data['type']) { + case 'location': + return StoryAreaTypeLocation::fromResponse($data); + case 'suggested_reaction': + return StoryAreaTypeSuggestedReaction::fromResponse($data); + case 'link': + return StoryAreaTypeLink::fromResponse($data); + case 'weather': + return StoryAreaTypeWeather::fromResponse($data); + case 'unique_gift': + return StoryAreaTypeUniqueGift::fromResponse($data); + default: + throw new InvalidArgumentException('Unknown story area type: ' . $data['type']); + } + } + + protected $type; + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } +} diff --git a/src/Types/StoryAreaTypeLink.php b/src/Types/StoryAreaTypeLink.php new file mode 100644 index 00000000..5567eaf8 --- /dev/null +++ b/src/Types/StoryAreaTypeLink.php @@ -0,0 +1,38 @@ + true, + 'url' => true + ]; + + protected $type = 'link'; + protected $url; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getUrl() + { + return $this->url; + } + + public function setUrl($url) + { + $this->url = $url; + } +} diff --git a/src/Types/StoryAreaTypeLocation.php b/src/Types/StoryAreaTypeLocation.php new file mode 100644 index 00000000..25bcbaa5 --- /dev/null +++ b/src/Types/StoryAreaTypeLocation.php @@ -0,0 +1,62 @@ + true, + 'latitude' => true, + 'longitude' => true, + 'address' => LocationAddress::class + ]; + + protected $type = 'location'; + protected $latitude; + protected $longitude; + protected $address; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getLatitude() + { + return $this->latitude; + } + + public function setLatitude($latitude) + { + $this->latitude = $latitude; + } + + public function getLongitude() + { + return $this->longitude; + } + + public function setLongitude($longitude) + { + $this->longitude = $longitude; + } + + public function getAddress() + { + return $this->address; + } + + public function setAddress($address) + { + $this->address = $address; + } +} diff --git a/src/Types/StoryAreaTypeSuggestedReaction.php b/src/Types/StoryAreaTypeSuggestedReaction.php new file mode 100644 index 00000000..1d8732ea --- /dev/null +++ b/src/Types/StoryAreaTypeSuggestedReaction.php @@ -0,0 +1,62 @@ + true, + 'reaction_type' => ReactionType::class, + 'is_dark' => true, + 'is_flipped' => true + ]; + + protected $type = 'suggested_reaction'; + protected $reactionType; + protected $isDark; + protected $isFlipped; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getReactionType() + { + return $this->reactionType; + } + + public function setReactionType($reactionType) + { + $this->reactionType = $reactionType; + } + + public function getIsDark() + { + return $this->isDark; + } + + public function setIsDark($isDark) + { + $this->isDark = $isDark; + } + + public function getIsFlipped() + { + return $this->isFlipped; + } + + public function setIsFlipped($isFlipped) + { + $this->isFlipped = $isFlipped; + } +} diff --git a/src/Types/StoryAreaTypeUniqueGift.php b/src/Types/StoryAreaTypeUniqueGift.php new file mode 100644 index 00000000..7b5cb482 --- /dev/null +++ b/src/Types/StoryAreaTypeUniqueGift.php @@ -0,0 +1,38 @@ + true, + 'name' => true + ]; + + protected $type = 'unique_gift'; + protected $name; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } +} diff --git a/src/Types/StoryAreaTypeWeather.php b/src/Types/StoryAreaTypeWeather.php new file mode 100644 index 00000000..a620fac1 --- /dev/null +++ b/src/Types/StoryAreaTypeWeather.php @@ -0,0 +1,62 @@ + true, + 'temperature' => true, + 'emoji' => true, + 'background_color' => true + ]; + + protected $type = 'weather'; + protected $temperature; + protected $emoji; + protected $backgroundColor; + + public static function fromResponse($data) + { + self::validate($data); + $instance = new static(); + $instance->map($data); + return $instance; + } + + public function getTemperature() + { + return $this->temperature; + } + + public function setTemperature($temperature) + { + $this->temperature = $temperature; + } + + public function getEmoji() + { + return $this->emoji; + } + + public function setEmoji($emoji) + { + $this->emoji = $emoji; + } + + public function getBackgroundColor() + { + return $this->backgroundColor; + } + + public function setBackgroundColor($backgroundColor) + { + $this->backgroundColor = $backgroundColor; + } +} diff --git a/src/Types/UniqueGift.php b/src/Types/UniqueGift.php new file mode 100644 index 00000000..30b515dd --- /dev/null +++ b/src/Types/UniqueGift.php @@ -0,0 +1,87 @@ + true, + 'name' => true, + 'number' => true, + 'model' => UniqueGiftModel::class, + 'symbol' => UniqueGiftSymbol::class, + 'backdrop' => UniqueGiftBackdrop::class, + ]; + + protected $baseName; + protected $name; + protected $number; + protected $model; + protected $symbol; + protected $backdrop; + + public function getBaseName() + { + return $this->baseName; + } + + public function setBaseName($baseName) + { + $this->baseName = $baseName; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getNumber() + { + return $this->number; + } + + public function setNumber($number) + { + $this->number = $number; + } + + public function getModel() + { + return $this->model; + } + + public function setModel($model) + { + $this->model = $model; + } + + public function getSymbol() + { + return $this->symbol; + } + + public function setSymbol($symbol) + { + $this->symbol = $symbol; + } + + public function getBackdrop() + { + return $this->backdrop; + } + + public function setBackdrop($backdrop) + { + $this->backdrop = $backdrop; + } +} diff --git a/src/Types/UniqueGiftBackdrop.php b/src/Types/UniqueGiftBackdrop.php new file mode 100644 index 00000000..b81af9e8 --- /dev/null +++ b/src/Types/UniqueGiftBackdrop.php @@ -0,0 +1,51 @@ + true, + 'colors' => UniqueGiftBackdropColors::class, + 'rarity_per_mille' => true, + ]; + + protected $name; + protected $colors; + protected $rarityPerMille; + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getColors() + { + return $this->colors; + } + + public function setColors($colors) + { + $this->colors = $colors; + } + + public function getRarityPerMille() + { + return $this->rarityPerMille; + } + + public function setRarityPerMille($rarityPerMille) + { + $this->rarityPerMille = $rarityPerMille; + } +} diff --git a/src/Types/UniqueGiftBackdropColors.php b/src/Types/UniqueGiftBackdropColors.php new file mode 100644 index 00000000..f9f55e32 --- /dev/null +++ b/src/Types/UniqueGiftBackdropColors.php @@ -0,0 +1,63 @@ + true, + 'edge_color' => true, + 'symbol_color' => true, + 'text_color' => true, + ]; + + protected $centerColor; + protected $edgeColor; + protected $symbolColor; + protected $textColor; + + public function getCenterColor() + { + return $this->centerColor; + } + + public function setCenterColor($centerColor) + { + $this->centerColor = $centerColor; + } + + public function getEdgeColor() + { + return $this->edgeColor; + } + + public function setEdgeColor($edgeColor) + { + $this->edgeColor = $edgeColor; + } + + public function getSymbolColor() + { + return $this->symbolColor; + } + + public function setSymbolColor($symbolColor) + { + $this->symbolColor = $symbolColor; + } + + public function getTextColor() + { + return $this->textColor; + } + + public function setTextColor($textColor) + { + $this->textColor = $textColor; + } +} diff --git a/src/Types/UniqueGiftInfo.php b/src/Types/UniqueGiftInfo.php new file mode 100644 index 00000000..92cce222 --- /dev/null +++ b/src/Types/UniqueGiftInfo.php @@ -0,0 +1,63 @@ + UniqueGift::class, + 'origin' => true, + 'owned_gift_id' => true, + 'transfer_star_count' => true, + ]; + + protected $gift; + protected $origin; + protected $ownedGiftId; + protected $transferStarCount; + + public function getGift() + { + return $this->gift; + } + + public function setGift($gift) + { + $this->gift = $gift; + } + + public function getOrigin() + { + return $this->origin; + } + + public function setOrigin($origin) + { + $this->origin = $origin; + } + + public function getOwnedGiftId() + { + return $this->ownedGiftId; + } + + public function setOwnedGiftId($ownedGiftId) + { + $this->ownedGiftId = $ownedGiftId; + } + + public function getTransferStarCount() + { + return $this->transferStarCount; + } + + public function setTransferStarCount($transferStarCount) + { + $this->transferStarCount = $transferStarCount; + } +} diff --git a/src/Types/UniqueGiftModel.php b/src/Types/UniqueGiftModel.php new file mode 100644 index 00000000..a1525f03 --- /dev/null +++ b/src/Types/UniqueGiftModel.php @@ -0,0 +1,51 @@ + true, + 'sticker' => Sticker::class, + 'rarity_per_mille' => true, + ]; + + protected $name; + protected $sticker; + protected $rarityPerMille; + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getSticker() + { + return $this->sticker; + } + + public function setSticker($sticker) + { + $this->sticker = $sticker; + } + + public function getRarityPerMille() + { + return $this->rarityPerMille; + } + + public function setRarityPerMille($rarityPerMille) + { + $this->rarityPerMille = $rarityPerMille; + } +} diff --git a/src/Types/UniqueGiftSymbol.php b/src/Types/UniqueGiftSymbol.php new file mode 100644 index 00000000..1b1c5261 --- /dev/null +++ b/src/Types/UniqueGiftSymbol.php @@ -0,0 +1,51 @@ + true, + 'sticker' => Sticker::class, + 'rarity_per_mille' => true, + ]; + + protected $name; + protected $sticker; + protected $rarityPerMille; + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getSticker() + { + return $this->sticker; + } + + public function setSticker($sticker) + { + $this->sticker = $sticker; + } + + public function getRarityPerMille() + { + return $this->rarityPerMille; + } + + public function setRarityPerMille($rarityPerMille) + { + $this->rarityPerMille = $rarityPerMille; + } +} diff --git a/tests/Types/AcceptedGiftTypesTest.php b/tests/Types/AcceptedGiftTypesTest.php new file mode 100644 index 00000000..ddd84e52 --- /dev/null +++ b/tests/Types/AcceptedGiftTypesTest.php @@ -0,0 +1,42 @@ + true, + 'limited_gifts' => true, + 'unique_gifts' => true, + 'premium_subscription' => true, + ]; + } + + public static function getFullResponse() + { + return static::getMinResponse(); + } + + protected function assertMinItem($item) + { + $this->assertTrue($item->getUnlimitedGifts()); + $this->assertTrue($item->getLimitedGifts()); + $this->assertTrue($item->getUniqueGifts()); + $this->assertTrue($item->getPremiumSubscription()); + } + + protected function assertFullItem($item) + { + $this->assertMinItem($item); + } +} diff --git a/tests/Types/GiftInfoTest.php b/tests/Types/GiftInfoTest.php new file mode 100644 index 00000000..e69d936e --- /dev/null +++ b/tests/Types/GiftInfoTest.php @@ -0,0 +1,59 @@ + GiftTest::getMinResponse(), + ]; + } + + public static function getFullResponse() + { + return [ + 'gift' => GiftTest::getMinResponse(), + 'owned_gift_id' => 'id', + 'convert_star_count' => 1, + 'prepaid_upgrade_star_count' => 2, + 'can_be_upgraded' => true, + 'text' => 'hi', + 'entities' => [MessageEntityTest::getMinResponse()], + 'is_private' => true, + ]; + } + + protected function assertMinItem($item) + { + $this->assertEquals(GiftTest::createMinInstance(), $item->getGift()); + $this->assertNull($item->getOwnedGiftId()); + $this->assertNull($item->getConvertStarCount()); + $this->assertNull($item->getPrepaidUpgradeStarCount()); + $this->assertNull($item->getCanBeUpgraded()); + $this->assertNull($item->getText()); + $this->assertNull($item->getEntities()); + $this->assertNull($item->getIsPrivate()); + } + + protected function assertFullItem($item) + { + $this->assertEquals(GiftTest::createMinInstance(), $item->getGift()); + $this->assertEquals('id', $item->getOwnedGiftId()); + $this->assertEquals(1, $item->getConvertStarCount()); + $this->assertEquals(2, $item->getPrepaidUpgradeStarCount()); + $this->assertTrue($item->getCanBeUpgraded()); + $this->assertEquals('hi', $item->getText()); + $this->assertEquals([MessageEntityTest::createMinInstance()], $item->getEntities()); + $this->assertTrue($item->getIsPrivate()); + } +} diff --git a/tests/Types/GiftTest.php b/tests/Types/GiftTest.php new file mode 100644 index 00000000..416f0078 --- /dev/null +++ b/tests/Types/GiftTest.php @@ -0,0 +1,55 @@ + 'gift1', + 'sticker' => StickerTest::getMinResponse(), + 'star_count' => 10, + ]; + } + + public static function getFullResponse() + { + return [ + 'id' => 'gift1', + 'sticker' => StickerTest::getMinResponse(), + 'star_count' => 10, + 'upgrade_star_count' => 5, + 'total_count' => 100, + 'remaining_count' => 50, + ]; + } + + protected function assertMinItem($item) + { + $this->assertEquals('gift1', $item->getId()); + $this->assertEquals(StickerTest::createMinInstance(), $item->getSticker()); + $this->assertEquals(10, $item->getStarCount()); + $this->assertNull($item->getUpgradeStarCount()); + $this->assertNull($item->getTotalCount()); + $this->assertNull($item->getRemainingCount()); + } + + protected function assertFullItem($item) + { + $this->assertEquals('gift1', $item->getId()); + $this->assertEquals(StickerTest::createMinInstance(), $item->getSticker()); + $this->assertEquals(10, $item->getStarCount()); + $this->assertEquals(5, $item->getUpgradeStarCount()); + $this->assertEquals(100, $item->getTotalCount()); + $this->assertEquals(50, $item->getRemainingCount()); + } +} diff --git a/tests/Types/GiftsTest.php b/tests/Types/GiftsTest.php new file mode 100644 index 00000000..5944bb60 --- /dev/null +++ b/tests/Types/GiftsTest.php @@ -0,0 +1,44 @@ + [ + GiftTest::getMinResponse(), + ], + ]; + } + + public static function getFullResponse() + { + return [ + 'gifts' => [ + GiftTest::getFullResponse(), + ], + ]; + } + + protected function assertMinItem($item) + { + $this->assertIsArray($item->getGifts()); + $this->assertEquals([GiftTest::createMinInstance()], $item->getGifts()); + } + + protected function assertFullItem($item) + { + $this->assertIsArray($item->getGifts()); + $this->assertEquals([GiftTest::createFullInstance()], $item->getGifts()); + } +} diff --git a/tests/Types/OwnedGiftRegularTest.php b/tests/Types/OwnedGiftRegularTest.php new file mode 100644 index 00000000..1b6a7bf8 --- /dev/null +++ b/tests/Types/OwnedGiftRegularTest.php @@ -0,0 +1,67 @@ + 'regular', + 'gift' => GiftTest::getMinResponse(), + 'send_date' => 1682343643, + ]; + } + + public static function getFullResponse() + { + return [ + 'type' => 'regular', + 'gift' => GiftTest::getMinResponse(), + 'owned_gift_id' => 'id', + 'sender_user' => UserTest::getMinResponse(), + 'send_date' => 1682343643, + 'text' => 'hi', + 'entities' => [MessageEntityTest::getMinResponse()], + 'is_private' => true, + 'is_saved' => true, + 'can_be_upgraded' => true, + 'was_refunded' => true, + 'convert_star_count' => 1, + 'prepaid_upgrade_star_count' => 2, + ]; + } + + protected function assertMinItem($item) + { + $this->assertEquals('regular', $item->getType()); + $this->assertEquals(GiftTest::createMinInstance(), $item->getGift()); + $this->assertEquals(1682343643, $item->getSendDate()); + $this->assertNull($item->getOwnedGiftId()); + } + + protected function assertFullItem($item) + { + $this->assertEquals('regular', $item->getType()); + $this->assertEquals(GiftTest::createMinInstance(), $item->getGift()); + $this->assertEquals('id', $item->getOwnedGiftId()); + $this->assertEquals(UserTest::createMinInstance(), $item->getSenderUser()); + $this->assertEquals(1682343643, $item->getSendDate()); + $this->assertEquals('hi', $item->getText()); + $this->assertEquals([MessageEntityTest::createMinInstance()], $item->getEntities()); + $this->assertTrue($item->getIsPrivate()); + $this->assertTrue($item->getIsSaved()); + $this->assertTrue($item->getCanBeUpgraded()); + $this->assertTrue($item->getWasRefunded()); + $this->assertEquals(1, $item->getConvertStarCount()); + $this->assertEquals(2, $item->getPrepaidUpgradeStarCount()); + } +} diff --git a/tests/Types/OwnedGiftUniqueTest.php b/tests/Types/OwnedGiftUniqueTest.php new file mode 100644 index 00000000..ebee3c67 --- /dev/null +++ b/tests/Types/OwnedGiftUniqueTest.php @@ -0,0 +1,57 @@ + 'unique', + 'gift' => UniqueGiftTest::getMinResponse(), + 'send_date' => 1682343643, + ]; + } + + public static function getFullResponse() + { + return [ + 'type' => 'unique', + 'gift' => UniqueGiftTest::getMinResponse(), + 'owned_gift_id' => 'id', + 'sender_user' => UserTest::getMinResponse(), + 'send_date' => 1682343643, + 'is_saved' => true, + 'can_be_transferred' => true, + 'transfer_star_count' => 3, + ]; + } + + protected function assertMinItem($item) + { + $this->assertEquals('unique', $item->getType()); + $this->assertEquals(UniqueGiftTest::createMinInstance(), $item->getGift()); + $this->assertEquals(1682343643, $item->getSendDate()); + $this->assertNull($item->getOwnedGiftId()); + } + + protected function assertFullItem($item) + { + $this->assertEquals('unique', $item->getType()); + $this->assertEquals(UniqueGiftTest::createMinInstance(), $item->getGift()); + $this->assertEquals('id', $item->getOwnedGiftId()); + $this->assertEquals(UserTest::createMinInstance(), $item->getSenderUser()); + $this->assertEquals(1682343643, $item->getSendDate()); + $this->assertTrue($item->getIsSaved()); + $this->assertTrue($item->getCanBeTransferred()); + $this->assertEquals(3, $item->getTransferStarCount()); + } +} diff --git a/tests/Types/OwnedGiftsTest.php b/tests/Types/OwnedGiftsTest.php new file mode 100644 index 00000000..81fc4858 --- /dev/null +++ b/tests/Types/OwnedGiftsTest.php @@ -0,0 +1,45 @@ + 1, + 'gifts' => [OwnedGiftRegularTest::getMinResponse()], + ]; + } + + public static function getFullResponse() + { + return [ + 'total_count' => 2, + 'gifts' => [OwnedGiftRegularTest::getMinResponse()], + 'next_offset' => '1', + ]; + } + + protected function assertMinItem($item) + { + $this->assertEquals(1, $item->getTotalCount()); + $this->assertEquals([OwnedGiftRegularTest::createMinInstance()], $item->getGifts()); + $this->assertNull($item->getNextOffset()); + } + + protected function assertFullItem($item) + { + $this->assertEquals(2, $item->getTotalCount()); + $this->assertEquals([OwnedGiftRegularTest::createMinInstance()], $item->getGifts()); + $this->assertEquals('1', $item->getNextOffset()); + } +} diff --git a/tests/Types/ReactionTypePaidTest.php b/tests/Types/ReactionTypePaidTest.php new file mode 100644 index 00000000..6c3f360a --- /dev/null +++ b/tests/Types/ReactionTypePaidTest.php @@ -0,0 +1,36 @@ + 'paid' + ]; + } + + public static function getFullResponse() + { + return static::getMinResponse(); + } + + protected function assertMinItem($item) + { + $this->assertEquals('paid', $item->getType()); + } + + protected function assertFullItem($item) + { + $this->assertMinItem($item); + } +} diff --git a/tests/Types/StarAmountTest.php b/tests/Types/StarAmountTest.php new file mode 100644 index 00000000..327bf350 --- /dev/null +++ b/tests/Types/StarAmountTest.php @@ -0,0 +1,41 @@ + 1, + ]; + } + + public static function getFullResponse() + { + return [ + 'amount' => 2, + 'nanostar_amount' => 100, + ]; + } + + protected function assertMinItem($item) + { + $this->assertEquals(1, $item->getAmount()); + $this->assertNull($item->getNanostarAmount()); + } + + protected function assertFullItem($item) + { + $this->assertEquals(2, $item->getAmount()); + $this->assertEquals(100, $item->getNanostarAmount()); + } +} diff --git a/tests/Types/UniqueGiftBackdropColorsTest.php b/tests/Types/UniqueGiftBackdropColorsTest.php new file mode 100644 index 00000000..f78b1410 --- /dev/null +++ b/tests/Types/UniqueGiftBackdropColorsTest.php @@ -0,0 +1,42 @@ + 1, + 'edge_color' => 2, + 'symbol_color' => 3, + 'text_color' => 4, + ]; + } + + public static function getFullResponse() + { + return static::getMinResponse(); + } + + protected function assertMinItem($item) + { + $this->assertEquals(1, $item->getCenterColor()); + $this->assertEquals(2, $item->getEdgeColor()); + $this->assertEquals(3, $item->getSymbolColor()); + $this->assertEquals(4, $item->getTextColor()); + } + + protected function assertFullItem($item) + { + $this->assertMinItem($item); + } +} diff --git a/tests/Types/UniqueGiftBackdropTest.php b/tests/Types/UniqueGiftBackdropTest.php new file mode 100644 index 00000000..c5955493 --- /dev/null +++ b/tests/Types/UniqueGiftBackdropTest.php @@ -0,0 +1,40 @@ + 'backdrop', + 'colors' => UniqueGiftBackdropColorsTest::getMinResponse(), + 'rarity_per_mille' => 1, + ]; + } + + public static function getFullResponse() + { + return static::getMinResponse(); + } + + protected function assertMinItem($item) + { + $this->assertEquals('backdrop', $item->getName()); + $this->assertEquals(UniqueGiftBackdropColorsTest::createMinInstance(), $item->getColors()); + $this->assertEquals(1, $item->getRarityPerMille()); + } + + protected function assertFullItem($item) + { + $this->assertMinItem($item); + } +} diff --git a/tests/Types/UniqueGiftInfoTest.php b/tests/Types/UniqueGiftInfoTest.php new file mode 100644 index 00000000..a56e0de8 --- /dev/null +++ b/tests/Types/UniqueGiftInfoTest.php @@ -0,0 +1,48 @@ + UniqueGiftTest::getMinResponse(), + 'origin' => 'upgrade', + ]; + } + + public static function getFullResponse() + { + return [ + 'gift' => UniqueGiftTest::getMinResponse(), + 'origin' => 'upgrade', + 'owned_gift_id' => 'id', + 'transfer_star_count' => 3, + ]; + } + + protected function assertMinItem($item) + { + $this->assertEquals(UniqueGiftTest::createMinInstance(), $item->getGift()); + $this->assertEquals('upgrade', $item->getOrigin()); + $this->assertNull($item->getOwnedGiftId()); + $this->assertNull($item->getTransferStarCount()); + } + + protected function assertFullItem($item) + { + $this->assertEquals(UniqueGiftTest::createMinInstance(), $item->getGift()); + $this->assertEquals('upgrade', $item->getOrigin()); + $this->assertEquals('id', $item->getOwnedGiftId()); + $this->assertEquals(3, $item->getTransferStarCount()); + } +} diff --git a/tests/Types/UniqueGiftModelTest.php b/tests/Types/UniqueGiftModelTest.php new file mode 100644 index 00000000..11863a8e --- /dev/null +++ b/tests/Types/UniqueGiftModelTest.php @@ -0,0 +1,40 @@ + 'model', + 'sticker' => StickerTest::getMinResponse(), + 'rarity_per_mille' => 1, + ]; + } + + public static function getFullResponse() + { + return static::getMinResponse(); + } + + protected function assertMinItem($item) + { + $this->assertEquals('model', $item->getName()); + $this->assertEquals(StickerTest::createMinInstance(), $item->getSticker()); + $this->assertEquals(1, $item->getRarityPerMille()); + } + + protected function assertFullItem($item) + { + $this->assertMinItem($item); + } +} diff --git a/tests/Types/UniqueGiftSymbolTest.php b/tests/Types/UniqueGiftSymbolTest.php new file mode 100644 index 00000000..fb58e7d9 --- /dev/null +++ b/tests/Types/UniqueGiftSymbolTest.php @@ -0,0 +1,40 @@ + 'symbol', + 'sticker' => StickerTest::getMinResponse(), + 'rarity_per_mille' => 1, + ]; + } + + public static function getFullResponse() + { + return static::getMinResponse(); + } + + protected function assertMinItem($item) + { + $this->assertEquals('symbol', $item->getName()); + $this->assertEquals(StickerTest::createMinInstance(), $item->getSticker()); + $this->assertEquals(1, $item->getRarityPerMille()); + } + + protected function assertFullItem($item) + { + $this->assertMinItem($item); + } +} diff --git a/tests/Types/UniqueGiftTest.php b/tests/Types/UniqueGiftTest.php new file mode 100644 index 00000000..e7004fe6 --- /dev/null +++ b/tests/Types/UniqueGiftTest.php @@ -0,0 +1,46 @@ + 'gift', + 'name' => 'unique1', + 'number' => 1, + 'model' => UniqueGiftModelTest::getMinResponse(), + 'symbol' => UniqueGiftSymbolTest::getMinResponse(), + 'backdrop' => UniqueGiftBackdropTest::getMinResponse(), + ]; + } + + public static function getFullResponse() + { + return static::getMinResponse(); + } + + protected function assertMinItem($item) + { + $this->assertEquals('gift', $item->getBaseName()); + $this->assertEquals('unique1', $item->getName()); + $this->assertEquals(1, $item->getNumber()); + $this->assertEquals(UniqueGiftModelTest::createMinInstance(), $item->getModel()); + $this->assertEquals(UniqueGiftSymbolTest::createMinInstance(), $item->getSymbol()); + $this->assertEquals(UniqueGiftBackdropTest::createMinInstance(), $item->getBackdrop()); + } + + protected function assertFullItem($item) + { + $this->assertMinItem($item); + } +}