fix: omitempty for optional fields

bot-api-6.1
Oleg A 2022-08-07 01:55:52 +03:00
parent 537c005643
commit 58adc9bef1
No known key found for this signature in database
GPG Key ID: 5FE046817A9657C5
1 changed files with 38 additions and 38 deletions

View File

@ -101,19 +101,19 @@ type Update struct {
// unblocked by the user. // unblocked by the user.
// //
// optional // optional
MyChatMember *ChatMemberUpdated `json:"my_chat_member"` MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
// ChatMember is a chat member's status was updated in a chat. The bot must // ChatMember is a chat member's status was updated in a chat. The bot must
// be an administrator in the chat and must explicitly specify "chat_member" // be an administrator in the chat and must explicitly specify "chat_member"
// in the list of allowed_updates to receive these updates. // in the list of allowed_updates to receive these updates.
// //
// optional // optional
ChatMember *ChatMemberUpdated `json:"chat_member"` ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
// ChatJoinRequest is a request to join the chat has been sent. The bot must // ChatJoinRequest is a request to join the chat has been sent. The bot must
// have the can_invite_users administrator right in the chat to receive // have the can_invite_users administrator right in the chat to receive
// these updates. // these updates.
// //
// optional // optional
ChatJoinRequest *ChatJoinRequest `json:"chat_join_request"` ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
} }
// SentFrom returns the user who sent an update. Can be nil, if Telegram did not provide information // SentFrom returns the user who sent an update. Can be nil, if Telegram did not provide information
@ -325,7 +325,7 @@ type Chat struct {
// connected. Returned only in getChat. // connected. Returned only in getChat.
// //
// optional // optional
Location *ChatLocation `json:"location"` Location *ChatLocation `json:"location,omitempty"`
} }
// IsPrivate returns if the Chat is a private conversation. // IsPrivate returns if the Chat is a private conversation.
@ -553,7 +553,7 @@ type Message struct {
// settings changed in the chat. // settings changed in the chat.
// //
// optional // optional
MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed"` MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`
// MigrateToChatID is the group has been migrated to a supergroup with the specified identifier. // MigrateToChatID is the group has been migrated to a supergroup with the specified identifier.
// This number may be greater than 32 bits and some programming languages // This number may be greater than 32 bits and some programming languages
// may have difficulty/silent defects in interpreting it. // may have difficulty/silent defects in interpreting it.
@ -598,28 +598,28 @@ type Message struct {
// triggered another user's proximity alert while sharing Live Location // triggered another user's proximity alert while sharing Live Location
// //
// optional // optional
ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered"` ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`
// VideoChatScheduled is a service message: video chat scheduled. // VideoChatScheduled is a service message: video chat scheduled.
// //
// optional // optional
VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled"` VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"`
// VideoChatStarted is a service message: video chat started. // VideoChatStarted is a service message: video chat started.
// //
// optional // optional
VideoChatStarted *VideoChatStarted `json:"video_chat_started"` VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"`
// VideoChatEnded is a service message: video chat ended. // VideoChatEnded is a service message: video chat ended.
// //
// optional // optional
VideoChatEnded *VideoChatEnded `json:"video_chat_ended"` VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"`
// VideoChatParticipantsInvited is a service message: new participants // VideoChatParticipantsInvited is a service message: new participants
// invited to a video chat. // invited to a video chat.
// //
// optional // optional
VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited"` VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"`
// WebAppData is a service message: data sent by a Web App. // WebAppData is a service message: data sent by a Web App.
// //
// optional // optional
WebAppData *WebAppData `json:"web_app_data"` WebAppData *WebAppData `json:"web_app_data,omitempty"`
// ReplyMarkup is the Inline keyboard attached to the message. // ReplyMarkup is the Inline keyboard attached to the message.
// login_url buttons are represented as ordinary url buttons. // login_url buttons are represented as ordinary url buttons.
// //
@ -1196,7 +1196,7 @@ type VideoChatParticipantsInvited struct {
// New members that were invited to the voice chat. // New members that were invited to the voice chat.
// //
// optional // optional
Users []User `json:"users"` Users []User `json:"users,omitempty"`
} }
// UserProfilePhotos contains a set of user profile photos. // UserProfilePhotos contains a set of user profile photos.
@ -1538,7 +1538,7 @@ type ChatInviteLink struct {
// be approved by chat administrators. // be approved by chat administrators.
// //
// optional // optional
CreatesJoinRequest bool `json:"creates_join_request"` CreatesJoinRequest bool `json:"creates_join_request,omitempty"`
// IsPrimary is true, if the link is primary. // IsPrimary is true, if the link is primary.
IsPrimary bool `json:"is_primary"` IsPrimary bool `json:"is_primary"`
// IsRevoked is true, if the link is revoked. // IsRevoked is true, if the link is revoked.
@ -1546,22 +1546,22 @@ type ChatInviteLink struct {
// Name is the name of the invite link. // Name is the name of the invite link.
// //
// optional // optional
Name string `json:"name"` Name string `json:"name,omitempty"`
// ExpireDate is the point in time (Unix timestamp) when the link will // ExpireDate is the point in time (Unix timestamp) when the link will
// expire or has been expired. // expire or has been expired.
// //
// optional // optional
ExpireDate int `json:"expire_date"` ExpireDate int `json:"expire_date,omitempty"`
// MemberLimit is the maximum number of users that can be members of the // MemberLimit is the maximum number of users that can be members of the
// chat simultaneously after joining the chat via this invite link; 1-99999. // chat simultaneously after joining the chat via this invite link; 1-99999.
// //
// optional // optional
MemberLimit int `json:"member_limit"` MemberLimit int `json:"member_limit,omitempty"`
// PendingJoinRequestCount is the number of pending join requests created // PendingJoinRequestCount is the number of pending join requests created
// using this link. // using this link.
// //
// optional // optional
PendingJoinRequestCount int `json:"pending_join_request_count"` PendingJoinRequestCount int `json:"pending_join_request_count,omitempty"`
} }
type ChatAdministratorRights struct { type ChatAdministratorRights struct {
@ -1599,7 +1599,7 @@ type ChatMember struct {
// in the chat is hidden // in the chat is hidden
// //
// optional // optional
IsAnonymous bool `json:"is_anonymous"` IsAnonymous bool `json:"is_anonymous,omitempty"`
// UntilDate restricted and kicked only. // UntilDate restricted and kicked only.
// Date when restrictions will be lifted for this user; // Date when restrictions will be lifted for this user;
// unix time. // unix time.
@ -1618,7 +1618,7 @@ type ChatMember struct {
// any other administrator privilege. // any other administrator privilege.
// //
// optional // optional
CanManageChat bool `json:"can_manage_chat"` CanManageChat bool `json:"can_manage_chat,omitempty"`
// CanPostMessages administrators only. // CanPostMessages administrators only.
// True, if the administrator can post in the channel; // True, if the administrator can post in the channel;
// channels only. // channels only.
@ -1640,7 +1640,7 @@ type ChatMember struct {
// True, if the administrator can manage video chats. // True, if the administrator can manage video chats.
// //
// optional // optional
CanManageVideoChats bool `json:"can_manage_video_chats"` CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"`
// CanRestrictMembers administrators only. // CanRestrictMembers administrators only.
// True, if the administrator can restrict, ban or unban chat members. // True, if the administrator can restrict, ban or unban chat members.
// //
@ -1726,7 +1726,7 @@ type ChatMemberUpdated struct {
// for joining by invite link events only. // for joining by invite link events only.
// //
// optional // optional
InviteLink *ChatInviteLink `json:"invite_link"` InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
} }
// ChatJoinRequest represents a join request sent to a chat. // ChatJoinRequest represents a join request sent to a chat.
@ -1740,11 +1740,11 @@ type ChatJoinRequest struct {
// Bio of the user. // Bio of the user.
// //
// optional // optional
Bio string `json:"bio"` Bio string `json:"bio,omitempty"`
// InviteLink is the link that was used by the user to send the join request. // InviteLink is the link that was used by the user to send the join request.
// //
// optional // optional
InviteLink *ChatInviteLink `json:"invite_link"` InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
} }
// ChatPermissions describes actions that a non-administrator user is // ChatPermissions describes actions that a non-administrator user is
@ -1875,7 +1875,7 @@ type BaseInputMedia struct {
// which can be specified instead of parse_mode // which can be specified instead of parse_mode
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
} }
// InputMediaPhoto is a photo to send as part of a media group. // InputMediaPhoto is a photo to send as part of a media group.
@ -2141,7 +2141,7 @@ type InlineQuery struct {
// unless the request was sent from a secret chat // unless the request was sent from a secret chat
// //
// optional // optional
ChatType string `json:"chat_type"` ChatType string `json:"chat_type,omitempty"`
// Location sender location, only for bots that request user location. // Location sender location, only for bots that request user location.
// //
// optional // optional
@ -2654,23 +2654,23 @@ type InlineQueryResultLocation struct {
// measured in meters; 0-1500 // measured in meters; 0-1500
// //
// optional // optional
HorizontalAccuracy float64 `json:"horizontal_accuracy"` HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
// LivePeriod is the period in seconds for which the location can be // LivePeriod is the period in seconds for which the location can be
// updated, should be between 60 and 86400. // updated, should be between 60 and 86400.
// //
// optional // optional
LivePeriod int `json:"live_period"` LivePeriod int `json:"live_period,omitempty"`
// Heading is for live locations, a direction in which the user is moving, // Heading is for live locations, a direction in which the user is moving,
// in degrees. Must be between 1 and 360 if specified. // in degrees. Must be between 1 and 360 if specified.
// //
// optional // optional
Heading int `json:"heading"` Heading int `json:"heading,omitempty"`
// ProximityAlertRadius is for live locations, a maximum distance for // ProximityAlertRadius is for live locations, a maximum distance for
// proximity alerts about approaching another chat member, in meters. Must // proximity alerts about approaching another chat member, in meters. Must
// be between 1 and 100000 if specified. // be between 1 and 100000 if specified.
// //
// optional // optional
ProximityAlertRadius int `json:"proximity_alert_radius"` ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
// ReplyMarkup inline keyboard attached to the message // ReplyMarkup inline keyboard attached to the message
// //
// optional // optional
@ -2704,15 +2704,15 @@ type InlineQueryResultMPEG4GIF struct {
// Width video width // Width video width
// //
// optional // optional
Width int `json:"mpeg4_width"` Width int `json:"mpeg4_width,omitempty"`
// Height vVideo height // Height vVideo height
// //
// optional // optional
Height int `json:"mpeg4_height"` Height int `json:"mpeg4_height,omitempty"`
// Duration video duration // Duration video duration
// //
// optional // optional
Duration int `json:"mpeg4_duration"` Duration int `json:"mpeg4_duration,omitempty"`
// ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result. // ThumbURL url of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result.
ThumbURL string `json:"thumb_url"` ThumbURL string `json:"thumb_url"`
// Title for the result // Title for the result
@ -2967,7 +2967,7 @@ type SentWebAppMessage struct {
// keyboard attached to the message. // keyboard attached to the message.
// //
// optional // optional
InlineMessageID string `json:"inline_message_id"` InlineMessageID string `json:"inline_message_id,omitempty"`
} }
// InputTextMessageContent contains text for displaying // InputTextMessageContent contains text for displaying
@ -3003,7 +3003,7 @@ type InputLocationMessageContent struct {
// measured in meters; 0-1500 // measured in meters; 0-1500
// //
// optional // optional
HorizontalAccuracy float64 `json:"horizontal_accuracy"` HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
// LivePeriod is the period in seconds for which the location can be // LivePeriod is the period in seconds for which the location can be
// updated, should be between 60 and 86400 // updated, should be between 60 and 86400
// //
@ -3013,13 +3013,13 @@ type InputLocationMessageContent struct {
// in degrees. Must be between 1 and 360 if specified. // in degrees. Must be between 1 and 360 if specified.
// //
// optional // optional
Heading int `json:"heading"` Heading int `json:"heading,omitempty"`
// ProximityAlertRadius is for live locations, a maximum distance for // ProximityAlertRadius is for live locations, a maximum distance for
// proximity alerts about approaching another chat member, in meters. Must // proximity alerts about approaching another chat member, in meters. Must
// be between 1 and 100000 if specified. // be between 1 and 100000 if specified.
// //
// optional // optional
ProximityAlertRadius int `json:"proximity_alert_radius"` ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
} }
// InputVenueMessageContent contains a venue for displaying // InputVenueMessageContent contains a venue for displaying
@ -3044,11 +3044,11 @@ type InputVenueMessageContent struct {
// GooglePlaceID is the Google Places identifier of the venue // GooglePlaceID is the Google Places identifier of the venue
// //
// optional // optional
GooglePlaceID string `json:"google_place_id"` GooglePlaceID string `json:"google_place_id,omitempty"`
// GooglePlaceType is the Google Places type of the venue // GooglePlaceType is the Google Places type of the venue
// //
// optional // optional
GooglePlaceType string `json:"google_place_type"` GooglePlaceType string `json:"google_place_type,omitempty"`
} }
// InputContactMessageContent contains a contact for displaying // InputContactMessageContent contains a contact for displaying