From ec93f9ffd7cc63b65b870df70a095a3d14f3e73c Mon Sep 17 00:00:00 2001 From: Netkas Date: Sun, 23 Apr 2023 14:57:44 -0400 Subject: [PATCH] Added object `\TgBotLib\Objects\Telegram > InputVenueMessageContent` to represent the content of a venue message to be sent as the result of an inline query. --- CHANGELOG.md | 2 +- .../Telegram/InputVenueMessageContent.php | 174 ++++++++++++++++++ 2 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 src/TgBotLib/Objects/Telegram/InputVenueMessageContent.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 62d5320..64eb6d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ This update accompanies the release of the [Telegram Bot API 6.7](https://core.t ### Added * Added object `\TgBotLib\Objects\Telegram > InputTextMessageContent` to represent the content of a text message to be sent as the result of an inline query. * Added object `\TgBotLib\Objects\Telegram > InputLocationMessageContent` to represent the content of a location message to be sent as the result of an inline query. - + * Added object `\TgBotLib\Objects\Telegram > InputVenueMessageContent` to represent the content of a venue message to be sent as the result of an inline query. ## [6.6.0] - 2023-04-10 diff --git a/src/TgBotLib/Objects/Telegram/InputVenueMessageContent.php b/src/TgBotLib/Objects/Telegram/InputVenueMessageContent.php new file mode 100644 index 0000000..e2ec0b5 --- /dev/null +++ b/src/TgBotLib/Objects/Telegram/InputVenueMessageContent.php @@ -0,0 +1,174 @@ +latitude; + } + + /** + * Longitude of the venue in degrees + * + * @return float + */ + public function getLongitude(): float + { + return $this->longitude; + } + + /** + * Name of the venue + * + * @return string + */ + public function getTitle(): string + { + return $this->title; + } + + /** + * Address of the venue + * + * @return string + */ + public function getAddress(): string + { + return $this->address; + } + + /** + * Optional. Foursquare identifier of the venue, if known + * + * @return string|null + */ + public function getFoursquareId(): ?string + { + return $this->foursquare_id; + } + + /** + * Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, + * “arts_entertainment/aquarium” or “food/icecream”.) + * + * @return string|null + */ + public function getFoursquareType(): ?string + { + return $this->foursquare_type; + } + + /** + * Optional. Google Places identifier of the venue + * + * @return string|null + */ + public function getGooglePlaceId(): ?string + { + return $this->google_place_id; + } + + /** + * Optional. Google Places type of the venue. + * + * @return string|null + * @see https://developers.google.com/places/web-service/supported_types + */ + public function getGooglePlaceType(): ?string + { + return $this->google_place_type; + } + + /** + * Returns an array representation of the object + * + * @return array + */ + public function toArray(): array + { + return [ + 'latitude' => $this->latitude, + 'longitude' => $this->longitude, + 'title' => $this->title, + 'address' => $this->address, + 'foursquare_id' => $this->foursquare_id, + 'foursquare_type' => $this->foursquare_type, + 'google_place_id' => $this->google_place_id, + 'google_place_type' => $this->google_place_type, + ]; + } + + /** + * Constructs object from an array representation + * + * @param array $data + * @return ObjectTypeInterface + */ + public static function fromArray(array $data): ObjectTypeInterface + { + $object = new self(); + + $object->latitude = (float)$data['latitude'] ?? null; + $object->longitude = (float)$data['longitude'] ?? null; + $object->title = $data['title'] ?? null; + $object->address = $data['address'] ?? null; + $object->foursquare_id = $data['foursquare_id'] ?? null; + $object->foursquare_type = $data['foursquare_type'] ?? null; + $object->google_place_id = $data['google_place_id'] ?? null; + $object->google_place_type = $data['google_place_type'] ?? null; + + return $object; + } + } \ No newline at end of file