go-tdlib/client/type.go

24177 lines
660 KiB
Go
Raw Normal View History

2018-08-30 14:55:42 +00:00
// AUTOGENERATED
package client
import (
2018-10-23 12:38:10 +00:00
"encoding/json"
2018-08-30 14:55:42 +00:00
)
const (
2018-10-23 12:38:10 +00:00
ClassAuthenticationCodeType = "AuthenticationCodeType"
ClassAuthorizationState = "AuthorizationState"
ClassInputFile = "InputFile"
ClassMaskPoint = "MaskPoint"
ClassLinkState = "LinkState"
ClassUserType = "UserType"
ClassChatMemberStatus = "ChatMemberStatus"
ClassChatMembersFilter = "ChatMembersFilter"
ClassSupergroupMembersFilter = "SupergroupMembersFilter"
ClassSecretChatState = "SecretChatState"
2019-06-07 10:56:06 +00:00
ClassMessageForwardOrigin = "MessageForwardOrigin"
2018-10-23 12:38:10 +00:00
ClassMessageSendingState = "MessageSendingState"
ClassNotificationSettingsScope = "NotificationSettingsScope"
ClassChatType = "ChatType"
ClassKeyboardButtonType = "KeyboardButtonType"
ClassInlineKeyboardButtonType = "InlineKeyboardButtonType"
ClassReplyMarkup = "ReplyMarkup"
ClassRichText = "RichText"
2019-06-07 10:56:06 +00:00
ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment"
ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment"
2018-10-23 12:38:10 +00:00
ClassPageBlock = "PageBlock"
ClassInputCredentials = "InputCredentials"
ClassPassportElementType = "PassportElementType"
ClassPassportElement = "PassportElement"
ClassInputPassportElement = "InputPassportElement"
ClassPassportElementErrorSource = "PassportElementErrorSource"
ClassInputPassportElementErrorSource = "InputPassportElementErrorSource"
ClassMessageContent = "MessageContent"
ClassTextEntityType = "TextEntityType"
ClassInputMessageContent = "InputMessageContent"
ClassSearchMessagesFilter = "SearchMessagesFilter"
ClassChatAction = "ChatAction"
ClassUserStatus = "UserStatus"
ClassCallDiscardReason = "CallDiscardReason"
ClassCallState = "CallState"
2019-09-10 12:36:54 +00:00
ClassCallProblem = "CallProblem"
2018-10-23 12:38:10 +00:00
ClassInputInlineQueryResult = "InputInlineQueryResult"
ClassInlineQueryResult = "InlineQueryResult"
ClassCallbackQueryPayload = "CallbackQueryPayload"
ClassChatEventAction = "ChatEventAction"
ClassLanguagePackStringValue = "LanguagePackStringValue"
ClassDeviceToken = "DeviceToken"
2019-09-10 12:36:54 +00:00
ClassBackgroundType = "BackgroundType"
ClassInputBackground = "InputBackground"
2018-10-23 12:38:10 +00:00
ClassCheckChatUsernameResult = "CheckChatUsernameResult"
2019-06-07 10:56:06 +00:00
ClassPushMessageContent = "PushMessageContent"
ClassNotificationType = "NotificationType"
ClassNotificationGroupType = "NotificationGroupType"
2018-10-23 12:38:10 +00:00
ClassOptionValue = "OptionValue"
2019-06-07 10:56:06 +00:00
ClassJsonValue = "JsonValue"
2018-10-23 12:38:10 +00:00
ClassUserPrivacySettingRule = "UserPrivacySettingRule"
ClassUserPrivacySetting = "UserPrivacySetting"
ClassChatReportReason = "ChatReportReason"
ClassFileType = "FileType"
ClassNetworkType = "NetworkType"
ClassNetworkStatisticsEntry = "NetworkStatisticsEntry"
ClassConnectionState = "ConnectionState"
ClassTopChatCategory = "TopChatCategory"
ClassTMeUrlType = "TMeUrlType"
ClassTextParseMode = "TextParseMode"
ClassProxyType = "ProxyType"
ClassUpdate = "Update"
2019-06-07 10:56:06 +00:00
ClassLogStream = "LogStream"
2018-10-23 12:38:10 +00:00
ClassError = "Error"
ClassOk = "Ok"
ClassTdlibParameters = "TdlibParameters"
ClassAuthenticationCodeInfo = "AuthenticationCodeInfo"
ClassEmailAddressAuthenticationCodeInfo = "EmailAddressAuthenticationCodeInfo"
ClassTextEntity = "TextEntity"
ClassTextEntities = "TextEntities"
ClassFormattedText = "FormattedText"
ClassTermsOfService = "TermsOfService"
ClassPasswordState = "PasswordState"
ClassRecoveryEmailAddress = "RecoveryEmailAddress"
ClassTemporaryPasswordState = "TemporaryPasswordState"
ClassLocalFile = "LocalFile"
ClassRemoteFile = "RemoteFile"
ClassFile = "File"
ClassPhotoSize = "PhotoSize"
2019-09-10 12:36:54 +00:00
ClassMinithumbnail = "Minithumbnail"
2018-10-23 12:38:10 +00:00
ClassMaskPosition = "MaskPosition"
2019-06-07 10:56:06 +00:00
ClassPollOption = "PollOption"
2018-10-23 12:38:10 +00:00
ClassAnimation = "Animation"
ClassAudio = "Audio"
ClassDocument = "Document"
ClassPhoto = "Photo"
ClassSticker = "Sticker"
ClassVideo = "Video"
ClassVideoNote = "VideoNote"
ClassVoiceNote = "VoiceNote"
ClassContact = "Contact"
ClassLocation = "Location"
ClassVenue = "Venue"
ClassGame = "Game"
2019-06-07 10:56:06 +00:00
ClassPoll = "Poll"
2018-10-23 12:38:10 +00:00
ClassProfilePhoto = "ProfilePhoto"
ClassChatPhoto = "ChatPhoto"
ClassBotCommand = "BotCommand"
ClassBotInfo = "BotInfo"
ClassUser = "User"
ClassUserFullInfo = "UserFullInfo"
2019-06-07 10:56:06 +00:00
ClassUserProfilePhoto = "UserProfilePhoto"
2018-10-23 12:38:10 +00:00
ClassUserProfilePhotos = "UserProfilePhotos"
ClassUsers = "Users"
2019-09-10 12:36:54 +00:00
ClassChatPermissions = "ChatPermissions"
2018-10-23 12:38:10 +00:00
ClassChatMember = "ChatMember"
ClassChatMembers = "ChatMembers"
ClassBasicGroup = "BasicGroup"
ClassBasicGroupFullInfo = "BasicGroupFullInfo"
ClassSupergroup = "Supergroup"
ClassSupergroupFullInfo = "SupergroupFullInfo"
ClassSecretChat = "SecretChat"
2019-06-07 10:56:06 +00:00
ClassMessageForwardInfo = "MessageForwardInfo"
2018-10-23 12:38:10 +00:00
ClassMessage = "Message"
ClassMessages = "Messages"
ClassFoundMessages = "FoundMessages"
ClassChatNotificationSettings = "ChatNotificationSettings"
ClassScopeNotificationSettings = "ScopeNotificationSettings"
ClassDraftMessage = "DraftMessage"
ClassChat = "Chat"
ClassChats = "Chats"
ClassChatInviteLink = "ChatInviteLink"
ClassChatInviteLinkInfo = "ChatInviteLinkInfo"
ClassKeyboardButton = "KeyboardButton"
ClassInlineKeyboardButton = "InlineKeyboardButton"
2019-06-07 10:56:06 +00:00
ClassPageBlockCaption = "PageBlockCaption"
ClassPageBlockListItem = "PageBlockListItem"
ClassPageBlockTableCell = "PageBlockTableCell"
ClassPageBlockRelatedArticle = "PageBlockRelatedArticle"
2018-10-23 12:38:10 +00:00
ClassWebPageInstantView = "WebPageInstantView"
ClassWebPage = "WebPage"
ClassAddress = "Address"
ClassLabeledPricePart = "LabeledPricePart"
ClassInvoice = "Invoice"
ClassOrderInfo = "OrderInfo"
ClassShippingOption = "ShippingOption"
ClassSavedCredentials = "SavedCredentials"
ClassPaymentsProviderStripe = "PaymentsProviderStripe"
ClassPaymentForm = "PaymentForm"
ClassValidatedOrderInfo = "ValidatedOrderInfo"
ClassPaymentResult = "PaymentResult"
ClassPaymentReceipt = "PaymentReceipt"
ClassDatedFile = "DatedFile"
ClassDate = "Date"
ClassPersonalDetails = "PersonalDetails"
ClassIdentityDocument = "IdentityDocument"
ClassInputIdentityDocument = "InputIdentityDocument"
ClassPersonalDocument = "PersonalDocument"
ClassInputPersonalDocument = "InputPersonalDocument"
ClassPassportElements = "PassportElements"
ClassPassportElementError = "PassportElementError"
ClassPassportSuitableElement = "PassportSuitableElement"
ClassPassportRequiredElement = "PassportRequiredElement"
ClassPassportAuthorizationForm = "PassportAuthorizationForm"
2019-06-07 10:56:06 +00:00
ClassPassportElementsWithErrors = "PassportElementsWithErrors"
2018-10-23 12:38:10 +00:00
ClassEncryptedCredentials = "EncryptedCredentials"
ClassEncryptedPassportElement = "EncryptedPassportElement"
ClassInputPassportElementError = "InputPassportElementError"
ClassInputThumbnail = "InputThumbnail"
ClassStickers = "Stickers"
2019-09-10 12:36:54 +00:00
ClassEmojis = "Emojis"
2018-10-23 12:38:10 +00:00
ClassStickerSet = "StickerSet"
ClassStickerSetInfo = "StickerSetInfo"
ClassStickerSets = "StickerSets"
ClassCallProtocol = "CallProtocol"
ClassCallConnection = "CallConnection"
ClassCallId = "CallId"
ClassCall = "Call"
2019-09-10 12:36:54 +00:00
ClassPhoneNumberAuthenticationSettings = "PhoneNumberAuthenticationSettings"
2018-10-23 12:38:10 +00:00
ClassAnimations = "Animations"
ClassImportedContacts = "ImportedContacts"
2019-06-07 10:56:06 +00:00
ClassHttpUrl = "HttpUrl"
2018-10-23 12:38:10 +00:00
ClassInlineQueryResults = "InlineQueryResults"
ClassCallbackQueryAnswer = "CallbackQueryAnswer"
ClassCustomRequestResult = "CustomRequestResult"
ClassGameHighScore = "GameHighScore"
ClassGameHighScores = "GameHighScores"
ClassChatEvent = "ChatEvent"
ClassChatEvents = "ChatEvents"
ClassChatEventLogFilters = "ChatEventLogFilters"
ClassLanguagePackString = "LanguagePackString"
ClassLanguagePackStrings = "LanguagePackStrings"
ClassLanguagePackInfo = "LanguagePackInfo"
ClassLocalizationTargetInfo = "LocalizationTargetInfo"
2019-06-07 10:56:06 +00:00
ClassPushReceiverId = "PushReceiverId"
2019-09-10 12:36:54 +00:00
ClassBackground = "Background"
ClassBackgrounds = "Backgrounds"
2018-10-23 12:38:10 +00:00
ClassHashtags = "Hashtags"
2019-06-07 10:56:06 +00:00
ClassNotification = "Notification"
ClassNotificationGroup = "NotificationGroup"
ClassJsonObjectMember = "JsonObjectMember"
2018-10-23 12:38:10 +00:00
ClassUserPrivacySettingRules = "UserPrivacySettingRules"
ClassAccountTtl = "AccountTtl"
ClassSession = "Session"
ClassSessions = "Sessions"
ClassConnectedWebsite = "ConnectedWebsite"
ClassConnectedWebsites = "ConnectedWebsites"
ClassChatReportSpamState = "ChatReportSpamState"
ClassPublicMessageLink = "PublicMessageLink"
2019-09-10 12:36:54 +00:00
ClassMessageLinkInfo = "MessageLinkInfo"
2019-06-07 10:56:06 +00:00
ClassFilePart = "FilePart"
2018-10-23 12:38:10 +00:00
ClassStorageStatisticsByFileType = "StorageStatisticsByFileType"
ClassStorageStatisticsByChat = "StorageStatisticsByChat"
ClassStorageStatistics = "StorageStatistics"
ClassStorageStatisticsFast = "StorageStatisticsFast"
2019-06-07 10:56:06 +00:00
ClassDatabaseStatistics = "DatabaseStatistics"
2018-10-23 12:38:10 +00:00
ClassNetworkStatistics = "NetworkStatistics"
2019-09-10 12:36:54 +00:00
ClassAutoDownloadSettings = "AutoDownloadSettings"
ClassAutoDownloadSettingsPresets = "AutoDownloadSettingsPresets"
2018-10-23 12:38:10 +00:00
ClassTMeUrl = "TMeUrl"
ClassTMeUrls = "TMeUrls"
ClassCount = "Count"
ClassText = "Text"
ClassSeconds = "Seconds"
ClassDeepLinkInfo = "DeepLinkInfo"
ClassProxy = "Proxy"
ClassProxies = "Proxies"
ClassInputSticker = "InputSticker"
2019-06-07 10:56:06 +00:00
ClassUpdates = "Updates"
ClassLogVerbosityLevel = "LogVerbosityLevel"
ClassLogTags = "LogTags"
2018-10-23 12:38:10 +00:00
ClassTestInt = "TestInt"
ClassTestString = "TestString"
ClassTestBytes = "TestBytes"
ClassTestVectorInt = "TestVectorInt"
ClassTestVectorIntObject = "TestVectorIntObject"
ClassTestVectorString = "TestVectorString"
ClassTestVectorStringObject = "TestVectorStringObject"
2018-08-30 14:55:42 +00:00
)
const (
2018-10-23 12:38:10 +00:00
TypeError = "error"
TypeOk = "ok"
TypeTdlibParameters = "tdlibParameters"
TypeAuthenticationCodeTypeTelegramMessage = "authenticationCodeTypeTelegramMessage"
TypeAuthenticationCodeTypeSms = "authenticationCodeTypeSms"
TypeAuthenticationCodeTypeCall = "authenticationCodeTypeCall"
TypeAuthenticationCodeTypeFlashCall = "authenticationCodeTypeFlashCall"
TypeAuthenticationCodeInfo = "authenticationCodeInfo"
TypeEmailAddressAuthenticationCodeInfo = "emailAddressAuthenticationCodeInfo"
TypeTextEntity = "textEntity"
TypeTextEntities = "textEntities"
TypeFormattedText = "formattedText"
TypeTermsOfService = "termsOfService"
TypeAuthorizationStateWaitTdlibParameters = "authorizationStateWaitTdlibParameters"
TypeAuthorizationStateWaitEncryptionKey = "authorizationStateWaitEncryptionKey"
TypeAuthorizationStateWaitPhoneNumber = "authorizationStateWaitPhoneNumber"
TypeAuthorizationStateWaitCode = "authorizationStateWaitCode"
2019-09-10 12:36:54 +00:00
TypeAuthorizationStateWaitRegistration = "authorizationStateWaitRegistration"
2018-10-23 12:38:10 +00:00
TypeAuthorizationStateWaitPassword = "authorizationStateWaitPassword"
TypeAuthorizationStateReady = "authorizationStateReady"
TypeAuthorizationStateLoggingOut = "authorizationStateLoggingOut"
TypeAuthorizationStateClosing = "authorizationStateClosing"
TypeAuthorizationStateClosed = "authorizationStateClosed"
TypePasswordState = "passwordState"
TypeRecoveryEmailAddress = "recoveryEmailAddress"
TypeTemporaryPasswordState = "temporaryPasswordState"
TypeLocalFile = "localFile"
TypeRemoteFile = "remoteFile"
TypeFile = "file"
TypeInputFileId = "inputFileId"
TypeInputFileRemote = "inputFileRemote"
TypeInputFileLocal = "inputFileLocal"
TypeInputFileGenerated = "inputFileGenerated"
TypePhotoSize = "photoSize"
2019-09-10 12:36:54 +00:00
TypeMinithumbnail = "minithumbnail"
2018-10-23 12:38:10 +00:00
TypeMaskPointForehead = "maskPointForehead"
TypeMaskPointEyes = "maskPointEyes"
TypeMaskPointMouth = "maskPointMouth"
TypeMaskPointChin = "maskPointChin"
TypeMaskPosition = "maskPosition"
2019-06-07 10:56:06 +00:00
TypePollOption = "pollOption"
2018-10-23 12:38:10 +00:00
TypeAnimation = "animation"
TypeAudio = "audio"
TypeDocument = "document"
TypePhoto = "photo"
TypeSticker = "sticker"
TypeVideo = "video"
TypeVideoNote = "videoNote"
TypeVoiceNote = "voiceNote"
TypeContact = "contact"
TypeLocation = "location"
TypeVenue = "venue"
TypeGame = "game"
2019-06-07 10:56:06 +00:00
TypePoll = "poll"
2018-10-23 12:38:10 +00:00
TypeProfilePhoto = "profilePhoto"
TypeChatPhoto = "chatPhoto"
TypeLinkStateNone = "linkStateNone"
TypeLinkStateKnowsPhoneNumber = "linkStateKnowsPhoneNumber"
TypeLinkStateIsContact = "linkStateIsContact"
TypeUserTypeRegular = "userTypeRegular"
TypeUserTypeDeleted = "userTypeDeleted"
TypeUserTypeBot = "userTypeBot"
TypeUserTypeUnknown = "userTypeUnknown"
TypeBotCommand = "botCommand"
TypeBotInfo = "botInfo"
TypeUser = "user"
TypeUserFullInfo = "userFullInfo"
2019-06-07 10:56:06 +00:00
TypeUserProfilePhoto = "userProfilePhoto"
2018-10-23 12:38:10 +00:00
TypeUserProfilePhotos = "userProfilePhotos"
TypeUsers = "users"
2019-09-10 12:36:54 +00:00
TypeChatPermissions = "chatPermissions"
2018-10-23 12:38:10 +00:00
TypeChatMemberStatusCreator = "chatMemberStatusCreator"
TypeChatMemberStatusAdministrator = "chatMemberStatusAdministrator"
TypeChatMemberStatusMember = "chatMemberStatusMember"
TypeChatMemberStatusRestricted = "chatMemberStatusRestricted"
TypeChatMemberStatusLeft = "chatMemberStatusLeft"
TypeChatMemberStatusBanned = "chatMemberStatusBanned"
TypeChatMember = "chatMember"
TypeChatMembers = "chatMembers"
2019-09-10 12:36:54 +00:00
TypeChatMembersFilterContacts = "chatMembersFilterContacts"
2018-10-23 12:38:10 +00:00
TypeChatMembersFilterAdministrators = "chatMembersFilterAdministrators"
TypeChatMembersFilterMembers = "chatMembersFilterMembers"
TypeChatMembersFilterRestricted = "chatMembersFilterRestricted"
TypeChatMembersFilterBanned = "chatMembersFilterBanned"
TypeChatMembersFilterBots = "chatMembersFilterBots"
TypeSupergroupMembersFilterRecent = "supergroupMembersFilterRecent"
2019-09-10 12:36:54 +00:00
TypeSupergroupMembersFilterContacts = "supergroupMembersFilterContacts"
2018-10-23 12:38:10 +00:00
TypeSupergroupMembersFilterAdministrators = "supergroupMembersFilterAdministrators"
TypeSupergroupMembersFilterSearch = "supergroupMembersFilterSearch"
TypeSupergroupMembersFilterRestricted = "supergroupMembersFilterRestricted"
TypeSupergroupMembersFilterBanned = "supergroupMembersFilterBanned"
TypeSupergroupMembersFilterBots = "supergroupMembersFilterBots"
TypeBasicGroup = "basicGroup"
TypeBasicGroupFullInfo = "basicGroupFullInfo"
TypeSupergroup = "supergroup"
TypeSupergroupFullInfo = "supergroupFullInfo"
TypeSecretChatStatePending = "secretChatStatePending"
TypeSecretChatStateReady = "secretChatStateReady"
TypeSecretChatStateClosed = "secretChatStateClosed"
TypeSecretChat = "secretChat"
2019-06-07 10:56:06 +00:00
TypeMessageForwardOriginUser = "messageForwardOriginUser"
TypeMessageForwardOriginHiddenUser = "messageForwardOriginHiddenUser"
TypeMessageForwardOriginChannel = "messageForwardOriginChannel"
TypeMessageForwardInfo = "messageForwardInfo"
2018-10-23 12:38:10 +00:00
TypeMessageSendingStatePending = "messageSendingStatePending"
TypeMessageSendingStateFailed = "messageSendingStateFailed"
TypeMessage = "message"
TypeMessages = "messages"
TypeFoundMessages = "foundMessages"
TypeNotificationSettingsScopePrivateChats = "notificationSettingsScopePrivateChats"
TypeNotificationSettingsScopeGroupChats = "notificationSettingsScopeGroupChats"
2019-06-07 10:56:06 +00:00
TypeNotificationSettingsScopeChannelChats = "notificationSettingsScopeChannelChats"
2018-10-23 12:38:10 +00:00
TypeChatNotificationSettings = "chatNotificationSettings"
TypeScopeNotificationSettings = "scopeNotificationSettings"
TypeDraftMessage = "draftMessage"
TypeChatTypePrivate = "chatTypePrivate"
TypeChatTypeBasicGroup = "chatTypeBasicGroup"
TypeChatTypeSupergroup = "chatTypeSupergroup"
TypeChatTypeSecret = "chatTypeSecret"
TypeChat = "chat"
TypeChats = "chats"
TypeChatInviteLink = "chatInviteLink"
TypeChatInviteLinkInfo = "chatInviteLinkInfo"
TypeKeyboardButtonTypeText = "keyboardButtonTypeText"
TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber"
TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation"
TypeKeyboardButton = "keyboardButton"
TypeInlineKeyboardButtonTypeUrl = "inlineKeyboardButtonTypeUrl"
2019-09-10 12:36:54 +00:00
TypeInlineKeyboardButtonTypeLoginUrl = "inlineKeyboardButtonTypeLoginUrl"
2018-10-23 12:38:10 +00:00
TypeInlineKeyboardButtonTypeCallback = "inlineKeyboardButtonTypeCallback"
TypeInlineKeyboardButtonTypeCallbackGame = "inlineKeyboardButtonTypeCallbackGame"
TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline"
TypeInlineKeyboardButtonTypeBuy = "inlineKeyboardButtonTypeBuy"
TypeInlineKeyboardButton = "inlineKeyboardButton"
TypeReplyMarkupRemoveKeyboard = "replyMarkupRemoveKeyboard"
TypeReplyMarkupForceReply = "replyMarkupForceReply"
TypeReplyMarkupShowKeyboard = "replyMarkupShowKeyboard"
TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard"
TypeRichTextPlain = "richTextPlain"
TypeRichTextBold = "richTextBold"
TypeRichTextItalic = "richTextItalic"
TypeRichTextUnderline = "richTextUnderline"
TypeRichTextStrikethrough = "richTextStrikethrough"
TypeRichTextFixed = "richTextFixed"
TypeRichTextUrl = "richTextUrl"
TypeRichTextEmailAddress = "richTextEmailAddress"
2019-06-07 10:56:06 +00:00
TypeRichTextSubscript = "richTextSubscript"
TypeRichTextSuperscript = "richTextSuperscript"
TypeRichTextMarked = "richTextMarked"
TypeRichTextPhoneNumber = "richTextPhoneNumber"
TypeRichTextIcon = "richTextIcon"
TypeRichTextAnchor = "richTextAnchor"
2018-10-23 12:38:10 +00:00
TypeRichTexts = "richTexts"
2019-06-07 10:56:06 +00:00
TypePageBlockCaption = "pageBlockCaption"
TypePageBlockListItem = "pageBlockListItem"
TypePageBlockHorizontalAlignmentLeft = "pageBlockHorizontalAlignmentLeft"
TypePageBlockHorizontalAlignmentCenter = "pageBlockHorizontalAlignmentCenter"
TypePageBlockHorizontalAlignmentRight = "pageBlockHorizontalAlignmentRight"
TypePageBlockVerticalAlignmentTop = "pageBlockVerticalAlignmentTop"
TypePageBlockVerticalAlignmentMiddle = "pageBlockVerticalAlignmentMiddle"
TypePageBlockVerticalAlignmentBottom = "pageBlockVerticalAlignmentBottom"
TypePageBlockTableCell = "pageBlockTableCell"
TypePageBlockRelatedArticle = "pageBlockRelatedArticle"
2018-10-23 12:38:10 +00:00
TypePageBlockTitle = "pageBlockTitle"
TypePageBlockSubtitle = "pageBlockSubtitle"
TypePageBlockAuthorDate = "pageBlockAuthorDate"
TypePageBlockHeader = "pageBlockHeader"
TypePageBlockSubheader = "pageBlockSubheader"
2019-06-07 10:56:06 +00:00
TypePageBlockKicker = "pageBlockKicker"
2018-10-23 12:38:10 +00:00
TypePageBlockParagraph = "pageBlockParagraph"
TypePageBlockPreformatted = "pageBlockPreformatted"
TypePageBlockFooter = "pageBlockFooter"
TypePageBlockDivider = "pageBlockDivider"
TypePageBlockAnchor = "pageBlockAnchor"
TypePageBlockList = "pageBlockList"
TypePageBlockBlockQuote = "pageBlockBlockQuote"
TypePageBlockPullQuote = "pageBlockPullQuote"
TypePageBlockAnimation = "pageBlockAnimation"
TypePageBlockAudio = "pageBlockAudio"
TypePageBlockPhoto = "pageBlockPhoto"
TypePageBlockVideo = "pageBlockVideo"
TypePageBlockCover = "pageBlockCover"
TypePageBlockEmbedded = "pageBlockEmbedded"
TypePageBlockEmbeddedPost = "pageBlockEmbeddedPost"
TypePageBlockCollage = "pageBlockCollage"
TypePageBlockSlideshow = "pageBlockSlideshow"
TypePageBlockChatLink = "pageBlockChatLink"
2019-06-07 10:56:06 +00:00
TypePageBlockTable = "pageBlockTable"
TypePageBlockDetails = "pageBlockDetails"
TypePageBlockRelatedArticles = "pageBlockRelatedArticles"
TypePageBlockMap = "pageBlockMap"
2018-10-23 12:38:10 +00:00
TypeWebPageInstantView = "webPageInstantView"
TypeWebPage = "webPage"
TypeAddress = "address"
TypeLabeledPricePart = "labeledPricePart"
TypeInvoice = "invoice"
TypeOrderInfo = "orderInfo"
TypeShippingOption = "shippingOption"
TypeSavedCredentials = "savedCredentials"
TypeInputCredentialsSaved = "inputCredentialsSaved"
TypeInputCredentialsNew = "inputCredentialsNew"
TypeInputCredentialsAndroidPay = "inputCredentialsAndroidPay"
TypeInputCredentialsApplePay = "inputCredentialsApplePay"
TypePaymentsProviderStripe = "paymentsProviderStripe"
TypePaymentForm = "paymentForm"
TypeValidatedOrderInfo = "validatedOrderInfo"
TypePaymentResult = "paymentResult"
TypePaymentReceipt = "paymentReceipt"
TypeDatedFile = "datedFile"
TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails"
TypePassportElementTypePassport = "passportElementTypePassport"
TypePassportElementTypeDriverLicense = "passportElementTypeDriverLicense"
TypePassportElementTypeIdentityCard = "passportElementTypeIdentityCard"
TypePassportElementTypeInternalPassport = "passportElementTypeInternalPassport"
TypePassportElementTypeAddress = "passportElementTypeAddress"
TypePassportElementTypeUtilityBill = "passportElementTypeUtilityBill"
TypePassportElementTypeBankStatement = "passportElementTypeBankStatement"
TypePassportElementTypeRentalAgreement = "passportElementTypeRentalAgreement"
TypePassportElementTypePassportRegistration = "passportElementTypePassportRegistration"
TypePassportElementTypeTemporaryRegistration = "passportElementTypeTemporaryRegistration"
TypePassportElementTypePhoneNumber = "passportElementTypePhoneNumber"
TypePassportElementTypeEmailAddress = "passportElementTypeEmailAddress"
TypeDate = "date"
TypePersonalDetails = "personalDetails"
TypeIdentityDocument = "identityDocument"
TypeInputIdentityDocument = "inputIdentityDocument"
TypePersonalDocument = "personalDocument"
TypeInputPersonalDocument = "inputPersonalDocument"
TypePassportElementPersonalDetails = "passportElementPersonalDetails"
TypePassportElementPassport = "passportElementPassport"
TypePassportElementDriverLicense = "passportElementDriverLicense"
TypePassportElementIdentityCard = "passportElementIdentityCard"
TypePassportElementInternalPassport = "passportElementInternalPassport"
TypePassportElementAddress = "passportElementAddress"
TypePassportElementUtilityBill = "passportElementUtilityBill"
TypePassportElementBankStatement = "passportElementBankStatement"
TypePassportElementRentalAgreement = "passportElementRentalAgreement"
TypePassportElementPassportRegistration = "passportElementPassportRegistration"
TypePassportElementTemporaryRegistration = "passportElementTemporaryRegistration"
TypePassportElementPhoneNumber = "passportElementPhoneNumber"
TypePassportElementEmailAddress = "passportElementEmailAddress"
TypeInputPassportElementPersonalDetails = "inputPassportElementPersonalDetails"
TypeInputPassportElementPassport = "inputPassportElementPassport"
TypeInputPassportElementDriverLicense = "inputPassportElementDriverLicense"
TypeInputPassportElementIdentityCard = "inputPassportElementIdentityCard"
TypeInputPassportElementInternalPassport = "inputPassportElementInternalPassport"
TypeInputPassportElementAddress = "inputPassportElementAddress"
TypeInputPassportElementUtilityBill = "inputPassportElementUtilityBill"
TypeInputPassportElementBankStatement = "inputPassportElementBankStatement"
TypeInputPassportElementRentalAgreement = "inputPassportElementRentalAgreement"
TypeInputPassportElementPassportRegistration = "inputPassportElementPassportRegistration"
TypeInputPassportElementTemporaryRegistration = "inputPassportElementTemporaryRegistration"
TypeInputPassportElementPhoneNumber = "inputPassportElementPhoneNumber"
TypeInputPassportElementEmailAddress = "inputPassportElementEmailAddress"
TypePassportElements = "passportElements"
TypePassportElementErrorSourceUnspecified = "passportElementErrorSourceUnspecified"
TypePassportElementErrorSourceDataField = "passportElementErrorSourceDataField"
TypePassportElementErrorSourceFrontSide = "passportElementErrorSourceFrontSide"
TypePassportElementErrorSourceReverseSide = "passportElementErrorSourceReverseSide"
TypePassportElementErrorSourceSelfie = "passportElementErrorSourceSelfie"
TypePassportElementErrorSourceTranslationFile = "passportElementErrorSourceTranslationFile"
TypePassportElementErrorSourceTranslationFiles = "passportElementErrorSourceTranslationFiles"
TypePassportElementErrorSourceFile = "passportElementErrorSourceFile"
TypePassportElementErrorSourceFiles = "passportElementErrorSourceFiles"
TypePassportElementError = "passportElementError"
TypePassportSuitableElement = "passportSuitableElement"
TypePassportRequiredElement = "passportRequiredElement"
TypePassportAuthorizationForm = "passportAuthorizationForm"
2019-06-07 10:56:06 +00:00
TypePassportElementsWithErrors = "passportElementsWithErrors"
2018-10-23 12:38:10 +00:00
TypeEncryptedCredentials = "encryptedCredentials"
TypeEncryptedPassportElement = "encryptedPassportElement"
TypeInputPassportElementErrorSourceUnspecified = "inputPassportElementErrorSourceUnspecified"
TypeInputPassportElementErrorSourceDataField = "inputPassportElementErrorSourceDataField"
TypeInputPassportElementErrorSourceFrontSide = "inputPassportElementErrorSourceFrontSide"
TypeInputPassportElementErrorSourceReverseSide = "inputPassportElementErrorSourceReverseSide"
TypeInputPassportElementErrorSourceSelfie = "inputPassportElementErrorSourceSelfie"
TypeInputPassportElementErrorSourceTranslationFile = "inputPassportElementErrorSourceTranslationFile"
TypeInputPassportElementErrorSourceTranslationFiles = "inputPassportElementErrorSourceTranslationFiles"
TypeInputPassportElementErrorSourceFile = "inputPassportElementErrorSourceFile"
TypeInputPassportElementErrorSourceFiles = "inputPassportElementErrorSourceFiles"
TypeInputPassportElementError = "inputPassportElementError"
TypeMessageText = "messageText"
TypeMessageAnimation = "messageAnimation"
TypeMessageAudio = "messageAudio"
TypeMessageDocument = "messageDocument"
TypeMessagePhoto = "messagePhoto"
TypeMessageExpiredPhoto = "messageExpiredPhoto"
TypeMessageSticker = "messageSticker"
TypeMessageVideo = "messageVideo"
TypeMessageExpiredVideo = "messageExpiredVideo"
TypeMessageVideoNote = "messageVideoNote"
TypeMessageVoiceNote = "messageVoiceNote"
TypeMessageLocation = "messageLocation"
TypeMessageVenue = "messageVenue"
TypeMessageContact = "messageContact"
TypeMessageGame = "messageGame"
2019-06-07 10:56:06 +00:00
TypeMessagePoll = "messagePoll"
2018-10-23 12:38:10 +00:00
TypeMessageInvoice = "messageInvoice"
TypeMessageCall = "messageCall"
TypeMessageBasicGroupChatCreate = "messageBasicGroupChatCreate"
TypeMessageSupergroupChatCreate = "messageSupergroupChatCreate"
TypeMessageChatChangeTitle = "messageChatChangeTitle"
TypeMessageChatChangePhoto = "messageChatChangePhoto"
TypeMessageChatDeletePhoto = "messageChatDeletePhoto"
TypeMessageChatAddMembers = "messageChatAddMembers"
TypeMessageChatJoinByLink = "messageChatJoinByLink"
TypeMessageChatDeleteMember = "messageChatDeleteMember"
TypeMessageChatUpgradeTo = "messageChatUpgradeTo"
TypeMessageChatUpgradeFrom = "messageChatUpgradeFrom"
TypeMessagePinMessage = "messagePinMessage"
TypeMessageScreenshotTaken = "messageScreenshotTaken"
TypeMessageChatSetTtl = "messageChatSetTtl"
TypeMessageCustomServiceAction = "messageCustomServiceAction"
TypeMessageGameScore = "messageGameScore"
TypeMessagePaymentSuccessful = "messagePaymentSuccessful"
TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot"
TypeMessageContactRegistered = "messageContactRegistered"
TypeMessageWebsiteConnected = "messageWebsiteConnected"
TypeMessagePassportDataSent = "messagePassportDataSent"
TypeMessagePassportDataReceived = "messagePassportDataReceived"
TypeMessageUnsupported = "messageUnsupported"
TypeTextEntityTypeMention = "textEntityTypeMention"
TypeTextEntityTypeHashtag = "textEntityTypeHashtag"
TypeTextEntityTypeCashtag = "textEntityTypeCashtag"
TypeTextEntityTypeBotCommand = "textEntityTypeBotCommand"
TypeTextEntityTypeUrl = "textEntityTypeUrl"
TypeTextEntityTypeEmailAddress = "textEntityTypeEmailAddress"
TypeTextEntityTypeBold = "textEntityTypeBold"
TypeTextEntityTypeItalic = "textEntityTypeItalic"
TypeTextEntityTypeCode = "textEntityTypeCode"
TypeTextEntityTypePre = "textEntityTypePre"
TypeTextEntityTypePreCode = "textEntityTypePreCode"
TypeTextEntityTypeTextUrl = "textEntityTypeTextUrl"
TypeTextEntityTypeMentionName = "textEntityTypeMentionName"
TypeTextEntityTypePhoneNumber = "textEntityTypePhoneNumber"
TypeInputThumbnail = "inputThumbnail"
TypeInputMessageText = "inputMessageText"
TypeInputMessageAnimation = "inputMessageAnimation"
TypeInputMessageAudio = "inputMessageAudio"
TypeInputMessageDocument = "inputMessageDocument"
TypeInputMessagePhoto = "inputMessagePhoto"
TypeInputMessageSticker = "inputMessageSticker"
TypeInputMessageVideo = "inputMessageVideo"
TypeInputMessageVideoNote = "inputMessageVideoNote"
TypeInputMessageVoiceNote = "inputMessageVoiceNote"
TypeInputMessageLocation = "inputMessageLocation"
TypeInputMessageVenue = "inputMessageVenue"
TypeInputMessageContact = "inputMessageContact"
TypeInputMessageGame = "inputMessageGame"
TypeInputMessageInvoice = "inputMessageInvoice"
2019-06-07 10:56:06 +00:00
TypeInputMessagePoll = "inputMessagePoll"
2018-10-23 12:38:10 +00:00
TypeInputMessageForwarded = "inputMessageForwarded"
TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty"
TypeSearchMessagesFilterAnimation = "searchMessagesFilterAnimation"
TypeSearchMessagesFilterAudio = "searchMessagesFilterAudio"
TypeSearchMessagesFilterDocument = "searchMessagesFilterDocument"
TypeSearchMessagesFilterPhoto = "searchMessagesFilterPhoto"
TypeSearchMessagesFilterVideo = "searchMessagesFilterVideo"
TypeSearchMessagesFilterVoiceNote = "searchMessagesFilterVoiceNote"
TypeSearchMessagesFilterPhotoAndVideo = "searchMessagesFilterPhotoAndVideo"
TypeSearchMessagesFilterUrl = "searchMessagesFilterUrl"
TypeSearchMessagesFilterChatPhoto = "searchMessagesFilterChatPhoto"
TypeSearchMessagesFilterCall = "searchMessagesFilterCall"
TypeSearchMessagesFilterMissedCall = "searchMessagesFilterMissedCall"
TypeSearchMessagesFilterVideoNote = "searchMessagesFilterVideoNote"
TypeSearchMessagesFilterVoiceAndVideoNote = "searchMessagesFilterVoiceAndVideoNote"
TypeSearchMessagesFilterMention = "searchMessagesFilterMention"
TypeSearchMessagesFilterUnreadMention = "searchMessagesFilterUnreadMention"
TypeChatActionTyping = "chatActionTyping"
TypeChatActionRecordingVideo = "chatActionRecordingVideo"
TypeChatActionUploadingVideo = "chatActionUploadingVideo"
TypeChatActionRecordingVoiceNote = "chatActionRecordingVoiceNote"
TypeChatActionUploadingVoiceNote = "chatActionUploadingVoiceNote"
TypeChatActionUploadingPhoto = "chatActionUploadingPhoto"
TypeChatActionUploadingDocument = "chatActionUploadingDocument"
TypeChatActionChoosingLocation = "chatActionChoosingLocation"
TypeChatActionChoosingContact = "chatActionChoosingContact"
TypeChatActionStartPlayingGame = "chatActionStartPlayingGame"
TypeChatActionRecordingVideoNote = "chatActionRecordingVideoNote"
TypeChatActionUploadingVideoNote = "chatActionUploadingVideoNote"
TypeChatActionCancel = "chatActionCancel"
TypeUserStatusEmpty = "userStatusEmpty"
TypeUserStatusOnline = "userStatusOnline"
TypeUserStatusOffline = "userStatusOffline"
TypeUserStatusRecently = "userStatusRecently"
TypeUserStatusLastWeek = "userStatusLastWeek"
TypeUserStatusLastMonth = "userStatusLastMonth"
TypeStickers = "stickers"
2019-09-10 12:36:54 +00:00
TypeEmojis = "emojis"
2018-10-23 12:38:10 +00:00
TypeStickerSet = "stickerSet"
TypeStickerSetInfo = "stickerSetInfo"
TypeStickerSets = "stickerSets"
TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty"
TypeCallDiscardReasonMissed = "callDiscardReasonMissed"
TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined"
TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected"
TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp"
TypeCallProtocol = "callProtocol"
TypeCallConnection = "callConnection"
TypeCallId = "callId"
TypeCallStatePending = "callStatePending"
TypeCallStateExchangingKeys = "callStateExchangingKeys"
TypeCallStateReady = "callStateReady"
TypeCallStateHangingUp = "callStateHangingUp"
TypeCallStateDiscarded = "callStateDiscarded"
TypeCallStateError = "callStateError"
2019-09-10 12:36:54 +00:00
TypeCallProblemEcho = "callProblemEcho"
TypeCallProblemNoise = "callProblemNoise"
TypeCallProblemInterruptions = "callProblemInterruptions"
TypeCallProblemDistortedSpeech = "callProblemDistortedSpeech"
TypeCallProblemSilentLocal = "callProblemSilentLocal"
TypeCallProblemSilentRemote = "callProblemSilentRemote"
TypeCallProblemDropped = "callProblemDropped"
2018-10-23 12:38:10 +00:00
TypeCall = "call"
2019-09-10 12:36:54 +00:00
TypePhoneNumberAuthenticationSettings = "phoneNumberAuthenticationSettings"
2018-10-23 12:38:10 +00:00
TypeAnimations = "animations"
TypeImportedContacts = "importedContacts"
2019-06-07 10:56:06 +00:00
TypeHttpUrl = "httpUrl"
2018-10-23 12:38:10 +00:00
TypeInputInlineQueryResultAnimatedGif = "inputInlineQueryResultAnimatedGif"
TypeInputInlineQueryResultAnimatedMpeg4 = "inputInlineQueryResultAnimatedMpeg4"
TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle"
TypeInputInlineQueryResultAudio = "inputInlineQueryResultAudio"
TypeInputInlineQueryResultContact = "inputInlineQueryResultContact"
TypeInputInlineQueryResultDocument = "inputInlineQueryResultDocument"
TypeInputInlineQueryResultGame = "inputInlineQueryResultGame"
TypeInputInlineQueryResultLocation = "inputInlineQueryResultLocation"
TypeInputInlineQueryResultPhoto = "inputInlineQueryResultPhoto"
TypeInputInlineQueryResultSticker = "inputInlineQueryResultSticker"
TypeInputInlineQueryResultVenue = "inputInlineQueryResultVenue"
TypeInputInlineQueryResultVideo = "inputInlineQueryResultVideo"
TypeInputInlineQueryResultVoiceNote = "inputInlineQueryResultVoiceNote"
TypeInlineQueryResultArticle = "inlineQueryResultArticle"
TypeInlineQueryResultContact = "inlineQueryResultContact"
TypeInlineQueryResultLocation = "inlineQueryResultLocation"
TypeInlineQueryResultVenue = "inlineQueryResultVenue"
TypeInlineQueryResultGame = "inlineQueryResultGame"
TypeInlineQueryResultAnimation = "inlineQueryResultAnimation"
TypeInlineQueryResultAudio = "inlineQueryResultAudio"
TypeInlineQueryResultDocument = "inlineQueryResultDocument"
TypeInlineQueryResultPhoto = "inlineQueryResultPhoto"
TypeInlineQueryResultSticker = "inlineQueryResultSticker"
TypeInlineQueryResultVideo = "inlineQueryResultVideo"
TypeInlineQueryResultVoiceNote = "inlineQueryResultVoiceNote"
TypeInlineQueryResults = "inlineQueryResults"
TypeCallbackQueryPayloadData = "callbackQueryPayloadData"
TypeCallbackQueryPayloadGame = "callbackQueryPayloadGame"
TypeCallbackQueryAnswer = "callbackQueryAnswer"
TypeCustomRequestResult = "customRequestResult"
TypeGameHighScore = "gameHighScore"
TypeGameHighScores = "gameHighScores"
TypeChatEventMessageEdited = "chatEventMessageEdited"
TypeChatEventMessageDeleted = "chatEventMessageDeleted"
2019-09-10 12:36:54 +00:00
TypeChatEventPollStopped = "chatEventPollStopped"
2018-10-23 12:38:10 +00:00
TypeChatEventMessagePinned = "chatEventMessagePinned"
TypeChatEventMessageUnpinned = "chatEventMessageUnpinned"
TypeChatEventMemberJoined = "chatEventMemberJoined"
TypeChatEventMemberLeft = "chatEventMemberLeft"
TypeChatEventMemberInvited = "chatEventMemberInvited"
TypeChatEventMemberPromoted = "chatEventMemberPromoted"
TypeChatEventMemberRestricted = "chatEventMemberRestricted"
TypeChatEventTitleChanged = "chatEventTitleChanged"
2019-09-10 12:36:54 +00:00
TypeChatEventPermissionsChanged = "chatEventPermissionsChanged"
2018-10-23 12:38:10 +00:00
TypeChatEventDescriptionChanged = "chatEventDescriptionChanged"
TypeChatEventUsernameChanged = "chatEventUsernameChanged"
TypeChatEventPhotoChanged = "chatEventPhotoChanged"
TypeChatEventInvitesToggled = "chatEventInvitesToggled"
TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled"
TypeChatEventStickerSetChanged = "chatEventStickerSetChanged"
TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled"
TypeChatEvent = "chatEvent"
TypeChatEvents = "chatEvents"
TypeChatEventLogFilters = "chatEventLogFilters"
TypeLanguagePackStringValueOrdinary = "languagePackStringValueOrdinary"
TypeLanguagePackStringValuePluralized = "languagePackStringValuePluralized"
TypeLanguagePackStringValueDeleted = "languagePackStringValueDeleted"
TypeLanguagePackString = "languagePackString"
TypeLanguagePackStrings = "languagePackStrings"
TypeLanguagePackInfo = "languagePackInfo"
TypeLocalizationTargetInfo = "localizationTargetInfo"
2019-06-07 10:56:06 +00:00
TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging"
2018-10-23 12:38:10 +00:00
TypeDeviceTokenApplePush = "deviceTokenApplePush"
TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP"
TypeDeviceTokenWindowsPush = "deviceTokenWindowsPush"
TypeDeviceTokenMicrosoftPush = "deviceTokenMicrosoftPush"
TypeDeviceTokenMicrosoftPushVoIP = "deviceTokenMicrosoftPushVoIP"
TypeDeviceTokenWebPush = "deviceTokenWebPush"
TypeDeviceTokenSimplePush = "deviceTokenSimplePush"
TypeDeviceTokenUbuntuPush = "deviceTokenUbuntuPush"
TypeDeviceTokenBlackBerryPush = "deviceTokenBlackBerryPush"
TypeDeviceTokenTizenPush = "deviceTokenTizenPush"
2019-06-07 10:56:06 +00:00
TypePushReceiverId = "pushReceiverId"
2019-09-10 12:36:54 +00:00
TypeBackgroundTypeWallpaper = "backgroundTypeWallpaper"
TypeBackgroundTypePattern = "backgroundTypePattern"
TypeBackgroundTypeSolid = "backgroundTypeSolid"
TypeBackground = "background"
TypeBackgrounds = "backgrounds"
TypeInputBackgroundLocal = "inputBackgroundLocal"
TypeInputBackgroundRemote = "inputBackgroundRemote"
2018-10-23 12:38:10 +00:00
TypeHashtags = "hashtags"
TypeCheckChatUsernameResultOk = "checkChatUsernameResultOk"
TypeCheckChatUsernameResultUsernameInvalid = "checkChatUsernameResultUsernameInvalid"
TypeCheckChatUsernameResultUsernameOccupied = "checkChatUsernameResultUsernameOccupied"
TypeCheckChatUsernameResultPublicChatsTooMuch = "checkChatUsernameResultPublicChatsTooMuch"
TypeCheckChatUsernameResultPublicGroupsUnavailable = "checkChatUsernameResultPublicGroupsUnavailable"
2019-06-07 10:56:06 +00:00
TypePushMessageContentHidden = "pushMessageContentHidden"
TypePushMessageContentAnimation = "pushMessageContentAnimation"
TypePushMessageContentAudio = "pushMessageContentAudio"
TypePushMessageContentContact = "pushMessageContentContact"
TypePushMessageContentContactRegistered = "pushMessageContentContactRegistered"
TypePushMessageContentDocument = "pushMessageContentDocument"
TypePushMessageContentGame = "pushMessageContentGame"
TypePushMessageContentGameScore = "pushMessageContentGameScore"
TypePushMessageContentInvoice = "pushMessageContentInvoice"
TypePushMessageContentLocation = "pushMessageContentLocation"
TypePushMessageContentPhoto = "pushMessageContentPhoto"
TypePushMessageContentPoll = "pushMessageContentPoll"
TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken"
TypePushMessageContentSticker = "pushMessageContentSticker"
TypePushMessageContentText = "pushMessageContentText"
TypePushMessageContentVideo = "pushMessageContentVideo"
TypePushMessageContentVideoNote = "pushMessageContentVideoNote"
TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote"
TypePushMessageContentBasicGroupChatCreate = "pushMessageContentBasicGroupChatCreate"
TypePushMessageContentChatAddMembers = "pushMessageContentChatAddMembers"
TypePushMessageContentChatChangePhoto = "pushMessageContentChatChangePhoto"
TypePushMessageContentChatChangeTitle = "pushMessageContentChatChangeTitle"
TypePushMessageContentChatDeleteMember = "pushMessageContentChatDeleteMember"
TypePushMessageContentChatJoinByLink = "pushMessageContentChatJoinByLink"
TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards"
TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum"
TypeNotificationTypeNewMessage = "notificationTypeNewMessage"
TypeNotificationTypeNewSecretChat = "notificationTypeNewSecretChat"
TypeNotificationTypeNewCall = "notificationTypeNewCall"
TypeNotificationTypeNewPushMessage = "notificationTypeNewPushMessage"
TypeNotificationGroupTypeMessages = "notificationGroupTypeMessages"
TypeNotificationGroupTypeMentions = "notificationGroupTypeMentions"
TypeNotificationGroupTypeSecretChat = "notificationGroupTypeSecretChat"
TypeNotificationGroupTypeCalls = "notificationGroupTypeCalls"
TypeNotification = "notification"
TypeNotificationGroup = "notificationGroup"
2018-10-23 12:38:10 +00:00
TypeOptionValueBoolean = "optionValueBoolean"
TypeOptionValueEmpty = "optionValueEmpty"
TypeOptionValueInteger = "optionValueInteger"
TypeOptionValueString = "optionValueString"
2019-06-07 10:56:06 +00:00
TypeJsonObjectMember = "jsonObjectMember"
TypeJsonValueNull = "jsonValueNull"
TypeJsonValueBoolean = "jsonValueBoolean"
TypeJsonValueNumber = "jsonValueNumber"
TypeJsonValueString = "jsonValueString"
TypeJsonValueArray = "jsonValueArray"
TypeJsonValueObject = "jsonValueObject"
2018-10-23 12:38:10 +00:00
TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll"
TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts"
TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers"
TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll"
TypeUserPrivacySettingRuleRestrictContacts = "userPrivacySettingRuleRestrictContacts"
TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers"
TypeUserPrivacySettingRules = "userPrivacySettingRules"
TypeUserPrivacySettingShowStatus = "userPrivacySettingShowStatus"
2019-09-10 12:36:54 +00:00
TypeUserPrivacySettingShowProfilePhoto = "userPrivacySettingShowProfilePhoto"
TypeUserPrivacySettingShowLinkInForwardedMessages = "userPrivacySettingShowLinkInForwardedMessages"
2018-10-23 12:38:10 +00:00
TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites"
TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls"
2019-06-07 10:56:06 +00:00
TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls"
2018-10-23 12:38:10 +00:00
TypeAccountTtl = "accountTtl"
TypeSession = "session"
TypeSessions = "sessions"
TypeConnectedWebsite = "connectedWebsite"
TypeConnectedWebsites = "connectedWebsites"
TypeChatReportSpamState = "chatReportSpamState"
TypeChatReportReasonSpam = "chatReportReasonSpam"
TypeChatReportReasonViolence = "chatReportReasonViolence"
TypeChatReportReasonPornography = "chatReportReasonPornography"
2019-06-07 10:56:06 +00:00
TypeChatReportReasonChildAbuse = "chatReportReasonChildAbuse"
2018-10-23 12:38:10 +00:00
TypeChatReportReasonCopyright = "chatReportReasonCopyright"
TypeChatReportReasonCustom = "chatReportReasonCustom"
TypePublicMessageLink = "publicMessageLink"
2019-09-10 12:36:54 +00:00
TypeMessageLinkInfo = "messageLinkInfo"
2019-06-07 10:56:06 +00:00
TypeFilePart = "filePart"
2018-10-23 12:38:10 +00:00
TypeFileTypeNone = "fileTypeNone"
TypeFileTypeAnimation = "fileTypeAnimation"
TypeFileTypeAudio = "fileTypeAudio"
TypeFileTypeDocument = "fileTypeDocument"
TypeFileTypePhoto = "fileTypePhoto"
TypeFileTypeProfilePhoto = "fileTypeProfilePhoto"
TypeFileTypeSecret = "fileTypeSecret"
TypeFileTypeSecretThumbnail = "fileTypeSecretThumbnail"
TypeFileTypeSecure = "fileTypeSecure"
TypeFileTypeSticker = "fileTypeSticker"
TypeFileTypeThumbnail = "fileTypeThumbnail"
TypeFileTypeUnknown = "fileTypeUnknown"
TypeFileTypeVideo = "fileTypeVideo"
TypeFileTypeVideoNote = "fileTypeVideoNote"
TypeFileTypeVoiceNote = "fileTypeVoiceNote"
TypeFileTypeWallpaper = "fileTypeWallpaper"
TypeStorageStatisticsByFileType = "storageStatisticsByFileType"
TypeStorageStatisticsByChat = "storageStatisticsByChat"
TypeStorageStatistics = "storageStatistics"
TypeStorageStatisticsFast = "storageStatisticsFast"
2019-06-07 10:56:06 +00:00
TypeDatabaseStatistics = "databaseStatistics"
2018-10-23 12:38:10 +00:00
TypeNetworkTypeNone = "networkTypeNone"
TypeNetworkTypeMobile = "networkTypeMobile"
TypeNetworkTypeMobileRoaming = "networkTypeMobileRoaming"
TypeNetworkTypeWiFi = "networkTypeWiFi"
TypeNetworkTypeOther = "networkTypeOther"
TypeNetworkStatisticsEntryFile = "networkStatisticsEntryFile"
TypeNetworkStatisticsEntryCall = "networkStatisticsEntryCall"
TypeNetworkStatistics = "networkStatistics"
2019-09-10 12:36:54 +00:00
TypeAutoDownloadSettings = "autoDownloadSettings"
TypeAutoDownloadSettingsPresets = "autoDownloadSettingsPresets"
2018-10-23 12:38:10 +00:00
TypeConnectionStateWaitingForNetwork = "connectionStateWaitingForNetwork"
TypeConnectionStateConnectingToProxy = "connectionStateConnectingToProxy"
TypeConnectionStateConnecting = "connectionStateConnecting"
TypeConnectionStateUpdating = "connectionStateUpdating"
TypeConnectionStateReady = "connectionStateReady"
TypeTopChatCategoryUsers = "topChatCategoryUsers"
TypeTopChatCategoryBots = "topChatCategoryBots"
TypeTopChatCategoryGroups = "topChatCategoryGroups"
TypeTopChatCategoryChannels = "topChatCategoryChannels"
TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots"
TypeTopChatCategoryCalls = "topChatCategoryCalls"
TypeTMeUrlTypeUser = "tMeUrlTypeUser"
TypeTMeUrlTypeSupergroup = "tMeUrlTypeSupergroup"
TypeTMeUrlTypeChatInvite = "tMeUrlTypeChatInvite"
TypeTMeUrlTypeStickerSet = "tMeUrlTypeStickerSet"
TypeTMeUrl = "tMeUrl"
TypeTMeUrls = "tMeUrls"
TypeCount = "count"
TypeText = "text"
TypeSeconds = "seconds"
TypeDeepLinkInfo = "deepLinkInfo"
TypeTextParseModeMarkdown = "textParseModeMarkdown"
TypeTextParseModeHTML = "textParseModeHTML"
TypeProxyTypeSocks5 = "proxyTypeSocks5"
TypeProxyTypeHttp = "proxyTypeHttp"
TypeProxyTypeMtproto = "proxyTypeMtproto"
TypeProxy = "proxy"
TypeProxies = "proxies"
TypeInputSticker = "inputSticker"
TypeUpdateAuthorizationState = "updateAuthorizationState"
TypeUpdateNewMessage = "updateNewMessage"
TypeUpdateMessageSendAcknowledged = "updateMessageSendAcknowledged"
TypeUpdateMessageSendSucceeded = "updateMessageSendSucceeded"
TypeUpdateMessageSendFailed = "updateMessageSendFailed"
TypeUpdateMessageContent = "updateMessageContent"
TypeUpdateMessageEdited = "updateMessageEdited"
TypeUpdateMessageViews = "updateMessageViews"
TypeUpdateMessageContentOpened = "updateMessageContentOpened"
TypeUpdateMessageMentionRead = "updateMessageMentionRead"
TypeUpdateNewChat = "updateNewChat"
TypeUpdateChatTitle = "updateChatTitle"
TypeUpdateChatPhoto = "updateChatPhoto"
2019-09-10 12:36:54 +00:00
TypeUpdateChatPermissions = "updateChatPermissions"
2018-10-23 12:38:10 +00:00
TypeUpdateChatLastMessage = "updateChatLastMessage"
TypeUpdateChatOrder = "updateChatOrder"
TypeUpdateChatIsPinned = "updateChatIsPinned"
TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread"
TypeUpdateChatIsSponsored = "updateChatIsSponsored"
TypeUpdateChatDefaultDisableNotification = "updateChatDefaultDisableNotification"
TypeUpdateChatReadInbox = "updateChatReadInbox"
TypeUpdateChatReadOutbox = "updateChatReadOutbox"
TypeUpdateChatUnreadMentionCount = "updateChatUnreadMentionCount"
TypeUpdateChatNotificationSettings = "updateChatNotificationSettings"
TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings"
2019-06-07 10:56:06 +00:00
TypeUpdateChatPinnedMessage = "updateChatPinnedMessage"
2018-10-23 12:38:10 +00:00
TypeUpdateChatReplyMarkup = "updateChatReplyMarkup"
TypeUpdateChatDraftMessage = "updateChatDraftMessage"
2019-06-07 10:56:06 +00:00
TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount"
TypeUpdateNotification = "updateNotification"
TypeUpdateNotificationGroup = "updateNotificationGroup"
TypeUpdateActiveNotifications = "updateActiveNotifications"
TypeUpdateHavePendingNotifications = "updateHavePendingNotifications"
2018-10-23 12:38:10 +00:00
TypeUpdateDeleteMessages = "updateDeleteMessages"
TypeUpdateUserChatAction = "updateUserChatAction"
TypeUpdateUserStatus = "updateUserStatus"
TypeUpdateUser = "updateUser"
TypeUpdateBasicGroup = "updateBasicGroup"
TypeUpdateSupergroup = "updateSupergroup"
TypeUpdateSecretChat = "updateSecretChat"
TypeUpdateUserFullInfo = "updateUserFullInfo"
TypeUpdateBasicGroupFullInfo = "updateBasicGroupFullInfo"
TypeUpdateSupergroupFullInfo = "updateSupergroupFullInfo"
TypeUpdateServiceNotification = "updateServiceNotification"
TypeUpdateFile = "updateFile"
TypeUpdateFileGenerationStart = "updateFileGenerationStart"
TypeUpdateFileGenerationStop = "updateFileGenerationStop"
TypeUpdateCall = "updateCall"
TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules"
TypeUpdateUnreadMessageCount = "updateUnreadMessageCount"
TypeUpdateUnreadChatCount = "updateUnreadChatCount"
TypeUpdateOption = "updateOption"
TypeUpdateInstalledStickerSets = "updateInstalledStickerSets"
TypeUpdateTrendingStickerSets = "updateTrendingStickerSets"
TypeUpdateRecentStickers = "updateRecentStickers"
TypeUpdateFavoriteStickers = "updateFavoriteStickers"
TypeUpdateSavedAnimations = "updateSavedAnimations"
2019-09-10 12:36:54 +00:00
TypeUpdateSelectedBackground = "updateSelectedBackground"
2018-10-23 12:38:10 +00:00
TypeUpdateLanguagePackStrings = "updateLanguagePackStrings"
TypeUpdateConnectionState = "updateConnectionState"
TypeUpdateTermsOfService = "updateTermsOfService"
TypeUpdateNewInlineQuery = "updateNewInlineQuery"
TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult"
TypeUpdateNewCallbackQuery = "updateNewCallbackQuery"
TypeUpdateNewInlineCallbackQuery = "updateNewInlineCallbackQuery"
TypeUpdateNewShippingQuery = "updateNewShippingQuery"
TypeUpdateNewPreCheckoutQuery = "updateNewPreCheckoutQuery"
TypeUpdateNewCustomEvent = "updateNewCustomEvent"
TypeUpdateNewCustomQuery = "updateNewCustomQuery"
2019-06-07 10:56:06 +00:00
TypeUpdatePoll = "updatePoll"
TypeUpdates = "updates"
TypeLogStreamDefault = "logStreamDefault"
TypeLogStreamFile = "logStreamFile"
TypeLogStreamEmpty = "logStreamEmpty"
TypeLogVerbosityLevel = "logVerbosityLevel"
TypeLogTags = "logTags"
2018-10-23 12:38:10 +00:00
TypeTestInt = "testInt"
TypeTestString = "testString"
TypeTestBytes = "testBytes"
TypeTestVectorInt = "testVectorInt"
TypeTestVectorIntObject = "testVectorIntObject"
TypeTestVectorString = "testVectorString"
TypeTestVectorStringObject = "testVectorStringObject"
2018-08-30 14:55:42 +00:00
)
// Provides information about the method by which an authentication code is delivered to the user
type AuthenticationCodeType interface {
2018-10-23 12:38:10 +00:00
AuthenticationCodeTypeType() string
2018-08-30 14:55:42 +00:00
}
// Represents the current authorization state of the client
type AuthorizationState interface {
2018-10-23 12:38:10 +00:00
AuthorizationStateType() string
2018-08-30 14:55:42 +00:00
}
// Points to a file
type InputFile interface {
2018-10-23 12:38:10 +00:00
InputFileType() string
2018-08-30 14:55:42 +00:00
}
// Part of the face, relative to which a mask should be placed
type MaskPoint interface {
2018-10-23 12:38:10 +00:00
MaskPointType() string
2018-08-30 14:55:42 +00:00
}
// Represents the relationship between user A and user B. For incoming_link, user A is the current user; for outgoing_link, user B is the current user
type LinkState interface {
2018-10-23 12:38:10 +00:00
LinkStateType() string
2018-08-30 14:55:42 +00:00
}
// Represents the type of the user. The following types are possible: regular users, deleted users and bots
type UserType interface {
2018-10-23 12:38:10 +00:00
UserTypeType() string
2018-08-30 14:55:42 +00:00
}
// Provides information about the status of a member in a chat
type ChatMemberStatus interface {
2018-10-23 12:38:10 +00:00
ChatMemberStatusType() string
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Specifies the kind of chat members to return in searchChatMembers
type ChatMembersFilter interface {
2018-10-23 12:38:10 +00:00
ChatMembersFilterType() string
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// Specifies the kind of chat members to return in getSupergroupMembers
type SupergroupMembersFilter interface {
2018-10-23 12:38:10 +00:00
SupergroupMembersFilterType() string
2018-08-30 14:55:42 +00:00
}
// Describes the current secret chat state
type SecretChatState interface {
2018-10-23 12:38:10 +00:00
SecretChatStateType() string
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about the origin of a forwarded message
type MessageForwardOrigin interface {
MessageForwardOriginType() string
2018-08-30 14:55:42 +00:00
}
// Contains information about the sending state of the message
type MessageSendingState interface {
2018-10-23 12:38:10 +00:00
MessageSendingStateType() string
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Describes the types of chats to which notification settings are applied
2018-08-30 14:55:42 +00:00
type NotificationSettingsScope interface {
2018-10-23 12:38:10 +00:00
NotificationSettingsScopeType() string
2018-08-30 14:55:42 +00:00
}
// Describes the type of a chat
type ChatType interface {
2018-10-23 12:38:10 +00:00
ChatTypeType() string
2018-08-30 14:55:42 +00:00
}
// Describes a keyboard button type
type KeyboardButtonType interface {
2018-10-23 12:38:10 +00:00
KeyboardButtonTypeType() string
2018-08-30 14:55:42 +00:00
}
// Describes the type of an inline keyboard button
type InlineKeyboardButtonType interface {
2018-10-23 12:38:10 +00:00
InlineKeyboardButtonTypeType() string
2018-08-30 14:55:42 +00:00
}
// Contains a description of a custom keyboard and actions that can be done with it to quickly reply to bots
type ReplyMarkup interface {
2018-10-23 12:38:10 +00:00
ReplyMarkupType() string
2018-08-30 14:55:42 +00:00
}
// Describes a text object inside an instant-view web page
type RichText interface {
2018-10-23 12:38:10 +00:00
RichTextType() string
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Describes a horizontal alignment of a table cell content
type PageBlockHorizontalAlignment interface {
PageBlockHorizontalAlignmentType() string
}
// Describes a Vertical alignment of a table cell content
type PageBlockVerticalAlignment interface {
PageBlockVerticalAlignmentType() string
}
2018-08-30 14:55:42 +00:00
// Describes a block of an instant view web page
type PageBlock interface {
2018-10-23 12:38:10 +00:00
PageBlockType() string
2018-08-30 14:55:42 +00:00
}
// Contains information about the payment method chosen by the user
type InputCredentials interface {
2018-10-23 12:38:10 +00:00
InputCredentialsType() string
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Contains the type of a Telegram Passport element
type PassportElementType interface {
2018-10-23 12:38:10 +00:00
PassportElementTypeType() string
2018-09-05 21:45:29 +00:00
}
// Contains information about a Telegram Passport element
type PassportElement interface {
2018-10-23 12:38:10 +00:00
PassportElementType() string
2018-09-05 21:45:29 +00:00
}
// Contains information about a Telegram Passport element to be saved
type InputPassportElement interface {
2018-10-23 12:38:10 +00:00
InputPassportElementType() string
2018-09-05 21:45:29 +00:00
}
// Contains the description of an error in a Telegram Passport element
type PassportElementErrorSource interface {
2018-10-23 12:38:10 +00:00
PassportElementErrorSourceType() string
2018-09-05 21:45:29 +00:00
}
// Contains the description of an error in a Telegram Passport element; for bots only
type InputPassportElementErrorSource interface {
2018-10-23 12:38:10 +00:00
InputPassportElementErrorSourceType() string
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// Contains the content of a message
type MessageContent interface {
2018-10-23 12:38:10 +00:00
MessageContentType() string
2018-08-30 14:55:42 +00:00
}
// Represents a part of the text which must be formatted differently
type TextEntityType interface {
2018-10-23 12:38:10 +00:00
TextEntityTypeType() string
2018-08-30 14:55:42 +00:00
}
// The content of a message to send
type InputMessageContent interface {
2018-10-23 12:38:10 +00:00
InputMessageContentType() string
2018-08-30 14:55:42 +00:00
}
// Represents a filter for message search results
type SearchMessagesFilter interface {
2018-10-23 12:38:10 +00:00
SearchMessagesFilterType() string
2018-08-30 14:55:42 +00:00
}
// Describes the different types of activity in a chat
type ChatAction interface {
2018-10-23 12:38:10 +00:00
ChatActionType() string
2018-08-30 14:55:42 +00:00
}
// Describes the last time the user was online
type UserStatus interface {
2018-10-23 12:38:10 +00:00
UserStatusType() string
2018-08-30 14:55:42 +00:00
}
// Describes the reason why a call was discarded
type CallDiscardReason interface {
2018-10-23 12:38:10 +00:00
CallDiscardReasonType() string
2018-08-30 14:55:42 +00:00
}
// Describes the current call state
type CallState interface {
2018-10-23 12:38:10 +00:00
CallStateType() string
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Describes the exact type of a problem with a call
type CallProblem interface {
CallProblemType() string
}
2018-08-30 14:55:42 +00:00
// Represents a single result of an inline query; for bots only
type InputInlineQueryResult interface {
2018-10-23 12:38:10 +00:00
InputInlineQueryResultType() string
2018-08-30 14:55:42 +00:00
}
// Represents a single result of an inline query
type InlineQueryResult interface {
2018-10-23 12:38:10 +00:00
InlineQueryResultType() string
2018-08-30 14:55:42 +00:00
}
// Represents a payload of a callback query
type CallbackQueryPayload interface {
2018-10-23 12:38:10 +00:00
CallbackQueryPayloadType() string
2018-08-30 14:55:42 +00:00
}
// Represents a chat event
type ChatEventAction interface {
2018-10-23 12:38:10 +00:00
ChatEventActionType() string
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Represents the value of a string in a language pack
type LanguagePackStringValue interface {
2018-10-23 12:38:10 +00:00
LanguagePackStringValueType() string
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, you must specify the correct application platform and upload valid server authentication data at https://my.telegram.org
2018-08-30 14:55:42 +00:00
type DeviceToken interface {
2018-10-23 12:38:10 +00:00
DeviceTokenType() string
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Describes a type of a background
type BackgroundType interface {
BackgroundTypeType() string
}
// Contains information about background to set
type InputBackground interface {
InputBackgroundType() string
}
2018-08-30 14:55:42 +00:00
// Represents result of checking whether a username can be set for a chat
type CheckChatUsernameResult interface {
2018-10-23 12:38:10 +00:00
CheckChatUsernameResultType() string
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains content of a push message notification
type PushMessageContent interface {
PushMessageContentType() string
}
// Contains detailed information about a notification
type NotificationType interface {
NotificationTypeType() string
}
// Describes type of notifications in the group
type NotificationGroupType interface {
NotificationGroupTypeType() string
}
2018-08-30 14:55:42 +00:00
// Represents the value of an option
type OptionValue interface {
2018-10-23 12:38:10 +00:00
OptionValueType() string
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a JSON value
type JsonValue interface {
JsonValueType() string
}
2018-08-30 14:55:42 +00:00
// Represents a single rule for managing privacy settings
type UserPrivacySettingRule interface {
2018-10-23 12:38:10 +00:00
UserPrivacySettingRuleType() string
2018-08-30 14:55:42 +00:00
}
// Describes available user privacy settings
type UserPrivacySetting interface {
2018-10-23 12:38:10 +00:00
UserPrivacySettingType() string
2018-08-30 14:55:42 +00:00
}
// Describes the reason why a chat is reported
type ChatReportReason interface {
2018-10-23 12:38:10 +00:00
ChatReportReasonType() string
2018-08-30 14:55:42 +00:00
}
// Represents the type of a file
type FileType interface {
2018-10-23 12:38:10 +00:00
FileTypeType() string
2018-08-30 14:55:42 +00:00
}
// Represents the type of a network
type NetworkType interface {
2018-10-23 12:38:10 +00:00
NetworkTypeType() string
2018-08-30 14:55:42 +00:00
}
// Contains statistics about network usage
type NetworkStatisticsEntry interface {
2018-10-23 12:38:10 +00:00
NetworkStatisticsEntryType() string
2018-08-30 14:55:42 +00:00
}
// Describes the current state of the connection to Telegram servers
type ConnectionState interface {
2018-10-23 12:38:10 +00:00
ConnectionStateType() string
2018-08-30 14:55:42 +00:00
}
// Represents the categories of chats for which a list of frequently used chats can be retrieved
type TopChatCategory interface {
2018-10-23 12:38:10 +00:00
TopChatCategoryType() string
2018-08-30 14:55:42 +00:00
}
// Describes the type of a URL linking to an internal Telegram entity
type TMeUrlType interface {
2018-10-23 12:38:10 +00:00
TMeUrlTypeType() string
2018-08-30 14:55:42 +00:00
}
// Describes the way the text should be parsed for TextEntities
type TextParseMode interface {
2018-10-23 12:38:10 +00:00
TextParseModeType() string
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Describes the type of the proxy server
type ProxyType interface {
2018-10-23 12:38:10 +00:00
ProxyTypeType() string
2018-08-30 14:55:42 +00:00
}
// Contains notifications about data changes
type Update interface {
2018-10-23 12:38:10 +00:00
UpdateType() string
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Describes a stream to which TDLib internal log is written
type LogStream interface {
LogStreamType() string
}
2018-08-30 14:55:42 +00:00
// An object of this type can be returned on every function call, in case of an error
type Error struct {
2018-10-23 12:38:10 +00:00
meta
// Error code; subject to future changes. If the error code is 406, the error message must not be processed in any way and must not be displayed to the user
Code int32 `json:"code"`
// Error message; subject to future changes
Message string `json:"message"`
2018-08-30 14:55:42 +00:00
}
func (entity *Error) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Error
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Error) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassError
2018-08-30 14:55:42 +00:00
}
func (*Error) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeError
2018-08-30 14:55:42 +00:00
}
// An object of this type is returned on a successful function call for certain functions
2018-10-23 12:38:10 +00:00
type Ok struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *Ok) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Ok
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Ok) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassOk
2018-08-30 14:55:42 +00:00
}
func (*Ok) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeOk
2018-08-30 14:55:42 +00:00
}
// Contains parameters for TDLib initialization
type TdlibParameters struct {
2018-10-23 12:38:10 +00:00
meta
// If set to true, the Telegram test environment will be used instead of the production environment
UseTestDc bool `json:"use_test_dc"`
// The path to the directory for the persistent database; if empty, the current working directory will be used
DatabaseDirectory string `json:"database_directory"`
// The path to the directory for storing files; if empty, database_directory will be used
FilesDirectory string `json:"files_directory"`
// If set to true, information about downloaded and uploaded files will be saved between application restarts
UseFileDatabase bool `json:"use_file_database"`
// If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies use_file_database
UseChatInfoDatabase bool `json:"use_chat_info_database"`
// If set to true, the library will maintain a cache of chats and messages. Implies use_chat_info_database
UseMessageDatabase bool `json:"use_message_database"`
// If set to true, support for secret chats will be enabled
UseSecretChats bool `json:"use_secret_chats"`
// Application identifier for Telegram API access, which can be obtained at https://my.telegram.org
ApiId int32 `json:"api_id"`
// Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org
ApiHash string `json:"api_hash"`
// IETF language tag of the user's operating system language; must be non-empty
SystemLanguageCode string `json:"system_language_code"`
// Model of the device the application is being run on; must be non-empty
DeviceModel string `json:"device_model"`
// Version of the operating system the application is being run on; must be non-empty
SystemVersion string `json:"system_version"`
// Application version; must be non-empty
ApplicationVersion string `json:"application_version"`
// If set to true, old files will automatically be deleted
EnableStorageOptimizer bool `json:"enable_storage_optimizer"`
// If set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name
IgnoreFileNames bool `json:"ignore_file_names"`
2018-08-30 14:55:42 +00:00
}
func (entity *TdlibParameters) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TdlibParameters
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TdlibParameters) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTdlibParameters
2018-08-30 14:55:42 +00:00
}
func (*TdlibParameters) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTdlibParameters
2018-08-30 14:55:42 +00:00
}
// An authentication code is delivered via a private Telegram message, which can be viewed in another client
type AuthenticationCodeTypeTelegramMessage struct {
2018-10-23 12:38:10 +00:00
meta
// Length of the code
Length int32 `json:"length"`
2018-08-30 14:55:42 +00:00
}
func (entity *AuthenticationCodeTypeTelegramMessage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthenticationCodeTypeTelegramMessage
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeTelegramMessage) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthenticationCodeType
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeTelegramMessage) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthenticationCodeTypeTelegramMessage
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeTelegramMessage) AuthenticationCodeTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthenticationCodeTypeTelegramMessage
2018-08-30 14:55:42 +00:00
}
// An authentication code is delivered via an SMS message to the specified phone number
type AuthenticationCodeTypeSms struct {
2018-10-23 12:38:10 +00:00
meta
// Length of the code
Length int32 `json:"length"`
2018-08-30 14:55:42 +00:00
}
func (entity *AuthenticationCodeTypeSms) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthenticationCodeTypeSms
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeSms) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthenticationCodeType
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeSms) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthenticationCodeTypeSms
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeSms) AuthenticationCodeTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthenticationCodeTypeSms
2018-08-30 14:55:42 +00:00
}
// An authentication code is delivered via a phone call to the specified phone number
type AuthenticationCodeTypeCall struct {
2018-10-23 12:38:10 +00:00
meta
// Length of the code
Length int32 `json:"length"`
2018-08-30 14:55:42 +00:00
}
func (entity *AuthenticationCodeTypeCall) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthenticationCodeTypeCall
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeCall) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthenticationCodeType
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeCall) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthenticationCodeTypeCall
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeCall) AuthenticationCodeTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthenticationCodeTypeCall
2018-08-30 14:55:42 +00:00
}
// An authentication code is delivered by an immediately cancelled call to the specified phone number. The number from which the call was made is the code
type AuthenticationCodeTypeFlashCall struct {
2018-10-23 12:38:10 +00:00
meta
// Pattern of the phone number from which the call will be made
Pattern string `json:"pattern"`
2018-08-30 14:55:42 +00:00
}
func (entity *AuthenticationCodeTypeFlashCall) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthenticationCodeTypeFlashCall
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeFlashCall) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthenticationCodeType
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeFlashCall) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthenticationCodeTypeFlashCall
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeTypeFlashCall) AuthenticationCodeTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthenticationCodeTypeFlashCall
2018-08-30 14:55:42 +00:00
}
// Information about the authentication code that was sent
type AuthenticationCodeInfo struct {
2018-10-23 12:38:10 +00:00
meta
// A phone number that is being authenticated
PhoneNumber string `json:"phone_number"`
// Describes the way the code was sent to the user
Type AuthenticationCodeType `json:"type"`
// Describes the way the next code will be sent to the user; may be null
NextType AuthenticationCodeType `json:"next_type"`
// Timeout before the code should be re-sent, in seconds
Timeout int32 `json:"timeout"`
2018-08-30 14:55:42 +00:00
}
func (entity *AuthenticationCodeInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthenticationCodeInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthenticationCodeInfo
2018-08-30 14:55:42 +00:00
}
func (*AuthenticationCodeInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthenticationCodeInfo
2018-08-30 14:55:42 +00:00
}
func (authenticationCodeInfo *AuthenticationCodeInfo) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
PhoneNumber string `json:"phone_number"`
Type json.RawMessage `json:"type"`
NextType json.RawMessage `json:"next_type"`
Timeout int32 `json:"timeout"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
authenticationCodeInfo.PhoneNumber = tmp.PhoneNumber
authenticationCodeInfo.Timeout = tmp.Timeout
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldType, _ := UnmarshalAuthenticationCodeType(tmp.Type)
authenticationCodeInfo.Type = fieldType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldNextType, _ := UnmarshalAuthenticationCodeType(tmp.NextType)
authenticationCodeInfo.NextType = fieldNextType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Information about the email address authentication code that was sent
type EmailAddressAuthenticationCodeInfo struct {
2018-10-23 12:38:10 +00:00
meta
// Pattern of the email address to which an authentication code was sent
EmailAddressPattern string `json:"email_address_pattern"`
// Length of the code; 0 if unknown
Length int32 `json:"length"`
2018-09-05 21:45:29 +00:00
}
func (entity *EmailAddressAuthenticationCodeInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub EmailAddressAuthenticationCodeInfo
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*EmailAddressAuthenticationCodeInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassEmailAddressAuthenticationCodeInfo
2018-09-05 21:45:29 +00:00
}
func (*EmailAddressAuthenticationCodeInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeEmailAddressAuthenticationCodeInfo
2018-09-05 21:45:29 +00:00
}
// Represents a part of the text that needs to be formatted in some unusual way
type TextEntity struct {
2018-10-23 12:38:10 +00:00
meta
// Offset of the entity in UTF-16 code points
Offset int32 `json:"offset"`
// Length of the entity, in UTF-16 code points
Length int32 `json:"length"`
// Type of the entity
Type TextEntityType `json:"type"`
2018-09-05 21:45:29 +00:00
}
func (entity *TextEntity) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub TextEntity
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*TextEntity) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTextEntity
2018-09-05 21:45:29 +00:00
}
func (*TextEntity) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTextEntity
2018-09-05 21:45:29 +00:00
}
func (textEntity *TextEntity) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Offset int32 `json:"offset"`
Length int32 `json:"length"`
Type json.RawMessage `json:"type"`
}
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
textEntity.Offset = tmp.Offset
textEntity.Length = tmp.Length
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
fieldType, _ := UnmarshalTextEntityType(tmp.Type)
textEntity.Type = fieldType
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-09-05 21:45:29 +00:00
}
// Contains a list of text entities
type TextEntities struct {
2018-10-23 12:38:10 +00:00
meta
// List of text entities
Entities []*TextEntity `json:"entities"`
2018-09-05 21:45:29 +00:00
}
func (entity *TextEntities) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub TextEntities
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*TextEntities) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTextEntities
2018-09-05 21:45:29 +00:00
}
func (*TextEntities) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTextEntities
2018-09-05 21:45:29 +00:00
}
// A text with some entities
type FormattedText struct {
2018-10-23 12:38:10 +00:00
meta
// The text
Text string `json:"text"`
// Entities contained in the text
Entities []*TextEntity `json:"entities"`
2018-09-05 21:45:29 +00:00
}
func (entity *FormattedText) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub FormattedText
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*FormattedText) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFormattedText
2018-09-05 21:45:29 +00:00
}
func (*FormattedText) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFormattedText
2018-09-05 21:45:29 +00:00
}
// Contains Telegram terms of service
type TermsOfService struct {
2018-10-23 12:38:10 +00:00
meta
// Text of the terms of service
Text *FormattedText `json:"text"`
2019-09-10 12:36:54 +00:00
// Minimum age of a user to be able to accept the terms; 0 if any
2018-10-23 12:38:10 +00:00
MinUserAge int32 `json:"min_user_age"`
// True, if a blocking popup with terms of service must be shown to the user
ShowPopup bool `json:"show_popup"`
2018-09-05 21:45:29 +00:00
}
func (entity *TermsOfService) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub TermsOfService
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*TermsOfService) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTermsOfService
2018-09-05 21:45:29 +00:00
}
func (*TermsOfService) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTermsOfService
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// TDLib needs TdlibParameters for initialization
2018-10-23 12:38:10 +00:00
type AuthorizationStateWaitTdlibParameters struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *AuthorizationStateWaitTdlibParameters) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthorizationStateWaitTdlibParameters
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitTdlibParameters) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitTdlibParameters) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitTdlibParameters
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitTdlibParameters) AuthorizationStateType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitTdlibParameters
2018-08-30 14:55:42 +00:00
}
// TDLib needs an encryption key to decrypt the local database
type AuthorizationStateWaitEncryptionKey struct {
2018-10-23 12:38:10 +00:00
meta
// True, if the database is currently encrypted
IsEncrypted bool `json:"is_encrypted"`
2018-08-30 14:55:42 +00:00
}
func (entity *AuthorizationStateWaitEncryptionKey) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthorizationStateWaitEncryptionKey
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitEncryptionKey) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitEncryptionKey) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitEncryptionKey
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitEncryptionKey) AuthorizationStateType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitEncryptionKey
2018-08-30 14:55:42 +00:00
}
// TDLib needs the user's phone number to authorize
2018-10-23 12:38:10 +00:00
type AuthorizationStateWaitPhoneNumber struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *AuthorizationStateWaitPhoneNumber) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthorizationStateWaitPhoneNumber
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitPhoneNumber) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitPhoneNumber) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitPhoneNumber
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitPhoneNumber) AuthorizationStateType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitPhoneNumber
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// TDLib needs the user's authentication code to authorize
2018-08-30 14:55:42 +00:00
type AuthorizationStateWaitCode struct {
2018-10-23 12:38:10 +00:00
meta
// Information about the authorization code that was sent
CodeInfo *AuthenticationCodeInfo `json:"code_info"`
2018-08-30 14:55:42 +00:00
}
func (entity *AuthorizationStateWaitCode) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthorizationStateWaitCode
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitCode) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitCode) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitCode
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitCode) AuthorizationStateType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitCode
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration
type AuthorizationStateWaitRegistration struct {
meta
// Telegram terms of service
TermsOfService *TermsOfService `json:"terms_of_service"`
}
func (entity *AuthorizationStateWaitRegistration) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub AuthorizationStateWaitRegistration
return json.Marshal((*stub)(entity))
}
func (*AuthorizationStateWaitRegistration) GetClass() string {
return ClassAuthorizationState
}
func (*AuthorizationStateWaitRegistration) GetType() string {
return TypeAuthorizationStateWaitRegistration
}
func (*AuthorizationStateWaitRegistration) AuthorizationStateType() string {
return TypeAuthorizationStateWaitRegistration
}
2018-08-30 14:55:42 +00:00
// The user has been authorized, but needs to enter a password to start using the application
type AuthorizationStateWaitPassword struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Hint for the password; may be empty
2018-10-23 12:38:10 +00:00
PasswordHint string `json:"password_hint"`
2019-09-10 12:36:54 +00:00
// True, if a recovery email address has been set up
2018-10-23 12:38:10 +00:00
HasRecoveryEmailAddress bool `json:"has_recovery_email_address"`
// Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent
RecoveryEmailAddressPattern string `json:"recovery_email_address_pattern"`
2018-08-30 14:55:42 +00:00
}
func (entity *AuthorizationStateWaitPassword) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthorizationStateWaitPassword
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitPassword) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitPassword) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitPassword
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateWaitPassword) AuthorizationStateType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateWaitPassword
2018-08-30 14:55:42 +00:00
}
// The user has been successfully authorized. TDLib is now ready to answer queries
2018-10-23 12:38:10 +00:00
type AuthorizationStateReady struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *AuthorizationStateReady) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthorizationStateReady
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateReady) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateReady) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateReady
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateReady) AuthorizationStateType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateReady
2018-08-30 14:55:42 +00:00
}
// The user is currently logging out
2018-10-23 12:38:10 +00:00
type AuthorizationStateLoggingOut struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *AuthorizationStateLoggingOut) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthorizationStateLoggingOut
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateLoggingOut) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateLoggingOut) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateLoggingOut
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateLoggingOut) AuthorizationStateType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateLoggingOut
2018-08-30 14:55:42 +00:00
}
// TDLib is closing, all subsequent queries will be answered with the error 500. Note that closing TDLib can take a while. All resources will be freed only after authorizationStateClosed has been received
2018-10-23 12:38:10 +00:00
type AuthorizationStateClosing struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *AuthorizationStateClosing) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthorizationStateClosing
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateClosing) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateClosing) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateClosing
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateClosing) AuthorizationStateType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateClosing
2018-08-30 14:55:42 +00:00
}
// TDLib client is in its final state. All databases are closed and all resources are released. No other updates will be received after this. All queries will be responded to with error code 500. To continue working, one should create a new instance of the TDLib client
2018-10-23 12:38:10 +00:00
type AuthorizationStateClosed struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *AuthorizationStateClosed) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AuthorizationStateClosed
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateClosed) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateClosed) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateClosed
2018-08-30 14:55:42 +00:00
}
func (*AuthorizationStateClosed) AuthorizationStateType() string {
2018-10-23 12:38:10 +00:00
return TypeAuthorizationStateClosed
2018-08-30 14:55:42 +00:00
}
// Represents the current state of 2-step verification
type PasswordState struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// True, if a 2-step verification password is set
2018-10-23 12:38:10 +00:00
HasPassword bool `json:"has_password"`
2019-06-07 10:56:06 +00:00
// Hint for the password; may be empty
2018-10-23 12:38:10 +00:00
PasswordHint string `json:"password_hint"`
2019-06-07 10:56:06 +00:00
// True, if a recovery email is set
2018-10-23 12:38:10 +00:00
HasRecoveryEmailAddress bool `json:"has_recovery_email_address"`
2019-06-07 10:56:06 +00:00
// True, if some Telegram Passport elements were saved
2018-10-23 12:38:10 +00:00
HasPassportData bool `json:"has_passport_data"`
2019-06-07 10:56:06 +00:00
// Information about the recovery email address to which the confirmation email was sent; may be null
RecoveryEmailAddressCodeInfo *EmailAddressAuthenticationCodeInfo `json:"recovery_email_address_code_info"`
2018-08-30 14:55:42 +00:00
}
func (entity *PasswordState) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub PasswordState
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*PasswordState) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPasswordState
2018-08-30 14:55:42 +00:00
}
func (*PasswordState) GetType() string {
2018-10-23 12:38:10 +00:00
return TypePasswordState
2018-08-30 14:55:42 +00:00
}
// Contains information about the current recovery email address
type RecoveryEmailAddress struct {
2018-10-23 12:38:10 +00:00
meta
// Recovery email address
RecoveryEmailAddress string `json:"recovery_email_address"`
2018-08-30 14:55:42 +00:00
}
func (entity *RecoveryEmailAddress) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RecoveryEmailAddress
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RecoveryEmailAddress) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRecoveryEmailAddress
2018-08-30 14:55:42 +00:00
}
func (*RecoveryEmailAddress) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRecoveryEmailAddress
2018-08-30 14:55:42 +00:00
}
// Returns information about the availability of a temporary password, which can be used for payments
type TemporaryPasswordState struct {
2018-10-23 12:38:10 +00:00
meta
// True, if a temporary password is available
HasPassword bool `json:"has_password"`
// Time left before the temporary password expires, in seconds
ValidFor int32 `json:"valid_for"`
2018-08-30 14:55:42 +00:00
}
func (entity *TemporaryPasswordState) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TemporaryPasswordState
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TemporaryPasswordState) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTemporaryPasswordState
2018-08-30 14:55:42 +00:00
}
func (*TemporaryPasswordState) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTemporaryPasswordState
2018-08-30 14:55:42 +00:00
}
// Represents a local file
type LocalFile struct {
2018-10-23 12:38:10 +00:00
meta
// Local path to the locally available file part; may be empty
Path string `json:"path"`
// True, if it is possible to try to download or generate the file
CanBeDownloaded bool `json:"can_be_downloaded"`
// True, if the file can be deleted
CanBeDeleted bool `json:"can_be_deleted"`
// True, if the file is currently being downloaded (or a local copy is being generated by some other means)
IsDownloadingActive bool `json:"is_downloading_active"`
// True, if the local copy is fully available
IsDownloadingCompleted bool `json:"is_downloading_completed"`
2019-06-07 10:56:06 +00:00
// Download will be started from this offset. downloaded_prefix_size is calculated from this offset
DownloadOffset int32 `json:"download_offset"`
// If is_downloading_completed is false, then only some prefix of the file starting from download_offset is ready to be read. downloaded_prefix_size is the size of that prefix
2018-10-23 12:38:10 +00:00
DownloadedPrefixSize int32 `json:"downloaded_prefix_size"`
// Total downloaded file bytes. Should be used only for calculating download progress. The actual file size may be bigger, and some parts of it may contain garbage
DownloadedSize int32 `json:"downloaded_size"`
2018-08-30 14:55:42 +00:00
}
func (entity *LocalFile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub LocalFile
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*LocalFile) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassLocalFile
2018-08-30 14:55:42 +00:00
}
func (*LocalFile) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeLocalFile
2018-08-30 14:55:42 +00:00
}
// Represents a remote file
type RemoteFile struct {
2018-10-23 12:38:10 +00:00
meta
// Remote file identifier; may be empty. Can be used across application restarts or even from other devices for the current user. If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the client with the HTTP URL in the original_path and "#url#" as the conversion string. Clients should generate the file by downloading it to the specified location
Id string `json:"id"`
// True, if the file is currently being uploaded (or a remote copy is being generated by some other means)
IsUploadingActive bool `json:"is_uploading_active"`
// True, if a remote copy is fully available
IsUploadingCompleted bool `json:"is_uploading_completed"`
// Size of the remote available part of the file; 0 if unknown
UploadedSize int32 `json:"uploaded_size"`
2018-08-30 14:55:42 +00:00
}
func (entity *RemoteFile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RemoteFile
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RemoteFile) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRemoteFile
2018-08-30 14:55:42 +00:00
}
func (*RemoteFile) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRemoteFile
2018-08-30 14:55:42 +00:00
}
// Represents a file
type File struct {
2018-10-23 12:38:10 +00:00
meta
// Unique file identifier
Id int32 `json:"id"`
// File size; 0 if unknown
Size int32 `json:"size"`
// Expected file size in case the exact file size is unknown, but an approximate size is known. Can be used to show download/upload progress
ExpectedSize int32 `json:"expected_size"`
// Information about the local copy of the file
Local *LocalFile `json:"local"`
// Information about the remote copy of the file
Remote *RemoteFile `json:"remote"`
2018-08-30 14:55:42 +00:00
}
func (entity *File) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub File
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*File) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFile
2018-08-30 14:55:42 +00:00
}
func (*File) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFile
2018-08-30 14:55:42 +00:00
}
// A file defined by its unique ID
type InputFileId struct {
2018-10-23 12:38:10 +00:00
meta
// Unique file identifier
Id int32 `json:"id"`
2018-08-30 14:55:42 +00:00
}
func (entity *InputFileId) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InputFileId
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InputFileId) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInputFile
2018-08-30 14:55:42 +00:00
}
func (*InputFileId) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInputFileId
2018-08-30 14:55:42 +00:00
}
func (*InputFileId) InputFileType() string {
2018-10-23 12:38:10 +00:00
return TypeInputFileId
2018-08-30 14:55:42 +00:00
}
// A file defined by its remote ID
type InputFileRemote struct {
2018-10-23 12:38:10 +00:00
meta
// Remote file identifier
Id string `json:"id"`
2018-08-30 14:55:42 +00:00
}
func (entity *InputFileRemote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InputFileRemote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InputFileRemote) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInputFile
2018-08-30 14:55:42 +00:00
}
func (*InputFileRemote) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInputFileRemote
2018-08-30 14:55:42 +00:00
}
func (*InputFileRemote) InputFileType() string {
2018-10-23 12:38:10 +00:00
return TypeInputFileRemote
2018-08-30 14:55:42 +00:00
}
// A file defined by a local path
type InputFileLocal struct {
2018-10-23 12:38:10 +00:00
meta
// Local path to the file
Path string `json:"path"`
2018-08-30 14:55:42 +00:00
}
func (entity *InputFileLocal) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InputFileLocal
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InputFileLocal) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInputFile
2018-08-30 14:55:42 +00:00
}
func (*InputFileLocal) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInputFileLocal
2018-08-30 14:55:42 +00:00
}
func (*InputFileLocal) InputFileType() string {
2018-10-23 12:38:10 +00:00
return TypeInputFileLocal
2018-08-30 14:55:42 +00:00
}
// A file generated by the client
type InputFileGenerated struct {
2018-10-23 12:38:10 +00:00
meta
// Local path to a file from which the file is generated; may be empty if there is no such file
OriginalPath string `json:"original_path"`
2019-06-07 10:56:06 +00:00
// String specifying the conversion applied to the original file; should be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage
2018-10-23 12:38:10 +00:00
Conversion string `json:"conversion"`
// Expected size of the generated file; 0 if unknown
ExpectedSize int32 `json:"expected_size"`
2018-08-30 14:55:42 +00:00
}
func (entity *InputFileGenerated) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InputFileGenerated
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InputFileGenerated) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInputFile
2018-08-30 14:55:42 +00:00
}
func (*InputFileGenerated) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInputFileGenerated
2018-08-30 14:55:42 +00:00
}
func (*InputFileGenerated) InputFileType() string {
2018-10-23 12:38:10 +00:00
return TypeInputFileGenerated
2018-08-30 14:55:42 +00:00
}
// Photo description
type PhotoSize struct {
2018-10-23 12:38:10 +00:00
meta
// Thumbnail type (see https://core.telegram.org/constructor/photoSize)
Type string `json:"type"`
// Information about the photo file
Photo *File `json:"photo"`
// Photo width
Width int32 `json:"width"`
// Photo height
Height int32 `json:"height"`
2018-08-30 14:55:42 +00:00
}
func (entity *PhotoSize) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub PhotoSize
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*PhotoSize) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPhotoSize
2018-08-30 14:55:42 +00:00
}
func (*PhotoSize) GetType() string {
2018-10-23 12:38:10 +00:00
return TypePhotoSize
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Thumbnail image of a very poor quality and low resolution
type Minithumbnail struct {
meta
// Thumbnail width, usually doesn't exceed 40
Width int32 `json:"width"`
// Thumbnail height, usually doesn't exceed 40
Height int32 `json:"height"`
// The thumbnail in JPEG format
Data []byte `json:"data"`
}
func (entity *Minithumbnail) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub Minithumbnail
return json.Marshal((*stub)(entity))
}
func (*Minithumbnail) GetClass() string {
return ClassMinithumbnail
}
func (*Minithumbnail) GetType() string {
return TypeMinithumbnail
}
2018-08-30 14:55:42 +00:00
// A mask should be placed relatively to the forehead
2018-10-23 12:38:10 +00:00
type MaskPointForehead struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *MaskPointForehead) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub MaskPointForehead
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*MaskPointForehead) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMaskPoint
2018-08-30 14:55:42 +00:00
}
func (*MaskPointForehead) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeMaskPointForehead
2018-08-30 14:55:42 +00:00
}
func (*MaskPointForehead) MaskPointType() string {
2018-10-23 12:38:10 +00:00
return TypeMaskPointForehead
2018-08-30 14:55:42 +00:00
}
// A mask should be placed relatively to the eyes
2018-10-23 12:38:10 +00:00
type MaskPointEyes struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *MaskPointEyes) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub MaskPointEyes
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*MaskPointEyes) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMaskPoint
2018-08-30 14:55:42 +00:00
}
func (*MaskPointEyes) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeMaskPointEyes
2018-08-30 14:55:42 +00:00
}
func (*MaskPointEyes) MaskPointType() string {
2018-10-23 12:38:10 +00:00
return TypeMaskPointEyes
2018-08-30 14:55:42 +00:00
}
// A mask should be placed relatively to the mouth
2018-10-23 12:38:10 +00:00
type MaskPointMouth struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *MaskPointMouth) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub MaskPointMouth
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*MaskPointMouth) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMaskPoint
2018-08-30 14:55:42 +00:00
}
func (*MaskPointMouth) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeMaskPointMouth
2018-08-30 14:55:42 +00:00
}
func (*MaskPointMouth) MaskPointType() string {
2018-10-23 12:38:10 +00:00
return TypeMaskPointMouth
2018-08-30 14:55:42 +00:00
}
// A mask should be placed relatively to the chin
2018-10-23 12:38:10 +00:00
type MaskPointChin struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *MaskPointChin) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub MaskPointChin
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*MaskPointChin) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMaskPoint
2018-08-30 14:55:42 +00:00
}
func (*MaskPointChin) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeMaskPointChin
2018-08-30 14:55:42 +00:00
}
func (*MaskPointChin) MaskPointType() string {
2018-10-23 12:38:10 +00:00
return TypeMaskPointChin
2018-08-30 14:55:42 +00:00
}
// Position on a photo where a mask should be placed
type MaskPosition struct {
2018-10-23 12:38:10 +00:00
meta
// Part of the face, relative to which the mask should be placed
Point MaskPoint `json:"point"`
// Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position)
XShift float64 `json:"x_shift"`
// Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. (For example, 1.0 will place the mask just below the default mask position)
YShift float64 `json:"y_shift"`
// Mask scaling coefficient. (For example, 2.0 means a doubled size)
Scale float64 `json:"scale"`
2018-08-30 14:55:42 +00:00
}
func (entity *MaskPosition) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub MaskPosition
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*MaskPosition) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMaskPosition
2018-08-30 14:55:42 +00:00
}
func (*MaskPosition) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeMaskPosition
2018-08-30 14:55:42 +00:00
}
func (maskPosition *MaskPosition) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Point json.RawMessage `json:"point"`
XShift float64 `json:"x_shift"`
YShift float64 `json:"y_shift"`
Scale float64 `json:"scale"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
maskPosition.XShift = tmp.XShift
maskPosition.YShift = tmp.YShift
maskPosition.Scale = tmp.Scale
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldPoint, _ := UnmarshalMaskPoint(tmp.Point)
maskPosition.Point = fieldPoint
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Describes one answer option of a poll
type PollOption struct {
meta
// Option text, 1-100 characters
Text string `json:"text"`
// Number of voters for this option, available only for closed or voted polls
VoterCount int32 `json:"voter_count"`
// The percentage of votes for this option, 0-100
VotePercentage int32 `json:"vote_percentage"`
// True, if the option was chosen by the user
IsChosen bool `json:"is_chosen"`
// True, if the option is being chosen by a pending setPollAnswer request
IsBeingChosen bool `json:"is_being_chosen"`
}
func (entity *PollOption) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub PollOption
return json.Marshal((*stub)(entity))
}
func (*PollOption) GetClass() string {
return ClassPollOption
}
func (*PollOption) GetType() string {
return TypePollOption
}
2018-09-05 21:45:29 +00:00
// Describes an animation file. The animation must be encoded in GIF or MPEG4 format
type Animation struct {
2018-10-23 12:38:10 +00:00
meta
// Duration of the animation, in seconds; as defined by the sender
Duration int32 `json:"duration"`
// Width of the animation
Width int32 `json:"width"`
// Height of the animation
Height int32 `json:"height"`
// Original name of the file; as defined by the sender
FileName string `json:"file_name"`
// MIME type of the file, usually "image/gif" or "video/mp4"
MimeType string `json:"mime_type"`
2019-09-10 12:36:54 +00:00
// Animation minithumbnail; may be null
Minithumbnail *Minithumbnail `json:"minithumbnail"`
2018-10-23 12:38:10 +00:00
// Animation thumbnail; may be null
Thumbnail *PhotoSize `json:"thumbnail"`
// File containing the animation
Animation *File `json:"animation"`
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (entity *Animation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Animation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*Animation) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAnimation
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*Animation) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAnimation
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Describes an audio file. Audio is usually in MP3 format
type Audio struct {
2018-10-23 12:38:10 +00:00
meta
// Duration of the audio, in seconds; as defined by the sender
Duration int32 `json:"duration"`
// Title of the audio; as defined by the sender
Title string `json:"title"`
// Performer of the audio; as defined by the sender
Performer string `json:"performer"`
// Original name of the file; as defined by the sender
FileName string `json:"file_name"`
// The MIME type of the file; as defined by the sender
MimeType string `json:"mime_type"`
2019-09-10 12:36:54 +00:00
// The minithumbnail of the album cover; may be null
AlbumCoverMinithumbnail *Minithumbnail `json:"album_cover_minithumbnail"`
2018-10-23 12:38:10 +00:00
// The thumbnail of the album cover; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null
AlbumCoverThumbnail *PhotoSize `json:"album_cover_thumbnail"`
// File containing the audio
Audio *File `json:"audio"`
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (entity *Audio) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Audio
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*Audio) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAudio
2018-08-30 14:55:42 +00:00
}
func (*Audio) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAudio
2018-08-30 14:55:42 +00:00
}
// Describes a document of any type
type Document struct {
2018-10-23 12:38:10 +00:00
meta
// Original name of the file; as defined by the sender
FileName string `json:"file_name"`
// MIME type of the file; as defined by the sender
MimeType string `json:"mime_type"`
2019-09-10 12:36:54 +00:00
// Document minithumbnail; may be null
Minithumbnail *Minithumbnail `json:"minithumbnail"`
// Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null
2018-10-23 12:38:10 +00:00
Thumbnail *PhotoSize `json:"thumbnail"`
// File containing the document
Document *File `json:"document"`
2018-08-30 14:55:42 +00:00
}
func (entity *Document) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Document
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Document) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassDocument
2018-08-30 14:55:42 +00:00
}
func (*Document) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeDocument
2018-08-30 14:55:42 +00:00
}
// Describes a photo
type Photo struct {
2018-10-23 12:38:10 +00:00
meta
// True, if stickers were added to the photo
HasStickers bool `json:"has_stickers"`
2019-09-10 12:36:54 +00:00
// Photo minithumbnail; may be null
Minithumbnail *Minithumbnail `json:"minithumbnail"`
2018-10-23 12:38:10 +00:00
// Available variants of the photo, in different sizes
Sizes []*PhotoSize `json:"sizes"`
2018-08-30 14:55:42 +00:00
}
func (entity *Photo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Photo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Photo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPhoto
2018-08-30 14:55:42 +00:00
}
func (*Photo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypePhoto
2018-08-30 14:55:42 +00:00
}
// Describes a sticker
type Sticker struct {
2018-10-23 12:38:10 +00:00
meta
// The identifier of the sticker set to which the sticker belongs; 0 if none
SetId JsonInt64 `json:"set_id"`
// Sticker width; as defined by the sender
Width int32 `json:"width"`
// Sticker height; as defined by the sender
Height int32 `json:"height"`
// Emoji corresponding to the sticker
Emoji string `json:"emoji"`
2019-09-10 12:36:54 +00:00
// True, if the sticker is an animated sticker in TGS format
IsAnimated bool `json:"is_animated"`
2018-10-23 12:38:10 +00:00
// True, if the sticker is a mask
IsMask bool `json:"is_mask"`
// Position where the mask should be placed; may be null
MaskPosition *MaskPosition `json:"mask_position"`
// Sticker thumbnail in WEBP or JPEG format; may be null
Thumbnail *PhotoSize `json:"thumbnail"`
// File containing the sticker
Sticker *File `json:"sticker"`
2018-08-30 14:55:42 +00:00
}
func (entity *Sticker) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Sticker
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Sticker) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSticker
2018-08-30 14:55:42 +00:00
}
func (*Sticker) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSticker
2018-08-30 14:55:42 +00:00
}
// Describes a video file
type Video struct {
2018-10-23 12:38:10 +00:00
meta
// Duration of the video, in seconds; as defined by the sender
Duration int32 `json:"duration"`
// Video width; as defined by the sender
Width int32 `json:"width"`
// Video height; as defined by the sender
Height int32 `json:"height"`
// Original name of the file; as defined by the sender
FileName string `json:"file_name"`
// MIME type of the file; as defined by the sender
MimeType string `json:"mime_type"`
// True, if stickers were added to the photo
HasStickers bool `json:"has_stickers"`
// True, if the video should be tried to be streamed
SupportsStreaming bool `json:"supports_streaming"`
2019-09-10 12:36:54 +00:00
// Video minithumbnail; may be null
Minithumbnail *Minithumbnail `json:"minithumbnail"`
2018-10-23 12:38:10 +00:00
// Video thumbnail; as defined by the sender; may be null
Thumbnail *PhotoSize `json:"thumbnail"`
// File containing the video
Video *File `json:"video"`
2018-08-30 14:55:42 +00:00
}
func (entity *Video) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Video
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Video) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassVideo
2018-08-30 14:55:42 +00:00
}
func (*Video) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeVideo
2018-08-30 14:55:42 +00:00
}
// Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format
type VideoNote struct {
2018-10-23 12:38:10 +00:00
meta
// Duration of the video, in seconds; as defined by the sender
Duration int32 `json:"duration"`
// Video width and height; as defined by the sender
Length int32 `json:"length"`
2019-09-10 12:36:54 +00:00
// Video minithumbnail; may be null
Minithumbnail *Minithumbnail `json:"minithumbnail"`
2018-10-23 12:38:10 +00:00
// Video thumbnail; as defined by the sender; may be null
Thumbnail *PhotoSize `json:"thumbnail"`
// File containing the video
Video *File `json:"video"`
2018-08-30 14:55:42 +00:00
}
func (entity *VideoNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub VideoNote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*VideoNote) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassVideoNote
2018-08-30 14:55:42 +00:00
}
func (*VideoNote) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeVideoNote
2018-08-30 14:55:42 +00:00
}
// Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel
type VoiceNote struct {
2018-10-23 12:38:10 +00:00
meta
// Duration of the voice note, in seconds; as defined by the sender
Duration int32 `json:"duration"`
// A waveform representation of the voice note in 5-bit format
Waveform []byte `json:"waveform"`
// MIME type of the file; as defined by the sender
MimeType string `json:"mime_type"`
// File containing the voice note
Voice *File `json:"voice"`
2018-08-30 14:55:42 +00:00
}
func (entity *VoiceNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub VoiceNote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*VoiceNote) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassVoiceNote
2018-08-30 14:55:42 +00:00
}
func (*VoiceNote) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeVoiceNote
2018-08-30 14:55:42 +00:00
}
// Describes a user contact
type Contact struct {
2018-10-23 12:38:10 +00:00
meta
// Phone number of the user
PhoneNumber string `json:"phone_number"`
// First name of the user; 1-255 characters in length
FirstName string `json:"first_name"`
// Last name of the user
LastName string `json:"last_name"`
// Additional data about the user in a form of vCard; 0-2048 bytes in length
Vcard string `json:"vcard"`
// Identifier of the user, if known; otherwise 0
UserId int32 `json:"user_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *Contact) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Contact
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Contact) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassContact
2018-08-30 14:55:42 +00:00
}
func (*Contact) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeContact
2018-08-30 14:55:42 +00:00
}
// Describes a location on planet Earth
type Location struct {
2018-10-23 12:38:10 +00:00
meta
// Latitude of the location in degrees; as defined by the sender
Latitude float64 `json:"latitude"`
// Longitude of the location, in degrees; as defined by the sender
Longitude float64 `json:"longitude"`
2018-08-30 14:55:42 +00:00
}
func (entity *Location) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Location
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Location) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassLocation
2018-08-30 14:55:42 +00:00
}
func (*Location) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeLocation
2018-08-30 14:55:42 +00:00
}
// Describes a venue
type Venue struct {
2018-10-23 12:38:10 +00:00
meta
// Venue location; as defined by the sender
Location *Location `json:"location"`
// Venue name; as defined by the sender
Title string `json:"title"`
// Venue address; as defined by the sender
Address string `json:"address"`
// Provider of the venue database; as defined by the sender. Currently only "foursquare" needs to be supported
Provider string `json:"provider"`
// Identifier of the venue in the provider database; as defined by the sender
Id string `json:"id"`
// Type of the venue in the provider database; as defined by the sender
Type string `json:"type"`
2018-08-30 14:55:42 +00:00
}
func (entity *Venue) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Venue
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Venue) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassVenue
2018-08-30 14:55:42 +00:00
}
func (*Venue) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeVenue
2018-08-30 14:55:42 +00:00
}
// Describes a game
type Game struct {
2018-10-23 12:38:10 +00:00
meta
// Game ID
Id JsonInt64 `json:"id"`
// Game short name. To share a game use the URL https://t.me/{bot_username}?game={game_short_name}
ShortName string `json:"short_name"`
// Game title
Title string `json:"title"`
// Game text, usually containing scoreboards for a game
Text *FormattedText `json:"text"`
// Game description
Description string `json:"description"`
// Game photo
Photo *Photo `json:"photo"`
// Game animation; may be null
Animation *Animation `json:"animation"`
2018-08-30 14:55:42 +00:00
}
func (entity *Game) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Game
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Game) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassGame
2018-08-30 14:55:42 +00:00
}
func (*Game) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Describes a poll
type Poll struct {
meta
// Unique poll identifier
Id JsonInt64 `json:"id"`
// Poll question, 1-255 characters
Question string `json:"question"`
// List of poll answer options
Options []*PollOption `json:"options"`
// Total number of voters, participating in the poll
TotalVoterCount int32 `json:"total_voter_count"`
// True, if the poll is closed
IsClosed bool `json:"is_closed"`
}
func (entity *Poll) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub Poll
return json.Marshal((*stub)(entity))
}
func (*Poll) GetClass() string {
return ClassPoll
}
func (*Poll) GetType() string {
return TypePoll
}
2018-08-30 14:55:42 +00:00
// Describes a user profile photo
type ProfilePhoto struct {
2018-10-23 12:38:10 +00:00
meta
// Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of userProfilePhotos
Id JsonInt64 `json:"id"`
2019-09-10 12:36:54 +00:00
// A small (160x160) user profile photo. The file can be downloaded only before the photo is changed
2018-10-23 12:38:10 +00:00
Small *File `json:"small"`
2019-09-10 12:36:54 +00:00
// A big (640x640) user profile photo. The file can be downloaded only before the photo is changed
2018-10-23 12:38:10 +00:00
Big *File `json:"big"`
2018-08-30 14:55:42 +00:00
}
func (entity *ProfilePhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ProfilePhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ProfilePhoto) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassProfilePhoto
2018-08-30 14:55:42 +00:00
}
func (*ProfilePhoto) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeProfilePhoto
2018-08-30 14:55:42 +00:00
}
// Describes the photo of a chat
type ChatPhoto struct {
2018-10-23 12:38:10 +00:00
meta
2019-09-10 12:36:54 +00:00
// A small (160x160) chat photo. The file can be downloaded only before the photo is changed
2018-10-23 12:38:10 +00:00
Small *File `json:"small"`
2019-09-10 12:36:54 +00:00
// A big (640x640) chat photo. The file can be downloaded only before the photo is changed
2018-10-23 12:38:10 +00:00
Big *File `json:"big"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatPhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatPhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatPhoto) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatPhoto
2018-08-30 14:55:42 +00:00
}
func (*ChatPhoto) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatPhoto
2018-08-30 14:55:42 +00:00
}
// The phone number of user A is not known to user B
2018-10-23 12:38:10 +00:00
type LinkStateNone struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *LinkStateNone) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub LinkStateNone
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*LinkStateNone) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassLinkState
2018-08-30 14:55:42 +00:00
}
func (*LinkStateNone) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeLinkStateNone
2018-08-30 14:55:42 +00:00
}
func (*LinkStateNone) LinkStateType() string {
2018-10-23 12:38:10 +00:00
return TypeLinkStateNone
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The phone number of user A is known but that number has not been saved to the contact list of user B
2018-10-23 12:38:10 +00:00
type LinkStateKnowsPhoneNumber struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *LinkStateKnowsPhoneNumber) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub LinkStateKnowsPhoneNumber
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*LinkStateKnowsPhoneNumber) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassLinkState
2018-08-30 14:55:42 +00:00
}
func (*LinkStateKnowsPhoneNumber) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeLinkStateKnowsPhoneNumber
2018-08-30 14:55:42 +00:00
}
func (*LinkStateKnowsPhoneNumber) LinkStateType() string {
2018-10-23 12:38:10 +00:00
return TypeLinkStateKnowsPhoneNumber
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The phone number of user A has been saved to the contact list of user B
2018-10-23 12:38:10 +00:00
type LinkStateIsContact struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *LinkStateIsContact) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub LinkStateIsContact
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*LinkStateIsContact) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassLinkState
2018-08-30 14:55:42 +00:00
}
func (*LinkStateIsContact) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeLinkStateIsContact
2018-08-30 14:55:42 +00:00
}
func (*LinkStateIsContact) LinkStateType() string {
2018-10-23 12:38:10 +00:00
return TypeLinkStateIsContact
2018-08-30 14:55:42 +00:00
}
// A regular user
2018-10-23 12:38:10 +00:00
type UserTypeRegular struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserTypeRegular) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserTypeRegular
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserTypeRegular) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserType
2018-08-30 14:55:42 +00:00
}
func (*UserTypeRegular) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserTypeRegular
2018-08-30 14:55:42 +00:00
}
func (*UserTypeRegular) UserTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeUserTypeRegular
2018-08-30 14:55:42 +00:00
}
// A deleted user or deleted bot. No information on the user besides the user_id is available. It is not possible to perform any active actions on this type of user
2018-10-23 12:38:10 +00:00
type UserTypeDeleted struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserTypeDeleted) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserTypeDeleted
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserTypeDeleted) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserType
2018-08-30 14:55:42 +00:00
}
func (*UserTypeDeleted) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserTypeDeleted
2018-08-30 14:55:42 +00:00
}
func (*UserTypeDeleted) UserTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeUserTypeDeleted
2018-08-30 14:55:42 +00:00
}
// A bot (see https://core.telegram.org/bots)
type UserTypeBot struct {
2018-10-23 12:38:10 +00:00
meta
// True, if the bot can be invited to basic group and supergroup chats
CanJoinGroups bool `json:"can_join_groups"`
// True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages
CanReadAllGroupMessages bool `json:"can_read_all_group_messages"`
// True, if the bot supports inline queries
IsInline bool `json:"is_inline"`
// Placeholder for inline queries (displayed on the client input field)
InlineQueryPlaceholder string `json:"inline_query_placeholder"`
// True, if the location of the user should be sent with every inline query to this bot
NeedLocation bool `json:"need_location"`
2018-08-30 14:55:42 +00:00
}
func (entity *UserTypeBot) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserTypeBot
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserTypeBot) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserType
2018-08-30 14:55:42 +00:00
}
func (*UserTypeBot) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserTypeBot
2018-08-30 14:55:42 +00:00
}
func (*UserTypeBot) UserTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeUserTypeBot
2018-08-30 14:55:42 +00:00
}
// No information on the user besides the user_id is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type
2018-10-23 12:38:10 +00:00
type UserTypeUnknown struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserTypeUnknown) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserTypeUnknown
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserTypeUnknown) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserType
2018-08-30 14:55:42 +00:00
}
func (*UserTypeUnknown) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserTypeUnknown
2018-08-30 14:55:42 +00:00
}
func (*UserTypeUnknown) UserTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeUserTypeUnknown
2018-08-30 14:55:42 +00:00
}
// Represents commands supported by a bot
type BotCommand struct {
2018-10-23 12:38:10 +00:00
meta
// Text of the bot command
Command string `json:"command"`
// Description of the bot command
Description string `json:"description"`
2018-08-30 14:55:42 +00:00
}
func (entity *BotCommand) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub BotCommand
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*BotCommand) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassBotCommand
2018-08-30 14:55:42 +00:00
}
func (*BotCommand) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeBotCommand
2018-08-30 14:55:42 +00:00
}
// Provides information about a bot and its supported commands
type BotInfo struct {
2018-10-23 12:38:10 +00:00
meta
// Long description shown on the user info page
Description string `json:"description"`
// A list of commands supported by the bot
Commands []*BotCommand `json:"commands"`
2018-08-30 14:55:42 +00:00
}
func (entity *BotInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub BotInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*BotInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassBotInfo
2018-08-30 14:55:42 +00:00
}
func (*BotInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeBotInfo
2018-08-30 14:55:42 +00:00
}
// Represents a user
type User struct {
2018-10-23 12:38:10 +00:00
meta
// User identifier
Id int32 `json:"id"`
// First name of the user
FirstName string `json:"first_name"`
// Last name of the user
LastName string `json:"last_name"`
// Username of the user
Username string `json:"username"`
// Phone number of the user
PhoneNumber string `json:"phone_number"`
// Current online status of the user
Status UserStatus `json:"status"`
// Profile photo of the user; may be null
ProfilePhoto *ProfilePhoto `json:"profile_photo"`
// Relationship from the current user to the other user
OutgoingLink LinkState `json:"outgoing_link"`
// Relationship from the other user to the current user
IncomingLink LinkState `json:"incoming_link"`
// True, if the user is verified
IsVerified bool `json:"is_verified"`
2019-06-07 10:56:06 +00:00
// True, if the user is Telegram support account
IsSupport bool `json:"is_support"`
2018-10-23 12:38:10 +00:00
// If non-empty, it contains the reason why access to this user must be restricted. The format of the string is "{type}: {description}". {type} contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user)
RestrictionReason string `json:"restriction_reason"`
2019-09-10 12:36:54 +00:00
// True, if many users reported this user as a scam
IsScam bool `json:"is_scam"`
2018-10-23 12:38:10 +00:00
// If false, the user is inaccessible, and the only information known about the user is inside this class. It can't be passed to any method except GetUser
HaveAccess bool `json:"have_access"`
// Type of the user
Type UserType `json:"type"`
// IETF language tag of the user's language; only available to bots
LanguageCode string `json:"language_code"`
2018-08-30 14:55:42 +00:00
}
func (entity *User) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub User
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*User) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUser
2018-08-30 14:55:42 +00:00
}
func (*User) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUser
2018-08-30 14:55:42 +00:00
}
func (user *User) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Id int32 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Username string `json:"username"`
PhoneNumber string `json:"phone_number"`
Status json.RawMessage `json:"status"`
ProfilePhoto *ProfilePhoto `json:"profile_photo"`
OutgoingLink json.RawMessage `json:"outgoing_link"`
IncomingLink json.RawMessage `json:"incoming_link"`
IsVerified bool `json:"is_verified"`
2019-06-07 10:56:06 +00:00
IsSupport bool `json:"is_support"`
2018-10-23 12:38:10 +00:00
RestrictionReason string `json:"restriction_reason"`
2019-09-10 12:36:54 +00:00
IsScam bool `json:"is_scam"`
2018-10-23 12:38:10 +00:00
HaveAccess bool `json:"have_access"`
Type json.RawMessage `json:"type"`
LanguageCode string `json:"language_code"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
user.Id = tmp.Id
user.FirstName = tmp.FirstName
user.LastName = tmp.LastName
user.Username = tmp.Username
user.PhoneNumber = tmp.PhoneNumber
user.ProfilePhoto = tmp.ProfilePhoto
user.IsVerified = tmp.IsVerified
2019-06-07 10:56:06 +00:00
user.IsSupport = tmp.IsSupport
2018-10-23 12:38:10 +00:00
user.RestrictionReason = tmp.RestrictionReason
2019-09-10 12:36:54 +00:00
user.IsScam = tmp.IsScam
2018-10-23 12:38:10 +00:00
user.HaveAccess = tmp.HaveAccess
user.LanguageCode = tmp.LanguageCode
fieldStatus, _ := UnmarshalUserStatus(tmp.Status)
user.Status = fieldStatus
fieldOutgoingLink, _ := UnmarshalLinkState(tmp.OutgoingLink)
user.OutgoingLink = fieldOutgoingLink
fieldIncomingLink, _ := UnmarshalLinkState(tmp.IncomingLink)
user.IncomingLink = fieldIncomingLink
fieldType, _ := UnmarshalUserType(tmp.Type)
user.Type = fieldType
return nil
2018-08-30 14:55:42 +00:00
}
// Contains full information about a user (except the full list of profile photos)
type UserFullInfo struct {
2018-10-23 12:38:10 +00:00
meta
// True, if the user is blacklisted by the current user
IsBlocked bool `json:"is_blocked"`
// True, if the user can be called
CanBeCalled bool `json:"can_be_called"`
// True, if the user can't be called due to their privacy settings
HasPrivateCalls bool `json:"has_private_calls"`
// A short user bio
Bio string `json:"bio"`
// For bots, the text that is included with the link when users share the bot
ShareText string `json:"share_text"`
// Number of group chats where both the other user and the current user are a member; 0 for the current user
GroupInCommonCount int32 `json:"group_in_common_count"`
// If the user is a bot, information about the bot; may be null
BotInfo *BotInfo `json:"bot_info"`
2018-08-30 14:55:42 +00:00
}
func (entity *UserFullInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserFullInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserFullInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserFullInfo
2018-08-30 14:55:42 +00:00
}
func (*UserFullInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserFullInfo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains full information about a user profile photo
type UserProfilePhoto struct {
meta
// Unique user profile photo identifier
Id JsonInt64 `json:"id"`
// Point in time (Unix timestamp) when the photo has been added
AddedDate int32 `json:"added_date"`
// Available variants of the user photo, in different sizes
Sizes []*PhotoSize `json:"sizes"`
}
func (entity *UserProfilePhoto) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserProfilePhoto
return json.Marshal((*stub)(entity))
}
func (*UserProfilePhoto) GetClass() string {
return ClassUserProfilePhoto
}
func (*UserProfilePhoto) GetType() string {
return TypeUserProfilePhoto
}
2018-08-30 14:55:42 +00:00
// Contains part of the list of user photos
type UserProfilePhotos struct {
2018-10-23 12:38:10 +00:00
meta
// Total number of user profile photos
TotalCount int32 `json:"total_count"`
// A list of photos
2019-06-07 10:56:06 +00:00
Photos []*UserProfilePhoto `json:"photos"`
2018-08-30 14:55:42 +00:00
}
func (entity *UserProfilePhotos) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserProfilePhotos
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserProfilePhotos) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserProfilePhotos
2018-08-30 14:55:42 +00:00
}
func (*UserProfilePhotos) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserProfilePhotos
2018-08-30 14:55:42 +00:00
}
// Represents a list of users
type Users struct {
2018-10-23 12:38:10 +00:00
meta
// Approximate total count of users found
TotalCount int32 `json:"total_count"`
// A list of user identifiers
UserIds []int32 `json:"user_ids"`
2018-08-30 14:55:42 +00:00
}
func (entity *Users) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Users
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Users) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUsers
2018-08-30 14:55:42 +00:00
}
func (*Users) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUsers
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Describes actions that a user is allowed to take in a chat
type ChatPermissions struct {
meta
// True, if the user can send text messages, contacts, locations, and venues
CanSendMessages bool `json:"can_send_messages"`
// True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions
CanSendMediaMessages bool `json:"can_send_media_messages"`
// True, if the user can send polls. Implies can_send_messages permissions
CanSendPolls bool `json:"can_send_polls"`
// True, if the user can send animations, games, and stickers and use inline bots. Implies can_send_messages permissions
CanSendOtherMessages bool `json:"can_send_other_messages"`
// True, if the user may add a web page preview to their messages. Implies can_send_messages permissions
CanAddWebPagePreviews bool `json:"can_add_web_page_previews"`
// True, if the user can change the chat title, photo, and other settings
CanChangeInfo bool `json:"can_change_info"`
// True, if the user can invite new users to the chat
CanInviteUsers bool `json:"can_invite_users"`
// True, if the user can pin messages
CanPinMessages bool `json:"can_pin_messages"`
}
func (entity *ChatPermissions) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatPermissions
return json.Marshal((*stub)(entity))
}
func (*ChatPermissions) GetClass() string {
return ClassChatPermissions
}
func (*ChatPermissions) GetType() string {
return TypeChatPermissions
}
2018-08-30 14:55:42 +00:00
// The user is the creator of a chat and has all the administrator privileges
type ChatMemberStatusCreator struct {
2018-10-23 12:38:10 +00:00
meta
// True, if the user is a member of the chat
IsMember bool `json:"is_member"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatMemberStatusCreator) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMemberStatusCreator
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusCreator) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMemberStatus
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusCreator) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusCreator
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusCreator) ChatMemberStatusType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusCreator
2018-08-30 14:55:42 +00:00
}
// The user is a member of a chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, and ban unprivileged members. In supergroups and channels, there are more detailed options for administrator privileges
type ChatMemberStatusAdministrator struct {
2018-10-23 12:38:10 +00:00
meta
// True, if the current user can edit the administrator privileges for the called user
CanBeEdited bool `json:"can_be_edited"`
// True, if the administrator can change the chat title, photo, and other settings
CanChangeInfo bool `json:"can_change_info"`
// True, if the administrator can create channel posts; applicable to channels only
CanPostMessages bool `json:"can_post_messages"`
// True, if the administrator can edit messages of other users and pin messages; applicable to channels only
CanEditMessages bool `json:"can_edit_messages"`
// True, if the administrator can delete messages of other users
CanDeleteMessages bool `json:"can_delete_messages"`
// True, if the administrator can invite new users to the chat
CanInviteUsers bool `json:"can_invite_users"`
// True, if the administrator can restrict, ban, or unban chat members
CanRestrictMembers bool `json:"can_restrict_members"`
2019-06-07 10:56:06 +00:00
// True, if the administrator can pin messages; applicable to groups only
2018-10-23 12:38:10 +00:00
CanPinMessages bool `json:"can_pin_messages"`
2019-09-10 12:36:54 +00:00
// True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by him
2018-10-23 12:38:10 +00:00
CanPromoteMembers bool `json:"can_promote_members"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatMemberStatusAdministrator) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMemberStatusAdministrator
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusAdministrator) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMemberStatus
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusAdministrator) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusAdministrator
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusAdministrator) ChatMemberStatusType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusAdministrator
2018-08-30 14:55:42 +00:00
}
// The user is a member of a chat, without any additional privileges or restrictions
2018-10-23 12:38:10 +00:00
type ChatMemberStatusMember struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *ChatMemberStatusMember) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMemberStatusMember
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusMember) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMemberStatus
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusMember) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusMember
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusMember) ChatMemberStatusType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusMember
2018-08-30 14:55:42 +00:00
}
// The user is under certain restrictions in the chat. Not supported in basic groups and channels
type ChatMemberStatusRestricted struct {
2018-10-23 12:38:10 +00:00
meta
// True, if the user is a member of the chat
IsMember bool `json:"is_member"`
// Point in time (Unix timestamp) when restrictions will be lifted from the user; 0 if never. If the user is restricted for more than 366 days or for less than 30 seconds from the current time, the user is considered to be restricted forever
RestrictedUntilDate int32 `json:"restricted_until_date"`
2019-09-10 12:36:54 +00:00
// User permissions in the chat
Permissions *ChatPermissions `json:"permissions"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatMemberStatusRestricted) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMemberStatusRestricted
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusRestricted) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMemberStatus
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusRestricted) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusRestricted
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusRestricted) ChatMemberStatusType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusRestricted
2018-08-30 14:55:42 +00:00
}
// The user is not a chat member
2018-10-23 12:38:10 +00:00
type ChatMemberStatusLeft struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *ChatMemberStatusLeft) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMemberStatusLeft
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusLeft) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMemberStatus
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusLeft) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusLeft
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusLeft) ChatMemberStatusType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusLeft
2018-08-30 14:55:42 +00:00
}
// The user was banned (and hence is not a member of the chat). Implies the user can't return to the chat or view messages
type ChatMemberStatusBanned struct {
2018-10-23 12:38:10 +00:00
meta
// Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user is banned for more than 366 days or for less than 30 seconds from the current time, the user is considered to be banned forever
BannedUntilDate int32 `json:"banned_until_date"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatMemberStatusBanned) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMemberStatusBanned
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusBanned) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMemberStatus
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusBanned) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusBanned
2018-08-30 14:55:42 +00:00
}
func (*ChatMemberStatusBanned) ChatMemberStatusType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMemberStatusBanned
2018-08-30 14:55:42 +00:00
}
// A user with information about joining/leaving a chat
type ChatMember struct {
2018-10-23 12:38:10 +00:00
meta
// User identifier of the chat member
UserId int32 `json:"user_id"`
// Identifier of a user that invited/promoted/banned this member in the chat; 0 if unknown
InviterUserId int32 `json:"inviter_user_id"`
// Point in time (Unix timestamp) when the user joined a chat
JoinedChatDate int32 `json:"joined_chat_date"`
// Status of the member in the chat
Status ChatMemberStatus `json:"status"`
// If the user is a bot, information about the bot; may be null. Can be null even for a bot if the bot is not a chat member
BotInfo *BotInfo `json:"bot_info"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatMember) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMember
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatMember) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMember
2018-08-30 14:55:42 +00:00
}
func (*ChatMember) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMember
2018-08-30 14:55:42 +00:00
}
func (chatMember *ChatMember) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
UserId int32 `json:"user_id"`
InviterUserId int32 `json:"inviter_user_id"`
JoinedChatDate int32 `json:"joined_chat_date"`
Status json.RawMessage `json:"status"`
BotInfo *BotInfo `json:"bot_info"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
chatMember.UserId = tmp.UserId
chatMember.InviterUserId = tmp.InviterUserId
chatMember.JoinedChatDate = tmp.JoinedChatDate
chatMember.BotInfo = tmp.BotInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status)
chatMember.Status = fieldStatus
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// Contains a list of chat members
type ChatMembers struct {
2018-10-23 12:38:10 +00:00
meta
// Approximate total count of chat members found
TotalCount int32 `json:"total_count"`
// A list of chat members
Members []*ChatMember `json:"members"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatMembers) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMembers
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatMembers) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMembers
2018-08-30 14:55:42 +00:00
}
func (*ChatMembers) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembers
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Returns contacts of the user
type ChatMembersFilterContacts struct {
meta
}
func (entity *ChatMembersFilterContacts) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatMembersFilterContacts
return json.Marshal((*stub)(entity))
}
func (*ChatMembersFilterContacts) GetClass() string {
return ClassChatMembersFilter
}
func (*ChatMembersFilterContacts) GetType() string {
return TypeChatMembersFilterContacts
}
func (*ChatMembersFilterContacts) ChatMembersFilterType() string {
return TypeChatMembersFilterContacts
}
2018-09-05 21:45:29 +00:00
// Returns the creator and administrators
2018-10-23 12:38:10 +00:00
type ChatMembersFilterAdministrators struct {
meta
2018-09-05 21:45:29 +00:00
}
func (entity *ChatMembersFilterAdministrators) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMembersFilterAdministrators
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterAdministrators) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMembersFilter
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterAdministrators) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterAdministrators
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterAdministrators) ChatMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterAdministrators
2018-09-05 21:45:29 +00:00
}
// Returns all chat members, including restricted chat members
2018-10-23 12:38:10 +00:00
type ChatMembersFilterMembers struct {
meta
2018-09-05 21:45:29 +00:00
}
func (entity *ChatMembersFilterMembers) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMembersFilterMembers
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterMembers) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMembersFilter
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterMembers) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterMembers
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterMembers) ChatMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterMembers
2018-09-05 21:45:29 +00:00
}
// Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup
2018-10-23 12:38:10 +00:00
type ChatMembersFilterRestricted struct {
meta
2018-09-05 21:45:29 +00:00
}
func (entity *ChatMembersFilterRestricted) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMembersFilterRestricted
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterRestricted) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMembersFilter
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterRestricted) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterRestricted
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterRestricted) ChatMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterRestricted
2018-09-05 21:45:29 +00:00
}
// Returns users banned from the chat; can be used only by administrators in a supergroup or in a channel
2018-10-23 12:38:10 +00:00
type ChatMembersFilterBanned struct {
meta
2018-09-05 21:45:29 +00:00
}
func (entity *ChatMembersFilterBanned) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMembersFilterBanned
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterBanned) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMembersFilter
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterBanned) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterBanned
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterBanned) ChatMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterBanned
2018-09-05 21:45:29 +00:00
}
// Returns bot members of the chat
2018-10-23 12:38:10 +00:00
type ChatMembersFilterBots struct {
meta
2018-09-05 21:45:29 +00:00
}
func (entity *ChatMembersFilterBots) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatMembersFilterBots
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterBots) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatMembersFilter
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterBots) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterBots
2018-09-05 21:45:29 +00:00
}
func (*ChatMembersFilterBots) ChatMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeChatMembersFilterBots
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// Returns recently active users in reverse chronological order
2018-10-23 12:38:10 +00:00
type SupergroupMembersFilterRecent struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *SupergroupMembersFilterRecent) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SupergroupMembersFilterRecent
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterRecent) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSupergroupMembersFilter
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterRecent) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterRecent
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterRecent) SupergroupMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterRecent
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Returns contacts of the user, which are members of the supergroup or channel
type SupergroupMembersFilterContacts struct {
meta
// Query to search for
Query string `json:"query"`
}
func (entity *SupergroupMembersFilterContacts) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub SupergroupMembersFilterContacts
return json.Marshal((*stub)(entity))
}
func (*SupergroupMembersFilterContacts) GetClass() string {
return ClassSupergroupMembersFilter
}
func (*SupergroupMembersFilterContacts) GetType() string {
return TypeSupergroupMembersFilterContacts
}
func (*SupergroupMembersFilterContacts) SupergroupMembersFilterType() string {
return TypeSupergroupMembersFilterContacts
}
2018-08-30 14:55:42 +00:00
// Returns the creator and administrators
2018-10-23 12:38:10 +00:00
type SupergroupMembersFilterAdministrators struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *SupergroupMembersFilterAdministrators) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SupergroupMembersFilterAdministrators
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterAdministrators) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSupergroupMembersFilter
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterAdministrators) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterAdministrators
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterAdministrators) SupergroupMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterAdministrators
2018-08-30 14:55:42 +00:00
}
// Used to search for supergroup or channel members via a (string) query
type SupergroupMembersFilterSearch struct {
2018-10-23 12:38:10 +00:00
meta
// Query to search for
Query string `json:"query"`
2018-08-30 14:55:42 +00:00
}
func (entity *SupergroupMembersFilterSearch) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SupergroupMembersFilterSearch
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterSearch) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSupergroupMembersFilter
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterSearch) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterSearch
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterSearch) SupergroupMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterSearch
2018-08-30 14:55:42 +00:00
}
// Returns restricted supergroup members; can be used only by administrators
type SupergroupMembersFilterRestricted struct {
2018-10-23 12:38:10 +00:00
meta
// Query to search for
Query string `json:"query"`
2018-08-30 14:55:42 +00:00
}
func (entity *SupergroupMembersFilterRestricted) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SupergroupMembersFilterRestricted
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterRestricted) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSupergroupMembersFilter
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterRestricted) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterRestricted
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterRestricted) SupergroupMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterRestricted
2018-08-30 14:55:42 +00:00
}
// Returns users banned from the supergroup or channel; can be used only by administrators
type SupergroupMembersFilterBanned struct {
2018-10-23 12:38:10 +00:00
meta
// Query to search for
Query string `json:"query"`
2018-08-30 14:55:42 +00:00
}
func (entity *SupergroupMembersFilterBanned) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SupergroupMembersFilterBanned
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterBanned) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSupergroupMembersFilter
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterBanned) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterBanned
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterBanned) SupergroupMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterBanned
2018-08-30 14:55:42 +00:00
}
// Returns bot members of the supergroup or channel
2018-10-23 12:38:10 +00:00
type SupergroupMembersFilterBots struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *SupergroupMembersFilterBots) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SupergroupMembersFilterBots
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterBots) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSupergroupMembersFilter
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterBots) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterBots
2018-08-30 14:55:42 +00:00
}
func (*SupergroupMembersFilterBots) SupergroupMembersFilterType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupMembersFilterBots
2018-08-30 14:55:42 +00:00
}
// Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users)
type BasicGroup struct {
2018-10-23 12:38:10 +00:00
meta
// Group identifier
Id int32 `json:"id"`
// Number of members in the group
MemberCount int32 `json:"member_count"`
// Status of the current user in the group
Status ChatMemberStatus `json:"status"`
// True, if the group is active
IsActive bool `json:"is_active"`
// Identifier of the supergroup to which this group was upgraded; 0 if none
UpgradedToSupergroupId int32 `json:"upgraded_to_supergroup_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *BasicGroup) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub BasicGroup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*BasicGroup) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassBasicGroup
2018-08-30 14:55:42 +00:00
}
func (*BasicGroup) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeBasicGroup
2018-08-30 14:55:42 +00:00
}
func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-09-10 12:36:54 +00:00
Id int32 `json:"id"`
MemberCount int32 `json:"member_count"`
Status json.RawMessage `json:"status"`
IsActive bool `json:"is_active"`
UpgradedToSupergroupId int32 `json:"upgraded_to_supergroup_id"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
basicGroup.Id = tmp.Id
basicGroup.MemberCount = tmp.MemberCount
basicGroup.IsActive = tmp.IsActive
basicGroup.UpgradedToSupergroupId = tmp.UpgradedToSupergroupId
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status)
basicGroup.Status = fieldStatus
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// Contains full information about a basic group
type BasicGroupFullInfo struct {
2018-10-23 12:38:10 +00:00
meta
2019-09-10 12:36:54 +00:00
// Group description
Description string `json:"description"`
2018-10-23 12:38:10 +00:00
// User identifier of the creator of the group; 0 if unknown
CreatorUserId int32 `json:"creator_user_id"`
// Group members
Members []*ChatMember `json:"members"`
// Invite link for this group; available only for the group creator and only after it has been generated at least once
InviteLink string `json:"invite_link"`
2018-08-30 14:55:42 +00:00
}
func (entity *BasicGroupFullInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub BasicGroupFullInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*BasicGroupFullInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassBasicGroupFullInfo
2018-08-30 14:55:42 +00:00
}
func (*BasicGroupFullInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeBasicGroupFullInfo
2018-08-30 14:55:42 +00:00
}
// Represents a supergroup or channel with zero or more members (subscribers in the case of channels). From the point of view of the system, a channel is a special kind of a supergroup: only administrators can post and see the list of members, and posts from all administrators use the name and photo of the channel instead of individual names and profile photos. Unlike supergroups, channels can have an unlimited number of subscribers
type Supergroup struct {
2018-10-23 12:38:10 +00:00
meta
// Supergroup or channel identifier
Id int32 `json:"id"`
// Username of the supergroup or channel; empty for private supergroups or channels
Username string `json:"username"`
// Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member
Date int32 `json:"date"`
// Status of the current user in the supergroup or channel
Status ChatMemberStatus `json:"status"`
// Member count; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was found through SearchPublicChats
MemberCount int32 `json:"member_count"`
// True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels
SignMessages bool `json:"sign_messages"`
// True, if the supergroup is a channel
IsChannel bool `json:"is_channel"`
// True, if the supergroup or channel is verified
IsVerified bool `json:"is_verified"`
// If non-empty, contains the reason why access to this supergroup or channel must be restricted. Format of the string is "{type}: {description}". {type} Contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user)
RestrictionReason string `json:"restriction_reason"`
2019-09-10 12:36:54 +00:00
// True, if many users reported this supergroup as a scam
IsScam bool `json:"is_scam"`
2018-08-30 14:55:42 +00:00
}
func (entity *Supergroup) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Supergroup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Supergroup) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSupergroup
2018-08-30 14:55:42 +00:00
}
func (*Supergroup) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroup
2018-08-30 14:55:42 +00:00
}
func (supergroup *Supergroup) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Id int32 `json:"id"`
Username string `json:"username"`
Date int32 `json:"date"`
Status json.RawMessage `json:"status"`
MemberCount int32 `json:"member_count"`
SignMessages bool `json:"sign_messages"`
IsChannel bool `json:"is_channel"`
IsVerified bool `json:"is_verified"`
RestrictionReason string `json:"restriction_reason"`
2019-09-10 12:36:54 +00:00
IsScam bool `json:"is_scam"`
2018-10-23 12:38:10 +00:00
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
supergroup.Id = tmp.Id
supergroup.Username = tmp.Username
supergroup.Date = tmp.Date
supergroup.MemberCount = tmp.MemberCount
supergroup.SignMessages = tmp.SignMessages
supergroup.IsChannel = tmp.IsChannel
supergroup.IsVerified = tmp.IsVerified
supergroup.RestrictionReason = tmp.RestrictionReason
2019-09-10 12:36:54 +00:00
supergroup.IsScam = tmp.IsScam
2018-10-23 12:38:10 +00:00
fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status)
supergroup.Status = fieldStatus
return nil
2018-08-30 14:55:42 +00:00
}
// Contains full information about a supergroup or channel
type SupergroupFullInfo struct {
2018-10-23 12:38:10 +00:00
meta
// Supergroup or channel description
Description string `json:"description"`
// Number of members in the supergroup or channel; 0 if unknown
MemberCount int32 `json:"member_count"`
// Number of privileged users in the supergroup or channel; 0 if unknown
AdministratorCount int32 `json:"administrator_count"`
// Number of restricted users in the supergroup; 0 if unknown
RestrictedCount int32 `json:"restricted_count"`
// Number of users banned from chat; 0 if unknown
BannedCount int32 `json:"banned_count"`
// True, if members of the chat can be retrieved
CanGetMembers bool `json:"can_get_members"`
// True, if the chat can be made public
CanSetUsername bool `json:"can_set_username"`
// True, if the supergroup sticker set can be changed
CanSetStickerSet bool `json:"can_set_sticker_set"`
2019-06-07 10:56:06 +00:00
// True, if the channel statistics is available through getChatStatisticsUrl
CanViewStatistics bool `json:"can_view_statistics"`
2018-10-23 12:38:10 +00:00
// True, if new chat members will have access to old messages. In public supergroups and both public and private channels, old messages are always available, so this option affects only private supergroups. The value of this field is only available for chat administrators
IsAllHistoryAvailable bool `json:"is_all_history_available"`
// Identifier of the supergroup sticker set; 0 if none
StickerSetId JsonInt64 `json:"sticker_set_id"`
// Invite link for this chat
InviteLink string `json:"invite_link"`
// Identifier of the basic group from which supergroup was upgraded; 0 if none
UpgradedFromBasicGroupId int32 `json:"upgraded_from_basic_group_id"`
// Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none
UpgradedFromMaxMessageId int64 `json:"upgraded_from_max_message_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *SupergroupFullInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SupergroupFullInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SupergroupFullInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSupergroupFullInfo
2018-08-30 14:55:42 +00:00
}
func (*SupergroupFullInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSupergroupFullInfo
2018-08-30 14:55:42 +00:00
}
// The secret chat is not yet created; waiting for the other user to get online
2018-10-23 12:38:10 +00:00
type SecretChatStatePending struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *SecretChatStatePending) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SecretChatStatePending
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SecretChatStatePending) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSecretChatState
2018-08-30 14:55:42 +00:00
}
func (*SecretChatStatePending) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSecretChatStatePending
2018-08-30 14:55:42 +00:00
}
func (*SecretChatStatePending) SecretChatStateType() string {
2018-10-23 12:38:10 +00:00
return TypeSecretChatStatePending
2018-08-30 14:55:42 +00:00
}
// The secret chat is ready to use
2018-10-23 12:38:10 +00:00
type SecretChatStateReady struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *SecretChatStateReady) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SecretChatStateReady
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SecretChatStateReady) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSecretChatState
2018-08-30 14:55:42 +00:00
}
func (*SecretChatStateReady) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSecretChatStateReady
2018-08-30 14:55:42 +00:00
}
func (*SecretChatStateReady) SecretChatStateType() string {
2018-10-23 12:38:10 +00:00
return TypeSecretChatStateReady
2018-08-30 14:55:42 +00:00
}
// The secret chat is closed
2018-10-23 12:38:10 +00:00
type SecretChatStateClosed struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *SecretChatStateClosed) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SecretChatStateClosed
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SecretChatStateClosed) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSecretChatState
2018-08-30 14:55:42 +00:00
}
func (*SecretChatStateClosed) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSecretChatStateClosed
2018-08-30 14:55:42 +00:00
}
func (*SecretChatStateClosed) SecretChatStateType() string {
2018-10-23 12:38:10 +00:00
return TypeSecretChatStateClosed
2018-08-30 14:55:42 +00:00
}
// Represents a secret chat
type SecretChat struct {
2018-10-23 12:38:10 +00:00
meta
// Secret chat identifier
Id int32 `json:"id"`
// Identifier of the chat partner
UserId int32 `json:"user_id"`
// State of the secret chat
State SecretChatState `json:"state"`
// True, if the chat was created by the current user; otherwise false
IsOutbound bool `json:"is_outbound"`
// Current message Time To Live setting (self-destruct timer) for the chat, in seconds
Ttl int32 `json:"ttl"`
// Hash of the currently used key for comparison with the hash of the chat partner's key. This is a string of 36 bytes, which must be used to make a 12x12 square image with a color depth of 4. The first 16 bytes should be used to make a central 8x8 square, while the remaining 20 bytes should be used to construct a 2-pixel-wide border around that square. Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 2-digit hex numbers
KeyHash []byte `json:"key_hash"`
// Secret chat layer; determines features supported by the other client. Video notes are supported if the layer >= 66
Layer int32 `json:"layer"`
2018-08-30 14:55:42 +00:00
}
func (entity *SecretChat) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub SecretChat
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*SecretChat) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSecretChat
2018-08-30 14:55:42 +00:00
}
func (*SecretChat) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSecretChat
2018-08-30 14:55:42 +00:00
}
func (secretChat *SecretChat) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Id int32 `json:"id"`
UserId int32 `json:"user_id"`
State json.RawMessage `json:"state"`
IsOutbound bool `json:"is_outbound"`
Ttl int32 `json:"ttl"`
KeyHash []byte `json:"key_hash"`
Layer int32 `json:"layer"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
secretChat.Id = tmp.Id
secretChat.UserId = tmp.UserId
secretChat.IsOutbound = tmp.IsOutbound
secretChat.Ttl = tmp.Ttl
secretChat.KeyHash = tmp.KeyHash
secretChat.Layer = tmp.Layer
fieldState, _ := UnmarshalSecretChatState(tmp.State)
secretChat.State = fieldState
return nil
2018-08-30 14:55:42 +00:00
}
// The message was originally written by a known user
2019-06-07 10:56:06 +00:00
type MessageForwardOriginUser struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Identifier of the user that originally sent the message
2018-10-23 12:38:10 +00:00
SenderUserId int32 `json:"sender_user_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageForwardOriginUser) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageForwardOriginUser
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageForwardOriginUser) GetClass() string {
return ClassMessageForwardOrigin
}
func (*MessageForwardOriginUser) GetType() string {
return TypeMessageForwardOriginUser
}
func (*MessageForwardOriginUser) MessageForwardOriginType() string {
return TypeMessageForwardOriginUser
}
2019-09-10 12:36:54 +00:00
// The message was originally written by a user, which is hidden by their privacy settings
2019-06-07 10:56:06 +00:00
type MessageForwardOriginHiddenUser struct {
meta
// Name of the sender
SenderName string `json:"sender_name"`
}
func (entity *MessageForwardOriginHiddenUser) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub MessageForwardOriginHiddenUser
return json.Marshal((*stub)(entity))
}
func (*MessageForwardOriginHiddenUser) GetClass() string {
return ClassMessageForwardOrigin
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageForwardOriginHiddenUser) GetType() string {
return TypeMessageForwardOriginHiddenUser
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageForwardOriginHiddenUser) MessageForwardOriginType() string {
return TypeMessageForwardOriginHiddenUser
2018-08-30 14:55:42 +00:00
}
// The message was originally a post in a channel
2019-06-07 10:56:06 +00:00
type MessageForwardOriginChannel struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Identifier of the chat from which the message was originally forwarded
2018-10-23 12:38:10 +00:00
ChatId int64 `json:"chat_id"`
2019-06-07 10:56:06 +00:00
// Message identifier of the original message; 0 if unknown
MessageId int64 `json:"message_id"`
// Original post author signature
2018-10-23 12:38:10 +00:00
AuthorSignature string `json:"author_signature"`
2019-06-07 10:56:06 +00:00
}
func (entity *MessageForwardOriginChannel) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub MessageForwardOriginChannel
return json.Marshal((*stub)(entity))
}
func (*MessageForwardOriginChannel) GetClass() string {
return ClassMessageForwardOrigin
}
func (*MessageForwardOriginChannel) GetType() string {
return TypeMessageForwardOriginChannel
}
func (*MessageForwardOriginChannel) MessageForwardOriginType() string {
return TypeMessageForwardOriginChannel
}
// Contains information about a forwarded message
type MessageForwardInfo struct {
meta
// Origin of a forwarded message
Origin MessageForwardOrigin `json:"origin"`
2018-10-23 12:38:10 +00:00
// Point in time (Unix timestamp) when the message was originally sent
Date int32 `json:"date"`
2019-09-10 12:36:54 +00:00
// For messages forwarded to the chat with the current user (saved messages) or to the channel discussion supergroup, the identifier of the chat from which the message was forwarded last time; 0 if unknown
2019-06-07 10:56:06 +00:00
FromChatId int64 `json:"from_chat_id"`
2019-09-10 12:36:54 +00:00
// For messages forwarded to the chat with the current user (saved messages) or to the channel discussion supergroup, the identifier of the original message from which the new message was forwarded last time; 0 if unknown
2019-06-07 10:56:06 +00:00
FromMessageId int64 `json:"from_message_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageForwardInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageForwardInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageForwardInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageForwardInfo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageForwardInfo) GetType() string {
return TypeMessageForwardInfo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (messageForwardInfo *MessageForwardInfo) UnmarshalJSON(data []byte) error {
var tmp struct {
Origin json.RawMessage `json:"origin"`
Date int32 `json:"date"`
FromChatId int64 `json:"from_chat_id"`
FromMessageId int64 `json:"from_message_id"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
messageForwardInfo.Date = tmp.Date
messageForwardInfo.FromChatId = tmp.FromChatId
messageForwardInfo.FromMessageId = tmp.FromMessageId
fieldOrigin, _ := UnmarshalMessageForwardOrigin(tmp.Origin)
messageForwardInfo.Origin = fieldOrigin
return nil
2018-08-30 14:55:42 +00:00
}
// The message is being sent now, but has not yet been delivered to the server
2018-10-23 12:38:10 +00:00
type MessageSendingStatePending struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *MessageSendingStatePending) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub MessageSendingStatePending
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*MessageSendingStatePending) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageSendingState
2018-08-30 14:55:42 +00:00
}
func (*MessageSendingStatePending) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeMessageSendingStatePending
2018-08-30 14:55:42 +00:00
}
func (*MessageSendingStatePending) MessageSendingStateType() string {
2018-10-23 12:38:10 +00:00
return TypeMessageSendingStatePending
2018-08-30 14:55:42 +00:00
}
// The message failed to be sent
2018-10-23 12:38:10 +00:00
type MessageSendingStateFailed struct {
meta
2019-09-10 12:36:54 +00:00
// An error code; 0 if unknown
ErrorCode int32 `json:"error_code"`
// Error message
ErrorMessage string `json:"error_message"`
// True, if the message can be re-sent
CanRetry bool `json:"can_retry"`
// Time left before the message can be re-sent, in seconds. No update is sent when this field changes
RetryAfter float64 `json:"retry_after"`
2018-08-30 14:55:42 +00:00
}
func (entity *MessageSendingStateFailed) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub MessageSendingStateFailed
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*MessageSendingStateFailed) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageSendingState
2018-08-30 14:55:42 +00:00
}
func (*MessageSendingStateFailed) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeMessageSendingStateFailed
2018-08-30 14:55:42 +00:00
}
func (*MessageSendingStateFailed) MessageSendingStateType() string {
2018-10-23 12:38:10 +00:00
return TypeMessageSendingStateFailed
2018-08-30 14:55:42 +00:00
}
// Describes a message
type Message struct {
2018-10-23 12:38:10 +00:00
meta
// Message identifier, unique for the chat to which the message belongs
Id int64 `json:"id"`
2019-09-10 12:36:54 +00:00
// Identifier of the user who sent the message; 0 if unknown. Currently, it is unknown for channel posts and for channel posts automatically forwarded to discussion group
2018-10-23 12:38:10 +00:00
SenderUserId int32 `json:"sender_user_id"`
// Chat identifier
ChatId int64 `json:"chat_id"`
// Information about the sending state of the message; may be null
SendingState MessageSendingState `json:"sending_state"`
// True, if the message is outgoing
IsOutgoing bool `json:"is_outgoing"`
2019-06-07 10:56:06 +00:00
// True, if the message can be edited. For live location and poll messages this fields shows, whether editMessageLiveLocation or stopPoll can be used with this message by the client
2018-10-23 12:38:10 +00:00
CanBeEdited bool `json:"can_be_edited"`
// True, if the message can be forwarded
CanBeForwarded bool `json:"can_be_forwarded"`
// True, if the message can be deleted only for the current user while other users will continue to see it
CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"`
// True, if the message can be deleted for all users
CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"`
// True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts
IsChannelPost bool `json:"is_channel_post"`
// True, if the message contains an unread mention for the current user
ContainsUnreadMention bool `json:"contains_unread_mention"`
// Point in time (Unix timestamp) when the message was sent
Date int32 `json:"date"`
// Point in time (Unix timestamp) when the message was last edited
EditDate int32 `json:"edit_date"`
// Information about the initial message sender; may be null
2019-06-07 10:56:06 +00:00
ForwardInfo *MessageForwardInfo `json:"forward_info"`
2018-10-23 12:38:10 +00:00
// If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message
ReplyToMessageId int64 `json:"reply_to_message_id"`
// For self-destructing messages, the message's TTL (Time To Live), in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the TTL expires
Ttl int32 `json:"ttl"`
// Time left before the message expires, in seconds
TtlExpiresIn float64 `json:"ttl_expires_in"`
// If non-zero, the user identifier of the bot through which this message was sent
ViaBotUserId int32 `json:"via_bot_user_id"`
// For channel posts, optional author signature
AuthorSignature string `json:"author_signature"`
// Number of times this message was viewed
Views int32 `json:"views"`
// Unique identifier of an album this message belongs to. Only photos and videos can be grouped together in albums
MediaAlbumId JsonInt64 `json:"media_album_id"`
// Content of the message
Content MessageContent `json:"content"`
// Reply markup for the message; may be null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
2018-08-30 14:55:42 +00:00
}
func (entity *Message) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Message
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Message) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessage
2018-08-30 14:55:42 +00:00
}
func (*Message) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeMessage
2018-08-30 14:55:42 +00:00
}
func (message *Message) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Id int64 `json:"id"`
SenderUserId int32 `json:"sender_user_id"`
ChatId int64 `json:"chat_id"`
SendingState json.RawMessage `json:"sending_state"`
IsOutgoing bool `json:"is_outgoing"`
CanBeEdited bool `json:"can_be_edited"`
CanBeForwarded bool `json:"can_be_forwarded"`
CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"`
CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"`
IsChannelPost bool `json:"is_channel_post"`
ContainsUnreadMention bool `json:"contains_unread_mention"`
Date int32 `json:"date"`
EditDate int32 `json:"edit_date"`
ForwardInfo *MessageForwardInfo `json:"forward_info"`
ReplyToMessageId int64 `json:"reply_to_message_id"`
Ttl int32 `json:"ttl"`
TtlExpiresIn float64 `json:"ttl_expires_in"`
ViaBotUserId int32 `json:"via_bot_user_id"`
AuthorSignature string `json:"author_signature"`
Views int32 `json:"views"`
MediaAlbumId JsonInt64 `json:"media_album_id"`
Content json.RawMessage `json:"content"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
2018-10-23 12:38:10 +00:00
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
message.Id = tmp.Id
message.SenderUserId = tmp.SenderUserId
message.ChatId = tmp.ChatId
message.IsOutgoing = tmp.IsOutgoing
message.CanBeEdited = tmp.CanBeEdited
message.CanBeForwarded = tmp.CanBeForwarded
message.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf
message.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers
message.IsChannelPost = tmp.IsChannelPost
message.ContainsUnreadMention = tmp.ContainsUnreadMention
message.Date = tmp.Date
message.EditDate = tmp.EditDate
2019-06-07 10:56:06 +00:00
message.ForwardInfo = tmp.ForwardInfo
2018-10-23 12:38:10 +00:00
message.ReplyToMessageId = tmp.ReplyToMessageId
message.Ttl = tmp.Ttl
message.TtlExpiresIn = tmp.TtlExpiresIn
message.ViaBotUserId = tmp.ViaBotUserId
message.AuthorSignature = tmp.AuthorSignature
message.Views = tmp.Views
message.MediaAlbumId = tmp.MediaAlbumId
fieldSendingState, _ := UnmarshalMessageSendingState(tmp.SendingState)
message.SendingState = fieldSendingState
fieldContent, _ := UnmarshalMessageContent(tmp.Content)
message.Content = fieldContent
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
message.ReplyMarkup = fieldReplyMarkup
return nil
2018-08-30 14:55:42 +00:00
}
// Contains a list of messages
type Messages struct {
2018-10-23 12:38:10 +00:00
meta
// Approximate total count of messages found
TotalCount int32 `json:"total_count"`
// List of messages; messages may be null
Messages []*Message `json:"messages"`
2018-08-30 14:55:42 +00:00
}
func (entity *Messages) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Messages
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Messages) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessages
2018-08-30 14:55:42 +00:00
}
func (*Messages) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeMessages
2018-08-30 14:55:42 +00:00
}
// Contains a list of messages found by a search
type FoundMessages struct {
2018-10-23 12:38:10 +00:00
meta
// List of messages
Messages []*Message `json:"messages"`
// Value to pass as from_search_id to get more results
NextFromSearchId JsonInt64 `json:"next_from_search_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *FoundMessages) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FoundMessages
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FoundMessages) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFoundMessages
2018-08-30 14:55:42 +00:00
}
func (*FoundMessages) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFoundMessages
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Notification settings applied to all private and secret chats when the corresponding chat setting has a default value
2018-10-23 12:38:10 +00:00
type NotificationSettingsScopePrivateChats struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *NotificationSettingsScopePrivateChats) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NotificationSettingsScopePrivateChats
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*NotificationSettingsScopePrivateChats) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNotificationSettingsScope
2018-08-30 14:55:42 +00:00
}
func (*NotificationSettingsScopePrivateChats) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNotificationSettingsScopePrivateChats
2018-08-30 14:55:42 +00:00
}
func (*NotificationSettingsScopePrivateChats) NotificationSettingsScopeType() string {
2018-10-23 12:38:10 +00:00
return TypeNotificationSettingsScopePrivateChats
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value
2018-10-23 12:38:10 +00:00
type NotificationSettingsScopeGroupChats struct {
meta
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (entity *NotificationSettingsScopeGroupChats) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NotificationSettingsScopeGroupChats
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*NotificationSettingsScopeGroupChats) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNotificationSettingsScope
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*NotificationSettingsScopeGroupChats) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNotificationSettingsScopeGroupChats
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*NotificationSettingsScopeGroupChats) NotificationSettingsScopeType() string {
2018-10-23 12:38:10 +00:00
return TypeNotificationSettingsScopeGroupChats
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Notification settings applied to all channels when the corresponding chat setting has a default value
type NotificationSettingsScopeChannelChats struct {
meta
}
func (entity *NotificationSettingsScopeChannelChats) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub NotificationSettingsScopeChannelChats
return json.Marshal((*stub)(entity))
}
func (*NotificationSettingsScopeChannelChats) GetClass() string {
return ClassNotificationSettingsScope
}
func (*NotificationSettingsScopeChannelChats) GetType() string {
return TypeNotificationSettingsScopeChannelChats
}
func (*NotificationSettingsScopeChannelChats) NotificationSettingsScopeType() string {
return TypeNotificationSettingsScopeChannelChats
}
2018-09-05 21:45:29 +00:00
// Contains information about notification settings for a chat
type ChatNotificationSettings struct {
2018-10-23 12:38:10 +00:00
meta
// If true, mute_for is ignored and the value for the relevant type of chat is used instead
UseDefaultMuteFor bool `json:"use_default_mute_for"`
// Time left before notifications will be unmuted, in seconds
MuteFor int32 `json:"mute_for"`
// If true, sound is ignored and the value for the relevant type of chat is used instead
UseDefaultSound bool `json:"use_default_sound"`
// The name of an audio file to be used for notification sounds; only applies to iOS applications
Sound string `json:"sound"`
// If true, show_preview is ignored and the value for the relevant type of chat is used instead
UseDefaultShowPreview bool `json:"use_default_show_preview"`
// True, if message content should be displayed in notifications
ShowPreview bool `json:"show_preview"`
2019-06-07 10:56:06 +00:00
// If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat is used instead
UseDefaultDisablePinnedMessageNotifications bool `json:"use_default_disable_pinned_message_notifications"`
// If true, notifications for incoming pinned messages will be created as for an ordinary unread message
DisablePinnedMessageNotifications bool `json:"disable_pinned_message_notifications"`
// If true, disable_mention_notifications is ignored and the value for the relevant type of chat is used instead
UseDefaultDisableMentionNotifications bool `json:"use_default_disable_mention_notifications"`
// If true, notifications for messages with mentions will be created as for an ordinary unread message
DisableMentionNotifications bool `json:"disable_mention_notifications"`
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (entity *ChatNotificationSettings) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatNotificationSettings
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*ChatNotificationSettings) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatNotificationSettings
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*ChatNotificationSettings) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatNotificationSettings
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Contains information about notification settings for several chats
type ScopeNotificationSettings struct {
2018-10-23 12:38:10 +00:00
meta
// Time left before notifications will be unmuted, in seconds
MuteFor int32 `json:"mute_for"`
// The name of an audio file to be used for notification sounds; only applies to iOS applications
Sound string `json:"sound"`
// True, if message content should be displayed in notifications
ShowPreview bool `json:"show_preview"`
2019-06-07 10:56:06 +00:00
// True, if notifications for incoming pinned messages will be created as for an ordinary unread message
DisablePinnedMessageNotifications bool `json:"disable_pinned_message_notifications"`
// True, if notifications for messages with mentions will be created as for an ordinary unread message
DisableMentionNotifications bool `json:"disable_mention_notifications"`
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (entity *ScopeNotificationSettings) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ScopeNotificationSettings
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*ScopeNotificationSettings) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassScopeNotificationSettings
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*ScopeNotificationSettings) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeScopeNotificationSettings
2018-08-30 14:55:42 +00:00
}
// Contains information about a message draft
type DraftMessage struct {
2018-10-23 12:38:10 +00:00
meta
// Identifier of the message to reply to; 0 if none
ReplyToMessageId int64 `json:"reply_to_message_id"`
// Content of the message draft; this should always be of type inputMessageText
InputMessageText InputMessageContent `json:"input_message_text"`
2018-08-30 14:55:42 +00:00
}
func (entity *DraftMessage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub DraftMessage
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*DraftMessage) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassDraftMessage
2018-08-30 14:55:42 +00:00
}
func (*DraftMessage) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeDraftMessage
2018-08-30 14:55:42 +00:00
}
func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
ReplyToMessageId int64 `json:"reply_to_message_id"`
InputMessageText json.RawMessage `json:"input_message_text"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
draftMessage.ReplyToMessageId = tmp.ReplyToMessageId
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldInputMessageText, _ := UnmarshalInputMessageContent(tmp.InputMessageText)
draftMessage.InputMessageText = fieldInputMessageText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// An ordinary chat with a user
type ChatTypePrivate struct {
2018-10-23 12:38:10 +00:00
meta
// User identifier
UserId int32 `json:"user_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatTypePrivate) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatTypePrivate
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatTypePrivate) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatType
2018-08-30 14:55:42 +00:00
}
func (*ChatTypePrivate) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatTypePrivate
2018-08-30 14:55:42 +00:00
}
func (*ChatTypePrivate) ChatTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeChatTypePrivate
2018-08-30 14:55:42 +00:00
}
// A basic group (i.e., a chat with 0-200 other users)
type ChatTypeBasicGroup struct {
2018-10-23 12:38:10 +00:00
meta
// Basic group identifier
BasicGroupId int32 `json:"basic_group_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatTypeBasicGroup) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatTypeBasicGroup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatTypeBasicGroup) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatType
2018-08-30 14:55:42 +00:00
}
func (*ChatTypeBasicGroup) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatTypeBasicGroup
2018-08-30 14:55:42 +00:00
}
func (*ChatTypeBasicGroup) ChatTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeChatTypeBasicGroup
2018-08-30 14:55:42 +00:00
}
// A supergroup (i.e. a chat with up to GetOption("supergroup_max_size") other users), or channel (with unlimited members)
type ChatTypeSupergroup struct {
2018-10-23 12:38:10 +00:00
meta
// Supergroup or channel identifier
SupergroupId int32 `json:"supergroup_id"`
// True, if the supergroup is a channel
IsChannel bool `json:"is_channel"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatTypeSupergroup) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatTypeSupergroup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatTypeSupergroup) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatType
2018-08-30 14:55:42 +00:00
}
func (*ChatTypeSupergroup) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatTypeSupergroup
2018-08-30 14:55:42 +00:00
}
func (*ChatTypeSupergroup) ChatTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeChatTypeSupergroup
2018-08-30 14:55:42 +00:00
}
// A secret chat with a user
type ChatTypeSecret struct {
2018-10-23 12:38:10 +00:00
meta
// Secret chat identifier
SecretChatId int32 `json:"secret_chat_id"`
// User identifier of the secret chat peer
UserId int32 `json:"user_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatTypeSecret) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatTypeSecret
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatTypeSecret) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatType
2018-08-30 14:55:42 +00:00
}
func (*ChatTypeSecret) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatTypeSecret
2018-08-30 14:55:42 +00:00
}
func (*ChatTypeSecret) ChatTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeChatTypeSecret
2018-08-30 14:55:42 +00:00
}
// A chat. (Can be a private chat, basic group, supergroup, or secret chat)
type Chat struct {
2018-10-23 12:38:10 +00:00
meta
// Chat unique identifier
Id int64 `json:"id"`
// Type of the chat
Type ChatType `json:"type"`
// Chat title
Title string `json:"title"`
// Chat photo; may be null
Photo *ChatPhoto `json:"photo"`
2019-09-10 12:36:54 +00:00
// Actions that non-administrator chat members are allowed to take in the chat
Permissions *ChatPermissions `json:"permissions"`
2018-10-23 12:38:10 +00:00
// Last message in the chat; may be null
LastMessage *Message `json:"last_message"`
// Descending parameter by which chats are sorted in the main chat list. If the order number of two chats is the same, they must be sorted in descending order by ID. If 0, the position of the chat in the list is undetermined
Order JsonInt64 `json:"order"`
// True, if the chat is pinned
IsPinned bool `json:"is_pinned"`
// True, if the chat is marked as unread
IsMarkedAsUnread bool `json:"is_marked_as_unread"`
// True, if the chat is sponsored by the user's MTProxy server
IsSponsored bool `json:"is_sponsored"`
2019-06-07 10:56:06 +00:00
// True, if the chat messages can be deleted only for the current user while other users will continue to see the messages
CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"`
// True, if the chat messages can be deleted for all users
CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"`
2018-10-23 12:38:10 +00:00
// True, if the chat can be reported to Telegram moderators through reportChat
CanBeReported bool `json:"can_be_reported"`
// Default value of the disable_notification parameter, used when a message is sent to the chat
DefaultDisableNotification bool `json:"default_disable_notification"`
// Number of unread messages in the chat
UnreadCount int32 `json:"unread_count"`
// Identifier of the last read incoming message
LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"`
// Identifier of the last read outgoing message
LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"`
// Number of unread messages with a mention/reply in the chat
UnreadMentionCount int32 `json:"unread_mention_count"`
// Notification settings for this chat
NotificationSettings *ChatNotificationSettings `json:"notification_settings"`
2019-06-07 10:56:06 +00:00
// Identifier of the pinned message in the chat; 0 if none
PinnedMessageId int64 `json:"pinned_message_id"`
2018-10-23 12:38:10 +00:00
// Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
ReplyMarkupMessageId int64 `json:"reply_markup_message_id"`
// A draft of a message in the chat; may be null
DraftMessage *DraftMessage `json:"draft_message"`
// Contains client-specific data associated with the chat. (For example, the chat position or local chat notification settings can be stored here.) Persistent if a message database is used
ClientData string `json:"client_data"`
2018-08-30 14:55:42 +00:00
}
func (entity *Chat) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Chat
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Chat) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChat
2018-08-30 14:55:42 +00:00
}
func (*Chat) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChat
2018-08-30 14:55:42 +00:00
}
func (chat *Chat) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Id int64 `json:"id"`
Type json.RawMessage `json:"type"`
Title string `json:"title"`
Photo *ChatPhoto `json:"photo"`
2019-09-10 12:36:54 +00:00
Permissions *ChatPermissions `json:"permissions"`
2018-10-23 12:38:10 +00:00
LastMessage *Message `json:"last_message"`
Order JsonInt64 `json:"order"`
IsPinned bool `json:"is_pinned"`
IsMarkedAsUnread bool `json:"is_marked_as_unread"`
IsSponsored bool `json:"is_sponsored"`
2019-06-07 10:56:06 +00:00
CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"`
CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"`
2018-10-23 12:38:10 +00:00
CanBeReported bool `json:"can_be_reported"`
DefaultDisableNotification bool `json:"default_disable_notification"`
UnreadCount int32 `json:"unread_count"`
LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"`
LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"`
UnreadMentionCount int32 `json:"unread_mention_count"`
NotificationSettings *ChatNotificationSettings `json:"notification_settings"`
2019-06-07 10:56:06 +00:00
PinnedMessageId int64 `json:"pinned_message_id"`
2018-10-23 12:38:10 +00:00
ReplyMarkupMessageId int64 `json:"reply_markup_message_id"`
DraftMessage *DraftMessage `json:"draft_message"`
ClientData string `json:"client_data"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
chat.Id = tmp.Id
chat.Title = tmp.Title
chat.Photo = tmp.Photo
2019-09-10 12:36:54 +00:00
chat.Permissions = tmp.Permissions
2018-10-23 12:38:10 +00:00
chat.LastMessage = tmp.LastMessage
chat.Order = tmp.Order
chat.IsPinned = tmp.IsPinned
chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread
chat.IsSponsored = tmp.IsSponsored
2019-06-07 10:56:06 +00:00
chat.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf
chat.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers
2018-10-23 12:38:10 +00:00
chat.CanBeReported = tmp.CanBeReported
chat.DefaultDisableNotification = tmp.DefaultDisableNotification
chat.UnreadCount = tmp.UnreadCount
chat.LastReadInboxMessageId = tmp.LastReadInboxMessageId
chat.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId
chat.UnreadMentionCount = tmp.UnreadMentionCount
chat.NotificationSettings = tmp.NotificationSettings
2019-06-07 10:56:06 +00:00
chat.PinnedMessageId = tmp.PinnedMessageId
2018-10-23 12:38:10 +00:00
chat.ReplyMarkupMessageId = tmp.ReplyMarkupMessageId
chat.DraftMessage = tmp.DraftMessage
chat.ClientData = tmp.ClientData
fieldType, _ := UnmarshalChatType(tmp.Type)
chat.Type = fieldType
return nil
2018-08-30 14:55:42 +00:00
}
// Represents a list of chats
type Chats struct {
2018-10-23 12:38:10 +00:00
meta
// List of chat identifiers
ChatIds []int64 `json:"chat_ids"`
2018-08-30 14:55:42 +00:00
}
func (entity *Chats) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Chats
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Chats) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChats
2018-08-30 14:55:42 +00:00
}
func (*Chats) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChats
2018-08-30 14:55:42 +00:00
}
// Contains a chat invite link
type ChatInviteLink struct {
2018-10-23 12:38:10 +00:00
meta
// Chat invite link
InviteLink string `json:"invite_link"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatInviteLink) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatInviteLink
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatInviteLink) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatInviteLink
2018-08-30 14:55:42 +00:00
}
func (*ChatInviteLink) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatInviteLink
2018-08-30 14:55:42 +00:00
}
// Contains information about a chat invite link
type ChatInviteLinkInfo struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier of the invite link; 0 if the user is not a member of this chat
ChatId int64 `json:"chat_id"`
// Contains information about the type of the chat
Type ChatType `json:"type"`
// Title of the chat
Title string `json:"title"`
// Chat photo; may be null
Photo *ChatPhoto `json:"photo"`
// Number of members
MemberCount int32 `json:"member_count"`
// User identifiers of some chat members that may be known to the current user
MemberUserIds []int32 `json:"member_user_ids"`
2019-09-10 12:36:54 +00:00
// True, if the chat is a public supergroup or a channel with a username
2018-10-23 12:38:10 +00:00
IsPublic bool `json:"is_public"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatInviteLinkInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatInviteLinkInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatInviteLinkInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatInviteLinkInfo
2018-08-30 14:55:42 +00:00
}
func (*ChatInviteLinkInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatInviteLinkInfo
2018-08-30 14:55:42 +00:00
}
func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
ChatId int64 `json:"chat_id"`
Type json.RawMessage `json:"type"`
Title string `json:"title"`
Photo *ChatPhoto `json:"photo"`
MemberCount int32 `json:"member_count"`
MemberUserIds []int32 `json:"member_user_ids"`
IsPublic bool `json:"is_public"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
chatInviteLinkInfo.ChatId = tmp.ChatId
chatInviteLinkInfo.Title = tmp.Title
chatInviteLinkInfo.Photo = tmp.Photo
chatInviteLinkInfo.MemberCount = tmp.MemberCount
chatInviteLinkInfo.MemberUserIds = tmp.MemberUserIds
chatInviteLinkInfo.IsPublic = tmp.IsPublic
fieldType, _ := UnmarshalChatType(tmp.Type)
chatInviteLinkInfo.Type = fieldType
return nil
2018-08-30 14:55:42 +00:00
}
// A simple button, with text that should be sent when the button is pressed
2018-10-23 12:38:10 +00:00
type KeyboardButtonTypeText struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *KeyboardButtonTypeText) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub KeyboardButtonTypeText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButtonTypeText) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassKeyboardButtonType
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButtonTypeText) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeKeyboardButtonTypeText
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButtonTypeText) KeyboardButtonTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeKeyboardButtonTypeText
2018-08-30 14:55:42 +00:00
}
// A button that sends the user's phone number when pressed; available only in private chats
2018-10-23 12:38:10 +00:00
type KeyboardButtonTypeRequestPhoneNumber struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *KeyboardButtonTypeRequestPhoneNumber) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub KeyboardButtonTypeRequestPhoneNumber
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButtonTypeRequestPhoneNumber) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassKeyboardButtonType
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButtonTypeRequestPhoneNumber) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeKeyboardButtonTypeRequestPhoneNumber
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButtonTypeRequestPhoneNumber) KeyboardButtonTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeKeyboardButtonTypeRequestPhoneNumber
2018-08-30 14:55:42 +00:00
}
// A button that sends the user's location when pressed; available only in private chats
2018-10-23 12:38:10 +00:00
type KeyboardButtonTypeRequestLocation struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *KeyboardButtonTypeRequestLocation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub KeyboardButtonTypeRequestLocation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButtonTypeRequestLocation) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassKeyboardButtonType
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButtonTypeRequestLocation) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeKeyboardButtonTypeRequestLocation
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButtonTypeRequestLocation) KeyboardButtonTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeKeyboardButtonTypeRequestLocation
2018-08-30 14:55:42 +00:00
}
// Represents a single button in a bot keyboard
type KeyboardButton struct {
2018-10-23 12:38:10 +00:00
meta
// Text of the button
Text string `json:"text"`
// Type of the button
Type KeyboardButtonType `json:"type"`
2018-08-30 14:55:42 +00:00
}
func (entity *KeyboardButton) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub KeyboardButton
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButton) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassKeyboardButton
2018-08-30 14:55:42 +00:00
}
func (*KeyboardButton) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeKeyboardButton
2018-08-30 14:55:42 +00:00
}
func (keyboardButton *KeyboardButton) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text string `json:"text"`
Type json.RawMessage `json:"type"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
keyboardButton.Text = tmp.Text
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldType, _ := UnmarshalKeyboardButtonType(tmp.Type)
keyboardButton.Type = fieldType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A button that opens a specified URL
type InlineKeyboardButtonTypeUrl struct {
2018-10-23 12:38:10 +00:00
meta
// HTTP or tg:// URL to open
Url string `json:"url"`
2018-08-30 14:55:42 +00:00
}
func (entity *InlineKeyboardButtonTypeUrl) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InlineKeyboardButtonTypeUrl
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeUrl) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInlineKeyboardButtonType
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeUrl) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeUrl
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeUrl) InlineKeyboardButtonTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeUrl
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// A button that opens a specified URL and automatically logs in in current user if they allowed to do that
type InlineKeyboardButtonTypeLoginUrl struct {
meta
// HTTP URL to open
Url string `json:"url"`
// Unique button identifier
Id int32 `json:"id"`
// If non-empty, new text of the button in forwarded messages
ForwardText string `json:"forward_text"`
}
func (entity *InlineKeyboardButtonTypeLoginUrl) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InlineKeyboardButtonTypeLoginUrl
return json.Marshal((*stub)(entity))
}
func (*InlineKeyboardButtonTypeLoginUrl) GetClass() string {
return ClassInlineKeyboardButtonType
}
func (*InlineKeyboardButtonTypeLoginUrl) GetType() string {
return TypeInlineKeyboardButtonTypeLoginUrl
}
func (*InlineKeyboardButtonTypeLoginUrl) InlineKeyboardButtonTypeType() string {
return TypeInlineKeyboardButtonTypeLoginUrl
}
2018-08-30 14:55:42 +00:00
// A button that sends a special callback query to a bot
type InlineKeyboardButtonTypeCallback struct {
2018-10-23 12:38:10 +00:00
meta
// Data to be sent to the bot via a callback query
Data []byte `json:"data"`
2018-08-30 14:55:42 +00:00
}
func (entity *InlineKeyboardButtonTypeCallback) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InlineKeyboardButtonTypeCallback
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeCallback) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInlineKeyboardButtonType
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeCallback) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeCallback
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeCallback) InlineKeyboardButtonTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeCallback
2018-08-30 14:55:42 +00:00
}
// A button with a game that sends a special callback query to a bot. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageGame
2018-10-23 12:38:10 +00:00
type InlineKeyboardButtonTypeCallbackGame struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *InlineKeyboardButtonTypeCallbackGame) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InlineKeyboardButtonTypeCallbackGame
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeCallbackGame) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInlineKeyboardButtonType
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeCallbackGame) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeCallbackGame
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeCallbackGame) InlineKeyboardButtonTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeCallbackGame
2018-08-30 14:55:42 +00:00
}
// A button that forces an inline query to the bot to be inserted in the input field
type InlineKeyboardButtonTypeSwitchInline struct {
2018-10-23 12:38:10 +00:00
meta
// Inline query to be sent to the bot
Query string `json:"query"`
// True, if the inline query should be sent from the current chat
InCurrentChat bool `json:"in_current_chat"`
2018-08-30 14:55:42 +00:00
}
func (entity *InlineKeyboardButtonTypeSwitchInline) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InlineKeyboardButtonTypeSwitchInline
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeSwitchInline) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInlineKeyboardButtonType
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeSwitchInline) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeSwitchInline
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeSwitchInline) InlineKeyboardButtonTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeSwitchInline
2018-08-30 14:55:42 +00:00
}
// A button to buy something. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageInvoice
2018-10-23 12:38:10 +00:00
type InlineKeyboardButtonTypeBuy struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *InlineKeyboardButtonTypeBuy) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InlineKeyboardButtonTypeBuy
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeBuy) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInlineKeyboardButtonType
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeBuy) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeBuy
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButtonTypeBuy) InlineKeyboardButtonTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButtonTypeBuy
2018-08-30 14:55:42 +00:00
}
// Represents a single button in an inline keyboard
type InlineKeyboardButton struct {
2018-10-23 12:38:10 +00:00
meta
// Text of the button
Text string `json:"text"`
// Type of the button
Type InlineKeyboardButtonType `json:"type"`
2018-08-30 14:55:42 +00:00
}
func (entity *InlineKeyboardButton) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InlineKeyboardButton
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButton) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInlineKeyboardButton
2018-08-30 14:55:42 +00:00
}
func (*InlineKeyboardButton) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInlineKeyboardButton
2018-08-30 14:55:42 +00:00
}
func (inlineKeyboardButton *InlineKeyboardButton) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text string `json:"text"`
Type json.RawMessage `json:"type"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
inlineKeyboardButton.Text = tmp.Text
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldType, _ := UnmarshalInlineKeyboardButtonType(tmp.Type)
inlineKeyboardButton.Type = fieldType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// Instructs clients to remove the keyboard once this message has been received. This kind of keyboard can't be received in an incoming message; instead, UpdateChatReplyMarkup with message_id == 0 will be sent
type ReplyMarkupRemoveKeyboard struct {
2018-10-23 12:38:10 +00:00
meta
// True, if the keyboard is removed only for the mentioned users or the target user of a reply
IsPersonal bool `json:"is_personal"`
2018-08-30 14:55:42 +00:00
}
func (entity *ReplyMarkupRemoveKeyboard) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ReplyMarkupRemoveKeyboard
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupRemoveKeyboard) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassReplyMarkup
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupRemoveKeyboard) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeReplyMarkupRemoveKeyboard
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupRemoveKeyboard) ReplyMarkupType() string {
2018-10-23 12:38:10 +00:00
return TypeReplyMarkupRemoveKeyboard
2018-08-30 14:55:42 +00:00
}
// Instructs clients to force a reply to this message
type ReplyMarkupForceReply struct {
2018-10-23 12:38:10 +00:00
meta
// True, if a forced reply must automatically be shown to the current user. For outgoing messages, specify true to show the forced reply only for the mentioned users and for the target user of a reply
IsPersonal bool `json:"is_personal"`
2018-08-30 14:55:42 +00:00
}
func (entity *ReplyMarkupForceReply) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ReplyMarkupForceReply
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupForceReply) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassReplyMarkup
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupForceReply) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeReplyMarkupForceReply
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupForceReply) ReplyMarkupType() string {
2018-10-23 12:38:10 +00:00
return TypeReplyMarkupForceReply
2018-08-30 14:55:42 +00:00
}
// Contains a custom keyboard layout to quickly reply to bots
type ReplyMarkupShowKeyboard struct {
2018-10-23 12:38:10 +00:00
meta
// A list of rows of bot keyboard buttons
Rows [][]*KeyboardButton `json:"rows"`
// True, if the client needs to resize the keyboard vertically
ResizeKeyboard bool `json:"resize_keyboard"`
// True, if the client needs to hide the keyboard after use
OneTime bool `json:"one_time"`
// True, if the keyboard must automatically be shown to the current user. For outgoing messages, specify true to show the keyboard only for the mentioned users and for the target user of a reply
IsPersonal bool `json:"is_personal"`
2018-08-30 14:55:42 +00:00
}
func (entity *ReplyMarkupShowKeyboard) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ReplyMarkupShowKeyboard
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupShowKeyboard) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassReplyMarkup
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupShowKeyboard) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeReplyMarkupShowKeyboard
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupShowKeyboard) ReplyMarkupType() string {
2018-10-23 12:38:10 +00:00
return TypeReplyMarkupShowKeyboard
2018-08-30 14:55:42 +00:00
}
// Contains an inline keyboard layout
type ReplyMarkupInlineKeyboard struct {
2018-10-23 12:38:10 +00:00
meta
// A list of rows of inline keyboard buttons
Rows [][]*InlineKeyboardButton `json:"rows"`
2018-08-30 14:55:42 +00:00
}
func (entity *ReplyMarkupInlineKeyboard) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ReplyMarkupInlineKeyboard
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupInlineKeyboard) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassReplyMarkup
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupInlineKeyboard) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeReplyMarkupInlineKeyboard
2018-08-30 14:55:42 +00:00
}
func (*ReplyMarkupInlineKeyboard) ReplyMarkupType() string {
2018-10-23 12:38:10 +00:00
return TypeReplyMarkupInlineKeyboard
2018-08-30 14:55:42 +00:00
}
// A plain text
type RichTextPlain struct {
2018-10-23 12:38:10 +00:00
meta
// Text
Text string `json:"text"`
2018-08-30 14:55:42 +00:00
}
func (entity *RichTextPlain) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RichTextPlain
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RichTextPlain) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRichText
2018-08-30 14:55:42 +00:00
}
func (*RichTextPlain) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextPlain
2018-08-30 14:55:42 +00:00
}
func (*RichTextPlain) RichTextType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextPlain
2018-08-30 14:55:42 +00:00
}
// A bold rich text
type RichTextBold struct {
2018-10-23 12:38:10 +00:00
meta
// Text
Text RichText `json:"text"`
2018-08-30 14:55:42 +00:00
}
func (entity *RichTextBold) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RichTextBold
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RichTextBold) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRichText
2018-08-30 14:55:42 +00:00
}
func (*RichTextBold) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextBold
2018-08-30 14:55:42 +00:00
}
func (*RichTextBold) RichTextType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextBold
2018-08-30 14:55:42 +00:00
}
func (richTextBold *RichTextBold) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text json.RawMessage `json:"text"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextBold.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// An italicized rich text
type RichTextItalic struct {
2018-10-23 12:38:10 +00:00
meta
// Text
Text RichText `json:"text"`
2018-08-30 14:55:42 +00:00
}
func (entity *RichTextItalic) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RichTextItalic
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RichTextItalic) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRichText
2018-08-30 14:55:42 +00:00
}
func (*RichTextItalic) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextItalic
2018-08-30 14:55:42 +00:00
}
func (*RichTextItalic) RichTextType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextItalic
2018-08-30 14:55:42 +00:00
}
func (richTextItalic *RichTextItalic) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text json.RawMessage `json:"text"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextItalic.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// An underlined rich text
type RichTextUnderline struct {
2018-10-23 12:38:10 +00:00
meta
// Text
Text RichText `json:"text"`
2018-08-30 14:55:42 +00:00
}
func (entity *RichTextUnderline) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RichTextUnderline
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RichTextUnderline) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRichText
2018-08-30 14:55:42 +00:00
}
func (*RichTextUnderline) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextUnderline
2018-08-30 14:55:42 +00:00
}
func (*RichTextUnderline) RichTextType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextUnderline
2018-08-30 14:55:42 +00:00
}
func (richTextUnderline *RichTextUnderline) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text json.RawMessage `json:"text"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextUnderline.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A strike-through rich text
type RichTextStrikethrough struct {
2018-10-23 12:38:10 +00:00
meta
// Text
Text RichText `json:"text"`
2018-08-30 14:55:42 +00:00
}
func (entity *RichTextStrikethrough) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RichTextStrikethrough
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RichTextStrikethrough) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRichText
2018-08-30 14:55:42 +00:00
}
func (*RichTextStrikethrough) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextStrikethrough
2018-08-30 14:55:42 +00:00
}
func (*RichTextStrikethrough) RichTextType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextStrikethrough
2018-08-30 14:55:42 +00:00
}
func (richTextStrikethrough *RichTextStrikethrough) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text json.RawMessage `json:"text"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextStrikethrough.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A fixed-width rich text
type RichTextFixed struct {
2018-10-23 12:38:10 +00:00
meta
// Text
Text RichText `json:"text"`
2018-08-30 14:55:42 +00:00
}
func (entity *RichTextFixed) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RichTextFixed
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RichTextFixed) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRichText
2018-08-30 14:55:42 +00:00
}
func (*RichTextFixed) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextFixed
2018-08-30 14:55:42 +00:00
}
func (*RichTextFixed) RichTextType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextFixed
2018-08-30 14:55:42 +00:00
}
func (richTextFixed *RichTextFixed) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text json.RawMessage `json:"text"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextFixed.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A rich text URL link
type RichTextUrl struct {
2018-10-23 12:38:10 +00:00
meta
// Text
Text RichText `json:"text"`
// URL
Url string `json:"url"`
2018-08-30 14:55:42 +00:00
}
func (entity *RichTextUrl) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RichTextUrl
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RichTextUrl) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRichText
2018-08-30 14:55:42 +00:00
}
func (*RichTextUrl) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextUrl
2018-08-30 14:55:42 +00:00
}
func (*RichTextUrl) RichTextType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextUrl
2018-08-30 14:55:42 +00:00
}
func (richTextUrl *RichTextUrl) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text json.RawMessage `json:"text"`
Url string `json:"url"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
richTextUrl.Url = tmp.Url
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextUrl.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A rich text email link
type RichTextEmailAddress struct {
2018-10-23 12:38:10 +00:00
meta
// Text
Text RichText `json:"text"`
// Email address
EmailAddress string `json:"email_address"`
2018-08-30 14:55:42 +00:00
}
func (entity *RichTextEmailAddress) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub RichTextEmailAddress
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*RichTextEmailAddress) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRichText
2018-08-30 14:55:42 +00:00
}
func (*RichTextEmailAddress) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextEmailAddress
2018-08-30 14:55:42 +00:00
}
func (*RichTextEmailAddress) RichTextType() string {
2018-10-23 12:38:10 +00:00
return TypeRichTextEmailAddress
2018-08-30 14:55:42 +00:00
}
func (richTextEmailAddress *RichTextEmailAddress) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text json.RawMessage `json:"text"`
EmailAddress string `json:"email_address"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
richTextEmailAddress.EmailAddress = tmp.EmailAddress
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextEmailAddress.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A subscript rich text
type RichTextSubscript struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Text
Text RichText `json:"text"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *RichTextSubscript) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub RichTextSubscript
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextSubscript) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassRichText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextSubscript) GetType() string {
return TypeRichTextSubscript
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextSubscript) RichTextType() string {
return TypeRichTextSubscript
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (richTextSubscript *RichTextSubscript) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Text json.RawMessage `json:"text"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextSubscript.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A superscript rich text
type RichTextSuperscript struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Text
Text RichText `json:"text"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *RichTextSuperscript) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub RichTextSuperscript
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextSuperscript) GetClass() string {
return ClassRichText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextSuperscript) GetType() string {
return TypeRichTextSuperscript
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextSuperscript) RichTextType() string {
return TypeRichTextSuperscript
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (richTextSuperscript *RichTextSuperscript) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Text json.RawMessage `json:"text"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextSuperscript.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A marked rich text
type RichTextMarked struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Text
Text RichText `json:"text"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *RichTextMarked) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub RichTextMarked
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextMarked) GetClass() string {
return ClassRichText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextMarked) GetType() string {
return TypeRichTextMarked
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextMarked) RichTextType() string {
return TypeRichTextMarked
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (richTextMarked *RichTextMarked) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Text json.RawMessage `json:"text"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextMarked.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A rich text phone number
type RichTextPhoneNumber struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Text
Text RichText `json:"text"`
// Phone number
PhoneNumber string `json:"phone_number"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *RichTextPhoneNumber) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub RichTextPhoneNumber
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextPhoneNumber) GetClass() string {
return ClassRichText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextPhoneNumber) GetType() string {
return TypeRichTextPhoneNumber
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextPhoneNumber) RichTextType() string {
return TypeRichTextPhoneNumber
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (richTextPhoneNumber *RichTextPhoneNumber) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Text json.RawMessage `json:"text"`
PhoneNumber string `json:"phone_number"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
richTextPhoneNumber.PhoneNumber = tmp.PhoneNumber
fieldText, _ := UnmarshalRichText(tmp.Text)
richTextPhoneNumber.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A small image inside the text
type RichTextIcon struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The image represented as a document. The image can be in GIF, JPEG or PNG format
Document *Document `json:"document"`
2019-09-10 12:36:54 +00:00
// Width of a bounding box in which the image should be shown; 0 if unknown
2019-06-07 10:56:06 +00:00
Width int32 `json:"width"`
2019-09-10 12:36:54 +00:00
// Height of a bounding box in which the image should be shown; 0 if unknown
2019-06-07 10:56:06 +00:00
Height int32 `json:"height"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *RichTextIcon) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub RichTextIcon
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextIcon) GetClass() string {
return ClassRichText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextIcon) GetType() string {
return TypeRichTextIcon
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextIcon) RichTextType() string {
return TypeRichTextIcon
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A rich text anchor
type RichTextAnchor struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Text
2018-10-23 12:38:10 +00:00
Text RichText `json:"text"`
2019-06-07 10:56:06 +00:00
// Anchor name
Name string `json:"name"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *RichTextAnchor) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub RichTextAnchor
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextAnchor) GetClass() string {
return ClassRichText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextAnchor) GetType() string {
return TypeRichTextAnchor
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTextAnchor) RichTextType() string {
return TypeRichTextAnchor
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (richTextAnchor *RichTextAnchor) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Text json.RawMessage `json:"text"`
2019-06-07 10:56:06 +00:00
Name string `json:"name"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
richTextAnchor.Name = tmp.Name
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
2019-06-07 10:56:06 +00:00
richTextAnchor.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A concatenation of rich texts
type RichTexts struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Texts
Texts []RichText `json:"texts"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *RichTexts) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub RichTexts
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTexts) GetClass() string {
return ClassRichText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTexts) GetType() string {
return TypeRichTexts
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*RichTexts) RichTextType() string {
return TypeRichTexts
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains a caption of an instant view web page block, consisting of a text and a trailing credit
type PageBlockCaption struct {
meta
// Content of the caption
Text RichText `json:"text"`
// Block credit (like HTML tag <cite>)
Credit RichText `json:"credit"`
}
func (entity *PageBlockCaption) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub PageBlockCaption
return json.Marshal((*stub)(entity))
}
func (*PageBlockCaption) GetClass() string {
return ClassPageBlockCaption
}
func (*PageBlockCaption) GetType() string {
return TypePageBlockCaption
}
func (pageBlockCaption *PageBlockCaption) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Text json.RawMessage `json:"text"`
Credit json.RawMessage `json:"credit"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
2019-06-07 10:56:06 +00:00
pageBlockCaption.Text = fieldText
fieldCredit, _ := UnmarshalRichText(tmp.Credit)
pageBlockCaption.Credit = fieldCredit
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Describes an item of a list page block
type PageBlockListItem struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Item label
Label string `json:"label"`
// Item blocks
PageBlocks []PageBlock `json:"page_blocks"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockListItem) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockListItem
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockListItem) GetClass() string {
return ClassPageBlockListItem
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockListItem) GetType() string {
return TypePageBlockListItem
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The content should be left-aligned
type PageBlockHorizontalAlignmentLeft struct {
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockHorizontalAlignmentLeft) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockHorizontalAlignmentLeft
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*PageBlockHorizontalAlignmentLeft) GetClass() string {
return ClassPageBlockHorizontalAlignment
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHorizontalAlignmentLeft) GetType() string {
return TypePageBlockHorizontalAlignmentLeft
}
func (*PageBlockHorizontalAlignmentLeft) PageBlockHorizontalAlignmentType() string {
return TypePageBlockHorizontalAlignmentLeft
}
// The content should be center-aligned
type PageBlockHorizontalAlignmentCenter struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockHorizontalAlignmentCenter) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockHorizontalAlignmentCenter
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHorizontalAlignmentCenter) GetClass() string {
return ClassPageBlockHorizontalAlignment
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHorizontalAlignmentCenter) GetType() string {
return TypePageBlockHorizontalAlignmentCenter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHorizontalAlignmentCenter) PageBlockHorizontalAlignmentType() string {
return TypePageBlockHorizontalAlignmentCenter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The content should be right-aligned
type PageBlockHorizontalAlignmentRight struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockHorizontalAlignmentRight) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockHorizontalAlignmentRight
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHorizontalAlignmentRight) GetClass() string {
return ClassPageBlockHorizontalAlignment
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHorizontalAlignmentRight) GetType() string {
return TypePageBlockHorizontalAlignmentRight
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHorizontalAlignmentRight) PageBlockHorizontalAlignmentType() string {
return TypePageBlockHorizontalAlignmentRight
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The content should be top-aligned
type PageBlockVerticalAlignmentTop struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockVerticalAlignmentTop) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockVerticalAlignmentTop
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVerticalAlignmentTop) GetClass() string {
return ClassPageBlockVerticalAlignment
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVerticalAlignmentTop) GetType() string {
return TypePageBlockVerticalAlignmentTop
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVerticalAlignmentTop) PageBlockVerticalAlignmentType() string {
return TypePageBlockVerticalAlignmentTop
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The content should be middle-aligned
type PageBlockVerticalAlignmentMiddle struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockVerticalAlignmentMiddle) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockVerticalAlignmentMiddle
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVerticalAlignmentMiddle) GetClass() string {
return ClassPageBlockVerticalAlignment
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVerticalAlignmentMiddle) GetType() string {
return TypePageBlockVerticalAlignmentMiddle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVerticalAlignmentMiddle) PageBlockVerticalAlignmentType() string {
return TypePageBlockVerticalAlignmentMiddle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The content should be bottom-aligned
type PageBlockVerticalAlignmentBottom struct {
meta
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (entity *PageBlockVerticalAlignmentBottom) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockVerticalAlignmentBottom
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*PageBlockVerticalAlignmentBottom) GetClass() string {
return ClassPageBlockVerticalAlignment
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVerticalAlignmentBottom) GetType() string {
return TypePageBlockVerticalAlignmentBottom
}
func (*PageBlockVerticalAlignmentBottom) PageBlockVerticalAlignmentType() string {
return TypePageBlockVerticalAlignmentBottom
}
// Represents a cell of a table
type PageBlockTableCell struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Cell text
2018-10-23 12:38:10 +00:00
Text RichText `json:"text"`
2019-06-07 10:56:06 +00:00
// True, if it is a header cell
IsHeader bool `json:"is_header"`
// The number of columns the cell should span
Colspan int32 `json:"colspan"`
// The number of rows the cell should span
Rowspan int32 `json:"rowspan"`
// Horizontal cell content alignment
Align PageBlockHorizontalAlignment `json:"align"`
// Vertical cell content alignment
Valign PageBlockVerticalAlignment `json:"valign"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockTableCell) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockTableCell
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockTableCell) GetClass() string {
return ClassPageBlockTableCell
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockTableCell) GetType() string {
return TypePageBlockTableCell
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockTableCell *PageBlockTableCell) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Text json.RawMessage `json:"text"`
IsHeader bool `json:"is_header"`
Colspan int32 `json:"colspan"`
Rowspan int32 `json:"rowspan"`
Align json.RawMessage `json:"align"`
Valign json.RawMessage `json:"valign"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
pageBlockTableCell.IsHeader = tmp.IsHeader
pageBlockTableCell.Colspan = tmp.Colspan
pageBlockTableCell.Rowspan = tmp.Rowspan
2018-10-23 12:38:10 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
2019-06-07 10:56:06 +00:00
pageBlockTableCell.Text = fieldText
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldAlign, _ := UnmarshalPageBlockHorizontalAlignment(tmp.Align)
pageBlockTableCell.Align = fieldAlign
fieldValign, _ := UnmarshalPageBlockVerticalAlignment(tmp.Valign)
pageBlockTableCell.Valign = fieldValign
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about a related article
type PageBlockRelatedArticle struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Related article URL
Url string `json:"url"`
// Article title; may be empty
Title string `json:"title"`
// Article description; may be empty
Description string `json:"description"`
// Article photo; may be null
Photo *Photo `json:"photo"`
// Article author; may be empty
Author string `json:"author"`
// Point in time (Unix timestamp) when the article was published; 0 if unknown
PublishDate int32 `json:"publish_date"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockRelatedArticle) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockRelatedArticle
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockRelatedArticle) GetClass() string {
return ClassPageBlockRelatedArticle
}
func (*PageBlockRelatedArticle) GetType() string {
return TypePageBlockRelatedArticle
}
// The title of a page
type PageBlockTitle struct {
meta
// Title
Title RichText `json:"title"`
}
func (entity *PageBlockTitle) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub PageBlockTitle
return json.Marshal((*stub)(entity))
}
func (*PageBlockTitle) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockTitle) GetType() string {
return TypePageBlockTitle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockTitle) PageBlockType() string {
return TypePageBlockTitle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockTitle *PageBlockTitle) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Title json.RawMessage `json:"title"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldTitle, _ := UnmarshalRichText(tmp.Title)
pageBlockTitle.Title = fieldTitle
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The subtitle of a page
type PageBlockSubtitle struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Subtitle
Subtitle RichText `json:"subtitle"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockSubtitle) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockSubtitle
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockSubtitle) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockSubtitle) GetType() string {
return TypePageBlockSubtitle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockSubtitle) PageBlockType() string {
return TypePageBlockSubtitle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockSubtitle *PageBlockSubtitle) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Subtitle json.RawMessage `json:"subtitle"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldSubtitle, _ := UnmarshalRichText(tmp.Subtitle)
pageBlockSubtitle.Subtitle = fieldSubtitle
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The author and publishing date of a page
type PageBlockAuthorDate struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Author
Author RichText `json:"author"`
// Point in time (Unix timestamp) when the article was published; 0 if unknown
PublishDate int32 `json:"publish_date"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockAuthorDate) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockAuthorDate
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAuthorDate) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAuthorDate) GetType() string {
return TypePageBlockAuthorDate
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAuthorDate) PageBlockType() string {
return TypePageBlockAuthorDate
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockAuthorDate *PageBlockAuthorDate) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Author json.RawMessage `json:"author"`
PublishDate int32 `json:"publish_date"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
pageBlockAuthorDate.PublishDate = tmp.PublishDate
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldAuthor, _ := UnmarshalRichText(tmp.Author)
pageBlockAuthorDate.Author = fieldAuthor
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A header
type PageBlockHeader struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Header
Header RichText `json:"header"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockHeader) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockHeader
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHeader) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHeader) GetType() string {
return TypePageBlockHeader
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockHeader) PageBlockType() string {
return TypePageBlockHeader
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockHeader *PageBlockHeader) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Header json.RawMessage `json:"header"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldHeader, _ := UnmarshalRichText(tmp.Header)
pageBlockHeader.Header = fieldHeader
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A subheader
type PageBlockSubheader struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Subheader
Subheader RichText `json:"subheader"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockSubheader) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockSubheader
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockSubheader) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockSubheader) GetType() string {
return TypePageBlockSubheader
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockSubheader) PageBlockType() string {
return TypePageBlockSubheader
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockSubheader *PageBlockSubheader) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Subheader json.RawMessage `json:"subheader"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldSubheader, _ := UnmarshalRichText(tmp.Subheader)
pageBlockSubheader.Subheader = fieldSubheader
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A kicker
type PageBlockKicker struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Kicker
Kicker RichText `json:"kicker"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockKicker) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockKicker
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockKicker) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockKicker) GetType() string {
return TypePageBlockKicker
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockKicker) PageBlockType() string {
return TypePageBlockKicker
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockKicker *PageBlockKicker) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Kicker json.RawMessage `json:"kicker"`
2018-10-23 12:38:10 +00:00
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2019-06-07 10:56:06 +00:00
fieldKicker, _ := UnmarshalRichText(tmp.Kicker)
pageBlockKicker.Kicker = fieldKicker
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A text paragraph
type PageBlockParagraph struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Paragraph text
Text RichText `json:"text"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockParagraph) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockParagraph
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockParagraph) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockParagraph) GetType() string {
return TypePageBlockParagraph
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockParagraph) PageBlockType() string {
return TypePageBlockParagraph
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockParagraph *PageBlockParagraph) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Text json.RawMessage `json:"text"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
pageBlockParagraph.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A preformatted text paragraph
type PageBlockPreformatted struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Paragraph text
Text RichText `json:"text"`
// Programming language for which the text should be formatted
Language string `json:"language"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockPreformatted) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockPreformatted
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockPreformatted) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockPreformatted) GetType() string {
return TypePageBlockPreformatted
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockPreformatted) PageBlockType() string {
return TypePageBlockPreformatted
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockPreformatted *PageBlockPreformatted) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Text json.RawMessage `json:"text"`
Language string `json:"language"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
pageBlockPreformatted.Language = tmp.Language
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
pageBlockPreformatted.Text = fieldText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The footer of a page
type PageBlockFooter struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Footer
Footer RichText `json:"footer"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockFooter) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockFooter
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockFooter) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockFooter) GetType() string {
return TypePageBlockFooter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockFooter) PageBlockType() string {
return TypePageBlockFooter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockFooter *PageBlockFooter) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Footer json.RawMessage `json:"footer"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldFooter, _ := UnmarshalRichText(tmp.Footer)
pageBlockFooter.Footer = fieldFooter
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An empty block separating a page
type PageBlockDivider struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockDivider) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockDivider
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockDivider) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockDivider) GetType() string {
return TypePageBlockDivider
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockDivider) PageBlockType() string {
return TypePageBlockDivider
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An invisible anchor on a page, which can be used in a URL to open the page from the specified anchor
type PageBlockAnchor struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Name of the anchor
Name string `json:"name"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockAnchor) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockAnchor
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAnchor) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAnchor) GetType() string {
return TypePageBlockAnchor
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAnchor) PageBlockType() string {
return TypePageBlockAnchor
}
// A list of data blocks
type PageBlockList struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The items of the list
Items []*PageBlockListItem `json:"items"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockList) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockList
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockList) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockList) GetType() string {
return TypePageBlockList
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockList) PageBlockType() string {
return TypePageBlockList
}
// A block quote
type PageBlockBlockQuote struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Quote text
Text RichText `json:"text"`
// Quote credit
Credit RichText `json:"credit"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockBlockQuote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockBlockQuote
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockBlockQuote) GetClass() string {
return ClassPageBlock
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockBlockQuote) GetType() string {
return TypePageBlockBlockQuote
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockBlockQuote) PageBlockType() string {
return TypePageBlockBlockQuote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockBlockQuote *PageBlockBlockQuote) UnmarshalJSON(data []byte) error {
var tmp struct {
Text json.RawMessage `json:"text"`
Credit json.RawMessage `json:"credit"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
pageBlockBlockQuote.Text = fieldText
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldCredit, _ := UnmarshalRichText(tmp.Credit)
pageBlockBlockQuote.Credit = fieldCredit
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A pull quote
type PageBlockPullQuote struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Quote text
Text RichText `json:"text"`
// Quote credit
Credit RichText `json:"credit"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockPullQuote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockPullQuote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockPullQuote) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockPullQuote) GetType() string {
return TypePageBlockPullQuote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockPullQuote) PageBlockType() string {
return TypePageBlockPullQuote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockPullQuote *PageBlockPullQuote) UnmarshalJSON(data []byte) error {
var tmp struct {
Text json.RawMessage `json:"text"`
Credit json.RawMessage `json:"credit"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldText, _ := UnmarshalRichText(tmp.Text)
pageBlockPullQuote.Text = fieldText
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldCredit, _ := UnmarshalRichText(tmp.Credit)
pageBlockPullQuote.Credit = fieldCredit
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An animation
type PageBlockAnimation struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Animation file; may be null
Animation *Animation `json:"animation"`
// Animation caption
Caption *PageBlockCaption `json:"caption"`
// True, if the animation should be played automatically
NeedAutoplay bool `json:"need_autoplay"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockAnimation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockAnimation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAnimation) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAnimation) GetType() string {
return TypePageBlockAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAnimation) PageBlockType() string {
return TypePageBlockAnimation
}
// An audio file
type PageBlockAudio struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Audio file; may be null
Audio *Audio `json:"audio"`
// Audio file caption
Caption *PageBlockCaption `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockAudio) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockAudio
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAudio) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAudio) GetType() string {
return TypePageBlockAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockAudio) PageBlockType() string {
return TypePageBlockAudio
}
// A photo
type PageBlockPhoto struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Photo file; may be null
Photo *Photo `json:"photo"`
// Photo caption
Caption *PageBlockCaption `json:"caption"`
// URL that needs to be opened when the photo is clicked
Url string `json:"url"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockPhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockPhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockPhoto) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockPhoto) GetType() string {
return TypePageBlockPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockPhoto) PageBlockType() string {
return TypePageBlockPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A video
type PageBlockVideo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Video file; may be null
Video *Video `json:"video"`
// Video caption
Caption *PageBlockCaption `json:"caption"`
// True, if the video should be played automatically
NeedAutoplay bool `json:"need_autoplay"`
// True, if the video should be looped
IsLooped bool `json:"is_looped"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockVideo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVideo) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVideo) GetType() string {
return TypePageBlockVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockVideo) PageBlockType() string {
return TypePageBlockVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A page cover
type PageBlockCover struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Cover
Cover PageBlock `json:"cover"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockCover) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockCover
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockCover) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockCover) GetType() string {
return TypePageBlockCover
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockCover) PageBlockType() string {
return TypePageBlockCover
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockCover *PageBlockCover) UnmarshalJSON(data []byte) error {
var tmp struct {
Cover json.RawMessage `json:"cover"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
fieldCover, _ := UnmarshalPageBlock(tmp.Cover)
pageBlockCover.Cover = fieldCover
return nil
}
// An embedded web page
type PageBlockEmbedded struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Web page URL, if available
Url string `json:"url"`
// HTML-markup of the embedded page
Html string `json:"html"`
// Poster photo, if available; may be null
PosterPhoto *Photo `json:"poster_photo"`
2019-09-10 12:36:54 +00:00
// Block width; 0 if unknown
2019-06-07 10:56:06 +00:00
Width int32 `json:"width"`
2019-09-10 12:36:54 +00:00
// Block height; 0 if unknown
2019-06-07 10:56:06 +00:00
Height int32 `json:"height"`
// Block caption
Caption *PageBlockCaption `json:"caption"`
// True, if the block should be full width
IsFullWidth bool `json:"is_full_width"`
// True, if scrolling should be allowed
AllowScrolling bool `json:"allow_scrolling"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockEmbedded) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockEmbedded
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockEmbedded) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockEmbedded) GetType() string {
return TypePageBlockEmbedded
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockEmbedded) PageBlockType() string {
return TypePageBlockEmbedded
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An embedded post
type PageBlockEmbeddedPost struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Web page URL
Url string `json:"url"`
// Post author
Author string `json:"author"`
2019-09-10 12:36:54 +00:00
// Post author photo; may be null
2019-06-07 10:56:06 +00:00
AuthorPhoto *Photo `json:"author_photo"`
// Point in time (Unix timestamp) when the post was created; 0 if unknown
Date int32 `json:"date"`
// Post content
PageBlocks []PageBlock `json:"page_blocks"`
// Post caption
Caption *PageBlockCaption `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockEmbeddedPost) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockEmbeddedPost
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockEmbeddedPost) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockEmbeddedPost) GetType() string {
return TypePageBlockEmbeddedPost
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockEmbeddedPost) PageBlockType() string {
return TypePageBlockEmbeddedPost
}
// A collage
type PageBlockCollage struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Collage item contents
PageBlocks []PageBlock `json:"page_blocks"`
// Block caption
Caption *PageBlockCaption `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockCollage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockCollage
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockCollage) GetClass() string {
return ClassPageBlock
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockCollage) GetType() string {
return TypePageBlockCollage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockCollage) PageBlockType() string {
return TypePageBlockCollage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A slideshow
type PageBlockSlideshow struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Slideshow item contents
PageBlocks []PageBlock `json:"page_blocks"`
// Block caption
Caption *PageBlockCaption `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockSlideshow) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockSlideshow
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockSlideshow) GetClass() string {
return ClassPageBlock
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockSlideshow) GetType() string {
return TypePageBlockSlideshow
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockSlideshow) PageBlockType() string {
return TypePageBlockSlideshow
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A link to a chat
type PageBlockChatLink struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Chat title
Title string `json:"title"`
// Chat photo; may be null
Photo *ChatPhoto `json:"photo"`
// Chat username, by which all other information about the chat should be resolved
Username string `json:"username"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockChatLink) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockChatLink
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockChatLink) GetClass() string {
return ClassPageBlock
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockChatLink) GetType() string {
return TypePageBlockChatLink
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockChatLink) PageBlockType() string {
return TypePageBlockChatLink
}
// A table
type PageBlockTable struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Table caption
Caption RichText `json:"caption"`
// Table cells
Cells [][]*PageBlockTableCell `json:"cells"`
// True, if the table is bordered
IsBordered bool `json:"is_bordered"`
// True, if the table is striped
IsStriped bool `json:"is_striped"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockTable) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockTable
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockTable) GetClass() string {
return ClassPageBlock
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockTable) GetType() string {
return TypePageBlockTable
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockTable) PageBlockType() string {
return TypePageBlockTable
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockTable *PageBlockTable) UnmarshalJSON(data []byte) error {
var tmp struct {
Caption json.RawMessage `json:"caption"`
Cells [][]*PageBlockTableCell `json:"cells"`
IsBordered bool `json:"is_bordered"`
IsStriped bool `json:"is_striped"`
}
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
pageBlockTable.Cells = tmp.Cells
pageBlockTable.IsBordered = tmp.IsBordered
pageBlockTable.IsStriped = tmp.IsStriped
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
fieldCaption, _ := UnmarshalRichText(tmp.Caption)
pageBlockTable.Caption = fieldCaption
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A collapsible block
type PageBlockDetails struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Always visible heading for the block
Header RichText `json:"header"`
// Block contents
PageBlocks []PageBlock `json:"page_blocks"`
// True, if the block is open by default
IsOpen bool `json:"is_open"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockDetails) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockDetails
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockDetails) GetClass() string {
return ClassPageBlock
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockDetails) GetType() string {
return TypePageBlockDetails
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockDetails) PageBlockType() string {
return TypePageBlockDetails
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockDetails *PageBlockDetails) UnmarshalJSON(data []byte) error {
var tmp struct {
Header json.RawMessage `json:"header"`
PageBlocks []PageBlock `json:"page_blocks"`
IsOpen bool `json:"is_open"`
}
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
pageBlockDetails.PageBlocks = tmp.PageBlocks
pageBlockDetails.IsOpen = tmp.IsOpen
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
fieldHeader, _ := UnmarshalRichText(tmp.Header)
pageBlockDetails.Header = fieldHeader
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Related articles
type PageBlockRelatedArticles struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Block header
Header RichText `json:"header"`
// List of related articles
Articles []*PageBlockRelatedArticle `json:"articles"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockRelatedArticles) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockRelatedArticles
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockRelatedArticles) GetClass() string {
return ClassPageBlock
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockRelatedArticles) GetType() string {
return TypePageBlockRelatedArticles
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockRelatedArticles) PageBlockType() string {
return TypePageBlockRelatedArticles
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (pageBlockRelatedArticles *PageBlockRelatedArticles) UnmarshalJSON(data []byte) error {
var tmp struct {
Header json.RawMessage `json:"header"`
Articles []*PageBlockRelatedArticle `json:"articles"`
}
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
pageBlockRelatedArticles.Articles = tmp.Articles
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
fieldHeader, _ := UnmarshalRichText(tmp.Header)
pageBlockRelatedArticles.Header = fieldHeader
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A map
type PageBlockMap struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Location of the map center
Location *Location `json:"location"`
// Map zoom level
Zoom int32 `json:"zoom"`
// Map width
Width int32 `json:"width"`
// Map height
Height int32 `json:"height"`
// Block caption
Caption *PageBlockCaption `json:"caption"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PageBlockMap) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PageBlockMap
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockMap) GetClass() string {
return ClassPageBlock
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockMap) GetType() string {
return TypePageBlockMap
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PageBlockMap) PageBlockType() string {
return TypePageBlockMap
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Describes an instant view page for a web page
type WebPageInstantView struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Content of the web page
PageBlocks []PageBlock `json:"page_blocks"`
// Version of the instant view, currently can be 1 or 2
Version int32 `json:"version"`
// Instant view URL; may be different from WebPage.url and must be used for the correct anchors handling
Url string `json:"url"`
// True, if the instant view must be shown from right to left
IsRtl bool `json:"is_rtl"`
// True, if the instant view contains the full page. A network request might be needed to get the full web page instant view
IsFull bool `json:"is_full"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *WebPageInstantView) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub WebPageInstantView
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*WebPageInstantView) GetClass() string {
return ClassWebPageInstantView
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*WebPageInstantView) GetType() string {
return TypeWebPageInstantView
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Describes a web page preview
type WebPage struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Original URL of the link
Url string `json:"url"`
// URL to display
DisplayUrl string `json:"display_url"`
// Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else
Type string `json:"type"`
// Short name of the site (e.g., Google Docs, App Store)
SiteName string `json:"site_name"`
// Title of the content
Title string `json:"title"`
// Description of the content
Description string `json:"description"`
// Image representing the content; may be null
Photo *Photo `json:"photo"`
// URL to show in the embedded preview
EmbedUrl string `json:"embed_url"`
// MIME type of the embedded preview, (e.g., text/html or video/mp4)
EmbedType string `json:"embed_type"`
// Width of the embedded preview
EmbedWidth int32 `json:"embed_width"`
// Height of the embedded preview
EmbedHeight int32 `json:"embed_height"`
// Duration of the content, in seconds
Duration int32 `json:"duration"`
// Author of the content
Author string `json:"author"`
// Preview of the content as an animation, if available; may be null
Animation *Animation `json:"animation"`
// Preview of the content as an audio file, if available; may be null
Audio *Audio `json:"audio"`
// Preview of the content as a document, if available (currently only available for small PDF files and ZIP archives); may be null
Document *Document `json:"document"`
// Preview of the content as a sticker for small WEBP files, if available; may be null
Sticker *Sticker `json:"sticker"`
// Preview of the content as a video, if available; may be null
Video *Video `json:"video"`
// Preview of the content as a video note, if available; may be null
VideoNote *VideoNote `json:"video_note"`
// Preview of the content as a voice note, if available; may be null
VoiceNote *VoiceNote `json:"voice_note"`
// Version of instant view, available for the web page (currently can be 1 or 2), 0 if none
InstantViewVersion int32 `json:"instant_view_version"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *WebPage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub WebPage
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*WebPage) GetClass() string {
return ClassWebPage
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*WebPage) GetType() string {
return TypeWebPage
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Describes an address
type Address struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// A two-letter ISO 3166-1 alpha-2 country code
CountryCode string `json:"country_code"`
// State, if applicable
State string `json:"state"`
// City
City string `json:"city"`
// First line of the address
StreetLine1 string `json:"street_line1"`
// Second line of the address
StreetLine2 string `json:"street_line2"`
// Address postal code
PostalCode string `json:"postal_code"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *Address) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub Address
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Address) GetClass() string {
return ClassAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Address) GetType() string {
return TypeAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Portion of the price of a product (e.g., "delivery cost", "tax amount")
type LabeledPricePart struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Label for this portion of the product price
Label string `json:"label"`
// Currency amount in minimal quantity of the currency
Amount int64 `json:"amount"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *LabeledPricePart) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub LabeledPricePart
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LabeledPricePart) GetClass() string {
return ClassLabeledPricePart
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LabeledPricePart) GetType() string {
return TypeLabeledPricePart
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Product invoice
type Invoice struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// ISO 4217 currency code
Currency string `json:"currency"`
// A list of objects used to calculate the total price of the product
PriceParts []*LabeledPricePart `json:"price_parts"`
// True, if the payment is a test payment
IsTest bool `json:"is_test"`
// True, if the user's name is needed for payment
NeedName bool `json:"need_name"`
// True, if the user's phone number is needed for payment
NeedPhoneNumber bool `json:"need_phone_number"`
// True, if the user's email address is needed for payment
NeedEmailAddress bool `json:"need_email_address"`
// True, if the user's shipping address is needed for payment
NeedShippingAddress bool `json:"need_shipping_address"`
// True, if the user's phone number will be sent to the provider
SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider"`
// True, if the user's email address will be sent to the provider
SendEmailAddressToProvider bool `json:"send_email_address_to_provider"`
// True, if the total price depends on the shipping method
IsFlexible bool `json:"is_flexible"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *Invoice) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub Invoice
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Invoice) GetClass() string {
return ClassInvoice
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Invoice) GetType() string {
return TypeInvoice
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Order information
type OrderInfo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Name of the user
Name string `json:"name"`
// Phone number of the user
PhoneNumber string `json:"phone_number"`
// Email address of the user
EmailAddress string `json:"email_address"`
// Shipping address for this order; may be null
ShippingAddress *Address `json:"shipping_address"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *OrderInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub OrderInfo
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*OrderInfo) GetClass() string {
return ClassOrderInfo
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*OrderInfo) GetType() string {
return TypeOrderInfo
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// One shipping option
type ShippingOption struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Shipping option identifier
Id string `json:"id"`
// Option title
Title string `json:"title"`
// A list of objects used to calculate the total shipping costs
PriceParts []*LabeledPricePart `json:"price_parts"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ShippingOption) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub ShippingOption
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ShippingOption) GetClass() string {
return ClassShippingOption
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ShippingOption) GetType() string {
return TypeShippingOption
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about saved card credentials
type SavedCredentials struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the saved credentials
Id string `json:"id"`
// Title of the saved credentials
Title string `json:"title"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SavedCredentials) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub SavedCredentials
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SavedCredentials) GetClass() string {
return ClassSavedCredentials
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SavedCredentials) GetType() string {
return TypeSavedCredentials
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Applies if a user chooses some previously saved payment credentials. To use their previously saved credentials, the user must have a valid temporary password
type InputCredentialsSaved struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Identifier of the saved credentials
SavedCredentialsId string `json:"saved_credentials_id"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputCredentialsSaved) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputCredentialsSaved
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsSaved) GetClass() string {
return ClassInputCredentials
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsSaved) GetType() string {
return TypeInputCredentialsSaved
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsSaved) InputCredentialsType() string {
return TypeInputCredentialsSaved
}
// Applies if a user enters new credentials on a payment provider website
type InputCredentialsNew struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Contains JSON-encoded data with a credential identifier from the payment provider
Data string `json:"data"`
// True, if the credential identifier can be saved on the server side
AllowSave bool `json:"allow_save"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputCredentialsNew) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputCredentialsNew
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsNew) GetClass() string {
return ClassInputCredentials
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsNew) GetType() string {
return TypeInputCredentialsNew
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsNew) InputCredentialsType() string {
return TypeInputCredentialsNew
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Applies if a user enters new credentials using Android Pay
type InputCredentialsAndroidPay struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// JSON-encoded data with the credential identifier
Data string `json:"data"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputCredentialsAndroidPay) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputCredentialsAndroidPay
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsAndroidPay) GetClass() string {
return ClassInputCredentials
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsAndroidPay) GetType() string {
return TypeInputCredentialsAndroidPay
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsAndroidPay) InputCredentialsType() string {
return TypeInputCredentialsAndroidPay
}
// Applies if a user enters new credentials using Apple Pay
type InputCredentialsApplePay struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// JSON-encoded data with the credential identifier
Data string `json:"data"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputCredentialsApplePay) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputCredentialsApplePay
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsApplePay) GetClass() string {
return ClassInputCredentials
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsApplePay) GetType() string {
return TypeInputCredentialsApplePay
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputCredentialsApplePay) InputCredentialsType() string {
return TypeInputCredentialsApplePay
}
// Stripe payment provider
type PaymentsProviderStripe struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Stripe API publishable key
PublishableKey string `json:"publishable_key"`
// True, if the user country must be provided
NeedCountry bool `json:"need_country"`
// True, if the user ZIP/postal code must be provided
NeedPostalCode bool `json:"need_postal_code"`
// True, if the cardholder name must be provided
NeedCardholderName bool `json:"need_cardholder_name"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PaymentsProviderStripe) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PaymentsProviderStripe
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PaymentsProviderStripe) GetClass() string {
return ClassPaymentsProviderStripe
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PaymentsProviderStripe) GetType() string {
return TypePaymentsProviderStripe
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about an invoice payment form
type PaymentForm struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Full information of the invoice
Invoice *Invoice `json:"invoice"`
// Payment form URL
Url string `json:"url"`
// Contains information about the payment provider, if available, to support it natively without the need for opening the URL; may be null
PaymentsProvider *PaymentsProviderStripe `json:"payments_provider"`
// Saved server-side order information; may be null
SavedOrderInfo *OrderInfo `json:"saved_order_info"`
// Contains information about saved card credentials; may be null
SavedCredentials *SavedCredentials `json:"saved_credentials"`
// True, if the user can choose to save credentials
CanSaveCredentials bool `json:"can_save_credentials"`
// True, if the user will be able to save credentials protected by a password they set up
NeedPassword bool `json:"need_password"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PaymentForm) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PaymentForm
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PaymentForm) GetClass() string {
return ClassPaymentForm
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PaymentForm) GetType() string {
return TypePaymentForm
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options
type ValidatedOrderInfo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Temporary identifier of the order information
OrderInfoId string `json:"order_info_id"`
// Available shipping options
ShippingOptions []*ShippingOption `json:"shipping_options"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ValidatedOrderInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub ValidatedOrderInfo
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ValidatedOrderInfo) GetClass() string {
return ClassValidatedOrderInfo
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ValidatedOrderInfo) GetType() string {
return TypeValidatedOrderInfo
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains the result of a payment request
type PaymentResult struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// True, if the payment request was successful; otherwise the verification_url will be not empty
Success bool `json:"success"`
// URL for additional payment credentials verification
VerificationUrl string `json:"verification_url"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PaymentResult) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PaymentResult
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PaymentResult) GetClass() string {
return ClassPaymentResult
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PaymentResult) GetType() string {
return TypePaymentResult
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about a successful payment
type PaymentReceipt struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Point in time (Unix timestamp) when the payment was made
Date int32 `json:"date"`
// User identifier of the payment provider bot
PaymentsProviderUserId int32 `json:"payments_provider_user_id"`
// Contains information about the invoice
Invoice *Invoice `json:"invoice"`
// Contains order information; may be null
OrderInfo *OrderInfo `json:"order_info"`
// Chosen shipping option; may be null
ShippingOption *ShippingOption `json:"shipping_option"`
// Title of the saved credentials
CredentialsTitle string `json:"credentials_title"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PaymentReceipt) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PaymentReceipt
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PaymentReceipt) GetClass() string {
return ClassPaymentReceipt
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PaymentReceipt) GetType() string {
return TypePaymentReceipt
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// File with the date it was uploaded
type DatedFile struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The file
File *File `json:"file"`
// Point in time (Unix timestamp) when the file was uploaded
Date int32 `json:"date"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DatedFile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub DatedFile
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DatedFile) GetClass() string {
return ClassDatedFile
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DatedFile) GetType() string {
return TypeDatedFile
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's personal details
type PassportElementTypePersonalDetails struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypePersonalDetails) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypePersonalDetails
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePersonalDetails) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePersonalDetails) GetType() string {
return TypePassportElementTypePersonalDetails
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePersonalDetails) PassportElementTypeType() string {
return TypePassportElementTypePersonalDetails
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's passport
type PassportElementTypePassport struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypePassport) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypePassport
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePassport) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePassport) GetType() string {
return TypePassportElementTypePassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePassport) PassportElementTypeType() string {
return TypePassportElementTypePassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's driver license
type PassportElementTypeDriverLicense struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypeDriverLicense) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypeDriverLicense
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeDriverLicense) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeDriverLicense) GetType() string {
return TypePassportElementTypeDriverLicense
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeDriverLicense) PassportElementTypeType() string {
return TypePassportElementTypeDriverLicense
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's identity card
type PassportElementTypeIdentityCard struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypeIdentityCard) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypeIdentityCard
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeIdentityCard) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeIdentityCard) GetType() string {
return TypePassportElementTypeIdentityCard
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeIdentityCard) PassportElementTypeType() string {
return TypePassportElementTypeIdentityCard
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's internal passport
type PassportElementTypeInternalPassport struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypeInternalPassport) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypeInternalPassport
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeInternalPassport) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeInternalPassport) GetType() string {
return TypePassportElementTypeInternalPassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeInternalPassport) PassportElementTypeType() string {
return TypePassportElementTypeInternalPassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's address
type PassportElementTypeAddress struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypeAddress) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypeAddress
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeAddress) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeAddress) GetType() string {
return TypePassportElementTypeAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeAddress) PassportElementTypeType() string {
return TypePassportElementTypeAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's utility bill
type PassportElementTypeUtilityBill struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypeUtilityBill) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypeUtilityBill
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeUtilityBill) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeUtilityBill) GetType() string {
return TypePassportElementTypeUtilityBill
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeUtilityBill) PassportElementTypeType() string {
return TypePassportElementTypeUtilityBill
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's bank statement
type PassportElementTypeBankStatement struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypeBankStatement) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypeBankStatement
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeBankStatement) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeBankStatement) GetType() string {
return TypePassportElementTypeBankStatement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeBankStatement) PassportElementTypeType() string {
return TypePassportElementTypeBankStatement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's rental agreement
type PassportElementTypeRentalAgreement struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypeRentalAgreement) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypeRentalAgreement
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeRentalAgreement) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeRentalAgreement) GetType() string {
return TypePassportElementTypeRentalAgreement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeRentalAgreement) PassportElementTypeType() string {
return TypePassportElementTypeRentalAgreement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the registration page of the user's passport
type PassportElementTypePassportRegistration struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypePassportRegistration) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypePassportRegistration
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePassportRegistration) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePassportRegistration) GetType() string {
return TypePassportElementTypePassportRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePassportRegistration) PassportElementTypeType() string {
return TypePassportElementTypePassportRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's temporary registration
type PassportElementTypeTemporaryRegistration struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypeTemporaryRegistration) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypeTemporaryRegistration
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeTemporaryRegistration) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeTemporaryRegistration) GetType() string {
return TypePassportElementTypeTemporaryRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeTemporaryRegistration) PassportElementTypeType() string {
return TypePassportElementTypeTemporaryRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's phone number
type PassportElementTypePhoneNumber struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypePhoneNumber) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypePhoneNumber
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePhoneNumber) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePhoneNumber) GetType() string {
return TypePassportElementTypePhoneNumber
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypePhoneNumber) PassportElementTypeType() string {
return TypePassportElementTypePhoneNumber
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's email address
type PassportElementTypeEmailAddress struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTypeEmailAddress) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTypeEmailAddress
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeEmailAddress) GetClass() string {
return ClassPassportElementType
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeEmailAddress) GetType() string {
return TypePassportElementTypeEmailAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTypeEmailAddress) PassportElementTypeType() string {
return TypePassportElementTypeEmailAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a date according to the Gregorian calendar
type Date struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Day of the month, 1-31
Day int32 `json:"day"`
// Month, 1-12
Month int32 `json:"month"`
// Year, 1-9999
Year int32 `json:"year"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *Date) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub Date
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Date) GetClass() string {
return ClassDate
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Date) GetType() string {
return TypeDate
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains the user's personal details
type PersonalDetails struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// First name of the user written in English; 1-255 characters
FirstName string `json:"first_name"`
// Middle name of the user written in English; 0-255 characters
MiddleName string `json:"middle_name"`
// Last name of the user written in English; 1-255 characters
LastName string `json:"last_name"`
// Native first name of the user; 1-255 characters
NativeFirstName string `json:"native_first_name"`
// Native middle name of the user; 0-255 characters
NativeMiddleName string `json:"native_middle_name"`
// Native last name of the user; 1-255 characters
NativeLastName string `json:"native_last_name"`
// Birthdate of the user
Birthdate *Date `json:"birthdate"`
// Gender of the user, "male" or "female"
Gender string `json:"gender"`
// A two-letter ISO 3166-1 alpha-2 country code of the user's country
CountryCode string `json:"country_code"`
// A two-letter ISO 3166-1 alpha-2 country code of the user's residence country
ResidenceCountryCode string `json:"residence_country_code"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PersonalDetails) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PersonalDetails
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PersonalDetails) GetClass() string {
return ClassPersonalDetails
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PersonalDetails) GetType() string {
return TypePersonalDetails
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// An identity document
type IdentityDocument struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Document number; 1-24 characters
Number string `json:"number"`
// Document expiry date; may be null
ExpiryDate *Date `json:"expiry_date"`
// Front side of the document
FrontSide *DatedFile `json:"front_side"`
// Reverse side of the document; only for driver license and identity card
ReverseSide *DatedFile `json:"reverse_side"`
// Selfie with the document; may be null
Selfie *DatedFile `json:"selfie"`
// List of files containing a certified English translation of the document
Translation []*DatedFile `json:"translation"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *IdentityDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub IdentityDocument
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*IdentityDocument) GetClass() string {
return ClassIdentityDocument
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*IdentityDocument) GetType() string {
return TypeIdentityDocument
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// An identity document to be saved to Telegram Passport
type InputIdentityDocument struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Document number; 1-24 characters
Number string `json:"number"`
// Document expiry date, if available
ExpiryDate *Date `json:"expiry_date"`
// Front side of the document
FrontSide InputFile `json:"front_side"`
// Reverse side of the document; only for driver license and identity card
ReverseSide InputFile `json:"reverse_side"`
// Selfie with the document, if available
Selfie InputFile `json:"selfie"`
// List of files containing a certified English translation of the document
Translation []InputFile `json:"translation"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputIdentityDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputIdentityDocument
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputIdentityDocument) GetClass() string {
return ClassInputIdentityDocument
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputIdentityDocument) GetType() string {
return TypeInputIdentityDocument
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputIdentityDocument *InputIdentityDocument) UnmarshalJSON(data []byte) error {
var tmp struct {
Number string `json:"number"`
ExpiryDate *Date `json:"expiry_date"`
FrontSide json.RawMessage `json:"front_side"`
ReverseSide json.RawMessage `json:"reverse_side"`
Selfie json.RawMessage `json:"selfie"`
Translation []InputFile `json:"translation"`
}
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
inputIdentityDocument.Number = tmp.Number
inputIdentityDocument.ExpiryDate = tmp.ExpiryDate
inputIdentityDocument.Translation = tmp.Translation
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
fieldFrontSide, _ := UnmarshalInputFile(tmp.FrontSide)
inputIdentityDocument.FrontSide = fieldFrontSide
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
fieldReverseSide, _ := UnmarshalInputFile(tmp.ReverseSide)
inputIdentityDocument.ReverseSide = fieldReverseSide
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
fieldSelfie, _ := UnmarshalInputFile(tmp.Selfie)
inputIdentityDocument.Selfie = fieldSelfie
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A personal document, containing some information about a user
type PersonalDocument struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// List of files containing the pages of the document
Files []*DatedFile `json:"files"`
// List of files containing a certified English translation of the document
Translation []*DatedFile `json:"translation"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PersonalDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PersonalDocument
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PersonalDocument) GetClass() string {
return ClassPersonalDocument
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PersonalDocument) GetType() string {
return TypePersonalDocument
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A personal document to be saved to Telegram Passport
type InputPersonalDocument struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// List of files containing the pages of the document
Files []InputFile `json:"files"`
// List of files containing a certified English translation of the document
Translation []InputFile `json:"translation"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPersonalDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPersonalDocument
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPersonalDocument) GetClass() string {
return ClassInputPersonalDocument
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPersonalDocument) GetType() string {
return TypeInputPersonalDocument
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's personal details
type PassportElementPersonalDetails struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Personal details of the user
PersonalDetails *PersonalDetails `json:"personal_details"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementPersonalDetails) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementPersonalDetails
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPersonalDetails) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPersonalDetails) GetType() string {
return TypePassportElementPersonalDetails
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPersonalDetails) PassportElementType() string {
return TypePassportElementPersonalDetails
}
// A Telegram Passport element containing the user's passport
type PassportElementPassport struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Passport
Passport *IdentityDocument `json:"passport"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementPassport) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementPassport
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPassport) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPassport) GetType() string {
return TypePassportElementPassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPassport) PassportElementType() string {
return TypePassportElementPassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's driver license
type PassportElementDriverLicense struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Driver license
DriverLicense *IdentityDocument `json:"driver_license"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementDriverLicense) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementDriverLicense
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementDriverLicense) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementDriverLicense) GetType() string {
return TypePassportElementDriverLicense
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementDriverLicense) PassportElementType() string {
return TypePassportElementDriverLicense
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's identity card
type PassportElementIdentityCard struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Identity card
IdentityCard *IdentityDocument `json:"identity_card"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementIdentityCard) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementIdentityCard
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementIdentityCard) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementIdentityCard) GetType() string {
return TypePassportElementIdentityCard
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementIdentityCard) PassportElementType() string {
return TypePassportElementIdentityCard
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's internal passport
type PassportElementInternalPassport struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Internal passport
InternalPassport *IdentityDocument `json:"internal_passport"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementInternalPassport) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementInternalPassport
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementInternalPassport) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementInternalPassport) GetType() string {
return TypePassportElementInternalPassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementInternalPassport) PassportElementType() string {
return TypePassportElementInternalPassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's address
type PassportElementAddress struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Address
Address *Address `json:"address"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementAddress) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementAddress
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementAddress) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementAddress) GetType() string {
return TypePassportElementAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementAddress) PassportElementType() string {
return TypePassportElementAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's utility bill
type PassportElementUtilityBill struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Utility bill
UtilityBill *PersonalDocument `json:"utility_bill"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementUtilityBill) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementUtilityBill
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementUtilityBill) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementUtilityBill) GetType() string {
return TypePassportElementUtilityBill
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementUtilityBill) PassportElementType() string {
return TypePassportElementUtilityBill
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's bank statement
type PassportElementBankStatement struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Bank statement
BankStatement *PersonalDocument `json:"bank_statement"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementBankStatement) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementBankStatement
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementBankStatement) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementBankStatement) GetType() string {
return TypePassportElementBankStatement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementBankStatement) PassportElementType() string {
return TypePassportElementBankStatement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's rental agreement
type PassportElementRentalAgreement struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Rental agreement
RentalAgreement *PersonalDocument `json:"rental_agreement"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementRentalAgreement) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementRentalAgreement
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementRentalAgreement) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementRentalAgreement) GetType() string {
return TypePassportElementRentalAgreement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementRentalAgreement) PassportElementType() string {
return TypePassportElementRentalAgreement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's passport registration pages
type PassportElementPassportRegistration struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Passport registration pages
PassportRegistration *PersonalDocument `json:"passport_registration"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementPassportRegistration) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementPassportRegistration
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPassportRegistration) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPassportRegistration) GetType() string {
return TypePassportElementPassportRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPassportRegistration) PassportElementType() string {
return TypePassportElementPassportRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's temporary registration
type PassportElementTemporaryRegistration struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Temporary registration
TemporaryRegistration *PersonalDocument `json:"temporary_registration"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementTemporaryRegistration) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementTemporaryRegistration
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTemporaryRegistration) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTemporaryRegistration) GetType() string {
return TypePassportElementTemporaryRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementTemporaryRegistration) PassportElementType() string {
return TypePassportElementTemporaryRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's phone number
type PassportElementPhoneNumber struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Phone number
PhoneNumber string `json:"phone_number"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementPhoneNumber) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementPhoneNumber
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPhoneNumber) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPhoneNumber) GetType() string {
return TypePassportElementPhoneNumber
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementPhoneNumber) PassportElementType() string {
return TypePassportElementPhoneNumber
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element containing the user's email address
type PassportElementEmailAddress struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Email address
EmailAddress string `json:"email_address"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementEmailAddress) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementEmailAddress
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementEmailAddress) GetClass() string {
return ClassPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementEmailAddress) GetType() string {
return TypePassportElementEmailAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementEmailAddress) PassportElementType() string {
return TypePassportElementEmailAddress
}
// A Telegram Passport element to be saved containing the user's personal details
type InputPassportElementPersonalDetails struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Personal details of the user
PersonalDetails *PersonalDetails `json:"personal_details"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementPersonalDetails) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementPersonalDetails
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPersonalDetails) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPersonalDetails) GetType() string {
return TypeInputPassportElementPersonalDetails
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPersonalDetails) InputPassportElementType() string {
return TypeInputPassportElementPersonalDetails
}
// A Telegram Passport element to be saved containing the user's passport
type InputPassportElementPassport struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The passport to be saved
Passport *InputIdentityDocument `json:"passport"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementPassport) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementPassport
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPassport) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPassport) GetType() string {
return TypeInputPassportElementPassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPassport) InputPassportElementType() string {
return TypeInputPassportElementPassport
}
// A Telegram Passport element to be saved containing the user's driver license
type InputPassportElementDriverLicense struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The driver license to be saved
DriverLicense *InputIdentityDocument `json:"driver_license"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementDriverLicense) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementDriverLicense
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementDriverLicense) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementDriverLicense) GetType() string {
return TypeInputPassportElementDriverLicense
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementDriverLicense) InputPassportElementType() string {
return TypeInputPassportElementDriverLicense
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's identity card
type InputPassportElementIdentityCard struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The identity card to be saved
IdentityCard *InputIdentityDocument `json:"identity_card"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementIdentityCard) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementIdentityCard
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementIdentityCard) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementIdentityCard) GetType() string {
return TypeInputPassportElementIdentityCard
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementIdentityCard) InputPassportElementType() string {
return TypeInputPassportElementIdentityCard
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's internal passport
type InputPassportElementInternalPassport struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The internal passport to be saved
InternalPassport *InputIdentityDocument `json:"internal_passport"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementInternalPassport) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementInternalPassport
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementInternalPassport) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementInternalPassport) GetType() string {
return TypeInputPassportElementInternalPassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementInternalPassport) InputPassportElementType() string {
return TypeInputPassportElementInternalPassport
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's address
type InputPassportElementAddress struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The address to be saved
Address *Address `json:"address"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementAddress) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementAddress
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementAddress) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementAddress) GetType() string {
return TypeInputPassportElementAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementAddress) InputPassportElementType() string {
return TypeInputPassportElementAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's utility bill
type InputPassportElementUtilityBill struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The utility bill to be saved
UtilityBill *InputPersonalDocument `json:"utility_bill"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementUtilityBill) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementUtilityBill
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementUtilityBill) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementUtilityBill) GetType() string {
return TypeInputPassportElementUtilityBill
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementUtilityBill) InputPassportElementType() string {
return TypeInputPassportElementUtilityBill
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's bank statement
type InputPassportElementBankStatement struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The bank statement to be saved
BankStatement *InputPersonalDocument `json:"bank_statement"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementBankStatement) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementBankStatement
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementBankStatement) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementBankStatement) GetType() string {
return TypeInputPassportElementBankStatement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementBankStatement) InputPassportElementType() string {
return TypeInputPassportElementBankStatement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's rental agreement
type InputPassportElementRentalAgreement struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The rental agreement to be saved
RentalAgreement *InputPersonalDocument `json:"rental_agreement"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementRentalAgreement) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementRentalAgreement
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementRentalAgreement) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementRentalAgreement) GetType() string {
return TypeInputPassportElementRentalAgreement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementRentalAgreement) InputPassportElementType() string {
return TypeInputPassportElementRentalAgreement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's passport registration
type InputPassportElementPassportRegistration struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The passport registration page to be saved
PassportRegistration *InputPersonalDocument `json:"passport_registration"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementPassportRegistration) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementPassportRegistration
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPassportRegistration) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPassportRegistration) GetType() string {
return TypeInputPassportElementPassportRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPassportRegistration) InputPassportElementType() string {
return TypeInputPassportElementPassportRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's temporary registration
type InputPassportElementTemporaryRegistration struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The temporary registration document to be saved
TemporaryRegistration *InputPersonalDocument `json:"temporary_registration"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementTemporaryRegistration) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementTemporaryRegistration
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementTemporaryRegistration) GetClass() string {
return ClassInputPassportElement
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementTemporaryRegistration) GetType() string {
return TypeInputPassportElementTemporaryRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementTemporaryRegistration) InputPassportElementType() string {
return TypeInputPassportElementTemporaryRegistration
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's phone number
type InputPassportElementPhoneNumber struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The phone number to be saved
PhoneNumber string `json:"phone_number"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementPhoneNumber) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementPhoneNumber
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPhoneNumber) GetClass() string {
return ClassInputPassportElement
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPhoneNumber) GetType() string {
return TypeInputPassportElementPhoneNumber
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementPhoneNumber) InputPassportElementType() string {
return TypeInputPassportElementPhoneNumber
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A Telegram Passport element to be saved containing the user's email address
type InputPassportElementEmailAddress struct {
meta
// The email address to be saved
EmailAddress string `json:"email_address"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementEmailAddress) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementEmailAddress
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementEmailAddress) GetClass() string {
return ClassInputPassportElement
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementEmailAddress) GetType() string {
return TypeInputPassportElementEmailAddress
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementEmailAddress) InputPassportElementType() string {
return TypeInputPassportElementEmailAddress
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about saved Telegram Passport elements
type PassportElements struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Telegram Passport elements
Elements []PassportElement `json:"elements"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElements) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElements
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElements) GetClass() string {
return ClassPassportElements
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElements) GetType() string {
return TypePassportElements
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The element contains an error in an unspecified place. The error will be considered resolved when new data is added
type PassportElementErrorSourceUnspecified struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementErrorSourceUnspecified) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementErrorSourceUnspecified
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceUnspecified) GetClass() string {
return ClassPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceUnspecified) GetType() string {
return TypePassportElementErrorSourceUnspecified
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceUnspecified) PassportElementErrorSourceType() string {
return TypePassportElementErrorSourceUnspecified
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// One of the data fields contains an error. The error will be considered resolved when the value of the field changes
type PassportElementErrorSourceDataField struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Field name
FieldName string `json:"field_name"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementErrorSourceDataField) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementErrorSourceDataField
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceDataField) GetClass() string {
return ClassPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceDataField) GetType() string {
return TypePassportElementErrorSourceDataField
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceDataField) PassportElementErrorSourceType() string {
return TypePassportElementErrorSourceDataField
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The front side of the document contains an error. The error will be considered resolved when the file with the front side changes
type PassportElementErrorSourceFrontSide struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementErrorSourceFrontSide) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementErrorSourceFrontSide
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceFrontSide) GetClass() string {
return ClassPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceFrontSide) GetType() string {
return TypePassportElementErrorSourceFrontSide
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceFrontSide) PassportElementErrorSourceType() string {
return TypePassportElementErrorSourceFrontSide
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The reverse side of the document contains an error. The error will be considered resolved when the file with the reverse side changes
type PassportElementErrorSourceReverseSide struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementErrorSourceReverseSide) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementErrorSourceReverseSide
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceReverseSide) GetClass() string {
return ClassPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceReverseSide) GetType() string {
return TypePassportElementErrorSourceReverseSide
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceReverseSide) PassportElementErrorSourceType() string {
return TypePassportElementErrorSourceReverseSide
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes
type PassportElementErrorSourceSelfie struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementErrorSourceSelfie) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementErrorSourceSelfie
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceSelfie) GetClass() string {
return ClassPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceSelfie) GetType() string {
return TypePassportElementErrorSourceSelfie
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceSelfie) PassportElementErrorSourceType() string {
return TypePassportElementErrorSourceSelfie
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// One of files with the translation of the document contains an error. The error will be considered resolved when the file changes
type PassportElementErrorSourceTranslationFile struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Index of a file with the error
FileIndex int32 `json:"file_index"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementErrorSourceTranslationFile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementErrorSourceTranslationFile
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceTranslationFile) GetClass() string {
return ClassPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceTranslationFile) GetType() string {
return TypePassportElementErrorSourceTranslationFile
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceTranslationFile) PassportElementErrorSourceType() string {
return TypePassportElementErrorSourceTranslationFile
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The translation of the document contains an error. The error will be considered resolved when the list of translation files changes
type PassportElementErrorSourceTranslationFiles struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementErrorSourceTranslationFiles) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementErrorSourceTranslationFiles
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceTranslationFiles) GetClass() string {
return ClassPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceTranslationFiles) GetType() string {
return TypePassportElementErrorSourceTranslationFiles
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceTranslationFiles) PassportElementErrorSourceType() string {
return TypePassportElementErrorSourceTranslationFiles
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The file contains an error. The error will be considered resolved when the file changes
type PassportElementErrorSourceFile struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Index of a file with the error
FileIndex int32 `json:"file_index"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementErrorSourceFile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementErrorSourceFile
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceFile) GetClass() string {
return ClassPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceFile) GetType() string {
return TypePassportElementErrorSourceFile
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceFile) PassportElementErrorSourceType() string {
return TypePassportElementErrorSourceFile
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The list of attached files contains an error. The error will be considered resolved when the list of files changes
type PassportElementErrorSourceFiles struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementErrorSourceFiles) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementErrorSourceFiles
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceFiles) GetClass() string {
return ClassPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceFiles) GetType() string {
return TypePassportElementErrorSourceFiles
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementErrorSourceFiles) PassportElementErrorSourceType() string {
return TypePassportElementErrorSourceFiles
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains the description of an error in a Telegram Passport element
type PassportElementError struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Type of the Telegram Passport element which has the error
Type PassportElementType `json:"type"`
// Error message
Message string `json:"message"`
// Error source
Source PassportElementErrorSource `json:"source"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementError) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementError
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementError) GetClass() string {
return ClassPassportElementError
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementError) GetType() string {
return TypePassportElementError
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (passportElementError *PassportElementError) UnmarshalJSON(data []byte) error {
var tmp struct {
Type json.RawMessage `json:"type"`
Message string `json:"message"`
Source json.RawMessage `json:"source"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
passportElementError.Message = tmp.Message
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldType, _ := UnmarshalPassportElementType(tmp.Type)
passportElementError.Type = fieldType
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldSource, _ := UnmarshalPassportElementErrorSource(tmp.Source)
passportElementError.Source = fieldSource
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about a Telegram Passport element that was requested by a service
type PassportSuitableElement struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Type of the element
Type PassportElementType `json:"type"`
// True, if a selfie is required with the identity document
IsSelfieRequired bool `json:"is_selfie_required"`
// True, if a certified English translation is required with the document
IsTranslationRequired bool `json:"is_translation_required"`
// True, if personal details must include the user's name in the language of their country of residence
IsNativeNameRequired bool `json:"is_native_name_required"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportSuitableElement) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportSuitableElement
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportSuitableElement) GetClass() string {
return ClassPassportSuitableElement
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportSuitableElement) GetType() string {
return TypePassportSuitableElement
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (passportSuitableElement *PassportSuitableElement) UnmarshalJSON(data []byte) error {
var tmp struct {
Type json.RawMessage `json:"type"`
IsSelfieRequired bool `json:"is_selfie_required"`
IsTranslationRequired bool `json:"is_translation_required"`
IsNativeNameRequired bool `json:"is_native_name_required"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
passportSuitableElement.IsSelfieRequired = tmp.IsSelfieRequired
passportSuitableElement.IsTranslationRequired = tmp.IsTranslationRequired
passportSuitableElement.IsNativeNameRequired = tmp.IsNativeNameRequired
fieldType, _ := UnmarshalPassportElementType(tmp.Type)
passportSuitableElement.Type = fieldType
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains a description of the required Telegram Passport element that was requested by a service
type PassportRequiredElement struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// List of Telegram Passport elements any of which is enough to provide
SuitableElements []*PassportSuitableElement `json:"suitable_elements"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportRequiredElement) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportRequiredElement
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportRequiredElement) GetClass() string {
return ClassPassportRequiredElement
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportRequiredElement) GetType() string {
return TypePassportRequiredElement
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about a Telegram Passport authorization form that was requested
type PassportAuthorizationForm struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the authorization form
Id int32 `json:"id"`
// Information about the Telegram Passport elements that need to be provided to complete the form
RequiredElements []*PassportRequiredElement `json:"required_elements"`
// URL for the privacy policy of the service; may be empty
PrivacyPolicyUrl string `json:"privacy_policy_url"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportAuthorizationForm) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportAuthorizationForm
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportAuthorizationForm) GetClass() string {
return ClassPassportAuthorizationForm
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportAuthorizationForm) GetType() string {
return TypePassportAuthorizationForm
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about a Telegram Passport elements and corresponding errors
type PassportElementsWithErrors struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Telegram Passport elements
Elements []PassportElement `json:"elements"`
// Errors in the elements that are already available
Errors []*PassportElementError `json:"errors"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PassportElementsWithErrors) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PassportElementsWithErrors
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementsWithErrors) GetClass() string {
return ClassPassportElementsWithErrors
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PassportElementsWithErrors) GetType() string {
return TypePassportElementsWithErrors
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains encrypted Telegram Passport data credentials
type EncryptedCredentials struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The encrypted credentials
Data []byte `json:"data"`
// The decrypted data hash
Hash []byte `json:"hash"`
// Secret for data decryption, encrypted with the service's public key
Secret []byte `json:"secret"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *EncryptedCredentials) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub EncryptedCredentials
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*EncryptedCredentials) GetClass() string {
return ClassEncryptedCredentials
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*EncryptedCredentials) GetType() string {
return TypeEncryptedCredentials
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about an encrypted Telegram Passport element; for bots only
type EncryptedPassportElement struct {
meta
// Type of Telegram Passport element
Type PassportElementType `json:"type"`
// Encrypted JSON-encoded data about the user
Data []byte `json:"data"`
// The front side of an identity document
FrontSide *DatedFile `json:"front_side"`
// The reverse side of an identity document; may be null
ReverseSide *DatedFile `json:"reverse_side"`
// Selfie with the document; may be null
Selfie *DatedFile `json:"selfie"`
// List of files containing a certified English translation of the document
Translation []*DatedFile `json:"translation"`
// List of attached files
Files []*DatedFile `json:"files"`
// Unencrypted data, phone number or email address
Value string `json:"value"`
// Hash of the entire element
Hash string `json:"hash"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *EncryptedPassportElement) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub EncryptedPassportElement
return json.Marshal((*stub)(entity))
}
func (*EncryptedPassportElement) GetClass() string {
return ClassEncryptedPassportElement
}
func (*EncryptedPassportElement) GetType() string {
return TypeEncryptedPassportElement
}
func (encryptedPassportElement *EncryptedPassportElement) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Type json.RawMessage `json:"type"`
Data []byte `json:"data"`
FrontSide *DatedFile `json:"front_side"`
ReverseSide *DatedFile `json:"reverse_side"`
Selfie *DatedFile `json:"selfie"`
Translation []*DatedFile `json:"translation"`
Files []*DatedFile `json:"files"`
Value string `json:"value"`
Hash string `json:"hash"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
encryptedPassportElement.Data = tmp.Data
encryptedPassportElement.FrontSide = tmp.FrontSide
encryptedPassportElement.ReverseSide = tmp.ReverseSide
encryptedPassportElement.Selfie = tmp.Selfie
encryptedPassportElement.Translation = tmp.Translation
encryptedPassportElement.Files = tmp.Files
encryptedPassportElement.Value = tmp.Value
encryptedPassportElement.Hash = tmp.Hash
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldType, _ := UnmarshalPassportElementType(tmp.Type)
encryptedPassportElement.Type = fieldType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The element contains an error in an unspecified place. The error will be considered resolved when new data is added
type InputPassportElementErrorSourceUnspecified struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Current hash of the entire element
ElementHash []byte `json:"element_hash"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementErrorSourceUnspecified) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementErrorSourceUnspecified
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceUnspecified) GetClass() string {
return ClassInputPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceUnspecified) GetType() string {
return TypeInputPassportElementErrorSourceUnspecified
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceUnspecified) InputPassportElementErrorSourceType() string {
return TypeInputPassportElementErrorSourceUnspecified
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A data field contains an error. The error is considered resolved when the field's value changes
type InputPassportElementErrorSourceDataField struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Field name
FieldName string `json:"field_name"`
// Current data hash
DataHash []byte `json:"data_hash"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementErrorSourceDataField) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementErrorSourceDataField
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceDataField) GetClass() string {
return ClassInputPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceDataField) GetType() string {
return TypeInputPassportElementErrorSourceDataField
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceDataField) InputPassportElementErrorSourceType() string {
return TypeInputPassportElementErrorSourceDataField
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The front side of the document contains an error. The error is considered resolved when the file with the front side of the document changes
type InputPassportElementErrorSourceFrontSide struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Current hash of the file containing the front side
FileHash []byte `json:"file_hash"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementErrorSourceFrontSide) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementErrorSourceFrontSide
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceFrontSide) GetClass() string {
return ClassInputPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceFrontSide) GetType() string {
return TypeInputPassportElementErrorSourceFrontSide
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceFrontSide) InputPassportElementErrorSourceType() string {
return TypeInputPassportElementErrorSourceFrontSide
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The reverse side of the document contains an error. The error is considered resolved when the file with the reverse side of the document changes
type InputPassportElementErrorSourceReverseSide struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Current hash of the file containing the reverse side
FileHash []byte `json:"file_hash"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementErrorSourceReverseSide) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementErrorSourceReverseSide
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceReverseSide) GetClass() string {
return ClassInputPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceReverseSide) GetType() string {
return TypeInputPassportElementErrorSourceReverseSide
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceReverseSide) InputPassportElementErrorSourceType() string {
return TypeInputPassportElementErrorSourceReverseSide
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The selfie contains an error. The error is considered resolved when the file with the selfie changes
type InputPassportElementErrorSourceSelfie struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Current hash of the file containing the selfie
FileHash []byte `json:"file_hash"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementErrorSourceSelfie) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementErrorSourceSelfie
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceSelfie) GetClass() string {
return ClassInputPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceSelfie) GetType() string {
return TypeInputPassportElementErrorSourceSelfie
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceSelfie) InputPassportElementErrorSourceType() string {
return TypeInputPassportElementErrorSourceSelfie
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// One of the files containing the translation of the document contains an error. The error is considered resolved when the file with the translation changes
type InputPassportElementErrorSourceTranslationFile struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Current hash of the file containing the translation
FileHash []byte `json:"file_hash"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementErrorSourceTranslationFile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementErrorSourceTranslationFile
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceTranslationFile) GetClass() string {
return ClassInputPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceTranslationFile) GetType() string {
return TypeInputPassportElementErrorSourceTranslationFile
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceTranslationFile) InputPassportElementErrorSourceType() string {
return TypeInputPassportElementErrorSourceTranslationFile
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The translation of the document contains an error. The error is considered resolved when the list of files changes
type InputPassportElementErrorSourceTranslationFiles struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Current hashes of all files with the translation
FileHashes [][]byte `json:"file_hashes"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementErrorSourceTranslationFiles) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementErrorSourceTranslationFiles
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceTranslationFiles) GetClass() string {
return ClassInputPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceTranslationFiles) GetType() string {
return TypeInputPassportElementErrorSourceTranslationFiles
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceTranslationFiles) InputPassportElementErrorSourceType() string {
return TypeInputPassportElementErrorSourceTranslationFiles
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The file contains an error. The error is considered resolved when the file changes
type InputPassportElementErrorSourceFile struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Current hash of the file which has the error
FileHash []byte `json:"file_hash"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementErrorSourceFile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementErrorSourceFile
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceFile) GetClass() string {
return ClassInputPassportElementErrorSource
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceFile) GetType() string {
return TypeInputPassportElementErrorSourceFile
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceFile) InputPassportElementErrorSourceType() string {
return TypeInputPassportElementErrorSourceFile
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The list of attached files contains an error. The error is considered resolved when the file list changes
type InputPassportElementErrorSourceFiles struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Current hashes of all attached files
FileHashes [][]byte `json:"file_hashes"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementErrorSourceFiles) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementErrorSourceFiles
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceFiles) GetClass() string {
return ClassInputPassportElementErrorSource
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceFiles) GetType() string {
return TypeInputPassportElementErrorSourceFiles
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementErrorSourceFiles) InputPassportElementErrorSourceType() string {
return TypeInputPassportElementErrorSourceFiles
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains the description of an error in a Telegram Passport element; for bots only
type InputPassportElementError struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Type of Telegram Passport element that has the error
Type PassportElementType `json:"type"`
// Error message
Message string `json:"message"`
// Error source
Source InputPassportElementErrorSource `json:"source"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputPassportElementError) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputPassportElementError
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementError) GetClass() string {
return ClassInputPassportElementError
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputPassportElementError) GetType() string {
return TypeInputPassportElementError
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputPassportElementError *InputPassportElementError) UnmarshalJSON(data []byte) error {
var tmp struct {
Type json.RawMessage `json:"type"`
Message string `json:"message"`
Source json.RawMessage `json:"source"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputPassportElementError.Message = tmp.Message
fieldType, _ := UnmarshalPassportElementType(tmp.Type)
inputPassportElementError.Type = fieldType
fieldSource, _ := UnmarshalInputPassportElementErrorSource(tmp.Source)
inputPassportElementError.Source = fieldSource
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A text message
type MessageText struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Text of the message
Text *FormattedText `json:"text"`
// A preview of the web page that's mentioned in the text; may be null
WebPage *WebPage `json:"web_page"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageText) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageText) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageText) GetType() string {
return TypeMessageText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageText) MessageContentType() string {
return TypeMessageText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An animation message (GIF-style).
type MessageAnimation struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
Animation *Animation `json:"animation"`
// Animation caption
Caption *FormattedText `json:"caption"`
// True, if the animation thumbnail must be blurred and the animation must be shown only while tapped
IsSecret bool `json:"is_secret"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageAnimation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageAnimation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageAnimation) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageAnimation) GetType() string {
return TypeMessageAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageAnimation) MessageContentType() string {
return TypeMessageAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An audio message
type MessageAudio struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
Audio *Audio `json:"audio"`
// Audio caption
Caption *FormattedText `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageAudio) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageAudio
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageAudio) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageAudio) GetType() string {
return TypeMessageAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageAudio) MessageContentType() string {
return TypeMessageAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A document message (general file)
type MessageDocument struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
Document *Document `json:"document"`
// Document caption
Caption *FormattedText `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageDocument
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageDocument) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageDocument) GetType() string {
return TypeMessageDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageDocument) MessageContentType() string {
return TypeMessageDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A photo message
type MessagePhoto struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
Photo *Photo `json:"photo"`
// Photo caption
Caption *FormattedText `json:"caption"`
// True, if the photo must be blurred and must be shown only while tapped
IsSecret bool `json:"is_secret"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessagePhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessagePhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePhoto) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePhoto) GetType() string {
return TypeMessagePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePhoto) MessageContentType() string {
return TypeMessagePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An expired photo message (self-destructed after TTL has elapsed)
type MessageExpiredPhoto struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageExpiredPhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageExpiredPhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageExpiredPhoto) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageExpiredPhoto) GetType() string {
return TypeMessageExpiredPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageExpiredPhoto) MessageContentType() string {
return TypeMessageExpiredPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A sticker message
type MessageSticker struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
Sticker *Sticker `json:"sticker"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageSticker) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageSticker
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageSticker) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageSticker) GetType() string {
return TypeMessageSticker
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageSticker) MessageContentType() string {
return TypeMessageSticker
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A video message
type MessageVideo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
Video *Video `json:"video"`
// Video caption
Caption *FormattedText `json:"caption"`
// True, if the video thumbnail must be blurred and the video must be shown only while tapped
IsSecret bool `json:"is_secret"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageVideo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVideo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVideo) GetType() string {
return TypeMessageVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVideo) MessageContentType() string {
return TypeMessageVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An expired video message (self-destructed after TTL has elapsed)
type MessageExpiredVideo struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageExpiredVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageExpiredVideo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageExpiredVideo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageExpiredVideo) GetType() string {
return TypeMessageExpiredVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageExpiredVideo) MessageContentType() string {
return TypeMessageExpiredVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A video note message
type MessageVideoNote struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
VideoNote *VideoNote `json:"video_note"`
// True, if at least one of the recipients has viewed the video note
IsViewed bool `json:"is_viewed"`
// True, if the video note thumbnail must be blurred and the video note must be shown only while tapped
IsSecret bool `json:"is_secret"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageVideoNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageVideoNote
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVideoNote) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVideoNote) GetType() string {
return TypeMessageVideoNote
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVideoNote) MessageContentType() string {
return TypeMessageVideoNote
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A voice note message
type MessageVoiceNote struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
VoiceNote *VoiceNote `json:"voice_note"`
// Voice note caption
Caption *FormattedText `json:"caption"`
// True, if at least one of the recipients has listened to the voice note
IsListened bool `json:"is_listened"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageVoiceNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageVoiceNote
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVoiceNote) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVoiceNote) GetType() string {
return TypeMessageVoiceNote
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVoiceNote) MessageContentType() string {
return TypeMessageVoiceNote
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a location
type MessageLocation struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
Location *Location `json:"location"`
// Time relative to the message sent date until which the location can be updated, in seconds
LivePeriod int32 `json:"live_period"`
// Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes
ExpiresIn int32 `json:"expires_in"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageLocation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageLocation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageLocation) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageLocation) GetType() string {
return TypeMessageLocation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageLocation) MessageContentType() string {
return TypeMessageLocation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with information about a venue
type MessageVenue struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
Venue *Venue `json:"venue"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageVenue) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageVenue
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVenue) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVenue) GetType() string {
return TypeMessageVenue
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageVenue) MessageContentType() string {
return TypeMessageVenue
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a user contact
type MessageContact struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content
Contact *Contact `json:"contact"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageContact) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageContact
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageContact) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageContact) GetType() string {
return TypeMessageContact
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageContact) MessageContentType() string {
return TypeMessageContact
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a game
type MessageGame struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Game
Game *Game `json:"game"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageGame) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageGame
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageGame) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageGame) GetType() string {
return TypeMessageGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageGame) MessageContentType() string {
return TypeMessageGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a poll
type MessagePoll struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Poll
Poll *Poll `json:"poll"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessagePoll) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessagePoll
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePoll) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePoll) GetType() string {
return TypeMessagePoll
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePoll) MessageContentType() string {
return TypeMessagePoll
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with an invoice from a bot
type MessageInvoice struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Product title
Title string `json:"title"`
// Product description
Description string `json:"description"`
// Product photo; may be null
Photo *Photo `json:"photo"`
// Currency for the product price
Currency string `json:"currency"`
// Product total price in the minimal quantity of the currency
TotalAmount int64 `json:"total_amount"`
// Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter}
StartParameter string `json:"start_parameter"`
// True, if the invoice is a test invoice
IsTest bool `json:"is_test"`
// True, if the shipping address should be specified
NeedShippingAddress bool `json:"need_shipping_address"`
// The identifier of the message with the receipt, after the product has been purchased
ReceiptMessageId int64 `json:"receipt_message_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageInvoice) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageInvoice
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageInvoice) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageInvoice) GetType() string {
return TypeMessageInvoice
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageInvoice) MessageContentType() string {
return TypeMessageInvoice
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with information about an ended call
type MessageCall struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Reason why the call was discarded
DiscardReason CallDiscardReason `json:"discard_reason"`
// Call duration, in seconds
Duration int32 `json:"duration"`
}
func (entity *MessageCall) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageCall
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageCall) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageCall) GetType() string {
return TypeMessageCall
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageCall) MessageContentType() string {
return TypeMessageCall
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (messageCall *MessageCall) UnmarshalJSON(data []byte) error {
var tmp struct {
DiscardReason json.RawMessage `json:"discard_reason"`
Duration int32 `json:"duration"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
messageCall.Duration = tmp.Duration
fieldDiscardReason, _ := UnmarshalCallDiscardReason(tmp.DiscardReason)
messageCall.DiscardReason = fieldDiscardReason
return nil
}
// A newly created basic group
type MessageBasicGroupChatCreate struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Title of the basic group
Title string `json:"title"`
// User identifiers of members in the basic group
MemberUserIds []int32 `json:"member_user_ids"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageBasicGroupChatCreate) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageBasicGroupChatCreate
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageBasicGroupChatCreate) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageBasicGroupChatCreate) GetType() string {
return TypeMessageBasicGroupChatCreate
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageBasicGroupChatCreate) MessageContentType() string {
return TypeMessageBasicGroupChatCreate
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A newly created supergroup or channel
type MessageSupergroupChatCreate struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Title of the supergroup or channel
Title string `json:"title"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageSupergroupChatCreate) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageSupergroupChatCreate
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageSupergroupChatCreate) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageSupergroupChatCreate) GetType() string {
return TypeMessageSupergroupChatCreate
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageSupergroupChatCreate) MessageContentType() string {
return TypeMessageSupergroupChatCreate
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An updated chat title
type MessageChatChangeTitle struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// New chat title
Title string `json:"title"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageChatChangeTitle) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageChatChangeTitle
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatChangeTitle) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatChangeTitle) GetType() string {
return TypeMessageChatChangeTitle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatChangeTitle) MessageContentType() string {
return TypeMessageChatChangeTitle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An updated chat photo
type MessageChatChangePhoto struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// New chat photo
Photo *Photo `json:"photo"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageChatChangePhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageChatChangePhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatChangePhoto) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatChangePhoto) GetType() string {
return TypeMessageChatChangePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatChangePhoto) MessageContentType() string {
return TypeMessageChatChangePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A deleted chat photo
type MessageChatDeletePhoto struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageChatDeletePhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageChatDeletePhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatDeletePhoto) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatDeletePhoto) GetType() string {
return TypeMessageChatDeletePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatDeletePhoto) MessageContentType() string {
return TypeMessageChatDeletePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// New chat members were added
type MessageChatAddMembers struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// User identifiers of the new members
MemberUserIds []int32 `json:"member_user_ids"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageChatAddMembers) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageChatAddMembers
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatAddMembers) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatAddMembers) GetType() string {
return TypeMessageChatAddMembers
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatAddMembers) MessageContentType() string {
return TypeMessageChatAddMembers
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A new member joined the chat by invite link
type MessageChatJoinByLink struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageChatJoinByLink) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageChatJoinByLink
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatJoinByLink) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatJoinByLink) GetType() string {
return TypeMessageChatJoinByLink
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatJoinByLink) MessageContentType() string {
return TypeMessageChatJoinByLink
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A chat member was deleted
type MessageChatDeleteMember struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// User identifier of the deleted chat member
UserId int32 `json:"user_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageChatDeleteMember) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageChatDeleteMember
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatDeleteMember) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatDeleteMember) GetType() string {
return TypeMessageChatDeleteMember
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatDeleteMember) MessageContentType() string {
return TypeMessageChatDeleteMember
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A basic group was upgraded to a supergroup and was deactivated as the result
type MessageChatUpgradeTo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Identifier of the supergroup to which the basic group was upgraded
SupergroupId int32 `json:"supergroup_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageChatUpgradeTo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageChatUpgradeTo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatUpgradeTo) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatUpgradeTo) GetType() string {
return TypeMessageChatUpgradeTo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatUpgradeTo) MessageContentType() string {
return TypeMessageChatUpgradeTo
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
// A supergroup has been created from a basic group
type MessageChatUpgradeFrom struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Title of the newly created supergroup
Title string `json:"title"`
// The identifier of the original basic group
BasicGroupId int32 `json:"basic_group_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageChatUpgradeFrom) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageChatUpgradeFrom
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatUpgradeFrom) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatUpgradeFrom) GetType() string {
return TypeMessageChatUpgradeFrom
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatUpgradeFrom) MessageContentType() string {
return TypeMessageChatUpgradeFrom
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message has been pinned
type MessagePinMessage struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Identifier of the pinned message, can be an identifier of a deleted message or 0
MessageId int64 `json:"message_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessagePinMessage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessagePinMessage
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePinMessage) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePinMessage) GetType() string {
return TypeMessagePinMessage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePinMessage) MessageContentType() string {
return TypeMessagePinMessage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A screenshot of a message in the chat has been taken
type MessageScreenshotTaken struct {
meta
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (entity *MessageScreenshotTaken) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageScreenshotTaken
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*MessageScreenshotTaken) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageScreenshotTaken) GetType() string {
return TypeMessageScreenshotTaken
}
func (*MessageScreenshotTaken) MessageContentType() string {
return TypeMessageScreenshotTaken
}
// The TTL (Time To Live) setting messages in a secret chat has been changed
type MessageChatSetTtl struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// New TTL
Ttl int32 `json:"ttl"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageChatSetTtl) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageChatSetTtl
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatSetTtl) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatSetTtl) GetType() string {
return TypeMessageChatSetTtl
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageChatSetTtl) MessageContentType() string {
return TypeMessageChatSetTtl
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A non-standard action has happened in the chat
type MessageCustomServiceAction struct {
meta
// Message text to be shown in the chat
Text string `json:"text"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (entity *MessageCustomServiceAction) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageCustomServiceAction
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*MessageCustomServiceAction) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageCustomServiceAction) GetType() string {
return TypeMessageCustomServiceAction
}
func (*MessageCustomServiceAction) MessageContentType() string {
return TypeMessageCustomServiceAction
}
// A new high score was achieved in a game
type MessageGameScore struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Identifier of the message with the game, can be an identifier of a deleted message
GameMessageId int64 `json:"game_message_id"`
// Identifier of the game; may be different from the games presented in the message with the game
GameId JsonInt64 `json:"game_id"`
// New score
Score int32 `json:"score"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageGameScore) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageGameScore
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageGameScore) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageGameScore) GetType() string {
return TypeMessageGameScore
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageGameScore) MessageContentType() string {
return TypeMessageGameScore
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A payment has been completed
type MessagePaymentSuccessful struct {
meta
// Identifier of the message with the corresponding invoice; can be an identifier of a deleted message
InvoiceMessageId int64 `json:"invoice_message_id"`
// Currency for the price of the product
Currency string `json:"currency"`
// Total price for the product, in the minimal quantity of the currency
TotalAmount int64 `json:"total_amount"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (entity *MessagePaymentSuccessful) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessagePaymentSuccessful
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*MessagePaymentSuccessful) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePaymentSuccessful) GetType() string {
return TypeMessagePaymentSuccessful
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePaymentSuccessful) MessageContentType() string {
return TypeMessagePaymentSuccessful
}
// A payment has been completed; for bots only
type MessagePaymentSuccessfulBot struct {
meta
// Identifier of the message with the corresponding invoice; can be an identifier of a deleted message
InvoiceMessageId int64 `json:"invoice_message_id"`
// Currency for price of the product
Currency string `json:"currency"`
// Total price for the product, in the minimal quantity of the currency
TotalAmount int64 `json:"total_amount"`
// Invoice payload
InvoicePayload []byte `json:"invoice_payload"`
// Identifier of the shipping option chosen by the user; may be empty if not applicable
ShippingOptionId string `json:"shipping_option_id"`
// Information about the order; may be null
OrderInfo *OrderInfo `json:"order_info"`
// Telegram payment identifier
TelegramPaymentChargeId string `json:"telegram_payment_charge_id"`
// Provider payment identifier
ProviderPaymentChargeId string `json:"provider_payment_charge_id"`
}
func (entity *MessagePaymentSuccessfulBot) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessagePaymentSuccessfulBot
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePaymentSuccessfulBot) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePaymentSuccessfulBot) GetType() string {
return TypeMessagePaymentSuccessfulBot
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePaymentSuccessfulBot) MessageContentType() string {
return TypeMessagePaymentSuccessfulBot
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A contact has registered with Telegram
type MessageContactRegistered struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageContactRegistered) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageContactRegistered
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageContactRegistered) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageContactRegistered) GetType() string {
return TypeMessageContactRegistered
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageContactRegistered) MessageContentType() string {
return TypeMessageContactRegistered
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The current user has connected a website by logging in using Telegram Login Widget on it
type MessageWebsiteConnected struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Domain name of the connected website
DomainName string `json:"domain_name"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageWebsiteConnected) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageWebsiteConnected
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageWebsiteConnected) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageWebsiteConnected) GetType() string {
return TypeMessageWebsiteConnected
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageWebsiteConnected) MessageContentType() string {
return TypeMessageWebsiteConnected
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Telegram Passport data has been sent
type MessagePassportDataSent struct {
meta
// List of Telegram Passport element types sent
Types []PassportElementType `json:"types"`
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (entity *MessagePassportDataSent) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
type stub MessagePassportDataSent
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*MessagePassportDataSent) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePassportDataSent) GetType() string {
return TypeMessagePassportDataSent
}
func (*MessagePassportDataSent) MessageContentType() string {
return TypeMessagePassportDataSent
}
// Telegram Passport data has been received; for bots only
type MessagePassportDataReceived struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// List of received Telegram Passport elements
Elements []*EncryptedPassportElement `json:"elements"`
// Encrypted data credentials
Credentials *EncryptedCredentials `json:"credentials"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessagePassportDataReceived) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessagePassportDataReceived
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePassportDataReceived) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePassportDataReceived) GetType() string {
return TypeMessagePassportDataReceived
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessagePassportDataReceived) MessageContentType() string {
return TypeMessagePassportDataReceived
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Message content that is not supported by the client
type MessageUnsupported struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *MessageUnsupported) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub MessageUnsupported
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageUnsupported) GetClass() string {
return ClassMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageUnsupported) GetType() string {
return TypeMessageUnsupported
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*MessageUnsupported) MessageContentType() string {
return TypeMessageUnsupported
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A mention of a user by their username
type TextEntityTypeMention struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeMention) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeMention
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeMention) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeMention) GetType() string {
return TypeTextEntityTypeMention
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeMention) TextEntityTypeType() string {
return TypeTextEntityTypeMention
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A hashtag text, beginning with "#"
type TextEntityTypeHashtag struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeHashtag) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeHashtag
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeHashtag) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeHashtag) GetType() string {
return TypeTextEntityTypeHashtag
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeHashtag) TextEntityTypeType() string {
return TypeTextEntityTypeHashtag
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A cashtag text, beginning with "$" and consisting of capital english letters (i.e. "$USD")
type TextEntityTypeCashtag struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeCashtag) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeCashtag
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeCashtag) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeCashtag) GetType() string {
return TypeTextEntityTypeCashtag
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeCashtag) TextEntityTypeType() string {
return TypeTextEntityTypeCashtag
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A bot command, beginning with "/". This shouldn't be highlighted if there are no bots in the chat
type TextEntityTypeBotCommand struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeBotCommand) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeBotCommand
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeBotCommand) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeBotCommand) GetType() string {
return TypeTextEntityTypeBotCommand
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeBotCommand) TextEntityTypeType() string {
return TypeTextEntityTypeBotCommand
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An HTTP URL
type TextEntityTypeUrl struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeUrl) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeUrl
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeUrl) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeUrl) GetType() string {
return TypeTextEntityTypeUrl
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeUrl) TextEntityTypeType() string {
return TypeTextEntityTypeUrl
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An email address
type TextEntityTypeEmailAddress struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeEmailAddress) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeEmailAddress
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeEmailAddress) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeEmailAddress) GetType() string {
return TypeTextEntityTypeEmailAddress
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeEmailAddress) TextEntityTypeType() string {
return TypeTextEntityTypeEmailAddress
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A bold text
type TextEntityTypeBold struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeBold) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeBold
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeBold) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeBold) GetType() string {
return TypeTextEntityTypeBold
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeBold) TextEntityTypeType() string {
return TypeTextEntityTypeBold
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An italic text
type TextEntityTypeItalic struct {
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeItalic) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeItalic
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeItalic) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeItalic) GetType() string {
return TypeTextEntityTypeItalic
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeItalic) TextEntityTypeType() string {
return TypeTextEntityTypeItalic
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Text that must be formatted as if inside a code HTML tag
type TextEntityTypeCode struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeCode) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeCode
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeCode) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeCode) GetType() string {
return TypeTextEntityTypeCode
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeCode) TextEntityTypeType() string {
return TypeTextEntityTypeCode
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Text that must be formatted as if inside a pre HTML tag
type TextEntityTypePre struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypePre) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypePre
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypePre) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypePre) GetType() string {
return TypeTextEntityTypePre
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypePre) TextEntityTypeType() string {
return TypeTextEntityTypePre
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Text that must be formatted as if inside pre, and code HTML tags
type TextEntityTypePreCode struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Programming language of the code; as defined by the sender
Language string `json:"language"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypePreCode) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypePreCode
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypePreCode) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypePreCode) GetType() string {
return TypeTextEntityTypePreCode
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypePreCode) TextEntityTypeType() string {
return TypeTextEntityTypePreCode
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A text description shown instead of a raw URL
type TextEntityTypeTextUrl struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// HTTP or tg:// URL to be opened when the link is clicked
Url string `json:"url"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeTextUrl) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeTextUrl
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeTextUrl) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeTextUrl) GetType() string {
return TypeTextEntityTypeTextUrl
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeTextUrl) TextEntityTypeType() string {
return TypeTextEntityTypeTextUrl
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A text shows instead of a raw mention of the user (e.g., when the user has no username)
type TextEntityTypeMentionName struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Identifier of the mentioned user
UserId int32 `json:"user_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypeMentionName) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypeMentionName
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeMentionName) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeMentionName) GetType() string {
return TypeTextEntityTypeMentionName
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypeMentionName) TextEntityTypeType() string {
return TypeTextEntityTypeMentionName
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A phone number
type TextEntityTypePhoneNumber struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *TextEntityTypePhoneNumber) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub TextEntityTypePhoneNumber
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypePhoneNumber) GetClass() string {
return ClassTextEntityType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypePhoneNumber) GetType() string {
return TypeTextEntityTypePhoneNumber
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*TextEntityTypePhoneNumber) TextEntityTypeType() string {
return TypeTextEntityTypePhoneNumber
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A thumbnail to be sent along with a file; should be in JPEG or WEBP format for stickers, and less than 200 kB in size
type InputThumbnail struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Thumbnail file to send. Sending thumbnails by file_id is currently not supported
Thumbnail InputFile `json:"thumbnail"`
// Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown
Width int32 `json:"width"`
// Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown
Height int32 `json:"height"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputThumbnail) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputThumbnail
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputThumbnail) GetClass() string {
return ClassInputThumbnail
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputThumbnail) GetType() string {
return TypeInputThumbnail
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputThumbnail *InputThumbnail) UnmarshalJSON(data []byte) error {
var tmp struct {
Thumbnail json.RawMessage `json:"thumbnail"`
Width int32 `json:"width"`
Height int32 `json:"height"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
inputThumbnail.Width = tmp.Width
inputThumbnail.Height = tmp.Height
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldThumbnail, _ := UnmarshalInputFile(tmp.Thumbnail)
inputThumbnail.Thumbnail = fieldThumbnail
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A text message
type InputMessageText struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually
Text *FormattedText `json:"text"`
// True, if rich web page previews for URLs in the message text should be disabled
DisableWebPagePreview bool `json:"disable_web_page_preview"`
// True, if a chat message draft should be deleted
ClearDraft bool `json:"clear_draft"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageText) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageText
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageText) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageText) GetType() string {
return TypeInputMessageText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageText) InputMessageContentType() string {
return TypeInputMessageText
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An animation message (GIF-style).
type InputMessageAnimation struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Animation file to be sent
Animation InputFile `json:"animation"`
// Animation thumbnail, if available
Thumbnail *InputThumbnail `json:"thumbnail"`
// Duration of the animation, in seconds
Duration int32 `json:"duration"`
// Width of the animation; may be replaced by the server
Width int32 `json:"width"`
// Height of the animation; may be replaced by the server
Height int32 `json:"height"`
// Animation caption; 0-GetOption("message_caption_length_max") characters
Caption *FormattedText `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageAnimation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageAnimation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageAnimation) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageAnimation) GetType() string {
return TypeInputMessageAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageAnimation) InputMessageContentType() string {
return TypeInputMessageAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputMessageAnimation *InputMessageAnimation) UnmarshalJSON(data []byte) error {
var tmp struct {
Animation json.RawMessage `json:"animation"`
Thumbnail *InputThumbnail `json:"thumbnail"`
Duration int32 `json:"duration"`
Width int32 `json:"width"`
Height int32 `json:"height"`
Caption *FormattedText `json:"caption"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
inputMessageAnimation.Thumbnail = tmp.Thumbnail
inputMessageAnimation.Duration = tmp.Duration
inputMessageAnimation.Width = tmp.Width
inputMessageAnimation.Height = tmp.Height
inputMessageAnimation.Caption = tmp.Caption
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldAnimation, _ := UnmarshalInputFile(tmp.Animation)
inputMessageAnimation.Animation = fieldAnimation
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An audio message
type InputMessageAudio struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Audio file to be sent
Audio InputFile `json:"audio"`
// Thumbnail of the cover for the album, if available
AlbumCoverThumbnail *InputThumbnail `json:"album_cover_thumbnail"`
// Duration of the audio, in seconds; may be replaced by the server
Duration int32 `json:"duration"`
// Title of the audio; 0-64 characters; may be replaced by the server
Title string `json:"title"`
// Performer of the audio; 0-64 characters, may be replaced by the server
Performer string `json:"performer"`
// Audio caption; 0-GetOption("message_caption_length_max") characters
Caption *FormattedText `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageAudio) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageAudio
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageAudio) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageAudio) GetType() string {
return TypeInputMessageAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageAudio) InputMessageContentType() string {
return TypeInputMessageAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputMessageAudio *InputMessageAudio) UnmarshalJSON(data []byte) error {
var tmp struct {
Audio json.RawMessage `json:"audio"`
AlbumCoverThumbnail *InputThumbnail `json:"album_cover_thumbnail"`
Duration int32 `json:"duration"`
Title string `json:"title"`
Performer string `json:"performer"`
Caption *FormattedText `json:"caption"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
inputMessageAudio.AlbumCoverThumbnail = tmp.AlbumCoverThumbnail
inputMessageAudio.Duration = tmp.Duration
inputMessageAudio.Title = tmp.Title
inputMessageAudio.Performer = tmp.Performer
inputMessageAudio.Caption = tmp.Caption
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldAudio, _ := UnmarshalInputFile(tmp.Audio)
inputMessageAudio.Audio = fieldAudio
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A document message (general file)
type InputMessageDocument struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Document to be sent
Document InputFile `json:"document"`
// Document thumbnail, if available
Thumbnail *InputThumbnail `json:"thumbnail"`
// Document caption; 0-GetOption("message_caption_length_max") characters
Caption *FormattedText `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageDocument
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageDocument) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageDocument) GetType() string {
return TypeInputMessageDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageDocument) InputMessageContentType() string {
return TypeInputMessageDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputMessageDocument *InputMessageDocument) UnmarshalJSON(data []byte) error {
var tmp struct {
Document json.RawMessage `json:"document"`
Thumbnail *InputThumbnail `json:"thumbnail"`
Caption *FormattedText `json:"caption"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputMessageDocument.Thumbnail = tmp.Thumbnail
inputMessageDocument.Caption = tmp.Caption
fieldDocument, _ := UnmarshalInputFile(tmp.Document)
inputMessageDocument.Document = fieldDocument
return nil
}
// A photo message
type InputMessagePhoto struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Photo to send
Photo InputFile `json:"photo"`
// Photo thumbnail to be sent, this is sent to the other party in secret chats only
Thumbnail *InputThumbnail `json:"thumbnail"`
// File identifiers of the stickers added to the photo, if applicable
AddedStickerFileIds []int32 `json:"added_sticker_file_ids"`
// Photo width
Width int32 `json:"width"`
// Photo height
Height int32 `json:"height"`
// Photo caption; 0-GetOption("message_caption_length_max") characters
Caption *FormattedText `json:"caption"`
// Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
Ttl int32 `json:"ttl"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessagePhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessagePhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessagePhoto) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessagePhoto) GetType() string {
return TypeInputMessagePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessagePhoto) InputMessageContentType() string {
return TypeInputMessagePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputMessagePhoto *InputMessagePhoto) UnmarshalJSON(data []byte) error {
var tmp struct {
Photo json.RawMessage `json:"photo"`
Thumbnail *InputThumbnail `json:"thumbnail"`
AddedStickerFileIds []int32 `json:"added_sticker_file_ids"`
Width int32 `json:"width"`
Height int32 `json:"height"`
Caption *FormattedText `json:"caption"`
Ttl int32 `json:"ttl"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputMessagePhoto.Thumbnail = tmp.Thumbnail
inputMessagePhoto.AddedStickerFileIds = tmp.AddedStickerFileIds
inputMessagePhoto.Width = tmp.Width
inputMessagePhoto.Height = tmp.Height
inputMessagePhoto.Caption = tmp.Caption
inputMessagePhoto.Ttl = tmp.Ttl
fieldPhoto, _ := UnmarshalInputFile(tmp.Photo)
inputMessagePhoto.Photo = fieldPhoto
return nil
}
// A sticker message
type InputMessageSticker struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Sticker to be sent
Sticker InputFile `json:"sticker"`
// Sticker thumbnail, if available
Thumbnail *InputThumbnail `json:"thumbnail"`
// Sticker width
Width int32 `json:"width"`
// Sticker height
Height int32 `json:"height"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageSticker) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageSticker
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageSticker) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageSticker) GetType() string {
return TypeInputMessageSticker
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageSticker) InputMessageContentType() string {
return TypeInputMessageSticker
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputMessageSticker *InputMessageSticker) UnmarshalJSON(data []byte) error {
var tmp struct {
Sticker json.RawMessage `json:"sticker"`
Thumbnail *InputThumbnail `json:"thumbnail"`
Width int32 `json:"width"`
Height int32 `json:"height"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputMessageSticker.Thumbnail = tmp.Thumbnail
inputMessageSticker.Width = tmp.Width
inputMessageSticker.Height = tmp.Height
fieldSticker, _ := UnmarshalInputFile(tmp.Sticker)
inputMessageSticker.Sticker = fieldSticker
return nil
}
// A video message
type InputMessageVideo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Video to be sent
Video InputFile `json:"video"`
// Video thumbnail, if available
Thumbnail *InputThumbnail `json:"thumbnail"`
// File identifiers of the stickers added to the video, if applicable
AddedStickerFileIds []int32 `json:"added_sticker_file_ids"`
// Duration of the video, in seconds
Duration int32 `json:"duration"`
// Video width
Width int32 `json:"width"`
// Video height
Height int32 `json:"height"`
// True, if the video should be tried to be streamed
SupportsStreaming bool `json:"supports_streaming"`
// Video caption; 0-GetOption("message_caption_length_max") characters
Caption *FormattedText `json:"caption"`
// Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
Ttl int32 `json:"ttl"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageVideo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVideo) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVideo) GetType() string {
return TypeInputMessageVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVideo) InputMessageContentType() string {
return TypeInputMessageVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error {
var tmp struct {
Video json.RawMessage `json:"video"`
Thumbnail *InputThumbnail `json:"thumbnail"`
AddedStickerFileIds []int32 `json:"added_sticker_file_ids"`
Duration int32 `json:"duration"`
Width int32 `json:"width"`
Height int32 `json:"height"`
SupportsStreaming bool `json:"supports_streaming"`
Caption *FormattedText `json:"caption"`
Ttl int32 `json:"ttl"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputMessageVideo.Thumbnail = tmp.Thumbnail
inputMessageVideo.AddedStickerFileIds = tmp.AddedStickerFileIds
inputMessageVideo.Duration = tmp.Duration
inputMessageVideo.Width = tmp.Width
inputMessageVideo.Height = tmp.Height
inputMessageVideo.SupportsStreaming = tmp.SupportsStreaming
inputMessageVideo.Caption = tmp.Caption
inputMessageVideo.Ttl = tmp.Ttl
fieldVideo, _ := UnmarshalInputFile(tmp.Video)
inputMessageVideo.Video = fieldVideo
return nil
}
// A video note message
type InputMessageVideoNote struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Video note to be sent
VideoNote InputFile `json:"video_note"`
// Video thumbnail, if available
Thumbnail *InputThumbnail `json:"thumbnail"`
// Duration of the video, in seconds
Duration int32 `json:"duration"`
// Video width and height; must be positive and not greater than 640
Length int32 `json:"length"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageVideoNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageVideoNote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVideoNote) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVideoNote) GetType() string {
return TypeInputMessageVideoNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVideoNote) InputMessageContentType() string {
return TypeInputMessageVideoNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputMessageVideoNote *InputMessageVideoNote) UnmarshalJSON(data []byte) error {
var tmp struct {
VideoNote json.RawMessage `json:"video_note"`
Thumbnail *InputThumbnail `json:"thumbnail"`
Duration int32 `json:"duration"`
Length int32 `json:"length"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputMessageVideoNote.Thumbnail = tmp.Thumbnail
inputMessageVideoNote.Duration = tmp.Duration
inputMessageVideoNote.Length = tmp.Length
fieldVideoNote, _ := UnmarshalInputFile(tmp.VideoNote)
inputMessageVideoNote.VideoNote = fieldVideoNote
return nil
}
// A voice note message
type InputMessageVoiceNote struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Voice note to be sent
VoiceNote InputFile `json:"voice_note"`
// Duration of the voice note, in seconds
Duration int32 `json:"duration"`
// Waveform representation of the voice note, in 5-bit format
Waveform []byte `json:"waveform"`
// Voice note caption; 0-GetOption("message_caption_length_max") characters
Caption *FormattedText `json:"caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageVoiceNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageVoiceNote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVoiceNote) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVoiceNote) GetType() string {
return TypeInputMessageVoiceNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVoiceNote) InputMessageContentType() string {
return TypeInputMessageVoiceNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputMessageVoiceNote *InputMessageVoiceNote) UnmarshalJSON(data []byte) error {
var tmp struct {
VoiceNote json.RawMessage `json:"voice_note"`
Duration int32 `json:"duration"`
Waveform []byte `json:"waveform"`
Caption *FormattedText `json:"caption"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputMessageVoiceNote.Duration = tmp.Duration
inputMessageVoiceNote.Waveform = tmp.Waveform
inputMessageVoiceNote.Caption = tmp.Caption
fieldVoiceNote, _ := UnmarshalInputFile(tmp.VoiceNote)
inputMessageVoiceNote.VoiceNote = fieldVoiceNote
return nil
}
// A message with a location
type InputMessageLocation struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Location to be sent
Location *Location `json:"location"`
// Period for which the location can be updated, in seconds; should bebetween 60 and 86400 for a live location and 0 otherwise
LivePeriod int32 `json:"live_period"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageLocation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageLocation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageLocation) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageLocation) GetType() string {
return TypeInputMessageLocation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageLocation) InputMessageContentType() string {
return TypeInputMessageLocation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with information about a venue
type InputMessageVenue struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Venue to send
Venue *Venue `json:"venue"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageVenue) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageVenue
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVenue) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVenue) GetType() string {
return TypeInputMessageVenue
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageVenue) InputMessageContentType() string {
return TypeInputMessageVenue
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message containing a user contact
type InputMessageContact struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Contact to send
Contact *Contact `json:"contact"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageContact) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageContact
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageContact) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageContact) GetType() string {
return TypeInputMessageContact
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageContact) InputMessageContentType() string {
return TypeInputMessageContact
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a game; not supported for channels or secret chats
type InputMessageGame struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// User identifier of the bot that owns the game
BotUserId int32 `json:"bot_user_id"`
// Short name of the game
GameShortName string `json:"game_short_name"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageGame) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageGame
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageGame) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageGame) GetType() string {
return TypeInputMessageGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageGame) InputMessageContentType() string {
return TypeInputMessageGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with an invoice; can be used only by bots and only in private chats
type InputMessageInvoice struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Invoice
Invoice *Invoice `json:"invoice"`
// Product title; 1-32 characters
Title string `json:"title"`
// Product description; 0-255 characters
Description string `json:"description"`
// Product photo URL; optional
PhotoUrl string `json:"photo_url"`
// Product photo size
PhotoSize int32 `json:"photo_size"`
// Product photo width
PhotoWidth int32 `json:"photo_width"`
// Product photo height
PhotoHeight int32 `json:"photo_height"`
// The invoice payload
Payload []byte `json:"payload"`
// Payment provider token
ProviderToken string `json:"provider_token"`
// JSON-encoded data about the invoice, which will be shared with the payment provider
ProviderData string `json:"provider_data"`
// Unique invoice bot start_parameter for the generation of this invoice
StartParameter string `json:"start_parameter"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageInvoice) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageInvoice
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageInvoice) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageInvoice) GetType() string {
return TypeInputMessageInvoice
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageInvoice) InputMessageContentType() string {
return TypeInputMessageInvoice
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a poll. Polls can't be sent to private or secret chats
type InputMessagePoll struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Poll question, 1-255 characters
Question string `json:"question"`
// List of poll answer options, 2-10 strings 1-100 characters each
Options []string `json:"options"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessagePoll) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessagePoll
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessagePoll) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessagePoll) GetType() string {
return TypeInputMessagePoll
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessagePoll) InputMessageContentType() string {
return TypeInputMessagePoll
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A forwarded message
type InputMessageForwarded struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Identifier for the chat this forwarded message came from
FromChatId int64 `json:"from_chat_id"`
// Identifier of the message to forward
MessageId int64 `json:"message_id"`
// True, if a game message should be shared within a launched game; applies only to game messages
InGameShare bool `json:"in_game_share"`
2019-09-10 12:36:54 +00:00
// True, if content of the message needs to be copied without a link to the original message. Always true if the message is forwarded to a secret chat
SendCopy bool `json:"send_copy"`
// True, if media caption of the message copy needs to be removed. Ignored if send_copy is false
RemoveCaption bool `json:"remove_caption"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputMessageForwarded) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputMessageForwarded
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageForwarded) GetClass() string {
return ClassInputMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageForwarded) GetType() string {
return TypeInputMessageForwarded
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputMessageForwarded) InputMessageContentType() string {
return TypeInputMessageForwarded
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Returns all found messages, no filter is applied
type SearchMessagesFilterEmpty struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterEmpty) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterEmpty
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterEmpty) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterEmpty) GetType() string {
return TypeSearchMessagesFilterEmpty
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterEmpty) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterEmpty
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Returns only animation messages
type SearchMessagesFilterAnimation struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterAnimation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterAnimation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterAnimation) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterAnimation) GetType() string {
return TypeSearchMessagesFilterAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterAnimation) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Returns only audio messages
type SearchMessagesFilterAudio struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterAudio) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterAudio
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterAudio) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterAudio) GetType() string {
return TypeSearchMessagesFilterAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterAudio) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Returns only document messages
type SearchMessagesFilterDocument struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterDocument
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterDocument) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterDocument) GetType() string {
return TypeSearchMessagesFilterDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterDocument) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Returns only photo messages
type SearchMessagesFilterPhoto struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterPhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterPhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterPhoto) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterPhoto) GetType() string {
return TypeSearchMessagesFilterPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterPhoto) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Returns only video messages
type SearchMessagesFilterVideo struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterVideo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterVideo) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterVideo) GetType() string {
return TypeSearchMessagesFilterVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterVideo) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Returns only voice note messages
type SearchMessagesFilterVoiceNote struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterVoiceNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterVoiceNote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterVoiceNote) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterVoiceNote) GetType() string {
return TypeSearchMessagesFilterVoiceNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterVoiceNote) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterVoiceNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Returns only photo and video messages
type SearchMessagesFilterPhotoAndVideo struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterPhotoAndVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterPhotoAndVideo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterPhotoAndVideo) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterPhotoAndVideo) GetType() string {
return TypeSearchMessagesFilterPhotoAndVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterPhotoAndVideo) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterPhotoAndVideo
}
// Returns only messages containing URLs
type SearchMessagesFilterUrl struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterUrl) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterUrl
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterUrl) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterUrl) GetType() string {
return TypeSearchMessagesFilterUrl
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterUrl) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterUrl
}
// Returns only messages containing chat photos
type SearchMessagesFilterChatPhoto struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterChatPhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterChatPhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterChatPhoto) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterChatPhoto) GetType() string {
return TypeSearchMessagesFilterChatPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterChatPhoto) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterChatPhoto
}
// Returns only call messages
type SearchMessagesFilterCall struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterCall) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub SearchMessagesFilterCall
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterCall) GetClass() string {
return ClassSearchMessagesFilter
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterCall) GetType() string {
return TypeSearchMessagesFilterCall
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*SearchMessagesFilterCall) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterCall
}
// Returns only incoming call messages with missed/declined discard reasons
type SearchMessagesFilterMissedCall struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *SearchMessagesFilterMissedCall) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub SearchMessagesFilterMissedCall
return json.Marshal((*stub)(entity))
}
func (*SearchMessagesFilterMissedCall) GetClass() string {
return ClassSearchMessagesFilter
}
func (*SearchMessagesFilterMissedCall) GetType() string {
return TypeSearchMessagesFilterMissedCall
}
func (*SearchMessagesFilterMissedCall) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterMissedCall
}
// Returns only video note messages
type SearchMessagesFilterVideoNote struct {
meta
}
func (entity *SearchMessagesFilterVideoNote) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub SearchMessagesFilterVideoNote
return json.Marshal((*stub)(entity))
}
func (*SearchMessagesFilterVideoNote) GetClass() string {
return ClassSearchMessagesFilter
}
func (*SearchMessagesFilterVideoNote) GetType() string {
return TypeSearchMessagesFilterVideoNote
}
func (*SearchMessagesFilterVideoNote) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterVideoNote
}
// Returns only voice and video note messages
type SearchMessagesFilterVoiceAndVideoNote struct {
meta
}
func (entity *SearchMessagesFilterVoiceAndVideoNote) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub SearchMessagesFilterVoiceAndVideoNote
return json.Marshal((*stub)(entity))
}
func (*SearchMessagesFilterVoiceAndVideoNote) GetClass() string {
return ClassSearchMessagesFilter
}
func (*SearchMessagesFilterVoiceAndVideoNote) GetType() string {
return TypeSearchMessagesFilterVoiceAndVideoNote
}
func (*SearchMessagesFilterVoiceAndVideoNote) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterVoiceAndVideoNote
}
// Returns only messages with mentions of the current user, or messages that are replies to their messages
type SearchMessagesFilterMention struct {
meta
}
func (entity *SearchMessagesFilterMention) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub SearchMessagesFilterMention
return json.Marshal((*stub)(entity))
}
func (*SearchMessagesFilterMention) GetClass() string {
return ClassSearchMessagesFilter
}
func (*SearchMessagesFilterMention) GetType() string {
return TypeSearchMessagesFilterMention
}
func (*SearchMessagesFilterMention) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterMention
}
// Returns only messages with unread mentions of the current user, or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query or by the sending user
type SearchMessagesFilterUnreadMention struct {
meta
}
func (entity *SearchMessagesFilterUnreadMention) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub SearchMessagesFilterUnreadMention
return json.Marshal((*stub)(entity))
}
func (*SearchMessagesFilterUnreadMention) GetClass() string {
return ClassSearchMessagesFilter
}
func (*SearchMessagesFilterUnreadMention) GetType() string {
return TypeSearchMessagesFilterUnreadMention
}
func (*SearchMessagesFilterUnreadMention) SearchMessagesFilterType() string {
return TypeSearchMessagesFilterUnreadMention
}
// The user is typing a message
type ChatActionTyping struct {
meta
}
func (entity *ChatActionTyping) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionTyping
return json.Marshal((*stub)(entity))
}
func (*ChatActionTyping) GetClass() string {
return ClassChatAction
}
func (*ChatActionTyping) GetType() string {
return TypeChatActionTyping
}
func (*ChatActionTyping) ChatActionType() string {
return TypeChatActionTyping
}
// The user is recording a video
type ChatActionRecordingVideo struct {
meta
}
func (entity *ChatActionRecordingVideo) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionRecordingVideo
return json.Marshal((*stub)(entity))
}
func (*ChatActionRecordingVideo) GetClass() string {
return ClassChatAction
}
func (*ChatActionRecordingVideo) GetType() string {
return TypeChatActionRecordingVideo
}
func (*ChatActionRecordingVideo) ChatActionType() string {
return TypeChatActionRecordingVideo
}
// The user is uploading a video
type ChatActionUploadingVideo struct {
meta
// Upload progress, as a percentage
Progress int32 `json:"progress"`
}
func (entity *ChatActionUploadingVideo) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionUploadingVideo
return json.Marshal((*stub)(entity))
}
func (*ChatActionUploadingVideo) GetClass() string {
return ClassChatAction
}
func (*ChatActionUploadingVideo) GetType() string {
return TypeChatActionUploadingVideo
}
func (*ChatActionUploadingVideo) ChatActionType() string {
return TypeChatActionUploadingVideo
}
// The user is recording a voice note
type ChatActionRecordingVoiceNote struct {
meta
}
func (entity *ChatActionRecordingVoiceNote) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionRecordingVoiceNote
return json.Marshal((*stub)(entity))
}
func (*ChatActionRecordingVoiceNote) GetClass() string {
return ClassChatAction
}
func (*ChatActionRecordingVoiceNote) GetType() string {
return TypeChatActionRecordingVoiceNote
}
func (*ChatActionRecordingVoiceNote) ChatActionType() string {
return TypeChatActionRecordingVoiceNote
}
// The user is uploading a voice note
type ChatActionUploadingVoiceNote struct {
meta
// Upload progress, as a percentage
Progress int32 `json:"progress"`
}
func (entity *ChatActionUploadingVoiceNote) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionUploadingVoiceNote
return json.Marshal((*stub)(entity))
}
func (*ChatActionUploadingVoiceNote) GetClass() string {
return ClassChatAction
}
func (*ChatActionUploadingVoiceNote) GetType() string {
return TypeChatActionUploadingVoiceNote
}
func (*ChatActionUploadingVoiceNote) ChatActionType() string {
return TypeChatActionUploadingVoiceNote
}
// The user is uploading a photo
type ChatActionUploadingPhoto struct {
meta
// Upload progress, as a percentage
Progress int32 `json:"progress"`
}
func (entity *ChatActionUploadingPhoto) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionUploadingPhoto
return json.Marshal((*stub)(entity))
}
func (*ChatActionUploadingPhoto) GetClass() string {
return ClassChatAction
}
func (*ChatActionUploadingPhoto) GetType() string {
return TypeChatActionUploadingPhoto
}
func (*ChatActionUploadingPhoto) ChatActionType() string {
return TypeChatActionUploadingPhoto
}
// The user is uploading a document
type ChatActionUploadingDocument struct {
meta
// Upload progress, as a percentage
Progress int32 `json:"progress"`
}
func (entity *ChatActionUploadingDocument) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionUploadingDocument
return json.Marshal((*stub)(entity))
}
func (*ChatActionUploadingDocument) GetClass() string {
return ClassChatAction
}
func (*ChatActionUploadingDocument) GetType() string {
return TypeChatActionUploadingDocument
}
func (*ChatActionUploadingDocument) ChatActionType() string {
return TypeChatActionUploadingDocument
}
// The user is picking a location or venue to send
type ChatActionChoosingLocation struct {
meta
}
func (entity *ChatActionChoosingLocation) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionChoosingLocation
return json.Marshal((*stub)(entity))
}
func (*ChatActionChoosingLocation) GetClass() string {
return ClassChatAction
}
func (*ChatActionChoosingLocation) GetType() string {
return TypeChatActionChoosingLocation
}
func (*ChatActionChoosingLocation) ChatActionType() string {
return TypeChatActionChoosingLocation
}
// The user is picking a contact to send
type ChatActionChoosingContact struct {
meta
}
func (entity *ChatActionChoosingContact) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionChoosingContact
return json.Marshal((*stub)(entity))
}
func (*ChatActionChoosingContact) GetClass() string {
return ClassChatAction
}
func (*ChatActionChoosingContact) GetType() string {
return TypeChatActionChoosingContact
}
func (*ChatActionChoosingContact) ChatActionType() string {
return TypeChatActionChoosingContact
}
// The user has started to play a game
type ChatActionStartPlayingGame struct {
meta
}
func (entity *ChatActionStartPlayingGame) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionStartPlayingGame
return json.Marshal((*stub)(entity))
}
func (*ChatActionStartPlayingGame) GetClass() string {
return ClassChatAction
}
func (*ChatActionStartPlayingGame) GetType() string {
return TypeChatActionStartPlayingGame
}
func (*ChatActionStartPlayingGame) ChatActionType() string {
return TypeChatActionStartPlayingGame
}
// The user is recording a video note
type ChatActionRecordingVideoNote struct {
meta
}
func (entity *ChatActionRecordingVideoNote) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionRecordingVideoNote
return json.Marshal((*stub)(entity))
}
func (*ChatActionRecordingVideoNote) GetClass() string {
return ClassChatAction
}
func (*ChatActionRecordingVideoNote) GetType() string {
return TypeChatActionRecordingVideoNote
}
func (*ChatActionRecordingVideoNote) ChatActionType() string {
return TypeChatActionRecordingVideoNote
}
// The user is uploading a video note
type ChatActionUploadingVideoNote struct {
meta
// Upload progress, as a percentage
Progress int32 `json:"progress"`
}
func (entity *ChatActionUploadingVideoNote) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionUploadingVideoNote
return json.Marshal((*stub)(entity))
}
func (*ChatActionUploadingVideoNote) GetClass() string {
return ClassChatAction
}
func (*ChatActionUploadingVideoNote) GetType() string {
return TypeChatActionUploadingVideoNote
}
func (*ChatActionUploadingVideoNote) ChatActionType() string {
return TypeChatActionUploadingVideoNote
}
// The user has cancelled the previous action
type ChatActionCancel struct {
meta
}
func (entity *ChatActionCancel) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatActionCancel
return json.Marshal((*stub)(entity))
}
func (*ChatActionCancel) GetClass() string {
return ClassChatAction
}
func (*ChatActionCancel) GetType() string {
return TypeChatActionCancel
}
func (*ChatActionCancel) ChatActionType() string {
return TypeChatActionCancel
}
// The user status was never changed
type UserStatusEmpty struct {
meta
}
func (entity *UserStatusEmpty) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserStatusEmpty
return json.Marshal((*stub)(entity))
}
func (*UserStatusEmpty) GetClass() string {
return ClassUserStatus
}
func (*UserStatusEmpty) GetType() string {
return TypeUserStatusEmpty
}
func (*UserStatusEmpty) UserStatusType() string {
return TypeUserStatusEmpty
}
// The user is online
type UserStatusOnline struct {
meta
// Point in time (Unix timestamp) when the user's online status will expire
Expires int32 `json:"expires"`
}
func (entity *UserStatusOnline) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserStatusOnline
return json.Marshal((*stub)(entity))
}
func (*UserStatusOnline) GetClass() string {
return ClassUserStatus
}
func (*UserStatusOnline) GetType() string {
return TypeUserStatusOnline
}
func (*UserStatusOnline) UserStatusType() string {
return TypeUserStatusOnline
}
// The user is offline
type UserStatusOffline struct {
meta
// Point in time (Unix timestamp) when the user was last online
WasOnline int32 `json:"was_online"`
}
func (entity *UserStatusOffline) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserStatusOffline
return json.Marshal((*stub)(entity))
}
func (*UserStatusOffline) GetClass() string {
return ClassUserStatus
}
func (*UserStatusOffline) GetType() string {
return TypeUserStatusOffline
}
func (*UserStatusOffline) UserStatusType() string {
return TypeUserStatusOffline
}
// The user was online recently
type UserStatusRecently struct {
meta
}
func (entity *UserStatusRecently) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserStatusRecently
return json.Marshal((*stub)(entity))
}
func (*UserStatusRecently) GetClass() string {
return ClassUserStatus
}
func (*UserStatusRecently) GetType() string {
return TypeUserStatusRecently
}
func (*UserStatusRecently) UserStatusType() string {
return TypeUserStatusRecently
}
// The user is offline, but was online last week
type UserStatusLastWeek struct {
meta
}
func (entity *UserStatusLastWeek) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserStatusLastWeek
return json.Marshal((*stub)(entity))
}
func (*UserStatusLastWeek) GetClass() string {
return ClassUserStatus
}
func (*UserStatusLastWeek) GetType() string {
return TypeUserStatusLastWeek
}
func (*UserStatusLastWeek) UserStatusType() string {
return TypeUserStatusLastWeek
}
// The user is offline, but was online last month
type UserStatusLastMonth struct {
meta
}
func (entity *UserStatusLastMonth) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserStatusLastMonth
return json.Marshal((*stub)(entity))
}
func (*UserStatusLastMonth) GetClass() string {
return ClassUserStatus
}
func (*UserStatusLastMonth) GetType() string {
return TypeUserStatusLastMonth
}
func (*UserStatusLastMonth) UserStatusType() string {
return TypeUserStatusLastMonth
}
// Represents a list of stickers
type Stickers struct {
meta
// List of stickers
Stickers []*Sticker `json:"stickers"`
}
func (entity *Stickers) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub Stickers
return json.Marshal((*stub)(entity))
}
func (*Stickers) GetClass() string {
return ClassStickers
}
func (*Stickers) GetType() string {
return TypeStickers
}
2019-09-10 12:36:54 +00:00
// Represents a list of emoji
type Emojis struct {
2019-06-07 10:56:06 +00:00
meta
// List of emojis
Emojis []string `json:"emojis"`
}
2019-09-10 12:36:54 +00:00
func (entity *Emojis) MarshalJSON() ([]byte, error) {
2019-06-07 10:56:06 +00:00
entity.meta.Type = entity.GetType()
2019-09-10 12:36:54 +00:00
type stub Emojis
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2019-09-10 12:36:54 +00:00
func (*Emojis) GetClass() string {
return ClassEmojis
2019-06-07 10:56:06 +00:00
}
2019-09-10 12:36:54 +00:00
func (*Emojis) GetType() string {
return TypeEmojis
2019-06-07 10:56:06 +00:00
}
// Represents a sticker set
type StickerSet struct {
meta
// Identifier of the sticker set
Id JsonInt64 `json:"id"`
// Title of the sticker set
Title string `json:"title"`
// Name of the sticker set
Name string `json:"name"`
2019-09-10 12:36:54 +00:00
// Sticker set thumbnail in WEBP format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed
Thumbnail *PhotoSize `json:"thumbnail"`
2019-06-07 10:56:06 +00:00
// True, if the sticker set has been installed by the current user
IsInstalled bool `json:"is_installed"`
// True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously
IsArchived bool `json:"is_archived"`
// True, if the sticker set is official
IsOfficial bool `json:"is_official"`
2019-09-10 12:36:54 +00:00
// True, is the stickers in the set are animated
IsAnimated bool `json:"is_animated"`
2019-06-07 10:56:06 +00:00
// True, if the stickers in the set are masks
IsMasks bool `json:"is_masks"`
// True for already viewed trending sticker sets
IsViewed bool `json:"is_viewed"`
// List of stickers in this set
Stickers []*Sticker `json:"stickers"`
2019-09-10 12:36:54 +00:00
// A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object
Emojis []*Emojis `json:"emojis"`
2019-06-07 10:56:06 +00:00
}
func (entity *StickerSet) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub StickerSet
return json.Marshal((*stub)(entity))
}
func (*StickerSet) GetClass() string {
return ClassStickerSet
}
func (*StickerSet) GetType() string {
return TypeStickerSet
}
// Represents short information about a sticker set
type StickerSetInfo struct {
meta
// Identifier of the sticker set
Id JsonInt64 `json:"id"`
// Title of the sticker set
Title string `json:"title"`
// Name of the sticker set
Name string `json:"name"`
2019-09-10 12:36:54 +00:00
// Sticker set thumbnail in WEBP format with width and height 100; may be null
Thumbnail *PhotoSize `json:"thumbnail"`
2019-06-07 10:56:06 +00:00
// True, if the sticker set has been installed by current user
IsInstalled bool `json:"is_installed"`
// True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously
IsArchived bool `json:"is_archived"`
// True, if the sticker set is official
IsOfficial bool `json:"is_official"`
2019-09-10 12:36:54 +00:00
// True, is the stickers in the set are animated
IsAnimated bool `json:"is_animated"`
2019-06-07 10:56:06 +00:00
// True, if the stickers in the set are masks
IsMasks bool `json:"is_masks"`
// True for already viewed trending sticker sets
IsViewed bool `json:"is_viewed"`
// Total number of stickers in the set
Size int32 `json:"size"`
// Contains up to the first 5 stickers from the set, depending on the context. If the client needs more stickers the full set should be requested
Covers []*Sticker `json:"covers"`
}
func (entity *StickerSetInfo) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub StickerSetInfo
return json.Marshal((*stub)(entity))
}
func (*StickerSetInfo) GetClass() string {
return ClassStickerSetInfo
}
func (*StickerSetInfo) GetType() string {
return TypeStickerSetInfo
}
// Represents a list of sticker sets
type StickerSets struct {
meta
// Approximate total number of sticker sets found
TotalCount int32 `json:"total_count"`
// List of sticker sets
Sets []*StickerSetInfo `json:"sets"`
}
func (entity *StickerSets) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub StickerSets
return json.Marshal((*stub)(entity))
}
func (*StickerSets) GetClass() string {
return ClassStickerSets
}
func (*StickerSets) GetType() string {
return TypeStickerSets
}
// The call wasn't discarded, or the reason is unknown
type CallDiscardReasonEmpty struct {
meta
}
func (entity *CallDiscardReasonEmpty) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallDiscardReasonEmpty
return json.Marshal((*stub)(entity))
}
func (*CallDiscardReasonEmpty) GetClass() string {
return ClassCallDiscardReason
}
func (*CallDiscardReasonEmpty) GetType() string {
return TypeCallDiscardReasonEmpty
}
func (*CallDiscardReasonEmpty) CallDiscardReasonType() string {
return TypeCallDiscardReasonEmpty
}
// The call was ended before the conversation started. It was cancelled by the caller or missed by the other party
type CallDiscardReasonMissed struct {
meta
}
func (entity *CallDiscardReasonMissed) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallDiscardReasonMissed
return json.Marshal((*stub)(entity))
}
func (*CallDiscardReasonMissed) GetClass() string {
return ClassCallDiscardReason
}
func (*CallDiscardReasonMissed) GetType() string {
return TypeCallDiscardReasonMissed
}
func (*CallDiscardReasonMissed) CallDiscardReasonType() string {
return TypeCallDiscardReasonMissed
}
// The call was ended before the conversation started. It was declined by the other party
type CallDiscardReasonDeclined struct {
meta
}
func (entity *CallDiscardReasonDeclined) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallDiscardReasonDeclined
return json.Marshal((*stub)(entity))
}
func (*CallDiscardReasonDeclined) GetClass() string {
return ClassCallDiscardReason
}
func (*CallDiscardReasonDeclined) GetType() string {
return TypeCallDiscardReasonDeclined
}
func (*CallDiscardReasonDeclined) CallDiscardReasonType() string {
return TypeCallDiscardReasonDeclined
}
// The call was ended during the conversation because the users were disconnected
type CallDiscardReasonDisconnected struct {
meta
}
func (entity *CallDiscardReasonDisconnected) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallDiscardReasonDisconnected
return json.Marshal((*stub)(entity))
}
func (*CallDiscardReasonDisconnected) GetClass() string {
return ClassCallDiscardReason
}
func (*CallDiscardReasonDisconnected) GetType() string {
return TypeCallDiscardReasonDisconnected
}
func (*CallDiscardReasonDisconnected) CallDiscardReasonType() string {
return TypeCallDiscardReasonDisconnected
}
// The call was ended because one of the parties hung up
type CallDiscardReasonHungUp struct {
meta
}
func (entity *CallDiscardReasonHungUp) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallDiscardReasonHungUp
return json.Marshal((*stub)(entity))
}
func (*CallDiscardReasonHungUp) GetClass() string {
return ClassCallDiscardReason
}
func (*CallDiscardReasonHungUp) GetType() string {
return TypeCallDiscardReasonHungUp
}
func (*CallDiscardReasonHungUp) CallDiscardReasonType() string {
return TypeCallDiscardReasonHungUp
}
// Specifies the supported call protocols
type CallProtocol struct {
meta
// True, if UDP peer-to-peer connections are supported
UdpP2p bool `json:"udp_p2p"`
// True, if connection through UDP reflectors is supported
UdpReflector bool `json:"udp_reflector"`
// Minimum supported API layer; use 65
MinLayer int32 `json:"min_layer"`
// Maximum supported API layer; use 65
MaxLayer int32 `json:"max_layer"`
}
func (entity *CallProtocol) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallProtocol
return json.Marshal((*stub)(entity))
}
func (*CallProtocol) GetClass() string {
return ClassCallProtocol
}
func (*CallProtocol) GetType() string {
return TypeCallProtocol
}
// Describes the address of UDP reflectors
type CallConnection struct {
meta
// Reflector identifier
Id JsonInt64 `json:"id"`
// IPv4 reflector address
Ip string `json:"ip"`
// IPv6 reflector address
Ipv6 string `json:"ipv6"`
// Reflector port number
Port int32 `json:"port"`
// Connection peer tag
PeerTag []byte `json:"peer_tag"`
}
func (entity *CallConnection) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallConnection
return json.Marshal((*stub)(entity))
}
func (*CallConnection) GetClass() string {
return ClassCallConnection
}
func (*CallConnection) GetType() string {
return TypeCallConnection
}
// Contains the call identifier
type CallId struct {
meta
// Call identifier
Id int32 `json:"id"`
}
func (entity *CallId) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallId
return json.Marshal((*stub)(entity))
}
func (*CallId) GetClass() string {
return ClassCallId
}
func (*CallId) GetType() string {
return TypeCallId
}
// The call is pending, waiting to be accepted by a user
type CallStatePending struct {
meta
// True, if the call has already been created by the server
IsCreated bool `json:"is_created"`
// True, if the call has already been received by the other party
IsReceived bool `json:"is_received"`
}
func (entity *CallStatePending) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallStatePending
return json.Marshal((*stub)(entity))
}
func (*CallStatePending) GetClass() string {
return ClassCallState
}
func (*CallStatePending) GetType() string {
return TypeCallStatePending
}
func (*CallStatePending) CallStateType() string {
return TypeCallStatePending
}
// The call has been answered and encryption keys are being exchanged
type CallStateExchangingKeys struct {
meta
}
func (entity *CallStateExchangingKeys) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallStateExchangingKeys
return json.Marshal((*stub)(entity))
}
func (*CallStateExchangingKeys) GetClass() string {
return ClassCallState
}
func (*CallStateExchangingKeys) GetType() string {
return TypeCallStateExchangingKeys
}
func (*CallStateExchangingKeys) CallStateType() string {
return TypeCallStateExchangingKeys
}
// The call is ready to use
type CallStateReady struct {
meta
// Call protocols supported by the peer
Protocol *CallProtocol `json:"protocol"`
// Available UDP reflectors
Connections []*CallConnection `json:"connections"`
// A JSON-encoded call config
Config string `json:"config"`
// Call encryption key
EncryptionKey []byte `json:"encryption_key"`
// Encryption key emojis fingerprint
Emojis []string `json:"emojis"`
// True, if peer-to-peer connection is allowed by users privacy settings
AllowP2p bool `json:"allow_p2p"`
}
func (entity *CallStateReady) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallStateReady
return json.Marshal((*stub)(entity))
}
func (*CallStateReady) GetClass() string {
return ClassCallState
}
func (*CallStateReady) GetType() string {
return TypeCallStateReady
}
func (*CallStateReady) CallStateType() string {
return TypeCallStateReady
}
// The call is hanging up after discardCall has been called
type CallStateHangingUp struct {
meta
}
func (entity *CallStateHangingUp) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallStateHangingUp
return json.Marshal((*stub)(entity))
}
func (*CallStateHangingUp) GetClass() string {
return ClassCallState
}
func (*CallStateHangingUp) GetType() string {
return TypeCallStateHangingUp
}
func (*CallStateHangingUp) CallStateType() string {
return TypeCallStateHangingUp
}
// The call has ended successfully
type CallStateDiscarded struct {
meta
// The reason, why the call has ended
Reason CallDiscardReason `json:"reason"`
// True, if the call rating should be sent to the server
NeedRating bool `json:"need_rating"`
// True, if the call debug information should be sent to the server
NeedDebugInformation bool `json:"need_debug_information"`
}
func (entity *CallStateDiscarded) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallStateDiscarded
return json.Marshal((*stub)(entity))
}
func (*CallStateDiscarded) GetClass() string {
return ClassCallState
}
func (*CallStateDiscarded) GetType() string {
return TypeCallStateDiscarded
}
func (*CallStateDiscarded) CallStateType() string {
return TypeCallStateDiscarded
}
func (callStateDiscarded *CallStateDiscarded) UnmarshalJSON(data []byte) error {
var tmp struct {
Reason json.RawMessage `json:"reason"`
NeedRating bool `json:"need_rating"`
NeedDebugInformation bool `json:"need_debug_information"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
callStateDiscarded.NeedRating = tmp.NeedRating
callStateDiscarded.NeedDebugInformation = tmp.NeedDebugInformation
fieldReason, _ := UnmarshalCallDiscardReason(tmp.Reason)
callStateDiscarded.Reason = fieldReason
return nil
}
// The call has ended with an error
type CallStateError struct {
meta
// Error. An error with the code 4005000 will be returned if an outgoing call is missed because of an expired timeout
Error *Error `json:"error"`
}
func (entity *CallStateError) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallStateError
return json.Marshal((*stub)(entity))
}
func (*CallStateError) GetClass() string {
return ClassCallState
}
func (*CallStateError) GetType() string {
return TypeCallStateError
}
func (*CallStateError) CallStateType() string {
return TypeCallStateError
}
2019-09-10 12:36:54 +00:00
// The user heard their own voice
type CallProblemEcho struct {
meta
}
func (entity *CallProblemEcho) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallProblemEcho
return json.Marshal((*stub)(entity))
}
func (*CallProblemEcho) GetClass() string {
return ClassCallProblem
}
func (*CallProblemEcho) GetType() string {
return TypeCallProblemEcho
}
func (*CallProblemEcho) CallProblemType() string {
return TypeCallProblemEcho
}
// The user heard background noise
type CallProblemNoise struct {
meta
}
func (entity *CallProblemNoise) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallProblemNoise
return json.Marshal((*stub)(entity))
}
func (*CallProblemNoise) GetClass() string {
return ClassCallProblem
}
func (*CallProblemNoise) GetType() string {
return TypeCallProblemNoise
}
func (*CallProblemNoise) CallProblemType() string {
return TypeCallProblemNoise
}
// The other side kept disappearing
type CallProblemInterruptions struct {
meta
}
func (entity *CallProblemInterruptions) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallProblemInterruptions
return json.Marshal((*stub)(entity))
}
func (*CallProblemInterruptions) GetClass() string {
return ClassCallProblem
}
func (*CallProblemInterruptions) GetType() string {
return TypeCallProblemInterruptions
}
func (*CallProblemInterruptions) CallProblemType() string {
return TypeCallProblemInterruptions
}
// The speech was distorted
type CallProblemDistortedSpeech struct {
meta
}
func (entity *CallProblemDistortedSpeech) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallProblemDistortedSpeech
return json.Marshal((*stub)(entity))
}
func (*CallProblemDistortedSpeech) GetClass() string {
return ClassCallProblem
}
func (*CallProblemDistortedSpeech) GetType() string {
return TypeCallProblemDistortedSpeech
}
func (*CallProblemDistortedSpeech) CallProblemType() string {
return TypeCallProblemDistortedSpeech
}
// The user couldn't hear the other side
type CallProblemSilentLocal struct {
meta
}
func (entity *CallProblemSilentLocal) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallProblemSilentLocal
return json.Marshal((*stub)(entity))
}
func (*CallProblemSilentLocal) GetClass() string {
return ClassCallProblem
}
func (*CallProblemSilentLocal) GetType() string {
return TypeCallProblemSilentLocal
}
func (*CallProblemSilentLocal) CallProblemType() string {
return TypeCallProblemSilentLocal
}
// The other side couldn't hear the user
type CallProblemSilentRemote struct {
meta
}
func (entity *CallProblemSilentRemote) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallProblemSilentRemote
return json.Marshal((*stub)(entity))
}
func (*CallProblemSilentRemote) GetClass() string {
return ClassCallProblem
}
func (*CallProblemSilentRemote) GetType() string {
return TypeCallProblemSilentRemote
}
func (*CallProblemSilentRemote) CallProblemType() string {
return TypeCallProblemSilentRemote
}
// The call ended unexpectedly
type CallProblemDropped struct {
meta
}
func (entity *CallProblemDropped) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub CallProblemDropped
return json.Marshal((*stub)(entity))
}
func (*CallProblemDropped) GetClass() string {
return ClassCallProblem
}
func (*CallProblemDropped) GetType() string {
return TypeCallProblemDropped
}
func (*CallProblemDropped) CallProblemType() string {
return TypeCallProblemDropped
}
2019-06-07 10:56:06 +00:00
// Describes a call
type Call struct {
meta
// Call identifier, not persistent
Id int32 `json:"id"`
// Peer user identifier
UserId int32 `json:"user_id"`
// True, if the call is outgoing
IsOutgoing bool `json:"is_outgoing"`
// Call state
State CallState `json:"state"`
}
func (entity *Call) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub Call
return json.Marshal((*stub)(entity))
}
func (*Call) GetClass() string {
return ClassCall
}
func (*Call) GetType() string {
return TypeCall
}
func (call *Call) UnmarshalJSON(data []byte) error {
var tmp struct {
Id int32 `json:"id"`
UserId int32 `json:"user_id"`
IsOutgoing bool `json:"is_outgoing"`
State json.RawMessage `json:"state"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
call.Id = tmp.Id
call.UserId = tmp.UserId
call.IsOutgoing = tmp.IsOutgoing
fieldState, _ := UnmarshalCallState(tmp.State)
call.State = fieldState
return nil
}
2019-09-10 12:36:54 +00:00
// Contains settings for the authentication of the user's phone number
type PhoneNumberAuthenticationSettings struct {
meta
// Pass true if the authentication code may be sent via flash call to the specified phone number
AllowFlashCall bool `json:"allow_flash_call"`
// Pass true if the authenticated phone number is used on the current device
IsCurrentPhoneNumber bool `json:"is_current_phone_number"`
// For official applications only. True, if the app can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details
AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"`
}
func (entity *PhoneNumberAuthenticationSettings) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub PhoneNumberAuthenticationSettings
return json.Marshal((*stub)(entity))
}
func (*PhoneNumberAuthenticationSettings) GetClass() string {
return ClassPhoneNumberAuthenticationSettings
}
func (*PhoneNumberAuthenticationSettings) GetType() string {
return TypePhoneNumberAuthenticationSettings
}
2019-06-07 10:56:06 +00:00
// Represents a list of animations
type Animations struct {
meta
// List of animations
Animations []*Animation `json:"animations"`
}
func (entity *Animations) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub Animations
return json.Marshal((*stub)(entity))
}
func (*Animations) GetClass() string {
return ClassAnimations
}
func (*Animations) GetType() string {
return TypeAnimations
}
// Represents the result of an ImportContacts request
type ImportedContacts struct {
meta
// User identifiers of the imported contacts in the same order as they were specified in the request; 0 if the contact is not yet a registered user
UserIds []int32 `json:"user_ids"`
// The number of users that imported the corresponding contact; 0 for already registered users or if unavailable
ImporterCount []int32 `json:"importer_count"`
}
func (entity *ImportedContacts) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ImportedContacts
return json.Marshal((*stub)(entity))
}
func (*ImportedContacts) GetClass() string {
return ClassImportedContacts
}
func (*ImportedContacts) GetType() string {
return TypeImportedContacts
}
// Contains an HTTP URL
type HttpUrl struct {
meta
// The URL
Url string `json:"url"`
}
func (entity *HttpUrl) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub HttpUrl
return json.Marshal((*stub)(entity))
}
func (*HttpUrl) GetClass() string {
return ClassHttpUrl
}
func (*HttpUrl) GetType() string {
return TypeHttpUrl
}
// Represents a link to an animated GIF
type InputInlineQueryResultAnimatedGif struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Title of the query result
Title string `json:"title"`
// URL of the static result thumbnail (JPEG or GIF), if it exists
ThumbnailUrl string `json:"thumbnail_url"`
// The URL of the GIF-file (file size must not exceed 1MB)
GifUrl string `json:"gif_url"`
// Duration of the GIF, in seconds
GifDuration int32 `json:"gif_duration"`
// Width of the GIF
GifWidth int32 `json:"gif_width"`
// Height of the GIF
GifHeight int32 `json:"gif_height"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultAnimatedGif) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultAnimatedGif
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultAnimatedGif) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultAnimatedGif) GetType() string {
return TypeInputInlineQueryResultAnimatedGif
}
func (*InputInlineQueryResultAnimatedGif) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultAnimatedGif
}
func (inputInlineQueryResultAnimatedGif *InputInlineQueryResultAnimatedGif) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Title string `json:"title"`
ThumbnailUrl string `json:"thumbnail_url"`
GifUrl string `json:"gif_url"`
GifDuration int32 `json:"gif_duration"`
GifWidth int32 `json:"gif_width"`
GifHeight int32 `json:"gif_height"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultAnimatedGif.Id = tmp.Id
inputInlineQueryResultAnimatedGif.Title = tmp.Title
inputInlineQueryResultAnimatedGif.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultAnimatedGif.GifUrl = tmp.GifUrl
inputInlineQueryResultAnimatedGif.GifDuration = tmp.GifDuration
inputInlineQueryResultAnimatedGif.GifWidth = tmp.GifWidth
inputInlineQueryResultAnimatedGif.GifHeight = tmp.GifHeight
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultAnimatedGif.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultAnimatedGif.InputMessageContent = fieldInputMessageContent
return nil
}
// Represents a link to an animated (i.e. without sound) H.264/MPEG-4 AVC video
type InputInlineQueryResultAnimatedMpeg4 struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Title of the result
Title string `json:"title"`
// URL of the static result thumbnail (JPEG or GIF), if it exists
ThumbnailUrl string `json:"thumbnail_url"`
// The URL of the MPEG4-file (file size must not exceed 1MB)
Mpeg4Url string `json:"mpeg4_url"`
// Duration of the video, in seconds
Mpeg4Duration int32 `json:"mpeg4_duration"`
// Width of the video
Mpeg4Width int32 `json:"mpeg4_width"`
// Height of the video
Mpeg4Height int32 `json:"mpeg4_height"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultAnimatedMpeg4) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultAnimatedMpeg4
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultAnimatedMpeg4) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultAnimatedMpeg4) GetType() string {
return TypeInputInlineQueryResultAnimatedMpeg4
}
func (*InputInlineQueryResultAnimatedMpeg4) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultAnimatedMpeg4
}
func (inputInlineQueryResultAnimatedMpeg4 *InputInlineQueryResultAnimatedMpeg4) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Title string `json:"title"`
ThumbnailUrl string `json:"thumbnail_url"`
Mpeg4Url string `json:"mpeg4_url"`
Mpeg4Duration int32 `json:"mpeg4_duration"`
Mpeg4Width int32 `json:"mpeg4_width"`
Mpeg4Height int32 `json:"mpeg4_height"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultAnimatedMpeg4.Id = tmp.Id
inputInlineQueryResultAnimatedMpeg4.Title = tmp.Title
inputInlineQueryResultAnimatedMpeg4.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultAnimatedMpeg4.Mpeg4Url = tmp.Mpeg4Url
inputInlineQueryResultAnimatedMpeg4.Mpeg4Duration = tmp.Mpeg4Duration
inputInlineQueryResultAnimatedMpeg4.Mpeg4Width = tmp.Mpeg4Width
inputInlineQueryResultAnimatedMpeg4.Mpeg4Height = tmp.Mpeg4Height
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultAnimatedMpeg4.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultAnimatedMpeg4.InputMessageContent = fieldInputMessageContent
return nil
}
// Represents a link to an article or web page
type InputInlineQueryResultArticle struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// URL of the result, if it exists
Url string `json:"url"`
// True, if the URL must be not shown
HideUrl bool `json:"hide_url"`
// Title of the result
Title string `json:"title"`
// A short description of the result
Description string `json:"description"`
// URL of the result thumbnail, if it exists
ThumbnailUrl string `json:"thumbnail_url"`
// Thumbnail width, if known
ThumbnailWidth int32 `json:"thumbnail_width"`
// Thumbnail height, if known
ThumbnailHeight int32 `json:"thumbnail_height"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultArticle) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultArticle
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultArticle) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultArticle) GetType() string {
return TypeInputInlineQueryResultArticle
}
func (*InputInlineQueryResultArticle) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultArticle
}
func (inputInlineQueryResultArticle *InputInlineQueryResultArticle) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Url string `json:"url"`
HideUrl bool `json:"hide_url"`
Title string `json:"title"`
Description string `json:"description"`
ThumbnailUrl string `json:"thumbnail_url"`
ThumbnailWidth int32 `json:"thumbnail_width"`
ThumbnailHeight int32 `json:"thumbnail_height"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultArticle.Id = tmp.Id
inputInlineQueryResultArticle.Url = tmp.Url
inputInlineQueryResultArticle.HideUrl = tmp.HideUrl
inputInlineQueryResultArticle.Title = tmp.Title
inputInlineQueryResultArticle.Description = tmp.Description
inputInlineQueryResultArticle.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultArticle.ThumbnailWidth = tmp.ThumbnailWidth
inputInlineQueryResultArticle.ThumbnailHeight = tmp.ThumbnailHeight
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultArticle.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultArticle.InputMessageContent = fieldInputMessageContent
return nil
}
// Represents a link to an MP3 audio file
type InputInlineQueryResultAudio struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Title of the audio file
Title string `json:"title"`
// Performer of the audio file
Performer string `json:"performer"`
// The URL of the audio file
AudioUrl string `json:"audio_url"`
// Audio file duration, in seconds
AudioDuration int32 `json:"audio_duration"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAudio, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultAudio) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultAudio
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultAudio) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultAudio) GetType() string {
return TypeInputInlineQueryResultAudio
}
func (*InputInlineQueryResultAudio) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultAudio
}
func (inputInlineQueryResultAudio *InputInlineQueryResultAudio) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Title string `json:"title"`
Performer string `json:"performer"`
AudioUrl string `json:"audio_url"`
AudioDuration int32 `json:"audio_duration"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultAudio.Id = tmp.Id
inputInlineQueryResultAudio.Title = tmp.Title
inputInlineQueryResultAudio.Performer = tmp.Performer
inputInlineQueryResultAudio.AudioUrl = tmp.AudioUrl
inputInlineQueryResultAudio.AudioDuration = tmp.AudioDuration
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultAudio.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultAudio.InputMessageContent = fieldInputMessageContent
return nil
}
// Represents a user contact
type InputInlineQueryResultContact struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// User contact
Contact *Contact `json:"contact"`
// URL of the result thumbnail, if it exists
ThumbnailUrl string `json:"thumbnail_url"`
// Thumbnail width, if known
ThumbnailWidth int32 `json:"thumbnail_width"`
// Thumbnail height, if known
ThumbnailHeight int32 `json:"thumbnail_height"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultContact) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultContact
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultContact) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultContact) GetType() string {
return TypeInputInlineQueryResultContact
}
func (*InputInlineQueryResultContact) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultContact
}
func (inputInlineQueryResultContact *InputInlineQueryResultContact) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Contact *Contact `json:"contact"`
ThumbnailUrl string `json:"thumbnail_url"`
ThumbnailWidth int32 `json:"thumbnail_width"`
ThumbnailHeight int32 `json:"thumbnail_height"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultContact.Id = tmp.Id
inputInlineQueryResultContact.Contact = tmp.Contact
inputInlineQueryResultContact.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultContact.ThumbnailWidth = tmp.ThumbnailWidth
inputInlineQueryResultContact.ThumbnailHeight = tmp.ThumbnailHeight
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultContact.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultContact.InputMessageContent = fieldInputMessageContent
return nil
}
// Represents a link to a file
type InputInlineQueryResultDocument struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Title of the resulting file
Title string `json:"title"`
// Short description of the result, if known
Description string `json:"description"`
// URL of the file
DocumentUrl string `json:"document_url"`
// MIME type of the file content; only "application/pdf" and "application/zip" are currently allowed
MimeType string `json:"mime_type"`
// The URL of the file thumbnail, if it exists
ThumbnailUrl string `json:"thumbnail_url"`
// Width of the thumbnail
ThumbnailWidth int32 `json:"thumbnail_width"`
// Height of the thumbnail
ThumbnailHeight int32 `json:"thumbnail_height"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageDocument, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultDocument) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultDocument
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultDocument) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultDocument) GetType() string {
return TypeInputInlineQueryResultDocument
}
func (*InputInlineQueryResultDocument) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultDocument
}
func (inputInlineQueryResultDocument *InputInlineQueryResultDocument) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
DocumentUrl string `json:"document_url"`
MimeType string `json:"mime_type"`
ThumbnailUrl string `json:"thumbnail_url"`
ThumbnailWidth int32 `json:"thumbnail_width"`
ThumbnailHeight int32 `json:"thumbnail_height"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultDocument.Id = tmp.Id
inputInlineQueryResultDocument.Title = tmp.Title
inputInlineQueryResultDocument.Description = tmp.Description
inputInlineQueryResultDocument.DocumentUrl = tmp.DocumentUrl
inputInlineQueryResultDocument.MimeType = tmp.MimeType
inputInlineQueryResultDocument.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultDocument.ThumbnailWidth = tmp.ThumbnailWidth
inputInlineQueryResultDocument.ThumbnailHeight = tmp.ThumbnailHeight
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultDocument.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultDocument.InputMessageContent = fieldInputMessageContent
return nil
}
// Represents a game
type InputInlineQueryResultGame struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Short name of the game
GameShortName string `json:"game_short_name"`
// Message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
}
func (entity *InputInlineQueryResultGame) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultGame
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultGame) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultGame) GetType() string {
return TypeInputInlineQueryResultGame
}
func (*InputInlineQueryResultGame) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultGame
}
func (inputInlineQueryResultGame *InputInlineQueryResultGame) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
GameShortName string `json:"game_short_name"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultGame.Id = tmp.Id
inputInlineQueryResultGame.GameShortName = tmp.GameShortName
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultGame.ReplyMarkup = fieldReplyMarkup
return nil
}
// Represents a point on the map
type InputInlineQueryResultLocation struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Location result
Location *Location `json:"location"`
// Amount of time relative to the message sent time until the location can be updated, in seconds
LivePeriod int32 `json:"live_period"`
// Title of the result
Title string `json:"title"`
// URL of the result thumbnail, if it exists
ThumbnailUrl string `json:"thumbnail_url"`
// Thumbnail width, if known
ThumbnailWidth int32 `json:"thumbnail_width"`
// Thumbnail height, if known
ThumbnailHeight int32 `json:"thumbnail_height"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultLocation) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultLocation
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultLocation) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultLocation) GetType() string {
return TypeInputInlineQueryResultLocation
}
func (*InputInlineQueryResultLocation) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultLocation
}
func (inputInlineQueryResultLocation *InputInlineQueryResultLocation) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Location *Location `json:"location"`
LivePeriod int32 `json:"live_period"`
Title string `json:"title"`
ThumbnailUrl string `json:"thumbnail_url"`
ThumbnailWidth int32 `json:"thumbnail_width"`
ThumbnailHeight int32 `json:"thumbnail_height"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultLocation.Id = tmp.Id
inputInlineQueryResultLocation.Location = tmp.Location
inputInlineQueryResultLocation.LivePeriod = tmp.LivePeriod
inputInlineQueryResultLocation.Title = tmp.Title
inputInlineQueryResultLocation.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultLocation.ThumbnailWidth = tmp.ThumbnailWidth
inputInlineQueryResultLocation.ThumbnailHeight = tmp.ThumbnailHeight
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultLocation.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultLocation.InputMessageContent = fieldInputMessageContent
return nil
}
// Represents link to a JPEG image
type InputInlineQueryResultPhoto struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Title of the result, if known
Title string `json:"title"`
// A short description of the result, if known
Description string `json:"description"`
// URL of the photo thumbnail, if it exists
ThumbnailUrl string `json:"thumbnail_url"`
// The URL of the JPEG photo (photo size must not exceed 5MB)
PhotoUrl string `json:"photo_url"`
// Width of the photo
PhotoWidth int32 `json:"photo_width"`
// Height of the photo
PhotoHeight int32 `json:"photo_height"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessagePhoto, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultPhoto) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultPhoto
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultPhoto) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultPhoto) GetType() string {
return TypeInputInlineQueryResultPhoto
}
func (*InputInlineQueryResultPhoto) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultPhoto
}
func (inputInlineQueryResultPhoto *InputInlineQueryResultPhoto) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
ThumbnailUrl string `json:"thumbnail_url"`
PhotoUrl string `json:"photo_url"`
PhotoWidth int32 `json:"photo_width"`
PhotoHeight int32 `json:"photo_height"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultPhoto.Id = tmp.Id
inputInlineQueryResultPhoto.Title = tmp.Title
inputInlineQueryResultPhoto.Description = tmp.Description
inputInlineQueryResultPhoto.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultPhoto.PhotoUrl = tmp.PhotoUrl
inputInlineQueryResultPhoto.PhotoWidth = tmp.PhotoWidth
inputInlineQueryResultPhoto.PhotoHeight = tmp.PhotoHeight
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultPhoto.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultPhoto.InputMessageContent = fieldInputMessageContent
return nil
}
2019-09-10 12:36:54 +00:00
// Represents a link to a WEBP or a TGS sticker
2019-06-07 10:56:06 +00:00
type InputInlineQueryResultSticker struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// URL of the sticker thumbnail, if it exists
ThumbnailUrl string `json:"thumbnail_url"`
2019-09-10 12:36:54 +00:00
// The URL of the WEBP or a TGS sticker (sticker file size must not exceed 5MB)
2019-06-07 10:56:06 +00:00
StickerUrl string `json:"sticker_url"`
// Width of the sticker
StickerWidth int32 `json:"sticker_width"`
// Height of the sticker
StickerHeight int32 `json:"sticker_height"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, inputMessageSticker, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultSticker) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultSticker
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultSticker) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultSticker) GetType() string {
return TypeInputInlineQueryResultSticker
}
func (*InputInlineQueryResultSticker) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultSticker
}
func (inputInlineQueryResultSticker *InputInlineQueryResultSticker) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
ThumbnailUrl string `json:"thumbnail_url"`
StickerUrl string `json:"sticker_url"`
StickerWidth int32 `json:"sticker_width"`
StickerHeight int32 `json:"sticker_height"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultSticker.Id = tmp.Id
inputInlineQueryResultSticker.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultSticker.StickerUrl = tmp.StickerUrl
inputInlineQueryResultSticker.StickerWidth = tmp.StickerWidth
inputInlineQueryResultSticker.StickerHeight = tmp.StickerHeight
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultSticker.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultSticker.InputMessageContent = fieldInputMessageContent
return nil
}
// Represents information about a venue
type InputInlineQueryResultVenue struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Venue result
Venue *Venue `json:"venue"`
// URL of the result thumbnail, if it exists
ThumbnailUrl string `json:"thumbnail_url"`
// Thumbnail width, if known
ThumbnailWidth int32 `json:"thumbnail_width"`
// Thumbnail height, if known
ThumbnailHeight int32 `json:"thumbnail_height"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultVenue) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputInlineQueryResultVenue
return json.Marshal((*stub)(entity))
}
func (*InputInlineQueryResultVenue) GetClass() string {
return ClassInputInlineQueryResult
}
func (*InputInlineQueryResultVenue) GetType() string {
return TypeInputInlineQueryResultVenue
}
func (*InputInlineQueryResultVenue) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultVenue
}
func (inputInlineQueryResultVenue *InputInlineQueryResultVenue) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Venue *Venue `json:"venue"`
ThumbnailUrl string `json:"thumbnail_url"`
ThumbnailWidth int32 `json:"thumbnail_width"`
ThumbnailHeight int32 `json:"thumbnail_height"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
inputInlineQueryResultVenue.Id = tmp.Id
inputInlineQueryResultVenue.Venue = tmp.Venue
inputInlineQueryResultVenue.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultVenue.ThumbnailWidth = tmp.ThumbnailWidth
inputInlineQueryResultVenue.ThumbnailHeight = tmp.ThumbnailHeight
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultVenue.ReplyMarkup = fieldReplyMarkup
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultVenue.InputMessageContent = fieldInputMessageContent
return nil
}
// Represents a link to a page containing an embedded video player or a video file
type InputInlineQueryResultVideo struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Title of the result
Title string `json:"title"`
// A short description of the result, if known
Description string `json:"description"`
// The URL of the video thumbnail (JPEG), if it exists
ThumbnailUrl string `json:"thumbnail_url"`
// URL of the embedded video player or video file
VideoUrl string `json:"video_url"`
// MIME type of the content of the video URL, only "text/html" or "video/mp4" are currently supported
MimeType string `json:"mime_type"`
// Width of the video
VideoWidth int32 `json:"video_width"`
// Height of the video
VideoHeight int32 `json:"video_height"`
// Video duration, in seconds
VideoDuration int32 `json:"video_duration"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageVideo, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
}
func (entity *InputInlineQueryResultVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputInlineQueryResultVideo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputInlineQueryResultVideo) GetClass() string {
return ClassInputInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputInlineQueryResultVideo) GetType() string {
return TypeInputInlineQueryResultVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputInlineQueryResultVideo) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputInlineQueryResultVideo *InputInlineQueryResultVideo) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
ThumbnailUrl string `json:"thumbnail_url"`
VideoUrl string `json:"video_url"`
MimeType string `json:"mime_type"`
VideoWidth int32 `json:"video_width"`
VideoHeight int32 `json:"video_height"`
VideoDuration int32 `json:"video_duration"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
inputInlineQueryResultVideo.Id = tmp.Id
inputInlineQueryResultVideo.Title = tmp.Title
inputInlineQueryResultVideo.Description = tmp.Description
inputInlineQueryResultVideo.ThumbnailUrl = tmp.ThumbnailUrl
inputInlineQueryResultVideo.VideoUrl = tmp.VideoUrl
inputInlineQueryResultVideo.MimeType = tmp.MimeType
inputInlineQueryResultVideo.VideoWidth = tmp.VideoWidth
inputInlineQueryResultVideo.VideoHeight = tmp.VideoHeight
inputInlineQueryResultVideo.VideoDuration = tmp.VideoDuration
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultVideo.ReplyMarkup = fieldReplyMarkup
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultVideo.InputMessageContent = fieldInputMessageContent
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a link to an opus-encoded audio file within an OGG container, single channel audio
type InputInlineQueryResultVoiceNote struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Title of the voice note
Title string `json:"title"`
// The URL of the voice note file
VoiceNoteUrl string `json:"voice_note_url"`
// Duration of the voice note, in seconds
VoiceNoteDuration int32 `json:"voice_note_duration"`
// The message reply markup. Must be of type replyMarkupInlineKeyboard or null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageVoiceNote, InputMessageLocation, InputMessageVenue or InputMessageContact
InputMessageContent InputMessageContent `json:"input_message_content"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InputInlineQueryResultVoiceNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InputInlineQueryResultVoiceNote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputInlineQueryResultVoiceNote) GetClass() string {
return ClassInputInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputInlineQueryResultVoiceNote) GetType() string {
return TypeInputInlineQueryResultVoiceNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InputInlineQueryResultVoiceNote) InputInlineQueryResultType() string {
return TypeInputInlineQueryResultVoiceNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (inputInlineQueryResultVoiceNote *InputInlineQueryResultVoiceNote) UnmarshalJSON(data []byte) error {
var tmp struct {
Id string `json:"id"`
Title string `json:"title"`
VoiceNoteUrl string `json:"voice_note_url"`
VoiceNoteDuration int32 `json:"voice_note_duration"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
InputMessageContent json.RawMessage `json:"input_message_content"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
inputInlineQueryResultVoiceNote.Id = tmp.Id
inputInlineQueryResultVoiceNote.Title = tmp.Title
inputInlineQueryResultVoiceNote.VoiceNoteUrl = tmp.VoiceNoteUrl
inputInlineQueryResultVoiceNote.VoiceNoteDuration = tmp.VoiceNoteDuration
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
inputInlineQueryResultVoiceNote.ReplyMarkup = fieldReplyMarkup
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent)
inputInlineQueryResultVoiceNote.InputMessageContent = fieldInputMessageContent
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a link to an article or web page
type InlineQueryResultArticle struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// URL of the result, if it exists
Url string `json:"url"`
// True, if the URL must be not shown
HideUrl bool `json:"hide_url"`
// Title of the result
Title string `json:"title"`
// A short description of the result
Description string `json:"description"`
// Result thumbnail; may be null
Thumbnail *PhotoSize `json:"thumbnail"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultArticle) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultArticle
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultArticle) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultArticle) GetType() string {
return TypeInlineQueryResultArticle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultArticle) InlineQueryResultType() string {
return TypeInlineQueryResultArticle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a user contact
type InlineQueryResultContact struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// A user contact
Contact *Contact `json:"contact"`
// Result thumbnail; may be null
Thumbnail *PhotoSize `json:"thumbnail"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultContact) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultContact
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultContact) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultContact) GetType() string {
return TypeInlineQueryResultContact
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultContact) InlineQueryResultType() string {
return TypeInlineQueryResultContact
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a point on the map
type InlineQueryResultLocation struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Location result
Location *Location `json:"location"`
// Title of the result
Title string `json:"title"`
// Result thumbnail; may be null
Thumbnail *PhotoSize `json:"thumbnail"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultLocation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultLocation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultLocation) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultLocation) GetType() string {
return TypeInlineQueryResultLocation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultLocation) InlineQueryResultType() string {
return TypeInlineQueryResultLocation
}
// Represents information about a venue
type InlineQueryResultVenue struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Venue result
Venue *Venue `json:"venue"`
// Result thumbnail; may be null
Thumbnail *PhotoSize `json:"thumbnail"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultVenue) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultVenue
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultVenue) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultVenue) GetType() string {
return TypeInlineQueryResultVenue
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultVenue) InlineQueryResultType() string {
return TypeInlineQueryResultVenue
}
// Represents information about a game
type InlineQueryResultGame struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Game result
Game *Game `json:"game"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultGame) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultGame
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultGame) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultGame) GetType() string {
return TypeInlineQueryResultGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultGame) InlineQueryResultType() string {
return TypeInlineQueryResultGame
}
// Represents an animation file
type InlineQueryResultAnimation struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Animation file
Animation *Animation `json:"animation"`
// Animation title
Title string `json:"title"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultAnimation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultAnimation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultAnimation) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultAnimation) GetType() string {
return TypeInlineQueryResultAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultAnimation) InlineQueryResultType() string {
return TypeInlineQueryResultAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents an audio file
type InlineQueryResultAudio struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Audio file
Audio *Audio `json:"audio"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultAudio) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultAudio
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultAudio) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultAudio) GetType() string {
return TypeInlineQueryResultAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultAudio) InlineQueryResultType() string {
return TypeInlineQueryResultAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a document
type InlineQueryResultDocument struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Document
Document *Document `json:"document"`
// Document title
Title string `json:"title"`
// Document description
Description string `json:"description"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultDocument
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultDocument) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultDocument) GetType() string {
return TypeInlineQueryResultDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultDocument) InlineQueryResultType() string {
return TypeInlineQueryResultDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a photo
type InlineQueryResultPhoto struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Photo
Photo *Photo `json:"photo"`
// Title of the result, if known
Title string `json:"title"`
// A short description of the result, if known
Description string `json:"description"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultPhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultPhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultPhoto) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultPhoto) GetType() string {
return TypeInlineQueryResultPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultPhoto) InlineQueryResultType() string {
return TypeInlineQueryResultPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a sticker
type InlineQueryResultSticker struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Sticker
Sticker *Sticker `json:"sticker"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultSticker) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultSticker
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultSticker) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultSticker) GetType() string {
return TypeInlineQueryResultSticker
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultSticker) InlineQueryResultType() string {
return TypeInlineQueryResultSticker
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a video
type InlineQueryResultVideo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the query result
Id string `json:"id"`
// Video
Video *Video `json:"video"`
// Title of the video
Title string `json:"title"`
// Description of the video
Description string `json:"description"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResultVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultVideo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultVideo) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultVideo) GetType() string {
return TypeInlineQueryResultVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultVideo) InlineQueryResultType() string {
return TypeInlineQueryResultVideo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a voice note
type InlineQueryResultVoiceNote struct {
meta
// Unique identifier of the query result
Id string `json:"id"`
// Voice note
VoiceNote *VoiceNote `json:"voice_note"`
// Title of the voice note
Title string `json:"title"`
}
func (entity *InlineQueryResultVoiceNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResultVoiceNote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultVoiceNote) GetClass() string {
return ClassInlineQueryResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultVoiceNote) GetType() string {
return TypeInlineQueryResultVoiceNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResultVoiceNote) InlineQueryResultType() string {
return TypeInlineQueryResultVoiceNote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents the results of the inline query. Use sendInlineQueryResultMessage to send the result of the query
type InlineQueryResults struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique identifier of the inline query
InlineQueryId JsonInt64 `json:"inline_query_id"`
// The offset for the next request. If empty, there are no more results
NextOffset string `json:"next_offset"`
// Results of the query
Results []InlineQueryResult `json:"results"`
// If non-empty, this text should be shown on the button, which opens a private chat with the bot and sends the bot a start message with the switch_pm_parameter
SwitchPmText string `json:"switch_pm_text"`
// Parameter for the bot start message
SwitchPmParameter string `json:"switch_pm_parameter"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *InlineQueryResults) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub InlineQueryResults
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResults) GetClass() string {
return ClassInlineQueryResults
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*InlineQueryResults) GetType() string {
return TypeInlineQueryResults
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The payload from a general callback button
type CallbackQueryPayloadData struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Data that was attached to the callback button
Data []byte `json:"data"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *CallbackQueryPayloadData) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub CallbackQueryPayloadData
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CallbackQueryPayloadData) GetClass() string {
return ClassCallbackQueryPayload
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CallbackQueryPayloadData) GetType() string {
return TypeCallbackQueryPayloadData
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CallbackQueryPayloadData) CallbackQueryPayloadType() string {
return TypeCallbackQueryPayloadData
}
// The payload from a game callback button
type CallbackQueryPayloadGame struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// A short name of the game that was attached to the callback button
GameShortName string `json:"game_short_name"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *CallbackQueryPayloadGame) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub CallbackQueryPayloadGame
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CallbackQueryPayloadGame) GetClass() string {
return ClassCallbackQueryPayload
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CallbackQueryPayloadGame) GetType() string {
return TypeCallbackQueryPayloadGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CallbackQueryPayloadGame) CallbackQueryPayloadType() string {
return TypeCallbackQueryPayloadGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains a bot's answer to a callback query
type CallbackQueryAnswer struct {
meta
// Text of the answer
Text string `json:"text"`
// True, if an alert should be shown to the user instead of a toast notification
ShowAlert bool `json:"show_alert"`
// URL to be opened
Url string `json:"url"`
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (entity *CallbackQueryAnswer) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
type stub CallbackQueryAnswer
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*CallbackQueryAnswer) GetClass() string {
return ClassCallbackQueryAnswer
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*CallbackQueryAnswer) GetType() string {
return TypeCallbackQueryAnswer
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains the result of a custom request
type CustomRequestResult struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// A JSON-serialized result
Result string `json:"result"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *CustomRequestResult) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub CustomRequestResult
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CustomRequestResult) GetClass() string {
return ClassCustomRequestResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CustomRequestResult) GetType() string {
return TypeCustomRequestResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains one row of the game high score table
type GameHighScore struct {
meta
// Position in the high score table
Position int32 `json:"position"`
// User identifier
UserId int32 `json:"user_id"`
// User score
Score int32 `json:"score"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *GameHighScore) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
type stub GameHighScore
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*GameHighScore) GetClass() string {
return ClassGameHighScore
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*GameHighScore) GetType() string {
return TypeGameHighScore
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains a list of game high scores
type GameHighScores struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// A list of game high scores
Scores []*GameHighScore `json:"scores"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *GameHighScores) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub GameHighScores
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*GameHighScores) GetClass() string {
return ClassGameHighScores
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*GameHighScores) GetType() string {
return TypeGameHighScores
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message was edited
type ChatEventMessageEdited struct {
meta
// The original message before the edit
OldMessage *Message `json:"old_message"`
// The message after it was edited
NewMessage *Message `json:"new_message"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventMessageEdited) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventMessageEdited
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventMessageEdited) GetClass() string {
return ClassChatEventAction
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventMessageEdited) GetType() string {
return TypeChatEventMessageEdited
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventMessageEdited) ChatEventActionType() string {
return TypeChatEventMessageEdited
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message was deleted
type ChatEventMessageDeleted struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Deleted message
Message *Message `json:"message"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventMessageDeleted) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventMessageDeleted
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMessageDeleted) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMessageDeleted) GetType() string {
return TypeChatEventMessageDeleted
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMessageDeleted) ChatEventActionType() string {
return TypeChatEventMessageDeleted
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// A poll in a message was stopped
type ChatEventPollStopped struct {
meta
// The message with the poll
Message *Message `json:"message"`
}
func (entity *ChatEventPollStopped) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatEventPollStopped
return json.Marshal((*stub)(entity))
}
func (*ChatEventPollStopped) GetClass() string {
return ClassChatEventAction
}
func (*ChatEventPollStopped) GetType() string {
return TypeChatEventPollStopped
}
func (*ChatEventPollStopped) ChatEventActionType() string {
return TypeChatEventPollStopped
}
2019-06-07 10:56:06 +00:00
// A message was pinned
type ChatEventMessagePinned struct {
meta
// Pinned message
Message *Message `json:"message"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (entity *ChatEventMessagePinned) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventMessagePinned
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventMessagePinned) GetClass() string {
return ClassChatEventAction
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventMessagePinned) GetType() string {
return TypeChatEventMessagePinned
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMessagePinned) ChatEventActionType() string {
return TypeChatEventMessagePinned
}
// A message was unpinned
type ChatEventMessageUnpinned struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventMessageUnpinned) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventMessageUnpinned
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMessageUnpinned) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMessageUnpinned) GetType() string {
return TypeChatEventMessageUnpinned
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMessageUnpinned) ChatEventActionType() string {
return TypeChatEventMessageUnpinned
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A new member joined the chat
type ChatEventMemberJoined struct {
meta
}
func (entity *ChatEventMemberJoined) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatEventMemberJoined
return json.Marshal((*stub)(entity))
}
func (*ChatEventMemberJoined) GetClass() string {
return ClassChatEventAction
}
func (*ChatEventMemberJoined) GetType() string {
return TypeChatEventMemberJoined
}
func (*ChatEventMemberJoined) ChatEventActionType() string {
return TypeChatEventMemberJoined
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
// A member left the chat
type ChatEventMemberLeft struct {
meta
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (entity *ChatEventMemberLeft) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventMemberLeft
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberLeft) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberLeft) GetType() string {
return TypeChatEventMemberLeft
}
func (*ChatEventMemberLeft) ChatEventActionType() string {
return TypeChatEventMemberLeft
}
// A new chat member was invited
type ChatEventMemberInvited struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// New member user identifier
UserId int32 `json:"user_id"`
// New member status
Status ChatMemberStatus `json:"status"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventMemberInvited) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventMemberInvited
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberInvited) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberInvited) GetType() string {
return TypeChatEventMemberInvited
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberInvited) ChatEventActionType() string {
return TypeChatEventMemberInvited
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (chatEventMemberInvited *ChatEventMemberInvited) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
UserId int32 `json:"user_id"`
Status json.RawMessage `json:"status"`
2018-10-23 12:38:10 +00:00
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2019-06-07 10:56:06 +00:00
chatEventMemberInvited.UserId = tmp.UserId
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status)
chatEventMemberInvited.Status = fieldStatus
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A chat member has gained/lost administrator status, or the list of their administrator privileges has changed
type ChatEventMemberPromoted struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Chat member user identifier
UserId int32 `json:"user_id"`
// Previous status of the chat member
OldStatus ChatMemberStatus `json:"old_status"`
// New status of the chat member
NewStatus ChatMemberStatus `json:"new_status"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventMemberPromoted) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventMemberPromoted
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberPromoted) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberPromoted) GetType() string {
return TypeChatEventMemberPromoted
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberPromoted) ChatEventActionType() string {
return TypeChatEventMemberPromoted
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (chatEventMemberPromoted *ChatEventMemberPromoted) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
UserId int32 `json:"user_id"`
OldStatus json.RawMessage `json:"old_status"`
NewStatus json.RawMessage `json:"new_status"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
chatEventMemberPromoted.UserId = tmp.UserId
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus)
chatEventMemberPromoted.OldStatus = fieldOldStatus
fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus)
chatEventMemberPromoted.NewStatus = fieldNewStatus
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A chat member was restricted/unrestricted or banned/unbanned, or the list of their restrictions has changed
type ChatEventMemberRestricted struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Chat member user identifier
UserId int32 `json:"user_id"`
// Previous status of the chat member
OldStatus ChatMemberStatus `json:"old_status"`
// New status of the chat member
NewStatus ChatMemberStatus `json:"new_status"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventMemberRestricted) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventMemberRestricted
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberRestricted) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberRestricted) GetType() string {
return TypeChatEventMemberRestricted
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventMemberRestricted) ChatEventActionType() string {
return TypeChatEventMemberRestricted
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (chatEventMemberRestricted *ChatEventMemberRestricted) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
UserId int32 `json:"user_id"`
OldStatus json.RawMessage `json:"old_status"`
NewStatus json.RawMessage `json:"new_status"`
2018-10-23 12:38:10 +00:00
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2019-06-07 10:56:06 +00:00
chatEventMemberRestricted.UserId = tmp.UserId
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus)
chatEventMemberRestricted.OldStatus = fieldOldStatus
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus)
chatEventMemberRestricted.NewStatus = fieldNewStatus
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The chat title was changed
type ChatEventTitleChanged struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Previous chat title
OldTitle string `json:"old_title"`
// New chat title
NewTitle string `json:"new_title"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventTitleChanged) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventTitleChanged
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventTitleChanged) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventTitleChanged) GetType() string {
return TypeChatEventTitleChanged
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventTitleChanged) ChatEventActionType() string {
return TypeChatEventTitleChanged
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// The chat permissions was changed
type ChatEventPermissionsChanged struct {
meta
// Previous chat permissions
OldPermissions *ChatPermissions `json:"old_permissions"`
// New chat permissions
NewPermissions *ChatPermissions `json:"new_permissions"`
}
func (entity *ChatEventPermissionsChanged) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatEventPermissionsChanged
return json.Marshal((*stub)(entity))
}
func (*ChatEventPermissionsChanged) GetClass() string {
return ClassChatEventAction
}
func (*ChatEventPermissionsChanged) GetType() string {
return TypeChatEventPermissionsChanged
}
func (*ChatEventPermissionsChanged) ChatEventActionType() string {
return TypeChatEventPermissionsChanged
}
2019-06-07 10:56:06 +00:00
// The chat description was changed
type ChatEventDescriptionChanged struct {
meta
// Previous chat description
OldDescription string `json:"old_description"`
// New chat description
NewDescription string `json:"new_description"`
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (entity *ChatEventDescriptionChanged) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventDescriptionChanged
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventDescriptionChanged) GetClass() string {
return ClassChatEventAction
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventDescriptionChanged) GetType() string {
return TypeChatEventDescriptionChanged
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventDescriptionChanged) ChatEventActionType() string {
return TypeChatEventDescriptionChanged
}
// The chat username was changed
type ChatEventUsernameChanged struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Previous chat username
OldUsername string `json:"old_username"`
// New chat username
NewUsername string `json:"new_username"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventUsernameChanged) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventUsernameChanged
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventUsernameChanged) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventUsernameChanged) GetType() string {
return TypeChatEventUsernameChanged
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventUsernameChanged) ChatEventActionType() string {
return TypeChatEventUsernameChanged
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The chat photo was changed
type ChatEventPhotoChanged struct {
meta
// Previous chat photo value; may be null
2019-09-10 12:36:54 +00:00
OldPhoto *Photo `json:"old_photo"`
2019-06-07 10:56:06 +00:00
// New chat photo value; may be null
2019-09-10 12:36:54 +00:00
NewPhoto *Photo `json:"new_photo"`
2019-06-07 10:56:06 +00:00
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (entity *ChatEventPhotoChanged) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventPhotoChanged
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventPhotoChanged) GetClass() string {
return ClassChatEventAction
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventPhotoChanged) GetType() string {
return TypeChatEventPhotoChanged
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventPhotoChanged) ChatEventActionType() string {
return TypeChatEventPhotoChanged
}
2019-09-10 12:36:54 +00:00
// The can_invite_users permission of a supergroup chat was toggled
2019-06-07 10:56:06 +00:00
type ChatEventInvitesToggled struct {
2018-10-23 12:38:10 +00:00
meta
2019-09-10 12:36:54 +00:00
// New value of can_invite_users permission
CanInviteUsers bool `json:"can_invite_users"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventInvitesToggled) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventInvitesToggled
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventInvitesToggled) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventInvitesToggled) GetType() string {
return TypeChatEventInvitesToggled
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventInvitesToggled) ChatEventActionType() string {
return TypeChatEventInvitesToggled
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The sign_messages setting of a channel was toggled
type ChatEventSignMessagesToggled struct {
meta
// New value of sign_messages
SignMessages bool `json:"sign_messages"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (entity *ChatEventSignMessagesToggled) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventSignMessagesToggled
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventSignMessagesToggled) GetClass() string {
return ClassChatEventAction
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventSignMessagesToggled) GetType() string {
return TypeChatEventSignMessagesToggled
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventSignMessagesToggled) ChatEventActionType() string {
return TypeChatEventSignMessagesToggled
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The supergroup sticker set was changed
type ChatEventStickerSetChanged struct {
meta
// Previous identifier of the chat sticker set; 0 if none
OldStickerSetId JsonInt64 `json:"old_sticker_set_id"`
// New identifier of the chat sticker set; 0 if none
NewStickerSetId JsonInt64 `json:"new_sticker_set_id"`
}
func (entity *ChatEventStickerSetChanged) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventStickerSetChanged
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventStickerSetChanged) GetClass() string {
return ClassChatEventAction
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventStickerSetChanged) GetType() string {
return TypeChatEventStickerSetChanged
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventStickerSetChanged) ChatEventActionType() string {
return TypeChatEventStickerSetChanged
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The is_all_history_available setting of a supergroup was toggled
type ChatEventIsAllHistoryAvailableToggled struct {
meta
// New value of is_all_history_available
IsAllHistoryAvailable bool `json:"is_all_history_available"`
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (entity *ChatEventIsAllHistoryAvailableToggled) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEventIsAllHistoryAvailableToggled
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
return json.Marshal((*stub)(entity))
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventIsAllHistoryAvailableToggled) GetClass() string {
return ClassChatEventAction
}
2018-10-23 12:38:10 +00:00
2019-06-07 10:56:06 +00:00
func (*ChatEventIsAllHistoryAvailableToggled) GetType() string {
return TypeChatEventIsAllHistoryAvailableToggled
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEventIsAllHistoryAvailableToggled) ChatEventActionType() string {
return TypeChatEventIsAllHistoryAvailableToggled
}
// Represents a chat event
type ChatEvent struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Chat event identifier
Id JsonInt64 `json:"id"`
// Point in time (Unix timestamp) when the event happened
Date int32 `json:"date"`
// Identifier of the user who performed the action that triggered the event
UserId int32 `json:"user_id"`
// Action performed by the user
Action ChatEventAction `json:"action"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEvent) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEvent
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEvent) GetClass() string {
return ClassChatEvent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEvent) GetType() string {
return TypeChatEvent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (chatEvent *ChatEvent) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
2019-06-07 10:56:06 +00:00
Id JsonInt64 `json:"id"`
Date int32 `json:"date"`
UserId int32 `json:"user_id"`
Action json.RawMessage `json:"action"`
2018-10-23 12:38:10 +00:00
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
chatEvent.Id = tmp.Id
chatEvent.Date = tmp.Date
chatEvent.UserId = tmp.UserId
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldAction, _ := UnmarshalChatEventAction(tmp.Action)
chatEvent.Action = fieldAction
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains a list of chat events
type ChatEvents struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// List of events
Events []*ChatEvent `json:"events"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEvents) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatEvents
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEvents) GetClass() string {
return ClassChatEvents
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatEvents) GetType() string {
return TypeChatEvents
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a set of filters used to obtain a chat event log
type ChatEventLogFilters struct {
meta
// True, if message edits should be returned
MessageEdits bool `json:"message_edits"`
// True, if message deletions should be returned
MessageDeletions bool `json:"message_deletions"`
// True, if pin/unpin events should be returned
MessagePins bool `json:"message_pins"`
// True, if members joining events should be returned
MemberJoins bool `json:"member_joins"`
// True, if members leaving events should be returned
MemberLeaves bool `json:"member_leaves"`
// True, if invited member events should be returned
MemberInvites bool `json:"member_invites"`
// True, if member promotion/demotion events should be returned
MemberPromotions bool `json:"member_promotions"`
// True, if member restricted/unrestricted/banned/unbanned events should be returned
MemberRestrictions bool `json:"member_restrictions"`
// True, if changes in chat information should be returned
InfoChanges bool `json:"info_changes"`
// True, if changes in chat settings should be returned
SettingChanges bool `json:"setting_changes"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatEventLogFilters) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatEventLogFilters
return json.Marshal((*stub)(entity))
}
func (*ChatEventLogFilters) GetClass() string {
return ClassChatEventLogFilters
}
func (*ChatEventLogFilters) GetType() string {
return TypeChatEventLogFilters
}
// An ordinary language pack string
type LanguagePackStringValueOrdinary struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// String value
Value string `json:"value"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *LanguagePackStringValueOrdinary) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub LanguagePackStringValueOrdinary
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStringValueOrdinary) GetClass() string {
return ClassLanguagePackStringValue
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStringValueOrdinary) GetType() string {
return TypeLanguagePackStringValueOrdinary
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStringValueOrdinary) LanguagePackStringValueType() string {
return TypeLanguagePackStringValueOrdinary
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A language pack string which has different forms based on the number of some object it mentions. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info
type LanguagePackStringValuePluralized struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Value for zero objects
ZeroValue string `json:"zero_value"`
// Value for one object
OneValue string `json:"one_value"`
// Value for two objects
TwoValue string `json:"two_value"`
// Value for few objects
FewValue string `json:"few_value"`
// Value for many objects
ManyValue string `json:"many_value"`
// Default value
OtherValue string `json:"other_value"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *LanguagePackStringValuePluralized) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub LanguagePackStringValuePluralized
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStringValuePluralized) GetClass() string {
return ClassLanguagePackStringValue
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStringValuePluralized) GetType() string {
return TypeLanguagePackStringValuePluralized
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStringValuePluralized) LanguagePackStringValueType() string {
return TypeLanguagePackStringValuePluralized
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A deleted language pack string, the value should be taken from the built-in english language pack
type LanguagePackStringValueDeleted struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *LanguagePackStringValueDeleted) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub LanguagePackStringValueDeleted
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStringValueDeleted) GetClass() string {
return ClassLanguagePackStringValue
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStringValueDeleted) GetType() string {
return TypeLanguagePackStringValueDeleted
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStringValueDeleted) LanguagePackStringValueType() string {
return TypeLanguagePackStringValueDeleted
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents one language pack string
type LanguagePackString struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// String key
Key string `json:"key"`
// String value
Value LanguagePackStringValue `json:"value"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *LanguagePackString) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub LanguagePackString
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackString) GetClass() string {
return ClassLanguagePackString
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackString) GetType() string {
return TypeLanguagePackString
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (languagePackString *LanguagePackString) UnmarshalJSON(data []byte) error {
var tmp struct {
Key string `json:"key"`
Value json.RawMessage `json:"value"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
languagePackString.Key = tmp.Key
fieldValue, _ := UnmarshalLanguagePackStringValue(tmp.Value)
languagePackString.Value = fieldValue
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains a list of language pack strings
type LanguagePackStrings struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// A list of language pack strings
Strings []*LanguagePackString `json:"strings"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *LanguagePackStrings) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub LanguagePackStrings
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStrings) GetClass() string {
return ClassLanguagePackStrings
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackStrings) GetType() string {
return TypeLanguagePackStrings
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about a language pack
type LanguagePackInfo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique language pack identifier
2018-10-23 12:38:10 +00:00
Id string `json:"id"`
2019-06-07 10:56:06 +00:00
// Identifier of a base language pack; may be empty. If a string is missed in the language pack, then it should be fetched from base language pack. Unsupported in custom language packs
BaseLanguagePackId string `json:"base_language_pack_id"`
// Language name
Name string `json:"name"`
// Name of the language in that language
NativeName string `json:"native_name"`
// A language code to be used to apply plural forms. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info
PluralCode string `json:"plural_code"`
// True, if the language pack is official
IsOfficial bool `json:"is_official"`
// True, if the language pack strings are RTL
IsRtl bool `json:"is_rtl"`
// True, if the language pack is a beta language pack
IsBeta bool `json:"is_beta"`
// True, if the language pack is installed by the current user
IsInstalled bool `json:"is_installed"`
// Total number of non-deleted strings from the language pack
TotalStringCount int32 `json:"total_string_count"`
// Total number of translated strings from the language pack
TranslatedStringCount int32 `json:"translated_string_count"`
// Total number of non-deleted strings from the language pack available locally
LocalStringCount int32 `json:"local_string_count"`
// Link to language translation interface; empty for custom local language packs
TranslationUrl string `json:"translation_url"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *LanguagePackInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub LanguagePackInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackInfo) GetClass() string {
return ClassLanguagePackInfo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LanguagePackInfo) GetType() string {
return TypeLanguagePackInfo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about the current localization target
type LocalizationTargetInfo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// List of available language packs for this application
LanguagePacks []*LanguagePackInfo `json:"language_packs"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *LocalizationTargetInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub LocalizationTargetInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LocalizationTargetInfo) GetClass() string {
return ClassLocalizationTargetInfo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*LocalizationTargetInfo) GetType() string {
return TypeLocalizationTargetInfo
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A token for Firebase Cloud Messaging
type DeviceTokenFirebaseCloudMessaging struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Device registration token; may be empty to de-register a device
Token string `json:"token"`
// True, if push notifications should be additionally encrypted
Encrypt bool `json:"encrypt"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenFirebaseCloudMessaging) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenFirebaseCloudMessaging
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenFirebaseCloudMessaging) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenFirebaseCloudMessaging) GetType() string {
return TypeDeviceTokenFirebaseCloudMessaging
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenFirebaseCloudMessaging) DeviceTokenType() string {
return TypeDeviceTokenFirebaseCloudMessaging
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A token for Apple Push Notification service
type DeviceTokenApplePush struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Device token; may be empty to de-register a device
DeviceToken string `json:"device_token"`
// True, if App Sandbox is enabled
IsAppSandbox bool `json:"is_app_sandbox"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenApplePush) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenApplePush
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenApplePush) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenApplePush) GetType() string {
return TypeDeviceTokenApplePush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenApplePush) DeviceTokenType() string {
return TypeDeviceTokenApplePush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A token for Apple Push Notification service VoIP notifications
type DeviceTokenApplePushVoIP struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Device token; may be empty to de-register a device
DeviceToken string `json:"device_token"`
// True, if App Sandbox is enabled
IsAppSandbox bool `json:"is_app_sandbox"`
// True, if push notifications should be additionally encrypted
Encrypt bool `json:"encrypt"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenApplePushVoIP) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenApplePushVoIP
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenApplePushVoIP) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenApplePushVoIP) GetType() string {
return TypeDeviceTokenApplePushVoIP
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenApplePushVoIP) DeviceTokenType() string {
return TypeDeviceTokenApplePushVoIP
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A token for Windows Push Notification Services
type DeviceTokenWindowsPush struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The access token that will be used to send notifications; may be empty to de-register a device
AccessToken string `json:"access_token"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenWindowsPush) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenWindowsPush
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenWindowsPush) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenWindowsPush) GetType() string {
return TypeDeviceTokenWindowsPush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenWindowsPush) DeviceTokenType() string {
return TypeDeviceTokenWindowsPush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A token for Microsoft Push Notification Service
type DeviceTokenMicrosoftPush struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Push notification channel URI; may be empty to de-register a device
ChannelUri string `json:"channel_uri"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenMicrosoftPush) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenMicrosoftPush
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenMicrosoftPush) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenMicrosoftPush) GetType() string {
return TypeDeviceTokenMicrosoftPush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenMicrosoftPush) DeviceTokenType() string {
return TypeDeviceTokenMicrosoftPush
}
// A token for Microsoft Push Notification Service VoIP channel
type DeviceTokenMicrosoftPushVoIP struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Push notification channel URI; may be empty to de-register a device
ChannelUri string `json:"channel_uri"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenMicrosoftPushVoIP) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenMicrosoftPushVoIP
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenMicrosoftPushVoIP) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenMicrosoftPushVoIP) GetType() string {
return TypeDeviceTokenMicrosoftPushVoIP
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenMicrosoftPushVoIP) DeviceTokenType() string {
return TypeDeviceTokenMicrosoftPushVoIP
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A token for web Push API
type DeviceTokenWebPush struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device
Endpoint string `json:"endpoint"`
// Base64url-encoded P-256 elliptic curve Diffie-Hellman public key
P256dhBase64url string `json:"p256dh_base64url"`
// Base64url-encoded authentication secret
AuthBase64url string `json:"auth_base64url"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenWebPush) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenWebPush
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenWebPush) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenWebPush) GetType() string {
return TypeDeviceTokenWebPush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenWebPush) DeviceTokenType() string {
return TypeDeviceTokenWebPush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A token for Simple Push API for Firefox OS
type DeviceTokenSimplePush struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device
Endpoint string `json:"endpoint"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenSimplePush) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenSimplePush
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenSimplePush) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenSimplePush) GetType() string {
return TypeDeviceTokenSimplePush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenSimplePush) DeviceTokenType() string {
return TypeDeviceTokenSimplePush
}
// A token for Ubuntu Push Client service
type DeviceTokenUbuntuPush struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Token; may be empty to de-register a device
Token string `json:"token"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenUbuntuPush) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenUbuntuPush
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenUbuntuPush) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenUbuntuPush) GetType() string {
return TypeDeviceTokenUbuntuPush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenUbuntuPush) DeviceTokenType() string {
return TypeDeviceTokenUbuntuPush
}
// A token for BlackBerry Push Service
type DeviceTokenBlackBerryPush struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Token; may be empty to de-register a device
Token string `json:"token"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenBlackBerryPush) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenBlackBerryPush
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenBlackBerryPush) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenBlackBerryPush) GetType() string {
return TypeDeviceTokenBlackBerryPush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenBlackBerryPush) DeviceTokenType() string {
return TypeDeviceTokenBlackBerryPush
}
// A token for Tizen Push Service
type DeviceTokenTizenPush struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Push service registration identifier; may be empty to de-register a device
RegId string `json:"reg_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *DeviceTokenTizenPush) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub DeviceTokenTizenPush
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenTizenPush) GetClass() string {
return ClassDeviceToken
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenTizenPush) GetType() string {
return TypeDeviceTokenTizenPush
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*DeviceTokenTizenPush) DeviceTokenType() string {
return TypeDeviceTokenTizenPush
}
// Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification
type PushReceiverId struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The globally unique identifier of push notification subscription
Id JsonInt64 `json:"id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushReceiverId) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushReceiverId
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushReceiverId) GetClass() string {
return ClassPushReceiverId
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushReceiverId) GetType() string {
return TypePushReceiverId
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// A wallpaper in JPEG format
type BackgroundTypeWallpaper struct {
2018-10-23 12:38:10 +00:00
meta
2019-09-10 12:36:54 +00:00
// True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12
IsBlurred bool `json:"is_blurred"`
// True, if the background needs to be slightly moved when device is rotated
IsMoving bool `json:"is_moving"`
}
func (entity *BackgroundTypeWallpaper) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub BackgroundTypeWallpaper
return json.Marshal((*stub)(entity))
}
func (*BackgroundTypeWallpaper) GetClass() string {
return ClassBackgroundType
}
func (*BackgroundTypeWallpaper) GetType() string {
return TypeBackgroundTypeWallpaper
}
func (*BackgroundTypeWallpaper) BackgroundTypeType() string {
return TypeBackgroundTypeWallpaper
}
// A PNG pattern to be combined with the color chosen by the user
type BackgroundTypePattern struct {
meta
// True, if the background needs to be slightly moved when device is rotated
IsMoving bool `json:"is_moving"`
// Main color of the background in RGB24 format
2019-06-07 10:56:06 +00:00
Color int32 `json:"color"`
2019-09-10 12:36:54 +00:00
// Intensity of the pattern when it is shown above the main background color, 0-100
Intensity int32 `json:"intensity"`
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
func (entity *BackgroundTypePattern) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-09-10 12:36:54 +00:00
type stub BackgroundTypePattern
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
func (*BackgroundTypePattern) GetClass() string {
return ClassBackgroundType
}
func (*BackgroundTypePattern) GetType() string {
return TypeBackgroundTypePattern
}
func (*BackgroundTypePattern) BackgroundTypeType() string {
return TypeBackgroundTypePattern
}
// A solid background
type BackgroundTypeSolid struct {
meta
// A color of the background in RGB24 format
Color int32 `json:"color"`
}
func (entity *BackgroundTypeSolid) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub BackgroundTypeSolid
return json.Marshal((*stub)(entity))
}
func (*BackgroundTypeSolid) GetClass() string {
return ClassBackgroundType
}
func (*BackgroundTypeSolid) GetType() string {
return TypeBackgroundTypeSolid
}
func (*BackgroundTypeSolid) BackgroundTypeType() string {
return TypeBackgroundTypeSolid
}
// Describes a chat background
type Background struct {
meta
// Unique background identifier
Id JsonInt64 `json:"id"`
// True, if this is one of default backgrounds
IsDefault bool `json:"is_default"`
// True, if the background is dark and is recommended to be used with dark theme
IsDark bool `json:"is_dark"`
// Unique background name
Name string `json:"name"`
// Document with the background; may be null. Null only for solid backgrounds
Document *Document `json:"document"`
// Type of the background
Type BackgroundType `json:"type"`
}
func (entity *Background) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub Background
return json.Marshal((*stub)(entity))
}
func (*Background) GetClass() string {
return ClassBackground
}
func (*Background) GetType() string {
return TypeBackground
}
func (background *Background) UnmarshalJSON(data []byte) error {
var tmp struct {
Id JsonInt64 `json:"id"`
IsDefault bool `json:"is_default"`
IsDark bool `json:"is_dark"`
Name string `json:"name"`
Document *Document `json:"document"`
Type json.RawMessage `json:"type"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
background.Id = tmp.Id
background.IsDefault = tmp.IsDefault
background.IsDark = tmp.IsDark
background.Name = tmp.Name
background.Document = tmp.Document
fieldType, _ := UnmarshalBackgroundType(tmp.Type)
background.Type = fieldType
return nil
}
// Contains a list of backgrounds
type Backgrounds struct {
meta
// A list of backgrounds
Backgrounds []*Background `json:"backgrounds"`
}
func (entity *Backgrounds) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub Backgrounds
return json.Marshal((*stub)(entity))
}
func (*Backgrounds) GetClass() string {
return ClassBackgrounds
}
func (*Backgrounds) GetType() string {
return TypeBackgrounds
}
// A background from a local file
type InputBackgroundLocal struct {
meta
// Background file to use. Only inputFileLocal and inputFileGenerated are supported. The file nust be in JPEG format for wallpapers and in PNG format for patterns
Background InputFile `json:"background"`
}
func (entity *InputBackgroundLocal) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub InputBackgroundLocal
return json.Marshal((*stub)(entity))
}
func (*InputBackgroundLocal) GetClass() string {
return ClassInputBackground
}
func (*InputBackgroundLocal) GetType() string {
return TypeInputBackgroundLocal
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
func (*InputBackgroundLocal) InputBackgroundType() string {
return TypeInputBackgroundLocal
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
func (inputBackgroundLocal *InputBackgroundLocal) UnmarshalJSON(data []byte) error {
var tmp struct {
Background json.RawMessage `json:"background"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
fieldBackground, _ := UnmarshalInputFile(tmp.Background)
inputBackgroundLocal.Background = fieldBackground
return nil
}
// A background from the server
type InputBackgroundRemote struct {
2018-10-23 12:38:10 +00:00
meta
2019-09-10 12:36:54 +00:00
// The background identifier
BackgroundId JsonInt64 `json:"background_id"`
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
func (entity *InputBackgroundRemote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-09-10 12:36:54 +00:00
type stub InputBackgroundRemote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
func (*InputBackgroundRemote) GetClass() string {
return ClassInputBackground
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
func (*InputBackgroundRemote) GetType() string {
return TypeInputBackgroundRemote
}
func (*InputBackgroundRemote) InputBackgroundType() string {
return TypeInputBackgroundRemote
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains a list of hashtags
type Hashtags struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// A list of hashtags
Hashtags []string `json:"hashtags"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *Hashtags) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub Hashtags
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Hashtags) GetClass() string {
return ClassHashtags
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Hashtags) GetType() string {
return TypeHashtags
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The username can be set
type CheckChatUsernameResultOk struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *CheckChatUsernameResultOk) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub CheckChatUsernameResultOk
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultOk) GetClass() string {
return ClassCheckChatUsernameResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultOk) GetType() string {
return TypeCheckChatUsernameResultOk
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultOk) CheckChatUsernameResultType() string {
return TypeCheckChatUsernameResultOk
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The username is invalid
type CheckChatUsernameResultUsernameInvalid struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *CheckChatUsernameResultUsernameInvalid) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub CheckChatUsernameResultUsernameInvalid
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultUsernameInvalid) GetClass() string {
return ClassCheckChatUsernameResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultUsernameInvalid) GetType() string {
return TypeCheckChatUsernameResultUsernameInvalid
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultUsernameInvalid) CheckChatUsernameResultType() string {
return TypeCheckChatUsernameResultUsernameInvalid
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The username is occupied
type CheckChatUsernameResultUsernameOccupied struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *CheckChatUsernameResultUsernameOccupied) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub CheckChatUsernameResultUsernameOccupied
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultUsernameOccupied) GetClass() string {
return ClassCheckChatUsernameResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultUsernameOccupied) GetType() string {
return TypeCheckChatUsernameResultUsernameOccupied
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultUsernameOccupied) CheckChatUsernameResultType() string {
return TypeCheckChatUsernameResultUsernameOccupied
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// The user has too much chats with username, one of them should be made private first
2019-06-07 10:56:06 +00:00
type CheckChatUsernameResultPublicChatsTooMuch struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *CheckChatUsernameResultPublicChatsTooMuch) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub CheckChatUsernameResultPublicChatsTooMuch
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultPublicChatsTooMuch) GetClass() string {
return ClassCheckChatUsernameResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultPublicChatsTooMuch) GetType() string {
return TypeCheckChatUsernameResultPublicChatsTooMuch
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultPublicChatsTooMuch) CheckChatUsernameResultType() string {
return TypeCheckChatUsernameResultPublicChatsTooMuch
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The user can't be a member of a public supergroup
type CheckChatUsernameResultPublicGroupsUnavailable struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *CheckChatUsernameResultPublicGroupsUnavailable) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub CheckChatUsernameResultPublicGroupsUnavailable
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultPublicGroupsUnavailable) GetClass() string {
return ClassCheckChatUsernameResult
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultPublicGroupsUnavailable) GetType() string {
return TypeCheckChatUsernameResultPublicGroupsUnavailable
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*CheckChatUsernameResultPublicGroupsUnavailable) CheckChatUsernameResultType() string {
return TypeCheckChatUsernameResultPublicGroupsUnavailable
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A general message with hidden content
type PushMessageContentHidden struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentHidden) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentHidden
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentHidden) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentHidden) GetType() string {
return TypePushMessageContentHidden
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentHidden) PushMessageContentType() string {
return TypePushMessageContentHidden
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// An animation message (GIF-style).
2019-06-07 10:56:06 +00:00
type PushMessageContentAnimation struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content; may be null
Animation *Animation `json:"animation"`
// Animation caption
Caption string `json:"caption"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentAnimation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentAnimation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentAnimation) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentAnimation) GetType() string {
return TypePushMessageContentAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentAnimation) PushMessageContentType() string {
return TypePushMessageContentAnimation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// An audio message
type PushMessageContentAudio struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content; may be null
Audio *Audio `json:"audio"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentAudio) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentAudio
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentAudio) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentAudio) GetType() string {
return TypePushMessageContentAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentAudio) PushMessageContentType() string {
return TypePushMessageContentAudio
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a user contact
type PushMessageContentContact struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Contact's name
Name string `json:"name"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentContact) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentContact
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentContact) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentContact) GetType() string {
return TypePushMessageContentContact
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentContact) PushMessageContentType() string {
return TypePushMessageContentContact
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A contact has registered with Telegram
type PushMessageContentContactRegistered struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentContactRegistered) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentContactRegistered
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentContactRegistered) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentContactRegistered) GetType() string {
return TypePushMessageContentContactRegistered
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentContactRegistered) PushMessageContentType() string {
return TypePushMessageContentContactRegistered
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A document message (a general file)
type PushMessageContentDocument struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content; may be null
Document *Document `json:"document"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentDocument
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentDocument) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentDocument) GetType() string {
return TypePushMessageContentDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentDocument) PushMessageContentType() string {
return TypePushMessageContentDocument
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a game
type PushMessageContentGame struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Game title, empty for pinned game message
Title string `json:"title"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentGame) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentGame
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentGame) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentGame) GetType() string {
return TypePushMessageContentGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentGame) PushMessageContentType() string {
return TypePushMessageContentGame
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A new high score was achieved in a game
type PushMessageContentGameScore struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Game title, empty for pinned message
Title string `json:"title"`
// New score, 0 for pinned message
Score int32 `json:"score"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentGameScore) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentGameScore
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentGameScore) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentGameScore) GetType() string {
return TypePushMessageContentGameScore
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentGameScore) PushMessageContentType() string {
return TypePushMessageContentGameScore
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with an invoice from a bot
type PushMessageContentInvoice struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Product price
Price string `json:"price"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentInvoice) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentInvoice
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentInvoice) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentInvoice) GetType() string {
return TypePushMessageContentInvoice
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentInvoice) PushMessageContentType() string {
return TypePushMessageContentInvoice
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a location
type PushMessageContentLocation struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// True, if the location is live
IsLive bool `json:"is_live"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentLocation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentLocation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentLocation) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentLocation) GetType() string {
return TypePushMessageContentLocation
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentLocation) PushMessageContentType() string {
return TypePushMessageContentLocation
}
// A photo message
type PushMessageContentPhoto struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content; may be null
Photo *Photo `json:"photo"`
// Photo caption
Caption string `json:"caption"`
// True, if the photo is secret
IsSecret bool `json:"is_secret"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentPhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentPhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentPhoto) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentPhoto) GetType() string {
return TypePushMessageContentPhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentPhoto) PushMessageContentType() string {
return TypePushMessageContentPhoto
}
// A message with a poll
type PushMessageContentPoll struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Poll question
Question string `json:"question"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentPoll) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentPoll
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentPoll) GetClass() string {
return ClassPushMessageContent
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentPoll) GetType() string {
return TypePushMessageContentPoll
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentPoll) PushMessageContentType() string {
return TypePushMessageContentPoll
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A screenshot of a message in the chat has been taken
type PushMessageContentScreenshotTaken struct {
2018-10-23 12:38:10 +00:00
meta
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentScreenshotTaken) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentScreenshotTaken
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentScreenshotTaken) GetClass() string {
return ClassPushMessageContent
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentScreenshotTaken) GetType() string {
return TypePushMessageContentScreenshotTaken
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentScreenshotTaken) PushMessageContentType() string {
return TypePushMessageContentScreenshotTaken
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A message with a sticker
type PushMessageContentSticker struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content; may be null
Sticker *Sticker `json:"sticker"`
// Emoji corresponding to the sticker; may be empty
Emoji string `json:"emoji"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentSticker) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentSticker
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentSticker) GetClass() string {
return ClassPushMessageContent
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentSticker) GetType() string {
return TypePushMessageContentSticker
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentSticker) PushMessageContentType() string {
return TypePushMessageContentSticker
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A text message
type PushMessageContentText struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message text
Text string `json:"text"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentText) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentText
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentText) GetClass() string {
return ClassPushMessageContent
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentText) GetType() string {
return TypePushMessageContentText
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentText) PushMessageContentType() string {
return TypePushMessageContentText
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A video message
type PushMessageContentVideo struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content; may be null
Video *Video `json:"video"`
// Video caption
Caption string `json:"caption"`
// True, if the video is secret
IsSecret bool `json:"is_secret"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentVideo
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentVideo) GetClass() string {
return ClassPushMessageContent
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentVideo) GetType() string {
return TypePushMessageContentVideo
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentVideo) PushMessageContentType() string {
return TypePushMessageContentVideo
}
// A video note message
type PushMessageContentVideoNote struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content; may be null
VideoNote *VideoNote `json:"video_note"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentVideoNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentVideoNote
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentVideoNote) GetClass() string {
return ClassPushMessageContent
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentVideoNote) GetType() string {
return TypePushMessageContentVideoNote
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentVideoNote) PushMessageContentType() string {
return TypePushMessageContentVideoNote
}
// A voice note message
type PushMessageContentVoiceNote struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Message content; may be null
VoiceNote *VoiceNote `json:"voice_note"`
// True, if the message is a pinned message with the specified content
IsPinned bool `json:"is_pinned"`
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentVoiceNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentVoiceNote
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentVoiceNote) GetClass() string {
return ClassPushMessageContent
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentVoiceNote) GetType() string {
return TypePushMessageContentVoiceNote
}
func (*PushMessageContentVoiceNote) PushMessageContentType() string {
return TypePushMessageContentVoiceNote
2018-09-05 21:45:29 +00:00
}
2019-06-07 10:56:06 +00:00
// A newly created basic group
type PushMessageContentBasicGroupChatCreate struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentBasicGroupChatCreate) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentBasicGroupChatCreate
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentBasicGroupChatCreate) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentBasicGroupChatCreate) GetType() string {
return TypePushMessageContentBasicGroupChatCreate
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentBasicGroupChatCreate) PushMessageContentType() string {
return TypePushMessageContentBasicGroupChatCreate
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// New chat members were invited to a group
type PushMessageContentChatAddMembers struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Name of the added member
MemberName string `json:"member_name"`
// True, if the current user was added to the group
IsCurrentUser bool `json:"is_current_user"`
// True, if the user has returned to the group himself
IsReturned bool `json:"is_returned"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentChatAddMembers) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentChatAddMembers
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatAddMembers) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatAddMembers) GetType() string {
return TypePushMessageContentChatAddMembers
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatAddMembers) PushMessageContentType() string {
return TypePushMessageContentChatAddMembers
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A chat photo was edited
type PushMessageContentChatChangePhoto struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentChatChangePhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentChatChangePhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatChangePhoto) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatChangePhoto) GetType() string {
return TypePushMessageContentChatChangePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatChangePhoto) PushMessageContentType() string {
return TypePushMessageContentChatChangePhoto
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A chat title was edited
type PushMessageContentChatChangeTitle struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// New chat title
Title string `json:"title"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentChatChangeTitle) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentChatChangeTitle
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatChangeTitle) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatChangeTitle) GetType() string {
return TypePushMessageContentChatChangeTitle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatChangeTitle) PushMessageContentType() string {
return TypePushMessageContentChatChangeTitle
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A chat member was deleted
type PushMessageContentChatDeleteMember struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Name of the deleted member
MemberName string `json:"member_name"`
// True, if the current user was deleted from the group
IsCurrentUser bool `json:"is_current_user"`
// True, if the user has left the group himself
IsLeft bool `json:"is_left"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentChatDeleteMember) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentChatDeleteMember
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatDeleteMember) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatDeleteMember) GetType() string {
return TypePushMessageContentChatDeleteMember
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatDeleteMember) PushMessageContentType() string {
return TypePushMessageContentChatDeleteMember
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A new member joined the chat by invite link
type PushMessageContentChatJoinByLink struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentChatJoinByLink) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentChatJoinByLink
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatJoinByLink) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatJoinByLink) GetType() string {
return TypePushMessageContentChatJoinByLink
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentChatJoinByLink) PushMessageContentType() string {
return TypePushMessageContentChatJoinByLink
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A forwarded messages
type PushMessageContentMessageForwards struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Number of forwarded messages
TotalCount int32 `json:"total_count"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentMessageForwards) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentMessageForwards
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentMessageForwards) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentMessageForwards) GetType() string {
return TypePushMessageContentMessageForwards
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentMessageForwards) PushMessageContentType() string {
return TypePushMessageContentMessageForwards
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A media album
type PushMessageContentMediaAlbum struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Number of messages in the album
TotalCount int32 `json:"total_count"`
// True, if the album has at least one photo
HasPhotos bool `json:"has_photos"`
// True, if the album has at least one video
HasVideos bool `json:"has_videos"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *PushMessageContentMediaAlbum) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub PushMessageContentMediaAlbum
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentMediaAlbum) GetClass() string {
return ClassPushMessageContent
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentMediaAlbum) GetType() string {
return TypePushMessageContentMediaAlbum
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*PushMessageContentMediaAlbum) PushMessageContentType() string {
return TypePushMessageContentMediaAlbum
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// New message was received
type NotificationTypeNewMessage struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The message
Message *Message `json:"message"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *NotificationTypeNewMessage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub NotificationTypeNewMessage
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewMessage) GetClass() string {
return ClassNotificationType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewMessage) GetType() string {
return TypeNotificationTypeNewMessage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewMessage) NotificationTypeType() string {
return TypeNotificationTypeNewMessage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// New secret chat was created
type NotificationTypeNewSecretChat struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *NotificationTypeNewSecretChat) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub NotificationTypeNewSecretChat
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewSecretChat) GetClass() string {
return ClassNotificationType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewSecretChat) GetType() string {
return TypeNotificationTypeNewSecretChat
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewSecretChat) NotificationTypeType() string {
return TypeNotificationTypeNewSecretChat
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// New call was received
type NotificationTypeNewCall struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Call identifier
CallId int32 `json:"call_id"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *NotificationTypeNewCall) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub NotificationTypeNewCall
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewCall) GetClass() string {
return ClassNotificationType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewCall) GetType() string {
return TypeNotificationTypeNewCall
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewCall) NotificationTypeType() string {
return TypeNotificationTypeNewCall
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// New message was received through a push notification
type NotificationTypeNewPushMessage struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages and as reply_to_message_id
MessageId int64 `json:"message_id"`
// Sender of the message. Corresponding user may be inaccessible
SenderUserId int32 `json:"sender_user_id"`
// Push message content
Content PushMessageContent `json:"content"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *NotificationTypeNewPushMessage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub NotificationTypeNewPushMessage
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewPushMessage) GetClass() string {
return ClassNotificationType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewPushMessage) GetType() string {
return TypeNotificationTypeNewPushMessage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationTypeNewPushMessage) NotificationTypeType() string {
return TypeNotificationTypeNewPushMessage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (notificationTypeNewPushMessage *NotificationTypeNewPushMessage) UnmarshalJSON(data []byte) error {
var tmp struct {
MessageId int64 `json:"message_id"`
SenderUserId int32 `json:"sender_user_id"`
Content json.RawMessage `json:"content"`
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
notificationTypeNewPushMessage.MessageId = tmp.MessageId
notificationTypeNewPushMessage.SenderUserId = tmp.SenderUserId
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
fieldContent, _ := UnmarshalPushMessageContent(tmp.Content)
notificationTypeNewPushMessage.Content = fieldContent
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with ordinary unread messages
type NotificationGroupTypeMessages struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *NotificationGroupTypeMessages) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub NotificationGroupTypeMessages
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeMessages) GetClass() string {
return ClassNotificationGroupType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeMessages) GetType() string {
return TypeNotificationGroupTypeMessages
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeMessages) NotificationGroupTypeType() string {
return TypeNotificationGroupTypeMessages
}
// A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with unread mentions of the current user, replies to their messages, or a pinned message
type NotificationGroupTypeMentions struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *NotificationGroupTypeMentions) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub NotificationGroupTypeMentions
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeMentions) GetClass() string {
return ClassNotificationGroupType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeMentions) GetType() string {
return TypeNotificationGroupTypeMentions
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeMentions) NotificationGroupTypeType() string {
return TypeNotificationGroupTypeMentions
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A group containing a notification of type notificationTypeNewSecretChat
type NotificationGroupTypeSecretChat struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *NotificationGroupTypeSecretChat) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub NotificationGroupTypeSecretChat
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeSecretChat) GetClass() string {
return ClassNotificationGroupType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeSecretChat) GetType() string {
return TypeNotificationGroupTypeSecretChat
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeSecretChat) NotificationGroupTypeType() string {
return TypeNotificationGroupTypeSecretChat
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A group containing notifications of type notificationTypeNewCall
type NotificationGroupTypeCalls struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *NotificationGroupTypeCalls) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub NotificationGroupTypeCalls
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeCalls) GetClass() string {
return ClassNotificationGroupType
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeCalls) GetType() string {
return TypeNotificationGroupTypeCalls
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroupTypeCalls) NotificationGroupTypeType() string {
return TypeNotificationGroupTypeCalls
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about a notification
type Notification struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique persistent identifier of this notification
Id int32 `json:"id"`
// Notification date
Date int32 `json:"date"`
// Notification type
Type NotificationType `json:"type"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *Notification) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub Notification
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Notification) GetClass() string {
return ClassNotification
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*Notification) GetType() string {
return TypeNotification
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (notification *Notification) UnmarshalJSON(data []byte) error {
var tmp struct {
Id int32 `json:"id"`
Date int32 `json:"date"`
Type json.RawMessage `json:"type"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
notification.Id = tmp.Id
notification.Date = tmp.Date
fieldType, _ := UnmarshalNotificationType(tmp.Type)
notification.Type = fieldType
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Describes a group of notifications
type NotificationGroup struct {
2018-10-23 12:38:10 +00:00
meta
2019-06-07 10:56:06 +00:00
// Unique persistent auto-incremented from 1 identifier of the notification group
Id int32 `json:"id"`
// Type of the group
Type NotificationGroupType `json:"type"`
// Identifier of a chat to which all notifications in the group belong
ChatId int64 `json:"chat_id"`
// Total number of active notifications in the group
TotalCount int32 `json:"total_count"`
// The list of active notifications
Notifications []*Notification `json:"notifications"`
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *NotificationGroup) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub NotificationGroup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroup) GetClass() string {
return ClassNotificationGroup
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*NotificationGroup) GetType() string {
return TypeNotificationGroup
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (notificationGroup *NotificationGroup) UnmarshalJSON(data []byte) error {
var tmp struct {
Id int32 `json:"id"`
Type json.RawMessage `json:"type"`
ChatId int64 `json:"chat_id"`
TotalCount int32 `json:"total_count"`
Notifications []*Notification `json:"notifications"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
notificationGroup.Id = tmp.Id
notificationGroup.ChatId = tmp.ChatId
notificationGroup.TotalCount = tmp.TotalCount
notificationGroup.Notifications = tmp.Notifications
fieldType, _ := UnmarshalNotificationGroupType(tmp.Type)
notificationGroup.Type = fieldType
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a boolean option
2018-08-30 14:55:42 +00:00
type OptionValueBoolean struct {
2018-10-23 12:38:10 +00:00
meta
// The value of the option
Value bool `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *OptionValueBoolean) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub OptionValueBoolean
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*OptionValueBoolean) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassOptionValue
2018-08-30 14:55:42 +00:00
}
func (*OptionValueBoolean) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeOptionValueBoolean
2018-08-30 14:55:42 +00:00
}
func (*OptionValueBoolean) OptionValueType() string {
2018-10-23 12:38:10 +00:00
return TypeOptionValueBoolean
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents an unknown option or an option which has a default value
2018-10-23 12:38:10 +00:00
type OptionValueEmpty struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *OptionValueEmpty) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub OptionValueEmpty
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*OptionValueEmpty) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassOptionValue
2018-08-30 14:55:42 +00:00
}
func (*OptionValueEmpty) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeOptionValueEmpty
2018-08-30 14:55:42 +00:00
}
func (*OptionValueEmpty) OptionValueType() string {
2018-10-23 12:38:10 +00:00
return TypeOptionValueEmpty
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents an integer option
2018-08-30 14:55:42 +00:00
type OptionValueInteger struct {
2018-10-23 12:38:10 +00:00
meta
// The value of the option
Value int32 `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *OptionValueInteger) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub OptionValueInteger
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*OptionValueInteger) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassOptionValue
2018-08-30 14:55:42 +00:00
}
func (*OptionValueInteger) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeOptionValueInteger
2018-08-30 14:55:42 +00:00
}
func (*OptionValueInteger) OptionValueType() string {
2018-10-23 12:38:10 +00:00
return TypeOptionValueInteger
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents a string option
2018-08-30 14:55:42 +00:00
type OptionValueString struct {
2018-10-23 12:38:10 +00:00
meta
// The value of the option
Value string `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *OptionValueString) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub OptionValueString
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*OptionValueString) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassOptionValue
2018-08-30 14:55:42 +00:00
}
func (*OptionValueString) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeOptionValueString
2018-08-30 14:55:42 +00:00
}
func (*OptionValueString) OptionValueType() string {
2018-10-23 12:38:10 +00:00
return TypeOptionValueString
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Represents one member of a JSON object
type JsonObjectMember struct {
meta
// Member's key
Key string `json:"key"`
// Member's value
Value JsonValue `json:"value"`
}
func (entity *JsonObjectMember) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub JsonObjectMember
return json.Marshal((*stub)(entity))
}
func (*JsonObjectMember) GetClass() string {
return ClassJsonObjectMember
}
func (*JsonObjectMember) GetType() string {
return TypeJsonObjectMember
}
func (jsonObjectMember *JsonObjectMember) UnmarshalJSON(data []byte) error {
var tmp struct {
Key string `json:"key"`
Value json.RawMessage `json:"value"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
jsonObjectMember.Key = tmp.Key
fieldValue, _ := UnmarshalJsonValue(tmp.Value)
jsonObjectMember.Value = fieldValue
return nil
}
// Represents a null JSON value
type JsonValueNull struct {
meta
}
func (entity *JsonValueNull) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub JsonValueNull
return json.Marshal((*stub)(entity))
}
func (*JsonValueNull) GetClass() string {
return ClassJsonValue
}
func (*JsonValueNull) GetType() string {
return TypeJsonValueNull
}
func (*JsonValueNull) JsonValueType() string {
return TypeJsonValueNull
}
// Represents a boolean JSON value
type JsonValueBoolean struct {
meta
// The value
Value bool `json:"value"`
}
func (entity *JsonValueBoolean) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub JsonValueBoolean
return json.Marshal((*stub)(entity))
}
func (*JsonValueBoolean) GetClass() string {
return ClassJsonValue
}
func (*JsonValueBoolean) GetType() string {
return TypeJsonValueBoolean
}
func (*JsonValueBoolean) JsonValueType() string {
return TypeJsonValueBoolean
}
// Represents a numeric JSON value
type JsonValueNumber struct {
meta
// The value
Value float64 `json:"value"`
}
func (entity *JsonValueNumber) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub JsonValueNumber
return json.Marshal((*stub)(entity))
}
func (*JsonValueNumber) GetClass() string {
return ClassJsonValue
}
func (*JsonValueNumber) GetType() string {
return TypeJsonValueNumber
}
func (*JsonValueNumber) JsonValueType() string {
return TypeJsonValueNumber
}
// Represents a string JSON value
type JsonValueString struct {
meta
// The value
Value string `json:"value"`
}
func (entity *JsonValueString) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub JsonValueString
return json.Marshal((*stub)(entity))
}
func (*JsonValueString) GetClass() string {
return ClassJsonValue
}
func (*JsonValueString) GetType() string {
return TypeJsonValueString
}
func (*JsonValueString) JsonValueType() string {
return TypeJsonValueString
}
// Represents a JSON array
type JsonValueArray struct {
meta
// The list of array elements
Values []JsonValue `json:"values"`
}
func (entity *JsonValueArray) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub JsonValueArray
return json.Marshal((*stub)(entity))
}
func (*JsonValueArray) GetClass() string {
return ClassJsonValue
}
func (*JsonValueArray) GetType() string {
return TypeJsonValueArray
}
func (*JsonValueArray) JsonValueType() string {
return TypeJsonValueArray
}
// Represents a JSON object
type JsonValueObject struct {
meta
// The list of object members
Members []*JsonObjectMember `json:"members"`
}
func (entity *JsonValueObject) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub JsonValueObject
return json.Marshal((*stub)(entity))
}
func (*JsonValueObject) GetClass() string {
return ClassJsonValue
}
func (*JsonValueObject) GetType() string {
return TypeJsonValueObject
}
func (*JsonValueObject) JsonValueType() string {
return TypeJsonValueObject
}
2018-08-30 14:55:42 +00:00
// A rule to allow all users to do something
2018-10-23 12:38:10 +00:00
type UserPrivacySettingRuleAllowAll struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingRuleAllowAll) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingRuleAllowAll
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleAllowAll) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySettingRule
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleAllowAll) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleAllowAll
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleAllowAll) UserPrivacySettingRuleType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleAllowAll
2018-08-30 14:55:42 +00:00
}
// A rule to allow all of a user's contacts to do something
2018-10-23 12:38:10 +00:00
type UserPrivacySettingRuleAllowContacts struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingRuleAllowContacts) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingRuleAllowContacts
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleAllowContacts) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySettingRule
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleAllowContacts) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleAllowContacts
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleAllowContacts) UserPrivacySettingRuleType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleAllowContacts
2018-08-30 14:55:42 +00:00
}
// A rule to allow certain specified users to do something
type UserPrivacySettingRuleAllowUsers struct {
2018-10-23 12:38:10 +00:00
meta
// The user identifiers
UserIds []int32 `json:"user_ids"`
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingRuleAllowUsers) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingRuleAllowUsers
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleAllowUsers) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySettingRule
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleAllowUsers) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleAllowUsers
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleAllowUsers) UserPrivacySettingRuleType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleAllowUsers
2018-08-30 14:55:42 +00:00
}
// A rule to restrict all users from doing something
2018-10-23 12:38:10 +00:00
type UserPrivacySettingRuleRestrictAll struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingRuleRestrictAll) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingRuleRestrictAll
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleRestrictAll) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySettingRule
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleRestrictAll) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleRestrictAll
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleRestrictAll) UserPrivacySettingRuleType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleRestrictAll
2018-08-30 14:55:42 +00:00
}
// A rule to restrict all contacts of a user from doing something
2018-10-23 12:38:10 +00:00
type UserPrivacySettingRuleRestrictContacts struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingRuleRestrictContacts) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingRuleRestrictContacts
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleRestrictContacts) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySettingRule
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleRestrictContacts) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleRestrictContacts
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleRestrictContacts) UserPrivacySettingRuleType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleRestrictContacts
2018-08-30 14:55:42 +00:00
}
// A rule to restrict all specified users from doing something
type UserPrivacySettingRuleRestrictUsers struct {
2018-10-23 12:38:10 +00:00
meta
// The user identifiers
UserIds []int32 `json:"user_ids"`
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingRuleRestrictUsers) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingRuleRestrictUsers
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleRestrictUsers) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySettingRule
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleRestrictUsers) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleRestrictUsers
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRuleRestrictUsers) UserPrivacySettingRuleType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRuleRestrictUsers
2018-08-30 14:55:42 +00:00
}
// A list of privacy rules. Rules are matched in the specified order. The first matched rule defines the privacy setting for a given user. If no rule matches, the action is not allowed
type UserPrivacySettingRules struct {
2018-10-23 12:38:10 +00:00
meta
// A list of rules
Rules []UserPrivacySettingRule `json:"rules"`
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingRules) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingRules
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRules) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySettingRules
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingRules) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingRules
2018-08-30 14:55:42 +00:00
}
// A privacy setting for managing whether the user's online status is visible
2018-10-23 12:38:10 +00:00
type UserPrivacySettingShowStatus struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingShowStatus) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingShowStatus
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingShowStatus) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySetting
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingShowStatus) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingShowStatus
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingShowStatus) UserPrivacySettingType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingShowStatus
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// A privacy setting for managing whether the user's profile photo is visible
type UserPrivacySettingShowProfilePhoto struct {
meta
}
func (entity *UserPrivacySettingShowProfilePhoto) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserPrivacySettingShowProfilePhoto
return json.Marshal((*stub)(entity))
}
func (*UserPrivacySettingShowProfilePhoto) GetClass() string {
return ClassUserPrivacySetting
}
func (*UserPrivacySettingShowProfilePhoto) GetType() string {
return TypeUserPrivacySettingShowProfilePhoto
}
func (*UserPrivacySettingShowProfilePhoto) UserPrivacySettingType() string {
return TypeUserPrivacySettingShowProfilePhoto
}
// A privacy setting for managing whether a link to the user's account is included in forwarded messages
type UserPrivacySettingShowLinkInForwardedMessages struct {
meta
}
func (entity *UserPrivacySettingShowLinkInForwardedMessages) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserPrivacySettingShowLinkInForwardedMessages
return json.Marshal((*stub)(entity))
}
func (*UserPrivacySettingShowLinkInForwardedMessages) GetClass() string {
return ClassUserPrivacySetting
}
func (*UserPrivacySettingShowLinkInForwardedMessages) GetType() string {
return TypeUserPrivacySettingShowLinkInForwardedMessages
}
func (*UserPrivacySettingShowLinkInForwardedMessages) UserPrivacySettingType() string {
return TypeUserPrivacySettingShowLinkInForwardedMessages
}
2018-08-30 14:55:42 +00:00
// A privacy setting for managing whether the user can be invited to chats
2018-10-23 12:38:10 +00:00
type UserPrivacySettingAllowChatInvites struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingAllowChatInvites) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingAllowChatInvites
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingAllowChatInvites) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySetting
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingAllowChatInvites) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingAllowChatInvites
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingAllowChatInvites) UserPrivacySettingType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingAllowChatInvites
2018-08-30 14:55:42 +00:00
}
// A privacy setting for managing whether the user can be called
2018-10-23 12:38:10 +00:00
type UserPrivacySettingAllowCalls struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *UserPrivacySettingAllowCalls) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UserPrivacySettingAllowCalls
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingAllowCalls) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUserPrivacySetting
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingAllowCalls) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingAllowCalls
2018-08-30 14:55:42 +00:00
}
func (*UserPrivacySettingAllowCalls) UserPrivacySettingType() string {
2018-10-23 12:38:10 +00:00
return TypeUserPrivacySettingAllowCalls
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// A privacy setting for managing whether peer-to-peer connections can be used for calls
type UserPrivacySettingAllowPeerToPeerCalls struct {
meta
}
func (entity *UserPrivacySettingAllowPeerToPeerCalls) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UserPrivacySettingAllowPeerToPeerCalls
return json.Marshal((*stub)(entity))
}
func (*UserPrivacySettingAllowPeerToPeerCalls) GetClass() string {
return ClassUserPrivacySetting
}
func (*UserPrivacySettingAllowPeerToPeerCalls) GetType() string {
return TypeUserPrivacySettingAllowPeerToPeerCalls
}
func (*UserPrivacySettingAllowPeerToPeerCalls) UserPrivacySettingType() string {
return TypeUserPrivacySettingAllowPeerToPeerCalls
}
2018-08-30 14:55:42 +00:00
// Contains information about the period of inactivity after which the current user's account will automatically be deleted
type AccountTtl struct {
2018-10-23 12:38:10 +00:00
meta
// Number of days of inactivity before the account will be flagged for deletion; should range from 30-366 days
Days int32 `json:"days"`
2018-08-30 14:55:42 +00:00
}
func (entity *AccountTtl) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub AccountTtl
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*AccountTtl) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassAccountTtl
2018-08-30 14:55:42 +00:00
}
func (*AccountTtl) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeAccountTtl
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains information about one session in a Telegram application used by the current user. Sessions should be shown to the user in the returned order
2018-08-30 14:55:42 +00:00
type Session struct {
2018-10-23 12:38:10 +00:00
meta
// Session identifier
Id JsonInt64 `json:"id"`
// True, if this session is the current session
IsCurrent bool `json:"is_current"`
2019-06-07 10:56:06 +00:00
// True, if a password is needed to complete authorization of the session
IsPasswordPending bool `json:"is_password_pending"`
2018-10-23 12:38:10 +00:00
// Telegram API identifier, as provided by the application
ApiId int32 `json:"api_id"`
// Name of the application, as provided by the application
ApplicationName string `json:"application_name"`
// The version of the application, as provided by the application
ApplicationVersion string `json:"application_version"`
// True, if the application is an official application or uses the api_id of an official application
IsOfficialApplication bool `json:"is_official_application"`
// Model of the device the application has been run or is running on, as provided by the application
DeviceModel string `json:"device_model"`
// Operating system the application has been run or is running on, as provided by the application
Platform string `json:"platform"`
// Version of the operating system the application has been run or is running on, as provided by the application
SystemVersion string `json:"system_version"`
// Point in time (Unix timestamp) when the user has logged in
LogInDate int32 `json:"log_in_date"`
// Point in time (Unix timestamp) when the session was last used
LastActiveDate int32 `json:"last_active_date"`
// IP address from which the session was created, in human-readable format
Ip string `json:"ip"`
// A two-letter country code for the country from which the session was created, based on the IP address
Country string `json:"country"`
// Region code from which the session was created, based on the IP address
Region string `json:"region"`
2018-08-30 14:55:42 +00:00
}
func (entity *Session) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Session
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Session) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSession
2018-08-30 14:55:42 +00:00
}
func (*Session) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSession
2018-08-30 14:55:42 +00:00
}
// Contains a list of sessions
type Sessions struct {
2018-10-23 12:38:10 +00:00
meta
// List of sessions
Sessions []*Session `json:"sessions"`
2018-08-30 14:55:42 +00:00
}
func (entity *Sessions) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Sessions
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Sessions) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSessions
2018-08-30 14:55:42 +00:00
}
func (*Sessions) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSessions
2018-08-30 14:55:42 +00:00
}
// Contains information about one website the current user is logged in with Telegram
type ConnectedWebsite struct {
2018-10-23 12:38:10 +00:00
meta
// Website identifier
Id JsonInt64 `json:"id"`
// The domain name of the website
DomainName string `json:"domain_name"`
// User identifier of a bot linked with the website
BotUserId int32 `json:"bot_user_id"`
// The version of a browser used to log in
Browser string `json:"browser"`
// Operating system the browser is running on
Platform string `json:"platform"`
// Point in time (Unix timestamp) when the user was logged in
LogInDate int32 `json:"log_in_date"`
// Point in time (Unix timestamp) when obtained authorization was last used
LastActiveDate int32 `json:"last_active_date"`
// IP address from which the user was logged in, in human-readable format
Ip string `json:"ip"`
// Human-readable description of a country and a region, from which the user was logged in, based on the IP address
Location string `json:"location"`
2018-08-30 14:55:42 +00:00
}
func (entity *ConnectedWebsite) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ConnectedWebsite
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ConnectedWebsite) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassConnectedWebsite
2018-08-30 14:55:42 +00:00
}
func (*ConnectedWebsite) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectedWebsite
2018-08-30 14:55:42 +00:00
}
// Contains a list of websites the current user is logged in with Telegram
type ConnectedWebsites struct {
2018-10-23 12:38:10 +00:00
meta
// List of connected websites
Websites []*ConnectedWebsite `json:"websites"`
2018-08-30 14:55:42 +00:00
}
func (entity *ConnectedWebsites) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ConnectedWebsites
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ConnectedWebsites) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassConnectedWebsites
2018-08-30 14:55:42 +00:00
}
func (*ConnectedWebsites) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectedWebsites
2018-08-30 14:55:42 +00:00
}
// Contains information about the availability of the "Report spam" action for a chat
type ChatReportSpamState struct {
2018-10-23 12:38:10 +00:00
meta
// True, if a prompt with the "Report spam" action should be shown to the user
CanReportSpam bool `json:"can_report_spam"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatReportSpamState) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatReportSpamState
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatReportSpamState) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatReportSpamState
2018-08-30 14:55:42 +00:00
}
func (*ChatReportSpamState) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatReportSpamState
2018-08-30 14:55:42 +00:00
}
// The chat contains spam messages
2018-10-23 12:38:10 +00:00
type ChatReportReasonSpam struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *ChatReportReasonSpam) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatReportReasonSpam
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatReportReasonSpam) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatReportReason
2018-08-30 14:55:42 +00:00
}
func (*ChatReportReasonSpam) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatReportReasonSpam
2018-08-30 14:55:42 +00:00
}
func (*ChatReportReasonSpam) ChatReportReasonType() string {
2018-10-23 12:38:10 +00:00
return TypeChatReportReasonSpam
2018-08-30 14:55:42 +00:00
}
// The chat promotes violence
2018-10-23 12:38:10 +00:00
type ChatReportReasonViolence struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *ChatReportReasonViolence) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatReportReasonViolence
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatReportReasonViolence) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatReportReason
2018-08-30 14:55:42 +00:00
}
func (*ChatReportReasonViolence) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatReportReasonViolence
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatReportReasonViolence) ChatReportReasonType() string {
return TypeChatReportReasonViolence
}
// The chat contains pornographic messages
type ChatReportReasonPornography struct {
meta
}
func (entity *ChatReportReasonPornography) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub ChatReportReasonPornography
return json.Marshal((*stub)(entity))
}
func (*ChatReportReasonPornography) GetClass() string {
return ClassChatReportReason
}
func (*ChatReportReasonPornography) GetType() string {
return TypeChatReportReasonPornography
}
func (*ChatReportReasonPornography) ChatReportReasonType() string {
return TypeChatReportReasonPornography
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The chat has child abuse related content
type ChatReportReasonChildAbuse struct {
2018-10-23 12:38:10 +00:00
meta
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (entity *ChatReportReasonChildAbuse) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2019-06-07 10:56:06 +00:00
type stub ChatReportReasonChildAbuse
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatReportReasonChildAbuse) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatReportReason
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatReportReasonChildAbuse) GetType() string {
return TypeChatReportReasonChildAbuse
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
func (*ChatReportReasonChildAbuse) ChatReportReasonType() string {
return TypeChatReportReasonChildAbuse
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// The chat contains copyrighted content
2018-10-23 12:38:10 +00:00
type ChatReportReasonCopyright struct {
meta
2018-09-05 21:45:29 +00:00
}
func (entity *ChatReportReasonCopyright) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatReportReasonCopyright
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*ChatReportReasonCopyright) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatReportReason
2018-09-05 21:45:29 +00:00
}
func (*ChatReportReasonCopyright) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatReportReasonCopyright
2018-09-05 21:45:29 +00:00
}
func (*ChatReportReasonCopyright) ChatReportReasonType() string {
2018-10-23 12:38:10 +00:00
return TypeChatReportReasonCopyright
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// A custom reason provided by the user
type ChatReportReasonCustom struct {
2018-10-23 12:38:10 +00:00
meta
// Report text
Text string `json:"text"`
2018-08-30 14:55:42 +00:00
}
func (entity *ChatReportReasonCustom) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ChatReportReasonCustom
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ChatReportReasonCustom) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassChatReportReason
2018-08-30 14:55:42 +00:00
}
func (*ChatReportReasonCustom) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeChatReportReasonCustom
2018-08-30 14:55:42 +00:00
}
func (*ChatReportReasonCustom) ChatReportReasonType() string {
2018-10-23 12:38:10 +00:00
return TypeChatReportReasonCustom
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Contains a public HTTPS link to a message in a public supergroup or channel with a username
2018-08-30 14:55:42 +00:00
type PublicMessageLink struct {
2018-10-23 12:38:10 +00:00
meta
// Message link
Link string `json:"link"`
// HTML-code for embedding the message
Html string `json:"html"`
2018-08-30 14:55:42 +00:00
}
func (entity *PublicMessageLink) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub PublicMessageLink
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*PublicMessageLink) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassPublicMessageLink
2018-08-30 14:55:42 +00:00
}
func (*PublicMessageLink) GetType() string {
2018-10-23 12:38:10 +00:00
return TypePublicMessageLink
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Contains information about a link to a message in a chat
type MessageLinkInfo struct {
meta
// True, if the link is a public link for a message in a chat
IsPublic bool `json:"is_public"`
// If found, identifier of the chat to which the message belongs, 0 otherwise
ChatId int64 `json:"chat_id"`
// If found, the linked message; may be null
Message *Message `json:"message"`
// True, if the whole media album to which the message belongs is linked
ForAlbum bool `json:"for_album"`
}
func (entity *MessageLinkInfo) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub MessageLinkInfo
return json.Marshal((*stub)(entity))
}
func (*MessageLinkInfo) GetClass() string {
return ClassMessageLinkInfo
}
func (*MessageLinkInfo) GetType() string {
return TypeMessageLinkInfo
}
2019-06-07 10:56:06 +00:00
// Contains a part of a file
type FilePart struct {
meta
// File bytes
Data []byte `json:"data"`
}
func (entity *FilePart) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub FilePart
return json.Marshal((*stub)(entity))
}
func (*FilePart) GetClass() string {
return ClassFilePart
}
func (*FilePart) GetType() string {
return TypeFilePart
}
2018-08-30 14:55:42 +00:00
// The data is not a file
2018-10-23 12:38:10 +00:00
type FileTypeNone struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeNone) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeNone
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeNone) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeNone) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeNone
2018-08-30 14:55:42 +00:00
}
func (*FileTypeNone) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeNone
2018-08-30 14:55:42 +00:00
}
// The file is an animation
2018-10-23 12:38:10 +00:00
type FileTypeAnimation struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeAnimation) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeAnimation
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeAnimation) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeAnimation) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeAnimation
2018-08-30 14:55:42 +00:00
}
func (*FileTypeAnimation) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeAnimation
2018-08-30 14:55:42 +00:00
}
// The file is an audio file
2018-10-23 12:38:10 +00:00
type FileTypeAudio struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeAudio) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeAudio
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeAudio) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeAudio) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeAudio
2018-08-30 14:55:42 +00:00
}
func (*FileTypeAudio) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeAudio
2018-08-30 14:55:42 +00:00
}
// The file is a document
2018-10-23 12:38:10 +00:00
type FileTypeDocument struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeDocument) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeDocument
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeDocument) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeDocument) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeDocument
2018-08-30 14:55:42 +00:00
}
func (*FileTypeDocument) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeDocument
2018-08-30 14:55:42 +00:00
}
// The file is a photo
2018-10-23 12:38:10 +00:00
type FileTypePhoto struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypePhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypePhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypePhoto) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypePhoto) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypePhoto
2018-08-30 14:55:42 +00:00
}
func (*FileTypePhoto) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypePhoto
2018-08-30 14:55:42 +00:00
}
// The file is a profile photo
2018-10-23 12:38:10 +00:00
type FileTypeProfilePhoto struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeProfilePhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeProfilePhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeProfilePhoto) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeProfilePhoto) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeProfilePhoto
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*FileTypeProfilePhoto) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeProfilePhoto
2018-09-05 21:45:29 +00:00
}
// The file was sent to a secret chat (the file type is not known to the server)
2018-10-23 12:38:10 +00:00
type FileTypeSecret struct {
meta
2018-09-05 21:45:29 +00:00
}
func (entity *FileTypeSecret) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeSecret
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*FileTypeSecret) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-09-05 21:45:29 +00:00
}
func (*FileTypeSecret) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeSecret
2018-09-05 21:45:29 +00:00
}
func (*FileTypeSecret) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeSecret
2018-09-05 21:45:29 +00:00
}
// The file is a thumbnail of a file from a secret chat
2018-10-23 12:38:10 +00:00
type FileTypeSecretThumbnail struct {
meta
2018-09-05 21:45:29 +00:00
}
func (entity *FileTypeSecretThumbnail) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeSecretThumbnail
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*FileTypeSecretThumbnail) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-09-05 21:45:29 +00:00
}
func (*FileTypeSecretThumbnail) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeSecretThumbnail
2018-09-05 21:45:29 +00:00
}
func (*FileTypeSecretThumbnail) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeSecretThumbnail
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// The file is a file from Secure storage used for storing Telegram Passport files
2018-10-23 12:38:10 +00:00
type FileTypeSecure struct {
meta
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (entity *FileTypeSecure) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeSecure
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*FileTypeSecure) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*FileTypeSecure) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeSecure
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*FileTypeSecure) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeSecure
2018-08-30 14:55:42 +00:00
}
// The file is a sticker
2018-10-23 12:38:10 +00:00
type FileTypeSticker struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeSticker) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeSticker
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeSticker) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeSticker) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeSticker
2018-08-30 14:55:42 +00:00
}
func (*FileTypeSticker) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeSticker
2018-08-30 14:55:42 +00:00
}
// The file is a thumbnail of another file
2018-10-23 12:38:10 +00:00
type FileTypeThumbnail struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeThumbnail) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeThumbnail
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeThumbnail) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeThumbnail) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeThumbnail
2018-08-30 14:55:42 +00:00
}
func (*FileTypeThumbnail) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeThumbnail
2018-08-30 14:55:42 +00:00
}
// The file type is not yet known
2018-10-23 12:38:10 +00:00
type FileTypeUnknown struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeUnknown) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeUnknown
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeUnknown) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeUnknown) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeUnknown
2018-08-30 14:55:42 +00:00
}
func (*FileTypeUnknown) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeUnknown
2018-08-30 14:55:42 +00:00
}
// The file is a video
2018-10-23 12:38:10 +00:00
type FileTypeVideo struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeVideo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeVideo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeVideo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeVideo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeVideo
2018-08-30 14:55:42 +00:00
}
func (*FileTypeVideo) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeVideo
2018-08-30 14:55:42 +00:00
}
// The file is a video note
2018-10-23 12:38:10 +00:00
type FileTypeVideoNote struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeVideoNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeVideoNote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeVideoNote) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeVideoNote) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeVideoNote
2018-08-30 14:55:42 +00:00
}
func (*FileTypeVideoNote) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeVideoNote
2018-08-30 14:55:42 +00:00
}
// The file is a voice note
2018-10-23 12:38:10 +00:00
type FileTypeVoiceNote struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeVoiceNote) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeVoiceNote
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeVoiceNote) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeVoiceNote) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeVoiceNote
2018-08-30 14:55:42 +00:00
}
func (*FileTypeVoiceNote) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeVoiceNote
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// The file is a wallpaper or a background pattern
2018-10-23 12:38:10 +00:00
type FileTypeWallpaper struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *FileTypeWallpaper) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub FileTypeWallpaper
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*FileTypeWallpaper) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassFileType
2018-08-30 14:55:42 +00:00
}
func (*FileTypeWallpaper) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeWallpaper
2018-08-30 14:55:42 +00:00
}
func (*FileTypeWallpaper) FileTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeFileTypeWallpaper
2018-08-30 14:55:42 +00:00
}
// Contains the storage usage statistics for a specific file type
type StorageStatisticsByFileType struct {
2018-10-23 12:38:10 +00:00
meta
// File type
FileType FileType `json:"file_type"`
// Total size of the files
Size int64 `json:"size"`
// Total number of files
Count int32 `json:"count"`
2018-08-30 14:55:42 +00:00
}
func (entity *StorageStatisticsByFileType) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub StorageStatisticsByFileType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*StorageStatisticsByFileType) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassStorageStatisticsByFileType
2018-08-30 14:55:42 +00:00
}
func (*StorageStatisticsByFileType) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeStorageStatisticsByFileType
2018-08-30 14:55:42 +00:00
}
func (storageStatisticsByFileType *StorageStatisticsByFileType) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
FileType json.RawMessage `json:"file_type"`
Size int64 `json:"size"`
Count int32 `json:"count"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
storageStatisticsByFileType.Size = tmp.Size
storageStatisticsByFileType.Count = tmp.Count
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldFileType, _ := UnmarshalFileType(tmp.FileType)
storageStatisticsByFileType.FileType = fieldFileType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// Contains the storage usage statistics for a specific chat
type StorageStatisticsByChat struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier; 0 if none
ChatId int64 `json:"chat_id"`
// Total size of the files in the chat
Size int64 `json:"size"`
// Total number of files in the chat
Count int32 `json:"count"`
// Statistics split by file types
ByFileType []*StorageStatisticsByFileType `json:"by_file_type"`
2018-08-30 14:55:42 +00:00
}
func (entity *StorageStatisticsByChat) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub StorageStatisticsByChat
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*StorageStatisticsByChat) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassStorageStatisticsByChat
2018-08-30 14:55:42 +00:00
}
func (*StorageStatisticsByChat) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeStorageStatisticsByChat
2018-08-30 14:55:42 +00:00
}
// Contains the exact storage usage statistics split by chats and file type
type StorageStatistics struct {
2018-10-23 12:38:10 +00:00
meta
// Total size of files
Size int64 `json:"size"`
// Total number of files
Count int32 `json:"count"`
// Statistics split by chats
ByChat []*StorageStatisticsByChat `json:"by_chat"`
2018-08-30 14:55:42 +00:00
}
func (entity *StorageStatistics) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub StorageStatistics
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*StorageStatistics) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassStorageStatistics
2018-08-30 14:55:42 +00:00
}
func (*StorageStatistics) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeStorageStatistics
2018-08-30 14:55:42 +00:00
}
// Contains approximate storage usage statistics, excluding files of unknown file type
type StorageStatisticsFast struct {
2018-10-23 12:38:10 +00:00
meta
// Approximate total size of files
FilesSize int64 `json:"files_size"`
// Approximate number of files
FileCount int32 `json:"file_count"`
// Size of the database
DatabaseSize int64 `json:"database_size"`
2019-06-07 10:56:06 +00:00
// Size of the language pack database
LanguagePackDatabaseSize int64 `json:"language_pack_database_size"`
// Size of the TDLib internal log
LogSize int64 `json:"log_size"`
2018-08-30 14:55:42 +00:00
}
func (entity *StorageStatisticsFast) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub StorageStatisticsFast
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*StorageStatisticsFast) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassStorageStatisticsFast
2018-08-30 14:55:42 +00:00
}
func (*StorageStatisticsFast) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeStorageStatisticsFast
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Contains database statistics
type DatabaseStatistics struct {
meta
// Database statistics in an unspecified human-readable format
Statistics string `json:"statistics"`
}
func (entity *DatabaseStatistics) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub DatabaseStatistics
return json.Marshal((*stub)(entity))
}
func (*DatabaseStatistics) GetClass() string {
return ClassDatabaseStatistics
}
func (*DatabaseStatistics) GetType() string {
return TypeDatabaseStatistics
}
2018-08-30 14:55:42 +00:00
// The network is not available
2018-10-23 12:38:10 +00:00
type NetworkTypeNone struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *NetworkTypeNone) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NetworkTypeNone
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeNone) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNetworkType
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeNone) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeNone
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeNone) NetworkTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeNone
2018-08-30 14:55:42 +00:00
}
// A mobile network
2018-10-23 12:38:10 +00:00
type NetworkTypeMobile struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *NetworkTypeMobile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NetworkTypeMobile
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeMobile) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNetworkType
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeMobile) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeMobile
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeMobile) NetworkTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeMobile
2018-08-30 14:55:42 +00:00
}
// A mobile roaming network
2018-10-23 12:38:10 +00:00
type NetworkTypeMobileRoaming struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *NetworkTypeMobileRoaming) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NetworkTypeMobileRoaming
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeMobileRoaming) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNetworkType
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeMobileRoaming) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeMobileRoaming
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeMobileRoaming) NetworkTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeMobileRoaming
2018-08-30 14:55:42 +00:00
}
// A Wi-Fi network
2018-10-23 12:38:10 +00:00
type NetworkTypeWiFi struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *NetworkTypeWiFi) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NetworkTypeWiFi
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeWiFi) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNetworkType
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeWiFi) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeWiFi
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeWiFi) NetworkTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeWiFi
2018-08-30 14:55:42 +00:00
}
// A different network type (e.g., Ethernet network)
2018-10-23 12:38:10 +00:00
type NetworkTypeOther struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *NetworkTypeOther) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NetworkTypeOther
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeOther) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNetworkType
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeOther) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeOther
2018-08-30 14:55:42 +00:00
}
func (*NetworkTypeOther) NetworkTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkTypeOther
2018-08-30 14:55:42 +00:00
}
// Contains information about the total amount of data that was used to send and receive files
type NetworkStatisticsEntryFile struct {
2018-10-23 12:38:10 +00:00
meta
// Type of the file the data is part of
FileType FileType `json:"file_type"`
// Type of the network the data was sent through. Call setNetworkType to maintain the actual network type
NetworkType NetworkType `json:"network_type"`
// Total number of bytes sent
SentBytes int64 `json:"sent_bytes"`
// Total number of bytes received
ReceivedBytes int64 `json:"received_bytes"`
2018-08-30 14:55:42 +00:00
}
func (entity *NetworkStatisticsEntryFile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NetworkStatisticsEntryFile
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*NetworkStatisticsEntryFile) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNetworkStatisticsEntry
2018-08-30 14:55:42 +00:00
}
func (*NetworkStatisticsEntryFile) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkStatisticsEntryFile
2018-08-30 14:55:42 +00:00
}
func (*NetworkStatisticsEntryFile) NetworkStatisticsEntryType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkStatisticsEntryFile
2018-08-30 14:55:42 +00:00
}
func (networkStatisticsEntryFile *NetworkStatisticsEntryFile) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
FileType json.RawMessage `json:"file_type"`
NetworkType json.RawMessage `json:"network_type"`
SentBytes int64 `json:"sent_bytes"`
ReceivedBytes int64 `json:"received_bytes"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
networkStatisticsEntryFile.SentBytes = tmp.SentBytes
networkStatisticsEntryFile.ReceivedBytes = tmp.ReceivedBytes
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldFileType, _ := UnmarshalFileType(tmp.FileType)
networkStatisticsEntryFile.FileType = fieldFileType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldNetworkType, _ := UnmarshalNetworkType(tmp.NetworkType)
networkStatisticsEntryFile.NetworkType = fieldNetworkType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// Contains information about the total amount of data that was used for calls
type NetworkStatisticsEntryCall struct {
2018-10-23 12:38:10 +00:00
meta
// Type of the network the data was sent through. Call setNetworkType to maintain the actual network type
NetworkType NetworkType `json:"network_type"`
// Total number of bytes sent
SentBytes int64 `json:"sent_bytes"`
// Total number of bytes received
ReceivedBytes int64 `json:"received_bytes"`
// Total call duration, in seconds
Duration float64 `json:"duration"`
2018-08-30 14:55:42 +00:00
}
func (entity *NetworkStatisticsEntryCall) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NetworkStatisticsEntryCall
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*NetworkStatisticsEntryCall) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNetworkStatisticsEntry
2018-08-30 14:55:42 +00:00
}
func (*NetworkStatisticsEntryCall) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkStatisticsEntryCall
2018-08-30 14:55:42 +00:00
}
func (*NetworkStatisticsEntryCall) NetworkStatisticsEntryType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkStatisticsEntryCall
2018-08-30 14:55:42 +00:00
}
func (networkStatisticsEntryCall *NetworkStatisticsEntryCall) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
NetworkType json.RawMessage `json:"network_type"`
SentBytes int64 `json:"sent_bytes"`
ReceivedBytes int64 `json:"received_bytes"`
Duration float64 `json:"duration"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
networkStatisticsEntryCall.SentBytes = tmp.SentBytes
networkStatisticsEntryCall.ReceivedBytes = tmp.ReceivedBytes
networkStatisticsEntryCall.Duration = tmp.Duration
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldNetworkType, _ := UnmarshalNetworkType(tmp.NetworkType)
networkStatisticsEntryCall.NetworkType = fieldNetworkType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A full list of available network statistic entries
type NetworkStatistics struct {
2018-10-23 12:38:10 +00:00
meta
// Point in time (Unix timestamp) when the app began collecting statistics
SinceDate int32 `json:"since_date"`
// Network statistics entries
Entries []NetworkStatisticsEntry `json:"entries"`
2018-08-30 14:55:42 +00:00
}
func (entity *NetworkStatistics) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub NetworkStatistics
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*NetworkStatistics) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassNetworkStatistics
2018-08-30 14:55:42 +00:00
}
func (*NetworkStatistics) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeNetworkStatistics
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Contains auto-download settings
type AutoDownloadSettings struct {
meta
// True, if the auto-download is enabled
IsAutoDownloadEnabled bool `json:"is_auto_download_enabled"`
// Maximum size of a photo file to be auto-downloaded
MaxPhotoFileSize int32 `json:"max_photo_file_size"`
// Maximum size of a video file to be auto-downloaded
MaxVideoFileSize int32 `json:"max_video_file_size"`
// Maximum size of other file types to be auto-downloaded
MaxOtherFileSize int32 `json:"max_other_file_size"`
// True, if the beginning of videos needs to be preloaded for instant playback
PreloadLargeVideos bool `json:"preload_large_videos"`
// True, if the next audio track needs to be preloaded while the user is listening to an audio file
PreloadNextAudio bool `json:"preload_next_audio"`
// True, if "use less data for calls" option needs to be enabled
UseLessDataForCalls bool `json:"use_less_data_for_calls"`
}
func (entity *AutoDownloadSettings) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub AutoDownloadSettings
return json.Marshal((*stub)(entity))
}
func (*AutoDownloadSettings) GetClass() string {
return ClassAutoDownloadSettings
}
func (*AutoDownloadSettings) GetType() string {
return TypeAutoDownloadSettings
}
// Contains auto-download settings presets for the user
type AutoDownloadSettingsPresets struct {
meta
// Preset with lowest settings; supposed to be used by default when roaming
Low *AutoDownloadSettings `json:"low"`
// Preset with medium settings; supposed to be used by default when using mobile data
Medium *AutoDownloadSettings `json:"medium"`
// Preset with highest settings; supposed to be used by default when connected on Wi-Fi
High *AutoDownloadSettings `json:"high"`
}
func (entity *AutoDownloadSettingsPresets) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub AutoDownloadSettingsPresets
return json.Marshal((*stub)(entity))
}
func (*AutoDownloadSettingsPresets) GetClass() string {
return ClassAutoDownloadSettingsPresets
}
func (*AutoDownloadSettingsPresets) GetType() string {
return TypeAutoDownloadSettingsPresets
}
// Currently waiting for the network to become available. Use setNetworkType to change the available network type
2018-10-23 12:38:10 +00:00
type ConnectionStateWaitingForNetwork struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *ConnectionStateWaitingForNetwork) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ConnectionStateWaitingForNetwork
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateWaitingForNetwork) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassConnectionState
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateWaitingForNetwork) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateWaitingForNetwork
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateWaitingForNetwork) ConnectionStateType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateWaitingForNetwork
2018-08-30 14:55:42 +00:00
}
// Currently establishing a connection with a proxy server
2018-10-23 12:38:10 +00:00
type ConnectionStateConnectingToProxy struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *ConnectionStateConnectingToProxy) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ConnectionStateConnectingToProxy
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateConnectingToProxy) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassConnectionState
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateConnectingToProxy) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateConnectingToProxy
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateConnectingToProxy) ConnectionStateType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateConnectingToProxy
2018-08-30 14:55:42 +00:00
}
// Currently establishing a connection to the Telegram servers
2018-10-23 12:38:10 +00:00
type ConnectionStateConnecting struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *ConnectionStateConnecting) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ConnectionStateConnecting
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateConnecting) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassConnectionState
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateConnecting) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateConnecting
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateConnecting) ConnectionStateType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateConnecting
2018-08-30 14:55:42 +00:00
}
// Downloading data received while the client was offline
2018-10-23 12:38:10 +00:00
type ConnectionStateUpdating struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *ConnectionStateUpdating) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ConnectionStateUpdating
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateUpdating) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassConnectionState
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateUpdating) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateUpdating
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateUpdating) ConnectionStateType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateUpdating
2018-08-30 14:55:42 +00:00
}
// There is a working connection to the Telegram servers
2018-10-23 12:38:10 +00:00
type ConnectionStateReady struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *ConnectionStateReady) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ConnectionStateReady
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateReady) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassConnectionState
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateReady) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateReady
2018-08-30 14:55:42 +00:00
}
func (*ConnectionStateReady) ConnectionStateType() string {
2018-10-23 12:38:10 +00:00
return TypeConnectionStateReady
2018-08-30 14:55:42 +00:00
}
// A category containing frequently used private chats with non-bot users
2018-10-23 12:38:10 +00:00
type TopChatCategoryUsers struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *TopChatCategoryUsers) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TopChatCategoryUsers
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryUsers) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTopChatCategory
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryUsers) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryUsers
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryUsers) TopChatCategoryType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryUsers
2018-08-30 14:55:42 +00:00
}
// A category containing frequently used private chats with bot users
2018-10-23 12:38:10 +00:00
type TopChatCategoryBots struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *TopChatCategoryBots) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TopChatCategoryBots
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryBots) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTopChatCategory
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryBots) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryBots
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryBots) TopChatCategoryType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryBots
2018-08-30 14:55:42 +00:00
}
// A category containing frequently used basic groups and supergroups
2018-10-23 12:38:10 +00:00
type TopChatCategoryGroups struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *TopChatCategoryGroups) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TopChatCategoryGroups
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryGroups) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTopChatCategory
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryGroups) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryGroups
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryGroups) TopChatCategoryType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryGroups
2018-08-30 14:55:42 +00:00
}
// A category containing frequently used channels
2018-10-23 12:38:10 +00:00
type TopChatCategoryChannels struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *TopChatCategoryChannels) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TopChatCategoryChannels
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryChannels) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTopChatCategory
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryChannels) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryChannels
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryChannels) TopChatCategoryType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryChannels
2018-08-30 14:55:42 +00:00
}
// A category containing frequently used chats with inline bots sorted by their usage in inline mode
2018-10-23 12:38:10 +00:00
type TopChatCategoryInlineBots struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *TopChatCategoryInlineBots) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TopChatCategoryInlineBots
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryInlineBots) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTopChatCategory
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryInlineBots) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryInlineBots
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryInlineBots) TopChatCategoryType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryInlineBots
2018-08-30 14:55:42 +00:00
}
// A category containing frequently used chats used for calls
2018-10-23 12:38:10 +00:00
type TopChatCategoryCalls struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *TopChatCategoryCalls) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TopChatCategoryCalls
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryCalls) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTopChatCategory
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryCalls) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryCalls
2018-08-30 14:55:42 +00:00
}
func (*TopChatCategoryCalls) TopChatCategoryType() string {
2018-10-23 12:38:10 +00:00
return TypeTopChatCategoryCalls
2018-08-30 14:55:42 +00:00
}
// A URL linking to a user
type TMeUrlTypeUser struct {
2018-10-23 12:38:10 +00:00
meta
// Identifier of the user
UserId int32 `json:"user_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *TMeUrlTypeUser) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TMeUrlTypeUser
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeUser) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTMeUrlType
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeUser) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrlTypeUser
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeUser) TMeUrlTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrlTypeUser
2018-08-30 14:55:42 +00:00
}
// A URL linking to a public supergroup or channel
type TMeUrlTypeSupergroup struct {
2018-10-23 12:38:10 +00:00
meta
// Identifier of the supergroup or channel
SupergroupId int64 `json:"supergroup_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *TMeUrlTypeSupergroup) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TMeUrlTypeSupergroup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeSupergroup) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTMeUrlType
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeSupergroup) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrlTypeSupergroup
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeSupergroup) TMeUrlTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrlTypeSupergroup
2018-08-30 14:55:42 +00:00
}
// A chat invite link
type TMeUrlTypeChatInvite struct {
2018-10-23 12:38:10 +00:00
meta
// Chat invite link info
Info *ChatInviteLinkInfo `json:"info"`
2018-08-30 14:55:42 +00:00
}
func (entity *TMeUrlTypeChatInvite) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TMeUrlTypeChatInvite
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeChatInvite) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTMeUrlType
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeChatInvite) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrlTypeChatInvite
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeChatInvite) TMeUrlTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrlTypeChatInvite
2018-08-30 14:55:42 +00:00
}
// A URL linking to a sticker set
type TMeUrlTypeStickerSet struct {
2018-10-23 12:38:10 +00:00
meta
// Identifier of the sticker set
StickerSetId JsonInt64 `json:"sticker_set_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *TMeUrlTypeStickerSet) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TMeUrlTypeStickerSet
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeStickerSet) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTMeUrlType
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeStickerSet) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrlTypeStickerSet
2018-08-30 14:55:42 +00:00
}
func (*TMeUrlTypeStickerSet) TMeUrlTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrlTypeStickerSet
2018-08-30 14:55:42 +00:00
}
// Represents a URL linking to an internal Telegram entity
type TMeUrl struct {
2018-10-23 12:38:10 +00:00
meta
// URL
Url string `json:"url"`
// Type of the URL
Type TMeUrlType `json:"type"`
2018-08-30 14:55:42 +00:00
}
func (entity *TMeUrl) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TMeUrl
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TMeUrl) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTMeUrl
2018-08-30 14:55:42 +00:00
}
func (*TMeUrl) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrl
2018-08-30 14:55:42 +00:00
}
func (tMeUrl *TMeUrl) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Url string `json:"url"`
Type json.RawMessage `json:"type"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
tMeUrl.Url = tmp.Url
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldType, _ := UnmarshalTMeUrlType(tmp.Type)
tMeUrl.Type = fieldType
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// Contains a list of t.me URLs
type TMeUrls struct {
2018-10-23 12:38:10 +00:00
meta
// List of URLs
Urls []*TMeUrl `json:"urls"`
2018-08-30 14:55:42 +00:00
}
func (entity *TMeUrls) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TMeUrls
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TMeUrls) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTMeUrls
2018-08-30 14:55:42 +00:00
}
func (*TMeUrls) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTMeUrls
2018-08-30 14:55:42 +00:00
}
// Contains a counter
type Count struct {
2018-10-23 12:38:10 +00:00
meta
// Count
Count int32 `json:"count"`
2018-08-30 14:55:42 +00:00
}
func (entity *Count) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Count
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Count) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassCount
2018-08-30 14:55:42 +00:00
}
func (*Count) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeCount
2018-08-30 14:55:42 +00:00
}
// Contains some text
type Text struct {
2018-10-23 12:38:10 +00:00
meta
// Text
Text string `json:"text"`
2018-08-30 14:55:42 +00:00
}
func (entity *Text) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Text
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*Text) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassText
2018-08-30 14:55:42 +00:00
}
func (*Text) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeText
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Contains a value representing a number of seconds
type Seconds struct {
2018-10-23 12:38:10 +00:00
meta
// Number of seconds
Seconds float64 `json:"seconds"`
2018-09-05 21:45:29 +00:00
}
func (entity *Seconds) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub Seconds
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*Seconds) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassSeconds
2018-09-05 21:45:29 +00:00
}
func (*Seconds) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeSeconds
2018-09-05 21:45:29 +00:00
}
// Contains information about a tg:// deep link
type DeepLinkInfo struct {
2018-10-23 12:38:10 +00:00
meta
// Text to be shown to the user
Text *FormattedText `json:"text"`
// True, if user should be asked to update the application
NeedUpdateApplication bool `json:"need_update_application"`
2018-09-05 21:45:29 +00:00
}
func (entity *DeepLinkInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub DeepLinkInfo
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*DeepLinkInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassDeepLinkInfo
2018-09-05 21:45:29 +00:00
}
func (*DeepLinkInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeDeepLinkInfo
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// The text should be parsed in markdown-style
2018-10-23 12:38:10 +00:00
type TextParseModeMarkdown struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *TextParseModeMarkdown) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TextParseModeMarkdown
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TextParseModeMarkdown) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTextParseMode
2018-08-30 14:55:42 +00:00
}
func (*TextParseModeMarkdown) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTextParseModeMarkdown
2018-08-30 14:55:42 +00:00
}
func (*TextParseModeMarkdown) TextParseModeType() string {
2018-10-23 12:38:10 +00:00
return TypeTextParseModeMarkdown
2018-08-30 14:55:42 +00:00
}
// The text should be parsed in HTML-style
2018-10-23 12:38:10 +00:00
type TextParseModeHTML struct {
meta
2018-08-30 14:55:42 +00:00
}
func (entity *TextParseModeHTML) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TextParseModeHTML
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TextParseModeHTML) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTextParseMode
2018-08-30 14:55:42 +00:00
}
func (*TextParseModeHTML) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTextParseModeHTML
2018-08-30 14:55:42 +00:00
}
func (*TextParseModeHTML) TextParseModeType() string {
2018-10-23 12:38:10 +00:00
return TypeTextParseModeHTML
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// A SOCKS5 proxy server
type ProxyTypeSocks5 struct {
2018-10-23 12:38:10 +00:00
meta
// Username for logging in; may be empty
Username string `json:"username"`
// Password for logging in; may be empty
Password string `json:"password"`
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (entity *ProxyTypeSocks5) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub ProxyTypeSocks5
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*ProxyTypeSocks5) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassProxyType
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*ProxyTypeSocks5) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeProxyTypeSocks5
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*ProxyTypeSocks5) ProxyTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeProxyTypeSocks5
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// A HTTP transparent proxy server
type ProxyTypeHttp struct {
2018-10-23 12:38:10 +00:00
meta
// Username for logging in; may be empty
Username string `json:"username"`
// Password for logging in; may be empty
Password string `json:"password"`
// Pass true, if the proxy supports only HTTP requests and doesn't support transparent TCP connections via HTTP CONNECT method
HttpOnly bool `json:"http_only"`
2018-09-05 21:45:29 +00:00
}
func (entity *ProxyTypeHttp) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub ProxyTypeHttp
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*ProxyTypeHttp) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassProxyType
2018-09-05 21:45:29 +00:00
}
func (*ProxyTypeHttp) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeProxyTypeHttp
2018-09-05 21:45:29 +00:00
}
func (*ProxyTypeHttp) ProxyTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeProxyTypeHttp
2018-09-05 21:45:29 +00:00
}
// An MTProto proxy server
type ProxyTypeMtproto struct {
2018-10-23 12:38:10 +00:00
meta
// The proxy's secret in hexadecimal encoding
Secret string `json:"secret"`
2018-09-05 21:45:29 +00:00
}
func (entity *ProxyTypeMtproto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub ProxyTypeMtproto
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*ProxyTypeMtproto) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassProxyType
2018-09-05 21:45:29 +00:00
}
func (*ProxyTypeMtproto) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeProxyTypeMtproto
2018-09-05 21:45:29 +00:00
}
func (*ProxyTypeMtproto) ProxyTypeType() string {
2018-10-23 12:38:10 +00:00
return TypeProxyTypeMtproto
2018-09-05 21:45:29 +00:00
}
// Contains information about a proxy server
type Proxy struct {
2018-10-23 12:38:10 +00:00
meta
// Unique identifier of the proxy
Id int32 `json:"id"`
// Proxy server IP address
Server string `json:"server"`
// Proxy server port
Port int32 `json:"port"`
// Point in time (Unix timestamp) when the proxy was last used; 0 if never
LastUsedDate int32 `json:"last_used_date"`
// True, if the proxy is enabled now
IsEnabled bool `json:"is_enabled"`
// Type of the proxy
Type ProxyType `json:"type"`
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (entity *Proxy) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub Proxy
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*Proxy) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassProxy
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*Proxy) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeProxy
2018-09-05 21:45:29 +00:00
}
func (proxy *Proxy) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Id int32 `json:"id"`
Server string `json:"server"`
Port int32 `json:"port"`
LastUsedDate int32 `json:"last_used_date"`
IsEnabled bool `json:"is_enabled"`
Type json.RawMessage `json:"type"`
}
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
proxy.Id = tmp.Id
proxy.Server = tmp.Server
proxy.Port = tmp.Port
proxy.LastUsedDate = tmp.LastUsedDate
proxy.IsEnabled = tmp.IsEnabled
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
fieldType, _ := UnmarshalProxyType(tmp.Type)
proxy.Type = fieldType
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-09-05 21:45:29 +00:00
}
// Represents a list of proxy servers
type Proxies struct {
2018-10-23 12:38:10 +00:00
meta
// List of proxy servers
Proxies []*Proxy `json:"proxies"`
2018-09-05 21:45:29 +00:00
}
func (entity *Proxies) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub Proxies
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*Proxies) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassProxies
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*Proxies) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeProxies
2018-08-30 14:55:42 +00:00
}
// Describes a sticker that should be added to a sticker set
type InputSticker struct {
2018-10-23 12:38:10 +00:00
meta
// PNG image with the sticker; must be up to 512 kB in size and fit in a 512x512 square
PngSticker InputFile `json:"png_sticker"`
// Emoji corresponding to the sticker
Emojis string `json:"emojis"`
// For masks, position where the mask should be placed; may be null
MaskPosition *MaskPosition `json:"mask_position"`
2018-08-30 14:55:42 +00:00
}
func (entity *InputSticker) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub InputSticker
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*InputSticker) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassInputSticker
2018-08-30 14:55:42 +00:00
}
func (*InputSticker) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeInputSticker
2018-08-30 14:55:42 +00:00
}
func (inputSticker *InputSticker) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
PngSticker json.RawMessage `json:"png_sticker"`
Emojis string `json:"emojis"`
MaskPosition *MaskPosition `json:"mask_position"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
inputSticker.Emojis = tmp.Emojis
inputSticker.MaskPosition = tmp.MaskPosition
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldPngSticker, _ := UnmarshalInputFile(tmp.PngSticker)
inputSticker.PngSticker = fieldPngSticker
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// The user authorization state has changed
type UpdateAuthorizationState struct {
2018-10-23 12:38:10 +00:00
meta
// New authorization state
AuthorizationState AuthorizationState `json:"authorization_state"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateAuthorizationState) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateAuthorizationState
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateAuthorizationState) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateAuthorizationState) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (*UpdateAuthorizationState) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateAuthorizationState
2018-08-30 14:55:42 +00:00
}
func (updateAuthorizationState *UpdateAuthorizationState) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
AuthorizationState json.RawMessage `json:"authorization_state"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldAuthorizationState, _ := UnmarshalAuthorizationState(tmp.AuthorizationState)
updateAuthorizationState.AuthorizationState = fieldAuthorizationState
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A new message was received; can also be an outgoing message
type UpdateNewMessage struct {
2018-10-23 12:38:10 +00:00
meta
// The new message
Message *Message `json:"message"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewMessage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewMessage
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewMessage) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewMessage) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewMessage
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewMessage) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewMessage
2018-08-30 14:55:42 +00:00
}
// A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully or even that the send message request will be processed. This update will be sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message
type UpdateMessageSendAcknowledged struct {
2018-10-23 12:38:10 +00:00
meta
// The chat identifier of the sent message
ChatId int64 `json:"chat_id"`
// A temporary message identifier
MessageId int64 `json:"message_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateMessageSendAcknowledged) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateMessageSendAcknowledged
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageSendAcknowledged) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageSendAcknowledged) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageSendAcknowledged
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageSendAcknowledged) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageSendAcknowledged
2018-08-30 14:55:42 +00:00
}
// A message has been successfully sent
type UpdateMessageSendSucceeded struct {
2018-10-23 12:38:10 +00:00
meta
// Information about the sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change
Message *Message `json:"message"`
// The previous temporary message identifier
OldMessageId int64 `json:"old_message_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateMessageSendSucceeded) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateMessageSendSucceeded
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageSendSucceeded) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageSendSucceeded) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageSendSucceeded
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageSendSucceeded) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageSendSucceeded
2018-08-30 14:55:42 +00:00
}
// A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update
type UpdateMessageSendFailed struct {
2018-10-23 12:38:10 +00:00
meta
2019-09-10 12:36:54 +00:00
// Contains information about the message which failed to send
2018-10-23 12:38:10 +00:00
Message *Message `json:"message"`
// The previous temporary message identifier
OldMessageId int64 `json:"old_message_id"`
// An error code
ErrorCode int32 `json:"error_code"`
// Error message
ErrorMessage string `json:"error_message"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateMessageSendFailed) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateMessageSendFailed
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageSendFailed) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageSendFailed) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageSendFailed
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageSendFailed) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageSendFailed
2018-08-30 14:55:42 +00:00
}
// The message content has changed
type UpdateMessageContent struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Message identifier
MessageId int64 `json:"message_id"`
// New message content
NewContent MessageContent `json:"new_content"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateMessageContent) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateMessageContent
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageContent) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageContent) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageContent
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageContent) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageContent
2018-08-30 14:55:42 +00:00
}
func (updateMessageContent *UpdateMessageContent) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
ChatId int64 `json:"chat_id"`
MessageId int64 `json:"message_id"`
NewContent json.RawMessage `json:"new_content"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateMessageContent.ChatId = tmp.ChatId
updateMessageContent.MessageId = tmp.MessageId
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldNewContent, _ := UnmarshalMessageContent(tmp.NewContent)
updateMessageContent.NewContent = fieldNewContent
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A message was edited. Changes in the message content will come in a separate updateMessageContent
type UpdateMessageEdited struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Message identifier
MessageId int64 `json:"message_id"`
// Point in time (Unix timestamp) when the message was edited
EditDate int32 `json:"edit_date"`
// New message reply markup; may be null
ReplyMarkup ReplyMarkup `json:"reply_markup"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateMessageEdited) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateMessageEdited
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageEdited) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageEdited) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageEdited
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageEdited) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageEdited
2018-08-30 14:55:42 +00:00
}
func (updateMessageEdited *UpdateMessageEdited) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
ChatId int64 `json:"chat_id"`
MessageId int64 `json:"message_id"`
EditDate int32 `json:"edit_date"`
ReplyMarkup json.RawMessage `json:"reply_markup"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateMessageEdited.ChatId = tmp.ChatId
updateMessageEdited.MessageId = tmp.MessageId
updateMessageEdited.EditDate = tmp.EditDate
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup)
updateMessageEdited.ReplyMarkup = fieldReplyMarkup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// The view count of the message has changed
type UpdateMessageViews struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Message identifier
MessageId int64 `json:"message_id"`
// New value of the view count
Views int32 `json:"views"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateMessageViews) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateMessageViews
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageViews) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageViews) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageViews
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageViews) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageViews
2018-08-30 14:55:42 +00:00
}
// The message content was opened. Updates voice note messages to "listened", video note messages to "viewed" and starts the TTL timer for self-destructing messages
type UpdateMessageContentOpened struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Message identifier
MessageId int64 `json:"message_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateMessageContentOpened) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateMessageContentOpened
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageContentOpened) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageContentOpened) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageContentOpened
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageContentOpened) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageContentOpened
2018-08-30 14:55:42 +00:00
}
// A message with an unread mention was read
type UpdateMessageMentionRead struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Message identifier
MessageId int64 `json:"message_id"`
// The new number of unread mention messages left in the chat
UnreadMentionCount int32 `json:"unread_mention_count"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateMessageMentionRead) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateMessageMentionRead
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageMentionRead) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageMentionRead) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageMentionRead
2018-08-30 14:55:42 +00:00
}
func (*UpdateMessageMentionRead) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateMessageMentionRead
2018-08-30 14:55:42 +00:00
}
// A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the client. The chat field changes will be reported through separate updates
type UpdateNewChat struct {
2018-10-23 12:38:10 +00:00
meta
// The chat
Chat *Chat `json:"chat"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewChat) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewChat
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewChat) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewChat) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewChat
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewChat) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewChat
2018-08-30 14:55:42 +00:00
}
// The title of a chat was changed
type UpdateChatTitle struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// The new chat title
Title string `json:"title"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatTitle) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatTitle
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatTitle) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatTitle) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatTitle
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatTitle) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatTitle
2018-08-30 14:55:42 +00:00
}
// A chat photo was changed
type UpdateChatPhoto struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// The new chat photo; may be null
Photo *ChatPhoto `json:"photo"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatPhoto) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatPhoto
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatPhoto) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatPhoto) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatPhoto
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatPhoto) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatPhoto
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// Chat permissions was changed
type UpdateChatPermissions struct {
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// The new chat permissions
Permissions *ChatPermissions `json:"permissions"`
}
func (entity *UpdateChatPermissions) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UpdateChatPermissions
return json.Marshal((*stub)(entity))
}
func (*UpdateChatPermissions) GetClass() string {
return ClassUpdate
}
func (*UpdateChatPermissions) GetType() string {
return TypeUpdateChatPermissions
}
func (*UpdateChatPermissions) UpdateType() string {
return TypeUpdateChatPermissions
}
2018-08-30 14:55:42 +00:00
// The last message of a chat was changed. If last_message is null then the last message in the chat became unknown. Some new unknown messages might be added to the chat in this case
type UpdateChatLastMessage struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// The new last message in the chat; may be null
LastMessage *Message `json:"last_message"`
// New value of the chat order
Order JsonInt64 `json:"order"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatLastMessage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatLastMessage
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatLastMessage) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatLastMessage) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatLastMessage
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatLastMessage) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatLastMessage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The order of the chat in the chat list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent
2018-08-30 14:55:42 +00:00
type UpdateChatOrder struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// New value of the order
Order JsonInt64 `json:"order"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatOrder) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatOrder
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatOrder) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatOrder) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatOrder
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatOrder) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatOrder
2018-08-30 14:55:42 +00:00
}
// A chat was pinned or unpinned
type UpdateChatIsPinned struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// New value of is_pinned
IsPinned bool `json:"is_pinned"`
// New value of the chat order
Order JsonInt64 `json:"order"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatIsPinned) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatIsPinned
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatIsPinned) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatIsPinned) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatIsPinned
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatIsPinned) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatIsPinned
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// A chat was marked as unread or was read
type UpdateChatIsMarkedAsUnread struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// New value of is_marked_as_unread
IsMarkedAsUnread bool `json:"is_marked_as_unread"`
2018-09-05 21:45:29 +00:00
}
func (entity *UpdateChatIsMarkedAsUnread) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatIsMarkedAsUnread
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatIsMarkedAsUnread) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatIsMarkedAsUnread) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatIsMarkedAsUnread
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatIsMarkedAsUnread) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatIsMarkedAsUnread
2018-09-05 21:45:29 +00:00
}
// A chat's is_sponsored field has changed
type UpdateChatIsSponsored struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// New value of is_sponsored
IsSponsored bool `json:"is_sponsored"`
// New value of chat order
Order JsonInt64 `json:"order"`
2018-09-05 21:45:29 +00:00
}
func (entity *UpdateChatIsSponsored) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatIsSponsored
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatIsSponsored) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatIsSponsored) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatIsSponsored
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatIsSponsored) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatIsSponsored
2018-09-05 21:45:29 +00:00
}
// The value of the default disable_notification parameter, used when a message is sent to the chat, was changed
type UpdateChatDefaultDisableNotification struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// The new default_disable_notification value
DefaultDisableNotification bool `json:"default_disable_notification"`
2018-09-05 21:45:29 +00:00
}
func (entity *UpdateChatDefaultDisableNotification) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatDefaultDisableNotification
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatDefaultDisableNotification) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatDefaultDisableNotification) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatDefaultDisableNotification
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatDefaultDisableNotification) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatDefaultDisableNotification
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// Incoming messages were read or number of unread messages has been changed
type UpdateChatReadInbox struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Identifier of the last read incoming message
LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"`
// The number of unread messages left in the chat
UnreadCount int32 `json:"unread_count"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatReadInbox) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatReadInbox
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatReadInbox) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatReadInbox) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatReadInbox
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatReadInbox) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatReadInbox
2018-08-30 14:55:42 +00:00
}
// Outgoing messages were read
type UpdateChatReadOutbox struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Identifier of last read outgoing message
LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatReadOutbox) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatReadOutbox
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatReadOutbox) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatReadOutbox) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatReadOutbox
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatReadOutbox) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatReadOutbox
2018-08-30 14:55:42 +00:00
}
// The chat unread_mention_count has changed
type UpdateChatUnreadMentionCount struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// The number of unread mention messages left in the chat
UnreadMentionCount int32 `json:"unread_mention_count"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatUnreadMentionCount) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatUnreadMentionCount
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatUnreadMentionCount) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatUnreadMentionCount) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatUnreadMentionCount
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatUnreadMentionCount) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatUnreadMentionCount
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Notification settings for a chat were changed
type UpdateChatNotificationSettings struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// The new notification settings
NotificationSettings *ChatNotificationSettings `json:"notification_settings"`
2018-09-05 21:45:29 +00:00
}
func (entity *UpdateChatNotificationSettings) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatNotificationSettings
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatNotificationSettings) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatNotificationSettings) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatNotificationSettings
2018-09-05 21:45:29 +00:00
}
func (*UpdateChatNotificationSettings) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatNotificationSettings
2018-09-05 21:45:29 +00:00
}
// Notification settings for some type of chats were updated
type UpdateScopeNotificationSettings struct {
2018-10-23 12:38:10 +00:00
meta
// Types of chats for which notification settings were updated
Scope NotificationSettingsScope `json:"scope"`
// The new notification settings
NotificationSettings *ScopeNotificationSettings `json:"notification_settings"`
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (entity *UpdateScopeNotificationSettings) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateScopeNotificationSettings
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*UpdateScopeNotificationSettings) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*UpdateScopeNotificationSettings) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateScopeNotificationSettings
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (*UpdateScopeNotificationSettings) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateScopeNotificationSettings
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
func (updateScopeNotificationSettings *UpdateScopeNotificationSettings) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Scope json.RawMessage `json:"scope"`
NotificationSettings *ScopeNotificationSettings `json:"notification_settings"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateScopeNotificationSettings.NotificationSettings = tmp.NotificationSettings
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldScope, _ := UnmarshalNotificationSettingsScope(tmp.Scope)
updateScopeNotificationSettings.Scope = fieldScope
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The chat pinned message was changed
type UpdateChatPinnedMessage struct {
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// The new identifier of the pinned message; 0 if there is no pinned message in the chat
PinnedMessageId int64 `json:"pinned_message_id"`
}
func (entity *UpdateChatPinnedMessage) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UpdateChatPinnedMessage
return json.Marshal((*stub)(entity))
}
func (*UpdateChatPinnedMessage) GetClass() string {
return ClassUpdate
}
func (*UpdateChatPinnedMessage) GetType() string {
return TypeUpdateChatPinnedMessage
}
func (*UpdateChatPinnedMessage) UpdateType() string {
return TypeUpdateChatPinnedMessage
}
2018-08-30 14:55:42 +00:00
// The default chat reply markup was changed. Can occur because new messages with reply markup were received or because an old reply markup was hidden by the user
type UpdateChatReplyMarkup struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
ReplyMarkupMessageId int64 `json:"reply_markup_message_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatReplyMarkup) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatReplyMarkup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatReplyMarkup) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatReplyMarkup) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatReplyMarkup
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatReplyMarkup) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatReplyMarkup
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied
2018-08-30 14:55:42 +00:00
type UpdateChatDraftMessage struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// The new draft message; may be null
DraftMessage *DraftMessage `json:"draft_message"`
// New value of the chat order
Order JsonInt64 `json:"order"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateChatDraftMessage) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateChatDraftMessage
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatDraftMessage) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatDraftMessage) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatDraftMessage
2018-08-30 14:55:42 +00:00
}
func (*UpdateChatDraftMessage) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateChatDraftMessage
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// The number of online group members has changed. This update with non-zero count is sent only for currently opened chats. There is no guarantee that it will be sent just after the count has changed
type UpdateChatOnlineMemberCount struct {
meta
// Identifier of the chat
ChatId int64 `json:"chat_id"`
// New number of online members in the chat, or 0 if unknown
OnlineMemberCount int32 `json:"online_member_count"`
}
func (entity *UpdateChatOnlineMemberCount) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UpdateChatOnlineMemberCount
return json.Marshal((*stub)(entity))
}
func (*UpdateChatOnlineMemberCount) GetClass() string {
return ClassUpdate
}
func (*UpdateChatOnlineMemberCount) GetType() string {
return TypeUpdateChatOnlineMemberCount
}
func (*UpdateChatOnlineMemberCount) UpdateType() string {
return TypeUpdateChatOnlineMemberCount
}
// A notification was changed
type UpdateNotification struct {
meta
// Unique notification group identifier
NotificationGroupId int32 `json:"notification_group_id"`
// Changed notification
Notification *Notification `json:"notification"`
}
func (entity *UpdateNotification) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UpdateNotification
return json.Marshal((*stub)(entity))
}
func (*UpdateNotification) GetClass() string {
return ClassUpdate
}
func (*UpdateNotification) GetType() string {
return TypeUpdateNotification
}
func (*UpdateNotification) UpdateType() string {
return TypeUpdateNotification
}
// A list of active notifications in a notification group has changed
type UpdateNotificationGroup struct {
meta
// Unique notification group identifier
NotificationGroupId int32 `json:"notification_group_id"`
// New type of the notification group
Type NotificationGroupType `json:"type"`
// Identifier of a chat to which all notifications in the group belong
ChatId int64 `json:"chat_id"`
// Chat identifier, which notification settings must be applied to the added notifications
NotificationSettingsChatId int64 `json:"notification_settings_chat_id"`
// True, if the notifications should be shown without sound
IsSilent bool `json:"is_silent"`
// Total number of unread notifications in the group, can be bigger than number of active notifications
TotalCount int32 `json:"total_count"`
// List of added group notifications, sorted by notification ID
AddedNotifications []*Notification `json:"added_notifications"`
// Identifiers of removed group notifications, sorted by notification ID
RemovedNotificationIds []int32 `json:"removed_notification_ids"`
}
func (entity *UpdateNotificationGroup) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UpdateNotificationGroup
return json.Marshal((*stub)(entity))
}
func (*UpdateNotificationGroup) GetClass() string {
return ClassUpdate
}
func (*UpdateNotificationGroup) GetType() string {
return TypeUpdateNotificationGroup
}
func (*UpdateNotificationGroup) UpdateType() string {
return TypeUpdateNotificationGroup
}
func (updateNotificationGroup *UpdateNotificationGroup) UnmarshalJSON(data []byte) error {
var tmp struct {
NotificationGroupId int32 `json:"notification_group_id"`
Type json.RawMessage `json:"type"`
ChatId int64 `json:"chat_id"`
NotificationSettingsChatId int64 `json:"notification_settings_chat_id"`
IsSilent bool `json:"is_silent"`
TotalCount int32 `json:"total_count"`
AddedNotifications []*Notification `json:"added_notifications"`
RemovedNotificationIds []int32 `json:"removed_notification_ids"`
}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
updateNotificationGroup.NotificationGroupId = tmp.NotificationGroupId
updateNotificationGroup.ChatId = tmp.ChatId
updateNotificationGroup.NotificationSettingsChatId = tmp.NotificationSettingsChatId
updateNotificationGroup.IsSilent = tmp.IsSilent
updateNotificationGroup.TotalCount = tmp.TotalCount
updateNotificationGroup.AddedNotifications = tmp.AddedNotifications
updateNotificationGroup.RemovedNotificationIds = tmp.RemovedNotificationIds
fieldType, _ := UnmarshalNotificationGroupType(tmp.Type)
updateNotificationGroup.Type = fieldType
return nil
}
// Contains active notifications that was shown on previous application launches. This update is sent only if a message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update
type UpdateActiveNotifications struct {
meta
// Lists of active notification groups
Groups []*NotificationGroup `json:"groups"`
}
func (entity *UpdateActiveNotifications) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UpdateActiveNotifications
return json.Marshal((*stub)(entity))
}
func (*UpdateActiveNotifications) GetClass() string {
return ClassUpdate
}
func (*UpdateActiveNotifications) GetType() string {
return TypeUpdateActiveNotifications
}
func (*UpdateActiveNotifications) UpdateType() string {
return TypeUpdateActiveNotifications
}
// Describes, whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications
type UpdateHavePendingNotifications struct {
meta
// True, if there are some delayed notification updates, which will be sent soon
HaveDelayedNotifications bool `json:"have_delayed_notifications"`
// True, if there can be some yet unreceived notifications, which are being fetched from the server
HaveUnreceivedNotifications bool `json:"have_unreceived_notifications"`
}
func (entity *UpdateHavePendingNotifications) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UpdateHavePendingNotifications
return json.Marshal((*stub)(entity))
}
func (*UpdateHavePendingNotifications) GetClass() string {
return ClassUpdate
}
func (*UpdateHavePendingNotifications) GetType() string {
return TypeUpdateHavePendingNotifications
}
func (*UpdateHavePendingNotifications) UpdateType() string {
return TypeUpdateHavePendingNotifications
}
2018-08-30 14:55:42 +00:00
// Some messages were deleted
type UpdateDeleteMessages struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Identifiers of the deleted messages
MessageIds []int64 `json:"message_ids"`
2019-06-07 10:56:06 +00:00
// True, if the messages are permanently deleted by a user (as opposed to just becoming inaccessible)
2018-10-23 12:38:10 +00:00
IsPermanent bool `json:"is_permanent"`
// True, if the messages are deleted only from the cache and can possibly be retrieved again in the future
FromCache bool `json:"from_cache"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateDeleteMessages) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateDeleteMessages
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateDeleteMessages) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateDeleteMessages) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateDeleteMessages
2018-08-30 14:55:42 +00:00
}
func (*UpdateDeleteMessages) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateDeleteMessages
2018-08-30 14:55:42 +00:00
}
// User activity in the chat has changed
type UpdateUserChatAction struct {
2018-10-23 12:38:10 +00:00
meta
// Chat identifier
ChatId int64 `json:"chat_id"`
// Identifier of a user performing an action
UserId int32 `json:"user_id"`
// The action description
Action ChatAction `json:"action"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateUserChatAction) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateUserChatAction
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserChatAction) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserChatAction) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUserChatAction
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserChatAction) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUserChatAction
2018-08-30 14:55:42 +00:00
}
func (updateUserChatAction *UpdateUserChatAction) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
ChatId int64 `json:"chat_id"`
UserId int32 `json:"user_id"`
Action json.RawMessage `json:"action"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateUserChatAction.ChatId = tmp.ChatId
updateUserChatAction.UserId = tmp.UserId
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldAction, _ := UnmarshalChatAction(tmp.Action)
updateUserChatAction.Action = fieldAction
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// The user went online or offline
type UpdateUserStatus struct {
2018-10-23 12:38:10 +00:00
meta
// User identifier
UserId int32 `json:"user_id"`
// New status of the user
Status UserStatus `json:"status"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateUserStatus) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateUserStatus
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserStatus) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserStatus) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUserStatus
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserStatus) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUserStatus
2018-08-30 14:55:42 +00:00
}
func (updateUserStatus *UpdateUserStatus) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
UserId int32 `json:"user_id"`
Status json.RawMessage `json:"status"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateUserStatus.UserId = tmp.UserId
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldStatus, _ := UnmarshalUserStatus(tmp.Status)
updateUserStatus.Status = fieldStatus
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// Some data of a user has changed. This update is guaranteed to come before the user identifier is returned to the client
type UpdateUser struct {
2018-10-23 12:38:10 +00:00
meta
// New data about the user
User *User `json:"user"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateUser) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateUser
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateUser) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateUser) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUser
2018-08-30 14:55:42 +00:00
}
func (*UpdateUser) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUser
2018-08-30 14:55:42 +00:00
}
// Some data of a basic group has changed. This update is guaranteed to come before the basic group identifier is returned to the client
type UpdateBasicGroup struct {
2018-10-23 12:38:10 +00:00
meta
// New data about the group
BasicGroup *BasicGroup `json:"basic_group"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateBasicGroup) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateBasicGroup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateBasicGroup) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateBasicGroup) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateBasicGroup
2018-08-30 14:55:42 +00:00
}
func (*UpdateBasicGroup) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateBasicGroup
2018-08-30 14:55:42 +00:00
}
// Some data of a supergroup or a channel has changed. This update is guaranteed to come before the supergroup identifier is returned to the client
type UpdateSupergroup struct {
2018-10-23 12:38:10 +00:00
meta
// New data about the supergroup
Supergroup *Supergroup `json:"supergroup"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateSupergroup) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateSupergroup
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateSupergroup) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateSupergroup) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateSupergroup
2018-08-30 14:55:42 +00:00
}
func (*UpdateSupergroup) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateSupergroup
2018-08-30 14:55:42 +00:00
}
// Some data of a secret chat has changed. This update is guaranteed to come before the secret chat identifier is returned to the client
type UpdateSecretChat struct {
2018-10-23 12:38:10 +00:00
meta
// New data about the secret chat
SecretChat *SecretChat `json:"secret_chat"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateSecretChat) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateSecretChat
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateSecretChat) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateSecretChat) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateSecretChat
2018-08-30 14:55:42 +00:00
}
func (*UpdateSecretChat) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateSecretChat
2018-08-30 14:55:42 +00:00
}
// Some data from userFullInfo has been changed
type UpdateUserFullInfo struct {
2018-10-23 12:38:10 +00:00
meta
// User identifier
UserId int32 `json:"user_id"`
// New full information about the user
UserFullInfo *UserFullInfo `json:"user_full_info"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateUserFullInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateUserFullInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserFullInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserFullInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUserFullInfo
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserFullInfo) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUserFullInfo
2018-08-30 14:55:42 +00:00
}
// Some data from basicGroupFullInfo has been changed
type UpdateBasicGroupFullInfo struct {
2018-10-23 12:38:10 +00:00
meta
// Identifier of a basic group
BasicGroupId int32 `json:"basic_group_id"`
// New full information about the group
BasicGroupFullInfo *BasicGroupFullInfo `json:"basic_group_full_info"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateBasicGroupFullInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateBasicGroupFullInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateBasicGroupFullInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateBasicGroupFullInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateBasicGroupFullInfo
2018-08-30 14:55:42 +00:00
}
func (*UpdateBasicGroupFullInfo) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateBasicGroupFullInfo
2018-08-30 14:55:42 +00:00
}
// Some data from supergroupFullInfo has been changed
type UpdateSupergroupFullInfo struct {
2018-10-23 12:38:10 +00:00
meta
// Identifier of the supergroup or channel
SupergroupId int32 `json:"supergroup_id"`
// New full information about the supergroup
SupergroupFullInfo *SupergroupFullInfo `json:"supergroup_full_info"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateSupergroupFullInfo) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateSupergroupFullInfo
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateSupergroupFullInfo) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateSupergroupFullInfo) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateSupergroupFullInfo
2018-08-30 14:55:42 +00:00
}
func (*UpdateSupergroupFullInfo) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateSupergroupFullInfo
2018-08-30 14:55:42 +00:00
}
// Service notification from the server. Upon receiving this the client must show a popup with the content of the notification
type UpdateServiceNotification struct {
2018-10-23 12:38:10 +00:00
meta
// Notification type. If type begins with "AUTH_KEY_DROP_", then two buttons "Cancel" and "Log out" should be shown under notification; if user presses the second, all local data should be destroyed using Destroy method
Type string `json:"type"`
// Notification content
Content MessageContent `json:"content"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateServiceNotification) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateServiceNotification
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateServiceNotification) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateServiceNotification) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateServiceNotification
2018-08-30 14:55:42 +00:00
}
func (*UpdateServiceNotification) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateServiceNotification
2018-08-30 14:55:42 +00:00
}
func (updateServiceNotification *UpdateServiceNotification) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Type string `json:"type"`
Content json.RawMessage `json:"content"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateServiceNotification.Type = tmp.Type
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldContent, _ := UnmarshalMessageContent(tmp.Content)
updateServiceNotification.Content = fieldContent
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// Information about a file was updated
type UpdateFile struct {
2018-10-23 12:38:10 +00:00
meta
// New data about the file
File *File `json:"file"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateFile) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateFile
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateFile) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateFile) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateFile
2018-08-30 14:55:42 +00:00
}
func (*UpdateFile) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateFile
2018-08-30 14:55:42 +00:00
}
// The file generation process needs to be started by the client
type UpdateFileGenerationStart struct {
2018-10-23 12:38:10 +00:00
meta
// Unique identifier for the generation process
GenerationId JsonInt64 `json:"generation_id"`
// The path to a file from which a new file is generated; may be empty
OriginalPath string `json:"original_path"`
// The path to a file that should be created and where the new file should be generated
DestinationPath string `json:"destination_path"`
// String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which should be downloaded by the client
Conversion string `json:"conversion"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateFileGenerationStart) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateFileGenerationStart
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateFileGenerationStart) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateFileGenerationStart) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateFileGenerationStart
2018-08-30 14:55:42 +00:00
}
func (*UpdateFileGenerationStart) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateFileGenerationStart
2018-08-30 14:55:42 +00:00
}
// File generation is no longer needed
type UpdateFileGenerationStop struct {
2018-10-23 12:38:10 +00:00
meta
// Unique identifier for the generation process
GenerationId JsonInt64 `json:"generation_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateFileGenerationStop) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateFileGenerationStop
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateFileGenerationStop) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateFileGenerationStop) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateFileGenerationStop
2018-08-30 14:55:42 +00:00
}
func (*UpdateFileGenerationStop) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateFileGenerationStop
2018-08-30 14:55:42 +00:00
}
// New call was created or information about a call was updated
type UpdateCall struct {
2018-10-23 12:38:10 +00:00
meta
// New data about a call
Call *Call `json:"call"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateCall) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateCall
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateCall) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateCall) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateCall
2018-08-30 14:55:42 +00:00
}
func (*UpdateCall) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateCall
2018-08-30 14:55:42 +00:00
}
// Some privacy setting rules have been changed
type UpdateUserPrivacySettingRules struct {
2018-10-23 12:38:10 +00:00
meta
// The privacy setting
Setting UserPrivacySetting `json:"setting"`
// New privacy rules
Rules *UserPrivacySettingRules `json:"rules"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateUserPrivacySettingRules) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateUserPrivacySettingRules
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserPrivacySettingRules) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserPrivacySettingRules) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUserPrivacySettingRules
2018-08-30 14:55:42 +00:00
}
func (*UpdateUserPrivacySettingRules) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUserPrivacySettingRules
2018-08-30 14:55:42 +00:00
}
func (updateUserPrivacySettingRules *UpdateUserPrivacySettingRules) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Setting json.RawMessage `json:"setting"`
Rules *UserPrivacySettingRules `json:"rules"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateUserPrivacySettingRules.Rules = tmp.Rules
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldSetting, _ := UnmarshalUserPrivacySetting(tmp.Setting)
updateUserPrivacySettingRules.Setting = fieldSetting
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// Number of unread messages has changed. This update is sent only if a message database is used
type UpdateUnreadMessageCount struct {
2018-10-23 12:38:10 +00:00
meta
// Total number of unread messages
UnreadCount int32 `json:"unread_count"`
// Total number of unread messages in unmuted chats
UnreadUnmutedCount int32 `json:"unread_unmuted_count"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateUnreadMessageCount) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateUnreadMessageCount
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateUnreadMessageCount) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateUnreadMessageCount) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUnreadMessageCount
2018-08-30 14:55:42 +00:00
}
func (*UpdateUnreadMessageCount) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUnreadMessageCount
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if a message database is used
type UpdateUnreadChatCount struct {
2018-10-23 12:38:10 +00:00
meta
// Total number of unread chats
UnreadCount int32 `json:"unread_count"`
// Total number of unread unmuted chats
UnreadUnmutedCount int32 `json:"unread_unmuted_count"`
// Total number of chats marked as unread
MarkedAsUnreadCount int32 `json:"marked_as_unread_count"`
// Total number of unmuted chats marked as unread
MarkedAsUnreadUnmutedCount int32 `json:"marked_as_unread_unmuted_count"`
2018-09-05 21:45:29 +00:00
}
func (entity *UpdateUnreadChatCount) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateUnreadChatCount
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*UpdateUnreadChatCount) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-09-05 21:45:29 +00:00
}
func (*UpdateUnreadChatCount) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUnreadChatCount
2018-09-05 21:45:29 +00:00
}
func (*UpdateUnreadChatCount) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateUnreadChatCount
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// An option changed its value
type UpdateOption struct {
2018-10-23 12:38:10 +00:00
meta
// The option name
Name string `json:"name"`
// The new option value
Value OptionValue `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateOption) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateOption
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateOption) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateOption) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateOption
2018-08-30 14:55:42 +00:00
}
func (*UpdateOption) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateOption
2018-08-30 14:55:42 +00:00
}
func (updateOption *UpdateOption) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Name string `json:"name"`
Value json.RawMessage `json:"value"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateOption.Name = tmp.Name
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldValue, _ := UnmarshalOptionValue(tmp.Value)
updateOption.Value = fieldValue
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// The list of installed sticker sets was updated
type UpdateInstalledStickerSets struct {
2018-10-23 12:38:10 +00:00
meta
// True, if the list of installed mask sticker sets was updated
IsMasks bool `json:"is_masks"`
// The new list of installed ordinary sticker sets
StickerSetIds []JsonInt64 `json:"sticker_set_ids"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateInstalledStickerSets) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateInstalledStickerSets
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateInstalledStickerSets) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateInstalledStickerSets) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateInstalledStickerSets
2018-08-30 14:55:42 +00:00
}
func (*UpdateInstalledStickerSets) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateInstalledStickerSets
2018-08-30 14:55:42 +00:00
}
// The list of trending sticker sets was updated or some of them were viewed
type UpdateTrendingStickerSets struct {
2018-10-23 12:38:10 +00:00
meta
// The new list of trending sticker sets
StickerSets *StickerSets `json:"sticker_sets"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateTrendingStickerSets) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateTrendingStickerSets
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateTrendingStickerSets) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateTrendingStickerSets) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateTrendingStickerSets
2018-08-30 14:55:42 +00:00
}
func (*UpdateTrendingStickerSets) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateTrendingStickerSets
2018-08-30 14:55:42 +00:00
}
// The list of recently used stickers was updated
type UpdateRecentStickers struct {
2018-10-23 12:38:10 +00:00
meta
// True, if the list of stickers attached to photo or video files was updated, otherwise the list of sent stickers is updated
IsAttached bool `json:"is_attached"`
// The new list of file identifiers of recently used stickers
StickerIds []int32 `json:"sticker_ids"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateRecentStickers) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateRecentStickers
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateRecentStickers) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateRecentStickers) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateRecentStickers
2018-08-30 14:55:42 +00:00
}
func (*UpdateRecentStickers) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateRecentStickers
2018-08-30 14:55:42 +00:00
}
// The list of favorite stickers was updated
type UpdateFavoriteStickers struct {
2018-10-23 12:38:10 +00:00
meta
// The new list of file identifiers of favorite stickers
StickerIds []int32 `json:"sticker_ids"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateFavoriteStickers) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateFavoriteStickers
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateFavoriteStickers) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateFavoriteStickers) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateFavoriteStickers
2018-08-30 14:55:42 +00:00
}
func (*UpdateFavoriteStickers) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateFavoriteStickers
2018-08-30 14:55:42 +00:00
}
// The list of saved animations was updated
type UpdateSavedAnimations struct {
2018-10-23 12:38:10 +00:00
meta
// The new list of file identifiers of saved animations
AnimationIds []int32 `json:"animation_ids"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateSavedAnimations) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateSavedAnimations
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateSavedAnimations) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateSavedAnimations) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateSavedAnimations
2018-08-30 14:55:42 +00:00
}
func (*UpdateSavedAnimations) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateSavedAnimations
2018-08-30 14:55:42 +00:00
}
2019-09-10 12:36:54 +00:00
// The selected background has changed
type UpdateSelectedBackground struct {
meta
// True, if background for dark theme has changed
ForDarkTheme bool `json:"for_dark_theme"`
// The new selected background; may be null
Background *Background `json:"background"`
}
func (entity *UpdateSelectedBackground) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UpdateSelectedBackground
return json.Marshal((*stub)(entity))
}
func (*UpdateSelectedBackground) GetClass() string {
return ClassUpdate
}
func (*UpdateSelectedBackground) GetType() string {
return TypeUpdateSelectedBackground
}
func (*UpdateSelectedBackground) UpdateType() string {
return TypeUpdateSelectedBackground
}
2018-09-05 21:45:29 +00:00
// Some language pack strings have been updated
type UpdateLanguagePackStrings struct {
2018-10-23 12:38:10 +00:00
meta
// Localization target to which the language pack belongs
LocalizationTarget string `json:"localization_target"`
// Identifier of the updated language pack
LanguagePackId string `json:"language_pack_id"`
// List of changed language pack strings
Strings []*LanguagePackString `json:"strings"`
2018-09-05 21:45:29 +00:00
}
func (entity *UpdateLanguagePackStrings) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateLanguagePackStrings
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*UpdateLanguagePackStrings) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-09-05 21:45:29 +00:00
}
func (*UpdateLanguagePackStrings) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateLanguagePackStrings
2018-09-05 21:45:29 +00:00
}
func (*UpdateLanguagePackStrings) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateLanguagePackStrings
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// The connection state has changed
type UpdateConnectionState struct {
2018-10-23 12:38:10 +00:00
meta
// The new connection state
State ConnectionState `json:"state"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateConnectionState) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateConnectionState
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateConnectionState) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateConnectionState) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateConnectionState
2018-08-30 14:55:42 +00:00
}
func (*UpdateConnectionState) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateConnectionState
2018-08-30 14:55:42 +00:00
}
func (updateConnectionState *UpdateConnectionState) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
State json.RawMessage `json:"state"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldState, _ := UnmarshalConnectionState(tmp.State)
updateConnectionState.State = fieldState
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
2018-09-05 21:45:29 +00:00
// New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method should be called with the reason "Decline ToS update"
type UpdateTermsOfService struct {
2018-10-23 12:38:10 +00:00
meta
// Identifier of the terms of service
TermsOfServiceId string `json:"terms_of_service_id"`
// The new terms of service
TermsOfService *TermsOfService `json:"terms_of_service"`
2018-09-05 21:45:29 +00:00
}
func (entity *UpdateTermsOfService) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateTermsOfService
2018-09-05 21:45:29 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-09-05 21:45:29 +00:00
}
func (*UpdateTermsOfService) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-09-05 21:45:29 +00:00
}
func (*UpdateTermsOfService) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateTermsOfService
2018-09-05 21:45:29 +00:00
}
func (*UpdateTermsOfService) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateTermsOfService
2018-09-05 21:45:29 +00:00
}
2018-08-30 14:55:42 +00:00
// A new incoming inline query; for bots only
type UpdateNewInlineQuery struct {
2018-10-23 12:38:10 +00:00
meta
// Unique query identifier
Id JsonInt64 `json:"id"`
// Identifier of the user who sent the query
SenderUserId int32 `json:"sender_user_id"`
// User location, provided by the client; may be null
UserLocation *Location `json:"user_location"`
// Text of the query
Query string `json:"query"`
// Offset of the first entry to return
Offset string `json:"offset"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewInlineQuery) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewInlineQuery
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewInlineQuery) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewInlineQuery) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewInlineQuery
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewInlineQuery) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewInlineQuery
2018-08-30 14:55:42 +00:00
}
// The user has chosen a result of an inline query; for bots only
type UpdateNewChosenInlineResult struct {
2018-10-23 12:38:10 +00:00
meta
// Identifier of the user who sent the query
SenderUserId int32 `json:"sender_user_id"`
// User location, provided by the client; may be null
UserLocation *Location `json:"user_location"`
// Text of the query
Query string `json:"query"`
// Identifier of the chosen result
ResultId string `json:"result_id"`
// Identifier of the sent inline message, if known
InlineMessageId string `json:"inline_message_id"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewChosenInlineResult) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewChosenInlineResult
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewChosenInlineResult) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewChosenInlineResult) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewChosenInlineResult
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewChosenInlineResult) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewChosenInlineResult
2018-08-30 14:55:42 +00:00
}
// A new incoming callback query; for bots only
type UpdateNewCallbackQuery struct {
2018-10-23 12:38:10 +00:00
meta
// Unique query identifier
Id JsonInt64 `json:"id"`
// Identifier of the user who sent the query
SenderUserId int32 `json:"sender_user_id"`
// Identifier of the chat, in which the query was sent
ChatId int64 `json:"chat_id"`
// Identifier of the message, from which the query originated
MessageId int64 `json:"message_id"`
// Identifier that uniquely corresponds to the chat to which the message was sent
ChatInstance JsonInt64 `json:"chat_instance"`
// Query payload
Payload CallbackQueryPayload `json:"payload"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewCallbackQuery) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewCallbackQuery
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewCallbackQuery) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewCallbackQuery) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewCallbackQuery
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewCallbackQuery) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewCallbackQuery
2018-08-30 14:55:42 +00:00
}
func (updateNewCallbackQuery *UpdateNewCallbackQuery) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Id JsonInt64 `json:"id"`
SenderUserId int32 `json:"sender_user_id"`
ChatId int64 `json:"chat_id"`
MessageId int64 `json:"message_id"`
ChatInstance JsonInt64 `json:"chat_instance"`
Payload json.RawMessage `json:"payload"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateNewCallbackQuery.Id = tmp.Id
updateNewCallbackQuery.SenderUserId = tmp.SenderUserId
updateNewCallbackQuery.ChatId = tmp.ChatId
updateNewCallbackQuery.MessageId = tmp.MessageId
updateNewCallbackQuery.ChatInstance = tmp.ChatInstance
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldPayload, _ := UnmarshalCallbackQueryPayload(tmp.Payload)
updateNewCallbackQuery.Payload = fieldPayload
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A new incoming callback query from a message sent via a bot; for bots only
type UpdateNewInlineCallbackQuery struct {
2018-10-23 12:38:10 +00:00
meta
// Unique query identifier
Id JsonInt64 `json:"id"`
// Identifier of the user who sent the query
SenderUserId int32 `json:"sender_user_id"`
// Identifier of the inline message, from which the query originated
InlineMessageId string `json:"inline_message_id"`
// An identifier uniquely corresponding to the chat a message was sent to
ChatInstance JsonInt64 `json:"chat_instance"`
// Query payload
Payload CallbackQueryPayload `json:"payload"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewInlineCallbackQuery) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewInlineCallbackQuery
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewInlineCallbackQuery) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewInlineCallbackQuery) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewInlineCallbackQuery
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewInlineCallbackQuery) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewInlineCallbackQuery
2018-08-30 14:55:42 +00:00
}
func (updateNewInlineCallbackQuery *UpdateNewInlineCallbackQuery) UnmarshalJSON(data []byte) error {
2018-10-23 12:38:10 +00:00
var tmp struct {
Id JsonInt64 `json:"id"`
SenderUserId int32 `json:"sender_user_id"`
InlineMessageId string `json:"inline_message_id"`
ChatInstance JsonInt64 `json:"chat_instance"`
Payload json.RawMessage `json:"payload"`
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
updateNewInlineCallbackQuery.Id = tmp.Id
updateNewInlineCallbackQuery.SenderUserId = tmp.SenderUserId
updateNewInlineCallbackQuery.InlineMessageId = tmp.InlineMessageId
updateNewInlineCallbackQuery.ChatInstance = tmp.ChatInstance
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
fieldPayload, _ := UnmarshalCallbackQueryPayload(tmp.Payload)
updateNewInlineCallbackQuery.Payload = fieldPayload
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return nil
2018-08-30 14:55:42 +00:00
}
// A new incoming shipping query; for bots only. Only for invoices with flexible price
type UpdateNewShippingQuery struct {
2018-10-23 12:38:10 +00:00
meta
// Unique query identifier
Id JsonInt64 `json:"id"`
// Identifier of the user who sent the query
SenderUserId int32 `json:"sender_user_id"`
// Invoice payload
InvoicePayload string `json:"invoice_payload"`
// User shipping address
ShippingAddress *Address `json:"shipping_address"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewShippingQuery) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewShippingQuery
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewShippingQuery) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewShippingQuery) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewShippingQuery
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewShippingQuery) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewShippingQuery
2018-08-30 14:55:42 +00:00
}
// A new incoming pre-checkout query; for bots only. Contains full information about a checkout
type UpdateNewPreCheckoutQuery struct {
2018-10-23 12:38:10 +00:00
meta
// Unique query identifier
Id JsonInt64 `json:"id"`
// Identifier of the user who sent the query
SenderUserId int32 `json:"sender_user_id"`
// Currency for the product price
Currency string `json:"currency"`
// Total price for the product, in the minimal quantity of the currency
TotalAmount int64 `json:"total_amount"`
// Invoice payload
InvoicePayload []byte `json:"invoice_payload"`
// Identifier of a shipping option chosen by the user; may be empty if not applicable
ShippingOptionId string `json:"shipping_option_id"`
// Information about the order; may be null
OrderInfo *OrderInfo `json:"order_info"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewPreCheckoutQuery) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewPreCheckoutQuery
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewPreCheckoutQuery) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewPreCheckoutQuery) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewPreCheckoutQuery
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewPreCheckoutQuery) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewPreCheckoutQuery
2018-08-30 14:55:42 +00:00
}
// A new incoming event; for bots only
type UpdateNewCustomEvent struct {
2018-10-23 12:38:10 +00:00
meta
// A JSON-serialized event
Event string `json:"event"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewCustomEvent) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewCustomEvent
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewCustomEvent) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewCustomEvent) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewCustomEvent
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewCustomEvent) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewCustomEvent
2018-08-30 14:55:42 +00:00
}
// A new incoming query; for bots only
type UpdateNewCustomQuery struct {
2018-10-23 12:38:10 +00:00
meta
// The query identifier
Id JsonInt64 `json:"id"`
// JSON-serialized query data
Data string `json:"data"`
// Query timeout
Timeout int32 `json:"timeout"`
2018-08-30 14:55:42 +00:00
}
func (entity *UpdateNewCustomQuery) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub UpdateNewCustomQuery
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewCustomQuery) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassUpdate
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewCustomQuery) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewCustomQuery
2018-08-30 14:55:42 +00:00
}
func (*UpdateNewCustomQuery) UpdateType() string {
2018-10-23 12:38:10 +00:00
return TypeUpdateNewCustomQuery
2018-08-30 14:55:42 +00:00
}
2019-06-07 10:56:06 +00:00
// Information about a poll was updated; for bots only
type UpdatePoll struct {
meta
// New data about the poll
Poll *Poll `json:"poll"`
}
func (entity *UpdatePoll) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub UpdatePoll
return json.Marshal((*stub)(entity))
}
func (*UpdatePoll) GetClass() string {
return ClassUpdate
}
func (*UpdatePoll) GetType() string {
return TypeUpdatePoll
}
func (*UpdatePoll) UpdateType() string {
return TypeUpdatePoll
}
// Contains a list of updates
type Updates struct {
meta
// List of updates
Updates []Update `json:"updates"`
}
func (entity *Updates) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub Updates
return json.Marshal((*stub)(entity))
}
func (*Updates) GetClass() string {
return ClassUpdates
}
func (*Updates) GetType() string {
return TypeUpdates
}
// The log is written to stderr or an OS specific log
type LogStreamDefault struct {
meta
}
func (entity *LogStreamDefault) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub LogStreamDefault
return json.Marshal((*stub)(entity))
}
func (*LogStreamDefault) GetClass() string {
return ClassLogStream
}
func (*LogStreamDefault) GetType() string {
return TypeLogStreamDefault
}
func (*LogStreamDefault) LogStreamType() string {
return TypeLogStreamDefault
}
// The log is written to a file
type LogStreamFile struct {
meta
// Path to the file to where the internal TDLib log will be written
Path string `json:"path"`
// Maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated
MaxFileSize int64 `json:"max_file_size"`
}
func (entity *LogStreamFile) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub LogStreamFile
return json.Marshal((*stub)(entity))
}
func (*LogStreamFile) GetClass() string {
return ClassLogStream
}
func (*LogStreamFile) GetType() string {
return TypeLogStreamFile
}
func (*LogStreamFile) LogStreamType() string {
return TypeLogStreamFile
}
// The log is written nowhere
type LogStreamEmpty struct {
meta
}
func (entity *LogStreamEmpty) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub LogStreamEmpty
return json.Marshal((*stub)(entity))
}
func (*LogStreamEmpty) GetClass() string {
return ClassLogStream
}
func (*LogStreamEmpty) GetType() string {
return TypeLogStreamEmpty
}
func (*LogStreamEmpty) LogStreamType() string {
return TypeLogStreamEmpty
}
// Contains a TDLib internal log verbosity level
type LogVerbosityLevel struct {
meta
// Log verbosity level
VerbosityLevel int32 `json:"verbosity_level"`
}
func (entity *LogVerbosityLevel) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub LogVerbosityLevel
return json.Marshal((*stub)(entity))
}
func (*LogVerbosityLevel) GetClass() string {
return ClassLogVerbosityLevel
}
func (*LogVerbosityLevel) GetType() string {
return TypeLogVerbosityLevel
}
// Contains a list of available TDLib internal log tags
type LogTags struct {
meta
// List of log tags
Tags []string `json:"tags"`
}
func (entity *LogTags) MarshalJSON() ([]byte, error) {
entity.meta.Type = entity.GetType()
type stub LogTags
return json.Marshal((*stub)(entity))
}
func (*LogTags) GetClass() string {
return ClassLogTags
}
func (*LogTags) GetType() string {
return TypeLogTags
}
2018-08-30 14:55:42 +00:00
// A simple object containing a number; for testing only
type TestInt struct {
2018-10-23 12:38:10 +00:00
meta
// Number
Value int32 `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *TestInt) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TestInt
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TestInt) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTestInt
2018-08-30 14:55:42 +00:00
}
func (*TestInt) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTestInt
2018-08-30 14:55:42 +00:00
}
// A simple object containing a string; for testing only
type TestString struct {
2018-10-23 12:38:10 +00:00
meta
// String
Value string `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *TestString) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TestString
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TestString) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTestString
2018-08-30 14:55:42 +00:00
}
func (*TestString) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTestString
2018-08-30 14:55:42 +00:00
}
// A simple object containing a sequence of bytes; for testing only
type TestBytes struct {
2018-10-23 12:38:10 +00:00
meta
// Bytes
Value []byte `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *TestBytes) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TestBytes
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TestBytes) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTestBytes
2018-08-30 14:55:42 +00:00
}
func (*TestBytes) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTestBytes
2018-08-30 14:55:42 +00:00
}
// A simple object containing a vector of numbers; for testing only
type TestVectorInt struct {
2018-10-23 12:38:10 +00:00
meta
// Vector of numbers
Value []int32 `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *TestVectorInt) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TestVectorInt
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TestVectorInt) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTestVectorInt
2018-08-30 14:55:42 +00:00
}
func (*TestVectorInt) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTestVectorInt
2018-08-30 14:55:42 +00:00
}
// A simple object containing a vector of objects that hold a number; for testing only
type TestVectorIntObject struct {
2018-10-23 12:38:10 +00:00
meta
// Vector of objects
Value []*TestInt `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *TestVectorIntObject) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TestVectorIntObject
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TestVectorIntObject) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTestVectorIntObject
2018-08-30 14:55:42 +00:00
}
func (*TestVectorIntObject) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTestVectorIntObject
2018-08-30 14:55:42 +00:00
}
// A simple object containing a vector of strings; for testing only
type TestVectorString struct {
2018-10-23 12:38:10 +00:00
meta
// Vector of strings
Value []string `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *TestVectorString) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TestVectorString
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TestVectorString) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTestVectorString
2018-08-30 14:55:42 +00:00
}
func (*TestVectorString) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTestVectorString
2018-08-30 14:55:42 +00:00
}
// A simple object containing a vector of objects that hold a string; for testing only
type TestVectorStringObject struct {
2018-10-23 12:38:10 +00:00
meta
// Vector of objects
Value []*TestString `json:"value"`
2018-08-30 14:55:42 +00:00
}
func (entity *TestVectorStringObject) MarshalJSON() ([]byte, error) {
2018-10-23 12:38:10 +00:00
entity.meta.Type = entity.GetType()
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
type stub TestVectorStringObject
2018-08-30 14:55:42 +00:00
2018-10-23 12:38:10 +00:00
return json.Marshal((*stub)(entity))
2018-08-30 14:55:42 +00:00
}
func (*TestVectorStringObject) GetClass() string {
2018-10-23 12:38:10 +00:00
return ClassTestVectorStringObject
2018-08-30 14:55:42 +00:00
}
func (*TestVectorStringObject) GetType() string {
2018-10-23 12:38:10 +00:00
return TypeTestVectorStringObject
2018-08-30 14:55:42 +00:00
}