Skip to content

Commit 189bf08

Browse files
Add shipping and bot command types documentation
1 parent 1e31714 commit 189bf08

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

types.go

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,21 +1740,42 @@ type SuccessfulPayment struct {
17401740

17411741
// ShippingQuery contains information about an incoming shipping query.
17421742
type ShippingQuery struct {
1743-
ID string `json:"id"`
1744-
From *User `json:"from"`
1745-
InvoicePayload string `json:"invoice_payload"`
1743+
// ID unique query identifier
1744+
ID string `json:"id"`
1745+
// From user who sent the query
1746+
From *User `json:"from"`
1747+
// InvoicePayload bot specified invoice payload
1748+
InvoicePayload string `json:"invoice_payload"`
1749+
// ShippingAddress user specified shipping address
17461750
ShippingAddress *ShippingAddress `json:"shipping_address"`
17471751
}
17481752

17491753
// PreCheckoutQuery contains information about an incoming pre-checkout query.
17501754
type PreCheckoutQuery struct {
1751-
ID string `json:"id"`
1752-
From *User `json:"from"`
1753-
Currency string `json:"currency"`
1754-
TotalAmount int `json:"total_amount"`
1755-
InvoicePayload string `json:"invoice_payload"`
1756-
ShippingOptionID string `json:"shipping_option_id,omitempty"`
1757-
OrderInfo *OrderInfo `json:"order_info,omitempty"`
1755+
// ID unique query identifier
1756+
ID string `json:"id"`
1757+
// From user who sent the query
1758+
From *User `json:"from"`
1759+
// Currency three-letter ISO 4217 currency code
1760+
// // (see https://core.telegram.org/bots/payments#supported-currencies)
1761+
Currency string `json:"currency"`
1762+
// TotalAmount total price in the smallest units of the currency (integer, not float/double).
1763+
// // For example, for a price of US$ 1.45 pass amount = 145.
1764+
// // See the exp parameter in currencies.json,
1765+
// // (https://core.telegram.org/bots/payments/currencies.json)
1766+
// // it shows the number of digits past the decimal point
1767+
// // for each currency (2 for the majority of currencies).
1768+
TotalAmount int `json:"total_amount"`
1769+
// InvoicePayload bot specified invoice payload
1770+
InvoicePayload string `json:"invoice_payload"`
1771+
// ShippingOptionID identifier of the shipping option chosen by the user
1772+
//
1773+
// optional
1774+
ShippingOptionID string `json:"shipping_option_id,omitempty"`
1775+
// OrderInfo order info provided by the user
1776+
//
1777+
// optional
1778+
OrderInfo *OrderInfo `json:"order_info,omitempty"`
17581779
}
17591780

17601781
// Error is an error containing extra information returned by the Telegram API.
@@ -1770,6 +1791,9 @@ func (e Error) Error() string {
17701791

17711792
// BotCommand represents a bot command.
17721793
type BotCommand struct {
1773-
Command string `json:"command"`
1794+
// Command text of the command, 1-32 characters.
1795+
// Can contain only lowercase English letters, digits and underscores.
1796+
Command string `json:"command"`
1797+
// Description of the command, 3-256 characters.
17741798
Description string `json:"description"`
17751799
}

0 commit comments

Comments
 (0)