@@ 30-59 (lines=30) @@ | ||
27 | * \brief This object represents an incoming inline query. |
|
28 | * \details When the user sends an empty query, your bot could return some default or trending results. |
|
29 | */ |
|
30 | class InlineQuery implements \ArrayAccess |
|
31 | { |
|
32 | ||
33 | /** @} */ |
|
34 | ||
35 | use EntityAccess; |
|
36 | ||
37 | /** |
|
38 | * \brief Get result's query. |
|
39 | * @return string $query If set or <code>null</code> if empty. |
|
40 | */ |
|
41 | public function getQuery() : string |
|
42 | { |
|
43 | return isset($this->container['query']) ? $this->container['query'] : null; |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * \brief Get the chat ID where the result comes from. |
|
48 | * @return $chat_id Chat ID. |
|
49 | */ |
|
50 | public function getChatID() |
|
51 | { |
|
52 | return $this->container['from']['id']; |
|
53 | } |
|
54 | ||
55 | public function getBotParameter() : array |
|
56 | { |
|
57 | return ['var' => '_inline_query_id', 'id' => $this->container['id']]; |
|
58 | } |
|
59 | } |
|
60 |
@@ 30-76 (lines=47) @@ | ||
27 | /** \class PreCheckoutQuery |
|
28 | * \brief This object represents an incoming PreCheckout query. |
|
29 | */ |
|
30 | class PreCheckoutQuery implements \ArrayAccess |
|
31 | { |
|
32 | ||
33 | /** @} */ |
|
34 | ||
35 | use EntityAccess; |
|
36 | ||
37 | /** |
|
38 | * \brief Get payload for the current invoice's checkout. |
|
39 | * @return string $payload The invoice's payload. |
|
40 | */ |
|
41 | public function getPayload() : string |
|
42 | { |
|
43 | return $this->container['invoice_payload']; |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * \brief Get chat ID of the chat where the message comes from. |
|
48 | * @return $chat_id Chat ID. |
|
49 | */ |
|
50 | public function getChatID() |
|
51 | { |
|
52 | return isset($this->container['from']) ? $this->container['from']['id'] : null; |
|
53 | } |
|
54 | ||
55 | ||
56 | /** |
|
57 | * \brief (<i>Internal</i>) Get parameter to set to the bot. |
|
58 | * \details Each time the bot receive a query, |
|
59 | * the parameter _pre_checkout_query_id will be set to the ID of this callback. |
|
60 | * @return array Array with the parameter name as "var" index, and the id in "id" index. |
|
61 | */ |
|
62 | public function getBotParameter() : array |
|
63 | { |
|
64 | return ['var' => '_pre_checkout_query_id', 'id' => $this->container['id']]; |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * \brief Get ID of this callback query. |
|
69 | * @return int $id ID of the callback. |
|
70 | */ |
|
71 | public function getID() : int |
|
72 | { |
|
73 | ||
74 | return $this->container['id']; |
|
75 | } |
|
76 | } |
|
77 |
@@ 30-74 (lines=45) @@ | ||
27 | /** \class ShippingQuery |
|
28 | * \brief This object represents an incoming Shipping query. |
|
29 | */ |
|
30 | class ShippingQuery implements \ArrayAccess |
|
31 | { |
|
32 | ||
33 | /** @} */ |
|
34 | ||
35 | use EntityAccess; |
|
36 | ||
37 | /** |
|
38 | * \brief Get payload for the current invoice's checkout. |
|
39 | * @return string $payload The invoice's payload. |
|
40 | */ |
|
41 | public function getPayload() : string |
|
42 | { |
|
43 | return $this->container['invoice_payload']; |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * \brief Get chat ID of the chat where the message comes from. |
|
48 | * @return $chat_id Chat ID. |
|
49 | */ |
|
50 | public function getChatID() |
|
51 | { |
|
52 | return isset($this->container['from']) ? $this->container['from']['id'] : null; |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * \brief (<i>Internal</i>) Get parameter to set to the bot. |
|
57 | * \details Each time the bot receive a query, |
|
58 | * the parameter _shipping_query_id will be set to the ID of this callback. |
|
59 | * @return array Array with the parameter name as "var" index, and the id in "id" index. |
|
60 | */ |
|
61 | public function getBotParameter() : array |
|
62 | { |
|
63 | return ['var' => '_shipping_query_id', 'id' => $this->container['id']]; |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * \brief Get ID of this callback query. |
|
68 | * @return int $id ID of the callback. |
|
69 | */ |
|
70 | public function getID() : int |
|
71 | { |
|
72 | return $this->container['id']; |
|
73 | } |
|
74 | } |
|
75 |