Commit 970ec947 authored by MBoretto's avatar MBoretto

Inline Entities created

parent fa88ab2b
<?php
/*
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InlineQueryResult extends Entity
{
protected $type;
protected $id;
protected $title;
protected $parse_mode;
protected $disable_web_page_preview;
public function __construct(array $data)
{
$this->type = null;
$this->id = isset($data['id']) ? $data['id'] : null;
if (empty($this->id)) {
throw new TelegramException('id is empty!');
}
$this->title = isset($data['title']) ? $data['title'] : null;
if (empty($this->title)) {
throw new TelegramException('title is empty!');
}
$this->disable_web_page_preview = isset($data['disable_webpage_preview']) ? $data['disable_webpage_preview'] : null;
$this->parse_mode = isset($data['parse_mode']) ? $data['parse_mode'] : null;
}
public function getType()
{
return $this->type;
}
public function getId()
{
return $this->id;
}
public function getTitle()
{
return $this->title;
}
public function getParseMode()
{
return $this->parse_mode;
}
public function getDisableWebPagePreview()
{
return $this->disable_web_page_preview;
}
}
<?php
/*
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InlineQueryResultGif extends InlineQueryResult
{
protected $gif_url;
protected $gif_width;
protected $gif_height;
protected $thumb_url;
protected $caption;
protected $message_text;
public function __construct(array $data)
{
parent::__construct($data);
$this->type = 'gif';
$this->gif_url = isset($data['gif_url']) ? $data['gif_url'] : null;
if (empty($this->gif_url)) {
throw new TelegramException('gif_url is empty!');
}
$this->gif_width = isset($data['gif_width']) ? $data['gif_width'] : null;
$this->gif_height = isset($data['gif_height']) ? $data['gif_height'] : null;
$this->thumb_url = isset($data['thumb_url']) ? $data['thumb_url'] : null;
if (empty($this->thumb_url)) {
throw new TelegramException('thumb_url is empty!');
}
$this->caption = isset($data['caption']) ? $data['caption'] : null;
$this->message_text = isset($data['message_text']) ? $data['message_text'] : null;
}
public function getGifUrl()
{
return $this->gif_url;
}
public function getGifWidth()
{
return $this->gif_width;
}
public function getGifHeight()
{
return $this->gif_height;
}
public function getThumbUrl()
{
return $this->thumb_url;
}
public function getCaption()
{
return $this->caption;
}
public function getMessageText()
{
return $this->message_text;
}
}
<?php
/*
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InlineQueryResultMpeg4Gif extends InlineQueryResult
{
protected $mpeg4_url;
protected $mpeg4_width;
protected $mpeg4_height;
protected $thumb_url;
protected $caption;
protected $message_text;
public function __construct(array $data)
{
parent::__construct($data);
$this->type = 'mpeg4_gif';
$this->mpeg4_url = isset($data['mpeg4_url']) ? $data['mpeg4_url'] : null;
if (empty($this->mpeg4_url)) {
throw new TelegramException('mpeg4_url is empty!');
}
$this->mpeg4_width = isset($data['mpeg4_width']) ? $data['mpeg4_width'] : null;
$this->mpeg4_height = isset($data['mpeg4_height']) ? $data['mpeg4_height'] : null;
$this->thumb_url = isset($data['thumb_url']) ? $data['thumb_url'] : null;
if (empty($this->thumb_url)) {
throw new TelegramException('thumb_url is empty!');
}
$this->caption = isset($data['caption']) ? $data['caption'] : null;
$this->message_text = isset($data['message_text']) ? $data['message_text'] : null;
}
public function getMpeg4Url()
{
return $this->mpeg4_url;
}
public function getMpeg4Width()
{
return $this->mpeg4_width;
}
public function getMpeg4Height()
{
return $this->mpeg4_height;
}
public function getThumbUrl()
{
return $this->thumb_url;
}
public function getCaption()
{
return $this->caption;
}
public function getMessageText()
{
return $this->message_text;
}
}
<?php
/*
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InlineQueryResultPhoto extends InlineQueryResult
{
protected $photo_url;
protected $photo_width;
protected $photo_height;
protected $thumb_url;
protected $description;
protected $caption;
protected $message_text;
public function __construct(array $data)
{
parent::__construct($data);
$this->type = 'photo';
$this->photo_url = isset($data['photo_url']) ? $data['photo_url'] : null;
if (empty($this->photo_url)) {
throw new TelegramException('photo_url is empty!');
}
$this->photo_width = isset($data['photo_width']) ? $data['photo_width'] : null;
$this->photo_height = isset($data['photo_height']) ? $data['photo_height'] : null;
$this->thumb_url = isset($data['thumb_url']) ? $data['thumb_url'] : null;
if (empty($this->thumb_url)) {
throw new TelegramException('thumb_url is empty!');
}
$this->description = isset($data['description']) ? $data['description'] : null;
$this->caption = isset($data['caption']) ? $data['caption'] : null;
$this->message_text = isset($data['message_text']) ? $data['message_text'] : null;
}
public function getPhotoUrl()
{
return $this->photo_url;
}
public function getPhotoWidth()
{
return $this->photo_width;
}
public function getPhotoHeight()
{
return $this->photo_height;
}
public function getThumbUrl()
{
return $this->thumb_url;
}
public function getDescription()
{
return $this->description;
}
public function getCaption()
{
return $this->caption;
}
public function getMessageText()
{
return $this->message_text;
}
}
<?php
/*
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Longman\TelegramBot\Entities;
use Longman\TelegramBot\Exception\TelegramException;
class InlineQueryResultVideo extends InlineQueryResult
{
protected $video_url;
protected $mime_type;
protected $message_text;
protected $video_width;
protected $video_height;
protected $video_duration;
public function __construct(array $data)
{
parent::__construct($data);
$this->type = 'video';
$this->video_url = isset($data['video_url']) ? $data['video_url'] : null;
if (empty($this->video_url)) {
throw new TelegramException('video_url is empty!');
}
$this->mime_type = isset($data['mime_type']) ? $data['mime_type'] : null;
if (empty($this->mime_type)) {
throw new TelegramException('mime_type is empty!');
}
$this->message_text = isset($data['message_text']) ? $data['message_text'] : null;
if (empty($this->message_text)) {
throw new TelegramException('message_text is empty!');
}
$this->video_width = isset($data['video_width']) ? $data['video_width'] : null;
$this->video_height = isset($data['video_height']) ? $data['video_height'] : null;
$this->video_duration = isset($data['video_duration']) ? $data['video_duration'] : null;
}
public function getVideoUrl()
{
return $this->video_url;
}
public function getMimeType()
{
return $this->mime_type;
}
public function getMessageText()
{
return $this->message_text;
}
public function getVideoWidth()
{
return $this->video_width;
}
public function getVideoHeight()
{
return $this->video_height;
}
public function getVideoDuration()
{
return $this->video_duration;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment